Ejemplo n.º 1
0
 def visit_Name(self, node):
     if hasattr(node, "scopes") and is_global(node):
         old_name = get_id(node)
         new_name = camel_case(old_name)
         if old_name != new_name:
             rename(node.scopes[-1], old_name, new_name)
     return node
Ejemplo n.º 2
0
 def visit_FunctionDef(self, node):
     if hasattr(node, "scopes") and isinstance(node.scopes[-2], ast.Module):
         old_name = get_id(node)
         if old_name is not None:
             if "_" in old_name:
                 new_name = camel_case(old_name)
             else:
                 new_name = capitalize_first(old_name)
             if old_name != new_name:
                 rename(node.scopes[-2], old_name, new_name)
     return node