Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def assertAstEqual(self, ast1, ast2):
dmp1 = astor.dump_tree(ast1)
dmp2 = astor.dump_tree(ast2)
self.assertEqual(dmp1, dmp2)
def assertAstEqual(self, ast1, ast2):
dmp1 = astor.dump_tree(ast1)
dmp2 = astor.dump_tree(ast2)
self.assertEqual(dmp1, dmp2)
def makelib():
parse = ast.parse
dump_tree = astor.dump_tree
def default_value(): return 1000000, ''
mydict = collections.defaultdict(default_value)
allparams = [tuple('abcdefghijklmnop'[:x]) for x in range(13)]
alltxt = itertools.chain(build(1, use_operands=True),
build(2, use_operands=True),
build(3, select_operators))
yieldrepl = list(('yield %s %s' % (operator, operand),
'yield %s%s' % (operator, operand))
for operator in '+-' for operand in '(ab')
yieldrepl.append(('yield[', 'yield ['))
# alltxt = itertools.chain(build(1), build(2))
badexpr = 0
goodexpr = 0
for h in hst:
try:
print(h)
except:
print(str(h).encode('utf-8'))
else:
print(hst)
print()
print()
with filtered_hy_exceptions():
_ast = hy_compile(hst, '__main__', filename=filename, source=source)
if options.with_ast:
if platform.system() == "Windows":
_print_for_windows(astor.dump_tree(_ast))
else:
print(astor.dump_tree(_ast))
print()
print()
if not options.without_python:
if platform.system() == "Windows":
_print_for_windows(astor.code_gen.to_source(_ast))
else:
print(astor.code_gen.to_source(_ast))
parser.exit(0)
def print_file_ast():
with open(__file__) as fp:
this_source = fp.read()
this_ast = ast.parse(this_source)
print("AST:")
print("astor.dump_tree(this_ast)")
print(astor.dump_tree(this_ast))
def dump_ast(self):
return astor.dump_tree(self.__to_module())