Example #1
0
 def visit_Name(self, node):
     _, components = naming.decode_id(node.id)
     if "P" in components:
         # this is a passthrough variable
         if isinstance(node.ctx, ast.Load):
             if node.id not in self.stack[-1]:
                 self.found = True
         else:
             self.stack[-1].add(node.id)
Example #2
0
 def visit_Name(self, node):
     _, components = naming.decode_id(node.id)
     if "P" in components:
         # this is a passthrough variable
         if isinstance(node.ctx, ast.Load):
             if node.id not in self.stack[-1]:
                 self.found = True
         else:
             self.stack[-1].add(node.id)
Example #3
0
 def condition(var, scope):
     if naming.decode_id(var)[1]:
         # no variables we introduced
         return False
     elif var.startswith("__pydron"):
         return False
     elif scope == Scope.LOCAL or scope == Scope.SHARED:
         # local variables are welcome
         return True
     elif not isinstance(block, ast.ClassDef):
         # free variables too...
         return scope == Scope.FREE
     else:
         # ... unless we are in a class
         return False