38 lines
1.0 KiB
Diff
38 lines
1.0 KiB
Diff
|
Our builders still use the py2 version of this package.
|
||
|
|
||
|
--- a/automat/_methodical.py
|
||
|
+++ b/automat/_methodical.py
|
||
|
@@ -4,9 +4,15 @@
|
||
|
from functools import wraps
|
||
|
from itertools import count
|
||
|
|
||
|
-from inspect import getfullargspec as getArgsSpec
|
||
|
+try:
|
||
|
+ # Python 3
|
||
|
+ from inspect import getfullargspec as getArgsSpec
|
||
|
+except ImportError:
|
||
|
+ # Python 2
|
||
|
+ from inspect import getargspec as getArgsSpec
|
||
|
|
||
|
import attr
|
||
|
+import six
|
||
|
|
||
|
from ._core import Transitioner, Automaton
|
||
|
from ._introspection import preserveName
|
||
|
@@ -30,13 +36,13 @@
|
||
|
return ArgSpec(
|
||
|
args=tuple(spec.args),
|
||
|
varargs=spec.varargs,
|
||
|
- varkw=spec.varkw,
|
||
|
+ varkw=spec.varkw if six.PY3 else spec.keywords,
|
||
|
defaults=spec.defaults if spec.defaults else (),
|
||
|
kwonlyargs=tuple(spec.kwonlyargs),
|
||
|
kwonlydefaults=(
|
||
|
tuple(spec.kwonlydefaults.items())
|
||
|
if spec.kwonlydefaults else ()
|
||
|
- ),
|
||
|
+ ) if six.PY3 else (),
|
||
|
annotations=tuple(spec.annotations.items()),
|
||
|
)
|
||
|
|