tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
X\¬Qc@s~dZddlZddlZddlmZddlmZddlmZde    fd„ƒYZ
d    e
fd
„ƒYZ dS( s2Base class for fixers (optional, but recommended).iÿÿÿÿNi(tPatternCompiler(tpygram(tdoes_tree_importtBaseFixcBsàeZdZdZdZdZdZdZdZ    e
j dƒZ e ƒZdZeZdZdZeZeZejZd„Zd„Zd„Zd„Zd„Zd    d
„Zd „Zdd „Z d „Z!d„Z"d„Z#RS(sOptional base class for fixers.
 
    The subclass name must be FixFooBar where FooBar is the result of
    removing underscores and capitalizing the words of the fix name.
    For example, the class name for a fixer named 'has_key' should be
    FixHasKey.
    itposticCs ||_||_|jƒdS(sInitializer.  Subclass may override.
 
        Args:
            options: an dict containing the options passed to RefactoringTool
            that could be used to customize the fixer through the command line.
            log: a list to append warnings and other messages to.
        N(toptionstlogtcompile_pattern(tselfRR((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pyt__init__1s        cCsC|jdk    r?tƒ}|j|jdtƒ\|_|_ndS(s–Compiles self.PATTERN into self.pattern.
 
        Subclass may override if it doesn't want to use
        self.{pattern,PATTERN} in .match().
        t    with_treeN(tPATTERNtNoneRRtTruetpatternt pattern_tree(RtPC((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pyR=s    cCs||_tj|ƒ|_dS(smSet the filename, and a logger derived from it.
 
        The main refactoring tool should call this.
        N(tfilenametloggingt    getLoggertlogger(RR((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pyt set_filenameHs    cCs&i|d6}|jj||ƒo%|S(sReturns match for a given parse tree node.
 
        Should return a true or false object (not necessarily a bool).
        It may return a non-empty dict of matching sub-nodes as
        returned by a matching pattern.
 
        Subclass may override.
        tnode(Rtmatch(RRtresults((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pyRPs     cCs tƒ‚dS(s¶Returns the transformation for a given parse tree node.
 
        Args:
          node: the root of the parse tree that matched the fixer.
          results: a dict mapping symbolic names to part of the match.
 
        Returns:
          None, or a node that is a modified copy of the
          argument node.  The node argument may also be modified in-place to
          effect the same change.
 
        Subclass *must* override.
        N(tNotImplementedError(RRR((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pyt    transform\suxxx_todo_changemecCsI|}x,||jkr4|t|jjƒƒ}q    W|jj|ƒ|S(s†Return a string suitable for use as an identifier
 
        The new name is guaranteed not to conflict with other identifiers.
        (t
used_namestunicodetnumberstnexttadd(Rttemplatetname((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pytnew_namels
cCs@|jr,t|_|jjd|jƒn|jj|ƒdS(Ns### In file %s ###(t    first_logtFalseRtappendR(Rtmessage((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pyt log_messagews        cCsX|jƒ}|jƒ}d|_d}|j|||fƒ|rT|j|ƒndS(sWarn the user that a given chunk of code is not valid Python 3,
        but that it cannot be converted automatically.
 
        First argument is the top-level node for the code in question.
        Optional second argument is why it can't be converted.
        usLine %d: could not convert: %sN(t
get_linenotclonetprefixR'(RRtreasontlinenot
for_outputtmsg((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pytcannot_convert}s      cCs'|jƒ}|jd||fƒdS(sàUsed for warning the user about possible uncertainty in the
        translation.
 
        First argument is the top-level node for the code in question.
        Optional second argument is why it can't be converted.
        s Line %d: %sN(R(R'(RRR+R,((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pytwarningŒs cCs8|j|_|j|ƒtjdƒ|_t|_dS(sîSome fixers need to maintain tree-wide state.
        This method is called once, at the start of tree fix-up.
 
        tree - the root node of the tree to be processed.
        filename - the name of the file the tree came from.
        iN(RRt    itertoolstcountRR R#(RttreeR((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pyt
start_tree–s  cCsdS(sóSome fixers need to maintain tree-wide state.
        This method is called once, at the conclusion of tree fix-up.
 
        tree - the root node of the tree to be processed.
        filename - the name of the file the tree came from.
        N((RR3R((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pyt finish_tree¢sN($t__name__t
__module__t__doc__R R RRRRRR1R2RtsetRtorderR$texplicitt    run_ordert _accept_typetkeep_line_ordert BM_compatibleRtpython_symbolstsymsR    RRRRR"R'R/R0R4R5(((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pyRs6                                     
    tConditionalFixcBs&eZdZdZd„Zd„ZRS(s@ Base class for fixers which not execute if an import is found. cGs#tt|ƒj|Œd|_dS(N(tsuperRBR4R t _should_skip(Rtargs((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pyR4²scCsa|jdk    r|jS|jjdƒ}|d}dj|d ƒ}t|||ƒ|_|jS(Nt.iÿÿÿÿ(RDR tskip_ontsplittjoinR(RRtpkgR!((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pyt should_skip¶s
N(R6R7R8R RGR4RK(((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pyRB¬s    ( R8RR1tpatcompRtRt
fixer_utilRtobjectRRB(((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixer_base.pyt<module>s  