MCPcopy Index your code
hub / github.com/rocky/python-uncompyle6 / checker

Function checker

uncompyle6/semantics/check_ast.py:12–36  ·  view source on GitHub ↗
(ast, in_loop, errors)

Source from the content-addressed store, hash-verified

10
11
12def checker(ast, in_loop, errors):
13 if ast is None:
14 return
15 in_loop = (
16 in_loop
17 or ast.kind.startswith("for")
18 or ast.kind.startswith("while")
19 or ast.kind.startswith("async_for")
20 )
21 if ast.kind in ("aug_assign1", "aug_assign2") and ast[0][0] == "and":
22 text = str(ast)
23 error_text = (
24 "\n# improper augmented assignment (e.g. +=, *=, ...):\n#\t"
25 + "\n# ".join(text.split("\n"))
26 + "\n"
27 )
28 errors.append(error_text)
29
30 for node in ast:
31 if not in_loop and node.kind in ("continue", "break"):
32 text = str(node)
33 error_text = "\n# not in loop:\n#\t" + "\n# ".join(text.split("\n"))
34 errors.append(error_text)
35 if hasattr(node, "__repr1__"):
36 checker(node, in_loop, errors)

Callers 2

build_astMethod · 0.90
build_astMethod · 0.90

Calls 2

joinMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected