We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96931d8 commit d1f3a0bCopy full SHA for d1f3a0b
python/asthelper.py
@@ -90,7 +90,12 @@ def _handle_functions(self, node):
90
for arg in chain(node.args.args, node.args.kwonlyargs):
91
type_hint = None
92
if arg.annotation is not None:
93
- type_hint = ast.unparse(arg.annotation)
+ # ast.unparse doesn't work in python 3.8, needs to use astunparse instead
94
+ if sys.version_info[0] == 3 and sys.version_info[1] == 8:
95
+ import astunparse
96
+ type_hint = astunparse.unparse(arg.annotation)
97
+ else:
98
+ type_hint = ast.unparse(arg.annotation)
99
self.arguments.append({"arg": arg.arg, "type": type_hint})
100
if len(self.arguments) > 0 and (
101
self.arguments[0]["arg"] == "self" or self.arguments[0]["arg"] == "cls"
0 commit comments