Back to index

python3.2  3.2.2
Classes | Functions | Variables
lib2to3.fixes.fix_renames Namespace Reference

Classes

class  FixRenames

Functions

def alternates
def build_pattern

Variables

dictionary MAPPING
dictionary LOOKUP = {}

Detailed Description

Fix incompatible renames

Fixes:
  * sys.maxint -> sys.maxsize

Function Documentation

Definition at line 17 of file fix_renames.py.

00017 
00018 def alternates(members):
00019     return "(" + "|".join(map(repr, members)) + ")"
00020 

Definition at line 21 of file fix_renames.py.

00021 
00022 def build_pattern():
00023     #bare = set()
00024     for module, replace in list(MAPPING.items()):
00025         for old_attr, new_attr in list(replace.items()):
00026             LOOKUP[(module, old_attr)] = new_attr
00027             #bare.add(module)
00028             #bare.add(old_attr)
00029             #yield """
00030             #      import_name< 'import' (module=%r
00031             #          | dotted_as_names< any* module=%r any* >) >
00032             #      """ % (module, module)
00033             yield """
00034                   import_from< 'from' module_name=%r 'import'
00035                       ( attr_name=%r | import_as_name< attr_name=%r 'as' any >) >
00036                   """ % (module, old_attr, old_attr)
00037             yield """
00038                   power< module_name=%r trailer< '.' attr_name=%r > any* >
00039                   """ % (module, old_attr)
00040     #yield """bare_name=%s""" % alternates(bare)
00041 


Variable Documentation

Definition at line 15 of file fix_renames.py.

Initial value:
00001 {"sys":  {"maxint" : "maxsize"},
00002           }

Definition at line 13 of file fix_renames.py.