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
Y\¬Qc@sidZddlmZddlmZddlmZddlmZmZdej    fd„ƒYZ
dS(    s&Fixer for has_key().
 
Calls to .has_key() methods are expressed in terms of the 'in'
operator:
 
    d.has_key(k) -> k in d
 
CAVEATS:
1) While the primary target of this fixer is dict.has_key(), the
   fixer will change any has_key() method call, regardless of its
   class.
 
2) Cases like this will not be converted:
 
    m = d.has_key
    if m(k):
        ...
 
   Only *calls* to has_key() are converted. While it is possible to
   convert the above to something like
 
    m = d.__contains__
    if m(k):
        ...
 
   this is currently not done.
i(tpytree(ttoken(t
fixer_base(tNamet parenthesizet    FixHasKeycBseZeZdZd„ZRS(s•
    anchor=power<
        before=any+
        trailer< '.' 'has_key' >
        trailer<
            '('
            ( not(arglist | argument<any '=' any>) arg=any
            | arglist<(not argument<any '=' any>) arg=any ','>
            )
            ')'
        >
        after=any*
    >
    |
    negation=not_test<
        'not'
        anchor=power<
            before=any+
            trailer< '.' 'has_key' >
            trailer<
                '('
                ( not(arglist | argument<any '=' any>) arg=any
                | arglist<(not argument<any '=' any>) arg=any ','>
                )
                ')'
            >
        >
    >
    c CsU|s t‚|j}|jj|jkrC|jj|jƒrCdS|jdƒ}|d}|j    }g|dD]}|j
ƒ^qp}|dj
ƒ}    |jdƒ}
|
rÏg|
D]}|j
ƒ^q´}
n|    j|j |j|j |j |j|j|jfkrt|    ƒ}    nt|ƒdkr6|d}ntj|j|ƒ}d|_    td    d
dƒ} |rœtd d
dƒ} tj|j| | fƒ} ntj|j |    | |fƒ} |
rñt| ƒ} tj|j| ft|
ƒƒ} n|jj|j |j|j|j|j|j|j|j|jf    krHt| ƒ} n|| _    | S( Ntnegationtanchortbeforetargtafteriiu uintprefixunot( tAssertionErrortsymstparentttypetnot_testtpatterntmatchtNonetgetR tclonet
comparisontand_testtor_testttesttlambdeftargumentRtlenRtNodetpowerRtcomp_opttupletexprtxor_exprtand_exprt
shift_exprt
arith_exprttermtfactor(tselftnodetresultsR RRR tnRR    R
tn_optn_nottnew((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixes/fix_has_key.pyt    transformHsF     
    #"!      %      (t__name__t
__module__tTruet BM_compatibletPATTERNR/(((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixes/fix_has_key.pyR'sN( t__doc__tRtpgen2RRt
fixer_utilRRtBaseFixR(((sa/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/lib2to3/fixes/fix_has_key.pyt<module>s