Back to index

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

Classes

class  FixUrllib

Functions

def build_pattern

Variables

dictionary MAPPING

Detailed Description

Fix changes imports of urllib which are now incompatible.
   This is rather similar to fix_imports, but because of the more
   complex nature of the fixing for urllib, it has its own fixer.

Function Documentation

Definition at line 49 of file fix_urllib.py.

00049 
00050 def build_pattern():
00051     bare = set()
00052     for old_module, changes in MAPPING.items():
00053         for change in changes:
00054             new_module, members = change
00055             members = alternates(members)
00056             yield """import_name< 'import' (module=%r
00057                                   | dotted_as_names< any* module=%r any* >) >
00058                   """ % (old_module, old_module)
00059             yield """import_from< 'from' mod_member=%r 'import'
00060                        ( member=%s | import_as_name< member=%s 'as' any > |
00061                          import_as_names< members=any*  >) >
00062                   """ % (old_module, members, members)
00063             yield """import_from< 'from' module_star=%r 'import' star='*' >
00064                   """ % old_module
00065             yield """import_name< 'import'
00066                                   dotted_as_name< module_as=%r 'as' any > >
00067                   """ % old_module
00068             # bare_with_attr has a special significance for FixImports.match().
00069             yield """power< bare_with_attr=%r trailer< '.' member=%s > any* >
00070                   """ % (old_module, members)
00071 

Here is the call graph for this function:


Variable Documentation

Definition at line 13 of file fix_urllib.py.