本文整理汇总了Python中passmanager.Transformation类的典型用法代码示例。如果您正苦于以下问题:Python Transformation类的具体用法?Python Transformation怎么用?Python Transformation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Transformation类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, pm, name, ctx, lambda_functions, imports):
Transformation.__init__(self)
self.passmanager = pm
self.ctx = ctx
self.prefix = name
self.lambda_functions = lambda_functions
self.imports = imports
self.global_declarations = pm.gather(GlobalDeclarations, ctx.module)
示例2: generic_visit
def generic_visit(self, node):
if node in self.constant_expressions:
try:
fake_node = ast.Expression(
node.value if isinstance(node, ast.Index) else node)
code = compile(fake_node, '<constant folding>', 'eval')
value = eval(code, self.env)
new_node = self.to_ast(value)
if (isinstance(node, ast.Index)
and not isinstance(new_node, ast.Index)):
new_node = ast.Index(new_node)
return new_node
except Exception: # as e:
#print ast.dump(node)
#print 'error in constant folding: ', e
return Transformation.generic_visit(self, node)
else:
return Transformation.generic_visit(self, node)
示例3: __init__
def __init__(self):
Transformation.__init__(self, NormalizeTuples,
OptimizableComprehension)
示例4: __init__
def __init__(self):
Transformation.__init__(self, OptimizableGenexp)
示例5: __init__
def __init__(self):
Transformation.__init__(self, Locals, Globals)
示例6: __init__
def __init__(self):
Transformation.__init__(self, TypeDependencies,
OrderedGlobalDeclarations)
示例7: __init__
def __init__(self):
Transformation.__init__(self)
for s in GatherOMPData.statements:
setattr(self, "visit_" + s, lambda node_: self.attach_data(node_))
self.current = list()