Add support for Python3.11

This commit is contained in:
Griatch 2022-11-15 23:50:08 +01:00
parent c62bda9d77
commit 544638bf42
9 changed files with 30 additions and 28 deletions

View file

@ -122,7 +122,7 @@ heavily-documented code below.
"""
from inspect import getargspec
from inspect import getfullargspec
from textwrap import dedent
from django.conf import settings
@ -209,9 +209,9 @@ def _call_or_get(value, menu=None, choice=None, string=None, obj=None, caller=No
if callable(value):
# Check the function arguments
kwargs = {}
spec = getargspec(value)
spec = getfullargspec(value)
args = spec.args
if spec.keywords:
if spec.varkw:
kwargs.update(dict(menu=menu, choice=choice, string=string, obj=obj, caller=caller))
else:
if "menu" in args:
@ -292,8 +292,9 @@ def menu_quit(caller, menu):
"""
if caller is None or menu is None:
log_err(
"The function `menu_quit` was called with missing "
"arguments: caller={}, menu={}".format(caller, menu)
"The function `menu_quit` was called with missing arguments: caller={}, menu={}".format(
caller, menu
)
)
if caller.cmdset.has(BuildingMenuCmdSet):
@ -835,8 +836,9 @@ class BuildingMenu:
if key and key in self.cmds:
raise ValueError(
"A conflict exists between {} and {}, both use "
"key or alias {}".format(self.cmds[key], title, repr(key))
"A conflict exists between {} and {}, both use key or alias {}".format(
self.cmds[key], title, repr(key)
)
)
if attr:

View file

@ -188,7 +188,7 @@ class RandomStringGenerator:
"""
self.total = 1
self.elements = []
tree = re.sre_parse.parse(regex).data
tree = re._parser.parse(regex).data # note - sre_parse removed in py3.11
# `tree` contains a list of elements in the regular expression
for element in tree:
# `element` is also a list, the first element is a string