Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

Commit c216a99

Browse files
committed
clean up package_crawler
1 parent 99c59a4 commit c216a99

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

compatibility_lib/compatibility_lib/package_crawler_static.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,21 @@ def _get_args(node):
244244
if i >= num_required_args:
245245
valnode = node.defaults[i-len(node.args)]
246246
if isinstance(valnode, ast.NameConstant):
247-
# bools, nonetype
248247
value = valnode.value
249248
elif isinstance(valnode, ast.Num):
250-
# ints
251249
value = valnode.n
252250
elif isinstance(valnode, ast.Str):
253251
value = valnode.s
254-
elif isinstance(valnode, ast.List):
252+
elif isinstance(valnode, (ast.List, ast.Tuple)):
255253
value = valnode.elts
254+
elif isinstance(valnode, ast.Dict):
255+
value = {}
256+
for i, key in enumerate(valnode.keys):
257+
value[key] = valnode.values[i]
256258
else:
257-
print(valnode)
258-
from pdb import set_trace; set_trace()
259+
# TODO: provide better error messaging
260+
raise Exception('%s:%s: unsupported default arg type' %
261+
(valnode.lineno, valnode.col_offset))
259262
default_args[arg] = value
260263

261264
if node.vararg:

0 commit comments

Comments
 (0)