Critics have remarked that those four worthies were truly peerless throughout the ages; yet the present falls short of the pastβ€”the ancients favored unadorned simplicity, whereas the moderns prefer refined elegance. Styles of substance and ornament rise and fall in succession, shifting with the changing mores of the times; such evolution is simply the natural order of things. The ideal lies in honoring antiquity without clashing with the present, and embracing modernity without succumbing to its flawsβ€”embodying that perfect balance of substance and refinement that defines the true gentleman. There is surely no need to abandon a carved palace in favor of a cave dwelling, or to trade a jade carriage for a primitive cart with solid wooden wheels.🌌 SpectraShell

🌌 SpectraShell

Current path: lib64/python2.7/



⬆️ Go up: /lib64

πŸ“„ Viewing: sets.pyc

οΏ½
zfc@sοΏ½dZddlmZmZdddgZddlZejdedd	οΏ½defd
οΏ½οΏ½YZ	de	fdοΏ½οΏ½YZ
de	fdοΏ½οΏ½YZd
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οΏ½ZdοΏ½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((s/usr/lib64/python2.7/sets.pyt__init__HscCs
t|jοΏ½S(s'Return the number of elements of a set.(tlenR(R	((s/usr/lib64/python2.7/sets.pyt__len__QscCs
|jοΏ½S(seReturn string representation of a set.

        This looks like 'Set([<list of elements>])'.
        (t_repr(R	((s/usr/lib64/python2.7/sets.pyt__repr__UscCs6|jjοΏ½}|r"|jοΏ½nd|jj|fS(Ns%s(%r)(RtkeystsortRt__name__(R	tsortedtelements((s/usr/lib64/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	((s/usr/lib64/python2.7/sets.pyt__iter__escCs
tdοΏ½dS(Nscan't compare sets using cmp()(R(R	tother((s/usr/lib64/python2.7/sets.pyt__cmp__qscCs't|tοΏ½r|j|jkStSdS(N(t
isinstanceRRtFalse(R	R((s/usr/lib64/python2.7/sets.pyt__eq__οΏ½scCs't|tοΏ½r|j|jkStSdS(N(RRRtTrue(R	R((s/usr/lib64/python2.7/sets.pyt__ne__οΏ½scCs#|jοΏ½}|jj|jοΏ½|S(sReturn a shallow copy of a set.(RRtupdate(R	tresult((s/usr/lib64/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((s/usr/lib64/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((s/usr/lib64/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((s/usr/lib64/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((s/usr/lib64/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.)
        (RRRRRRt__contains__R(R	Rtlittletbigtcommon((s/usr/lib64/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((s/usr/lib64/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%((s/usr/lib64/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((s/usr/lib64/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%((s/usr/lib64/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((s/usr/lib64/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_checkRRRRR-R(R	RR%((s/usr/lib64/python2.7/sets.pytissubset!s
cCsN|j|οΏ½t|οΏ½t|οΏ½kr)tSxt|jj|οΏ½D]}tSWtS(s-Report whether this set contains another set.(R=RRRRR-R(R	RR%((s/usr/lib64/python2.7/sets.pyt
issuperset*s
cCs2|j|οΏ½t|οΏ½t|οΏ½ko1|j|οΏ½S(N(R=RR>(R	R((s/usr/lib64/python2.7/sets.pyt__lt__7s
cCs2|j|οΏ½t|οΏ½t|οΏ½ko1|j|οΏ½S(N(R=RR?(R	R((s/usr/lib64/python2.7/sets.pyt__gt__;s
cCst|tοΏ½stdοΏ½ndS(Ns,Binary operation only permitted between sets(RRR(R	R((s/usr/lib64/python2.7/sets.pyR=DscCs+d}x|D]}|t|οΏ½N}q
W|S(Ni(thash(R	RR%((s/usr/lib64/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<((s/usr/lib64/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*(((s/usr/lib64/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((s/usr/lib64/python2.7/sets.pyR
οΏ½s		cCs(|jdkr!|jοΏ½|_n|jS(N(RTR:RC(R	((s/usr/lib64/python2.7/sets.pyRSοΏ½scCs|j|jfS(N(RRT(R	((s/usr/lib64/python2.7/sets.pyt__getstate__οΏ½scCs|\|_|_dS(N(RRT(R	tstate((s/usr/lib64/python2.7/sets.pyt__setstate__οΏ½sN(	RRLRMRNR:R
RSRURW(((s/usr/lib64/python2.7/sets.pyRzs			cBsοΏ½eZdZgZddοΏ½ZdοΏ½ZdοΏ½ZdοΏ½ZdοΏ½Z	dοΏ½Z
dοΏ½ZdοΏ½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((s/usr/lib64/python2.7/sets.pyR
οΏ½s	cCs
|jfS(N(R(R	((s/usr/lib64/python2.7/sets.pyRUοΏ½scCs|\|_dS(N(R(R	R#((s/usr/lib64/python2.7/sets.pyRWοΏ½scCs$|j|οΏ½|jj|jοΏ½|S(s2Update a set with the union of itself and another.(R=RR(R	R((s/usr/lib64/python2.7/sets.pyt__ior__οΏ½s
cCs|j|οΏ½dS(s2Update a set with the union of itself and another.N(R*(R	R((s/usr/lib64/python2.7/sets.pytunion_updateοΏ½scCs!|j|οΏ½||@j|_|S(s9Update a set with the intersection of itself and another.(R=R(R	R((s/usr/lib64/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((s/usr/lib64/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((s/usr/lib64/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%((s/usr/lib64/python2.7/sets.pyR\οΏ½s	


cCs|j|οΏ½|j|οΏ½|S(s1Remove all elements of another set from this set.(R=tdifference_update(R	R((s/usr/lib64/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%((s/usr/lib64/python2.7/sets.pyR_οΏ½s	
cCs|j|οΏ½dS(s9Add all values from an iterable (such as a list or file).N(R*(R	RJ((s/usr/lib64/python2.7/sets.pyRοΏ½scCs|jjοΏ½dS(s"Remove all elements from this set.N(RR^(R	((s/usr/lib64/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<((s/usr/lib64/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<((s/usr/lib64/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;((s/usr/lib64/python2.7/sets.pytdiscard
s
cCs|jjοΏ½dS(s+Remove and return an arbitrary set element.i(Rtpopitem(R	((s/usr/lib64/python2.7/sets.pytpopscCs
t|οΏ½S(N(R(R	((s/usr/lib64/python2.7/sets.pyRDscCs
t|οΏ½S(N(t_TemporarilyImmutableSet(R	((s/usr/lib64/python2.7/sets.pyR8sN(RRLRMRNR:R
RURWRXRYRZR[R]R\R`R_RR^RaRbRdRfRDR8(((s/usr/lib64/python2.7/sets.pyRοΏ½s*													
	
	
		RgcBseZdοΏ½ZdοΏ½ZRS(cCs||_|j|_dS(N(t_setR(R	tset((s/usr/lib64/python2.7/sets.pyR
(s	cCs
|jjοΏ½S(N(RhRC(R	((s/usr/lib64/python2.7/sets.pyRS,s(RRLR
RS(((s/usr/lib64/python2.7/sets.pyRg$s	(
RMt	itertoolsRRt__all__twarningstwarntDeprecationWarningtobjectRRRRg(((s/usr/lib64/python2.7/sets.pyt<module>)sοΏ½:οΏ½


πŸ“