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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
M\¬Qc@s©dZddlmZmZdddgZddlZejdedd    ƒdefd
„ƒYZ    de    fd „ƒYZ
de    fd „ƒYZ d e    fd„ƒYZ dS(såClasses to represent arbitrary sets (including sets of sets).
 
This module implements sets using dictionaries whose values are
ignored.  The usual operations (union, intersection, deletion, etc.)
are provided as both methods and operators.
 
Important: sets are not sequences!  While they support 'x in s',
'len(s)', and 'for x in s', none of those operations are unique for
sequences; for example, mappings support all three as well.  The
characteristic operation for sequences is subscripting with small
integers: s[i], for i in range(len(s)).  Sets don't support
subscripting at all.  Also, sequences allow multiple occurrences and
their elements have a definite order; sets on the other hand don't
record multiple occurrences and don't remember the order of element
insertion (which is why they don't support s[i]).
 
The following classes are provided:
 
BaseSet -- All the operations common to both mutable and immutable
    sets. This is an abstract class, not meant to be directly
    instantiated.
 
Set -- Mutable sets, subclass of BaseSet; not hashable.
 
ImmutableSet -- Immutable sets, subclass of BaseSet; hashable.
    An iterable argument is mandatory to create an ImmutableSet.
 
_TemporarilyImmutableSet -- A wrapper around a Set, hashable,
    giving the same hash value as the immutable set equivalent
    would have.  Do not use this class directly.
 
Only hashable objects can be added to a Set. In particular, you cannot
really add a Set as an element to another Set; if you try, what is
actually added is an ImmutableSet built from it (it compares equal to
the one you tried adding).
 
When you ask if `x in y' where x is a Set and y is a Set or
ImmutableSet, x is wrapped into a _TemporarilyImmutableSet z, and
what's tested is actually `z in y'.
 
iÿÿÿÿ(tifiltert ifilterfalsetBaseSettSett ImmutableSetNsthe sets module is deprecatedt
stacklevelicBs"eZdZdgZd„Zd„Zd„ZeZed„Z    d„Z
d„Z d„Z d    „Z d
„ZeZd „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZeZeZd„Zd„ZdZ!d„Z"d„Z#d„Z$RS(s1Common base class for mutable and immutable sets.t_datacCs|jtkrtd‚ndS(sThis is an abstract class.s7BaseSet is an abstract class.  Use Set or ImmutableSet.N(t    __class__Rt    TypeError(tself((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__init__HscCs t|jƒS(s'Return the number of elements of a set.(tlenR(R    ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__len__QscCs
|jƒS(seReturn string representation of a set.
 
        This looks like 'Set([<list of elements>])'.
        (t_repr(R    ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__repr__UscCs6|jjƒ}|r"|jƒnd|jj|fS(Ns%s(%r)(RtkeystsortRt__name__(R    tsortedtelements((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR _s cCs |jjƒS(ssReturn an iterator over the elements or a set.
 
        This is the keys iterator for the underlying dict.
        (Rtiterkeys(R    ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__iter__escCs td‚dS(Nscan't compare sets using cmp()(R(R    tother((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__cmp__qscCs't|tƒr|j|jkStSdS(N(t
isinstanceRRtFalse(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__eq__ƒscCs't|tƒr|j|jkStSdS(N(RRRtTrue(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__ne__‰scCs#|jƒ}|jj|jƒ|S(sReturn a shallow copy of a set.(RRtupdate(R    tresult((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pytcopy‘s cCscddlm}|jƒ}||t|ƒ<|j}t}x!|D]}|||||ƒ<qBW|S(s1Return a deep copy of a set; used by copy module.iÿÿÿÿ(tdeepcopy(RR RtidRR(R    tmemoR Rtdatatvaluetelt((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt __deepcopy__™s      cCs t|tƒstS|j|ƒS(shReturn the union of two sets as a new set.
 
        (I.e. all elements that are in either set.)
        (RRtNotImplementedtunion(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__or__²scCs |j|ƒ}|j|ƒ|S(shReturn the union of two sets as a new set.
 
        (I.e. all elements that are in either set.)
        (Rt_update(R    RR((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR(»s cCs t|tƒstS|j|ƒS(snReturn the intersection of two sets as a new set.
 
        (I.e. all elements that are in both sets.)
        (RRR't intersection(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__and__ÄscCsut|tƒst|ƒ}nt|ƒt|ƒkrF||}}n ||}}t|jj|ƒ}|j|ƒS(snReturn the intersection of two sets as a new set.
 
        (I.e. all elements that are in both sets.)
        (RRRR RRt __contains__R(R    Rtlittletbigtcommon((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR+Ís cCs t|tƒstS|j|ƒS(s„Return the symmetric difference of two sets as a new set.
 
        (I.e. all elements that are in exactly one of the sets.)
        (RRR'tsymmetric_difference(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__xor__ÛscCs¦|jƒ}|j}t}|j}y |j}Wn tk
rSt|ƒj}nXx$t|j|ƒD]}|||<qgWx$t|j|ƒD]}|||<qŽW|S(s„Return the symmetric difference of two sets as a new set.
 
        (I.e. all elements that are in exactly one of the sets.)
        (RRRtAttributeErrorRRR-(R    RRR#R$tselfdatat    otherdataR%((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR1äs           cCs t|tƒstS|j|ƒS(s€Return the difference of two sets as a new Set.
 
        (I.e. all elements that are in this set and not in the other.)
        (RRR't
difference(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__sub__÷scCsv|jƒ}|j}y |j}Wn tk
rDt|ƒj}nXt}x$t|j|ƒD]}|||<q^W|S(s€Return the difference of two sets as a new Set.
 
        (I.e. all elements that are in this set and not in the other.)
        (RRR3RRRR-(R    RRR#R5R$R%((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR6s       cCsZy||jkSWnBtk
rUt|ddƒ}|dkrE‚n|ƒ|jkSXdS(s{Report whether an element is a member of a set.
 
        (Called in response to the expression `element in self'.)
        t__as_temporarily_immutable__N(RRtgetattrtNone(R    telementt    transform((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR-s  cCsN|j|ƒt|ƒt|ƒkr)tSxt|jj|ƒD]}tSWtS(s-Report whether another set contains this set.(t_binary_sanity_checkR RRRR-R(R    RR%((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pytissubset!s  cCsN|j|ƒt|ƒt|ƒkr)tSxt|jj|ƒD]}tSWtS(s-Report whether this set contains another set.(R=R RRRR-R(R    RR%((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt
issuperset*s  cCs2|j|ƒt|ƒt|ƒko1|j|ƒS(N(R=R R>(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__lt__7s cCs2|j|ƒt|ƒt|ƒko1|j|ƒS(N(R=R R?(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__gt__;s cCst|tƒstd‚ndS(Ns,Binary operation only permitted between sets(RRR(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR=DscCs+d}x|D]}|t|ƒN}q W|S(Ni(thash(R    RR%((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt _compute_hashJs cCs9|j}t|tƒr,|j|jƒdSt}t|ƒtttfkrÑt    |ƒ}xÙtrÍy#x|D]}|||<qlWdSWq\t
k
rÉt |ddƒ}|dkr¹‚n|||ƒ<q\Xq\Wndxa|D]Y}y|||<WqØt
k
r0t |ddƒ}|dkr ‚n|||ƒ<qØXqØWdS(Nt__as_immutable__( RRRRRttypetlistttupletxrangetiterRR9R:(R    titerableR#R$titR;R<((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR*Us2               N(%Rt
__module__t__doc__t    __slots__R
R Rt__str__RR RRRRRt__copy__R&R)R(R,R+R2R1R7R6R-R>R?t__le__t__ge__R@RAR:t__hash__R=RCR*(((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyRAsB                                                                                                                 
                 cBs>eZdZdgZdd„Zd„Zd„Zd„ZRS(sImmutable set class.t    _hashcodecCs2d|_i|_|dk    r.|j|ƒndS(s5Construct an immutable set from an optional iterable.N(R:RTRR*(R    RJ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR
s         cCs(|jdkr!|jƒ|_n|jS(N(RTR:RC(R    ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyRSˆscCs|j|jfS(N(RRT(R    ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt __getstate__scCs|\|_|_dS(N(RRT(R    tstate((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt __setstate__sN(    RRLRMRNR:R
RSRURW(((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyRzs              cBsÂeZdZgZdd„Zd„Zd„Zd„Zd„Z    d„Z
d„Z d„Z d    „Z d
„Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„ZRS(s Mutable set class.cCs)i|_|dk    r%|j|ƒndS(s*Construct a set from an optional iterable.N(RR:R*(R    RJ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR
šs     cCs
|jfS(N(R(R    ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyRU scCs|\|_dS(N(R(R    R#((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyRW¤scCs$|j|ƒ|jj|jƒ|S(s2Update a set with the union of itself and another.(R=RR(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__ior__¬s cCs|j|ƒdS(s2Update a set with the union of itself and another.N(R*(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt union_update²scCs!|j|ƒ||@j|_|S(s9Update a set with the intersection of itself and another.(R=R(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__iand__¶s cCs5t|tƒr||M}n|j|ƒj|_dS(s9Update a set with the intersection of itself and another.N(RRR+R(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pytintersection_update¼s cCs|j|ƒ|j|ƒ|S(sAUpdate a set with the symmetric difference of itself and another.(R=tsymmetric_difference_update(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__ixor__Ãs  cCs{|j}t}t|tƒs-t|ƒ}n||krF|jƒnx.|D]&}||kri||=qM|||<qMWdS(sAUpdate a set with the symmetric difference of itself and another.N(RRRRRtclear(R    RR#R$R%((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR\És        
cCs|j|ƒ|j|ƒ|S(s1Remove all elements of another set from this set.(R=tdifference_update(R    R((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt__isub__×s  cCsh|j}t|tƒs't|ƒ}n||kr@|jƒnx!t|j|ƒD] }||=qSWdS(s1Remove all elements of another set from this set.N(RRRRR^RR-(R    RR#R%((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR_Ýs      cCs|j|ƒdS(s9Add all values from an iterable (such as a list or file).N(R*(R    RJ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyRéscCs|jjƒdS(s"Remove all elements from this set.N(RR^(R    ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR^íscCs]yt|j|<WnEtk
rXt|ddƒ}|dkrE‚nt|j|ƒ<nXdS(s`Add an element to a set.
 
        This has no effect if the element is already present.
        RDN(RRRR9R:(R    R;R<((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pytaddós  cCsWy|j|=WnBtk
rRt|ddƒ}|dkrB‚n|j|ƒ=nXdS(svRemove an element from a set; it must be a member.
 
        If the element is not a member, raise a KeyError.
        R8N(RRR9R:(R    R;R<((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pytremoves  cCs)y|j|ƒWntk
r$nXdS(smRemove an element from a set if it is a member.
 
        If the element is not a member, do nothing.
        N(RbtKeyError(R    R;((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pytdiscard s cCs|jjƒdS(s+Remove and return an arbitrary set element.i(Rtpopitem(R    ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pytpopscCs
t|ƒS(N(R(R    ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyRDscCs
t|ƒS(N(t_TemporarilyImmutableSet(R    ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR8sN(RRLRMRNR:R
RURWRXRYRZR[R]R\R`R_RR^RaRbRdRfRDR8(((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR“s*                                                             
       RgcBseZd„Zd„ZRS(cCs||_|j|_dS(N(t_setR(R    tset((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyR
(s    cCs |jjƒS(N(RhRC(R    ((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyRS,s(RRLR
RS(((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyRg$s    ( RMt    itertoolsRRt__all__twarningstwarntDeprecationWarningtobjectRRRRg(((sL/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/sets.pyt<module>)s ÿ:‘