2008/5/16 Collin Winter <collinw at gmail.com>: > On Fri, May 16, 2008 at 10:30 AM, Guilherme Polo <ggpolo at gmail.com> wrote: >> 2008/5/12 Collin Winter <collinw at gmail.com>: >>> On Mon, May 12, 2008 at 1:58 PM, Guilherme Polo <ggpolo at gmail.com> wrote: >>>> Hello, >>>> >>>> Would someone tell me how can I add a new entry in the MAPPING dict in >>>> the lib2to3/fixes/fix_imports.py that does the following: >>>> >>>> "import A" gets fixed as "import C.D as A" >>>> >>>> Right now it is fixing by doing "import C.D" and changing several >>>> other lines in the code to use this new "C.D" name. I wanted to avoid >>>> these changes if possible. >>> >>> I don't believe there's a way to do that, but adding support for it >>> should be fairly straight-forward. Assign the patch to me for review. >>> >> >> Is there something I could read get some 2to3 understanding ? > > The README is a very shallow overview, but it needs to be beefed up to > talk about architecture. Honestly, the best way (currently) is to read > the existing fixers. Mea culpa. > >> How do I construct patterns ? > > find_pattern.py is the tool I wrote/use to find patterns. You give it > some Python code and it spits out the pattern for it. It's hard to > hand-construct patterns due to some optimizations done to eliminate > unneeded nodes (nodes with only a single child are eliminated, pulling > the child to its grandparent). > I see find_pattern.py is only at http://svn.python.org/projects/sandbox/trunk/2to3. Now I remember I saw it some time ago, but was trying to find it at python's repo and couldn't find it =) Thanks Collin. -- -- Guilherme H. Polo Goncalves
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4