Ñò ô†³Kc@s¨dZdZdZdZdZdefd„ƒYZeeƒZee ƒZ defd„ƒYZ e d jo5e d d fd ƒZ e d d fƒZe d d fd d dfddddƒZe GHe d@GHe dBGHe d dfAGHe dGHde jGHe ie ƒGHeie ƒGHe ie ƒGHeie ƒGHxe D] ZeGHq9We iƒGHe ejGHe ejGHe ejGHee ƒGHeeƒGHee ƒGHe iƒGHndS(stImmutable integer set type. Integer set class. Copyright (C) 2006, Heiko Wundram. Released under the MIT license. s Heiko Wundram s0.2t6s 2006-01-20t _InfinitycBs_eZdZdgZd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z RS( s0Internal type used to represent infinity values.t_negcCs ||_dS(N(R(tselftneg((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyt__init__scCs@t|tttfƒptS|iot|tƒo|i S(N(t isinstancetinttlongRtNotImplementedR(Rtvalue((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyt__lt__s cCs%t|tttfƒptS|iS(N(RRRRR R(RR ((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyt__le__$scCsAt|tttfƒptS|ipt|tƒo|i S(N(RRRRR R(RR ((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyt__gt__)s cCs&t|tttfƒptS|i S(N(RRRRR R(RR ((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyt__ge__/scCs>t|tttfƒptSt|tƒo|i|ijS(N(RRRRR R(RR ((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyt__eq__4scCs?t|tttfƒptSt|tƒ p|i|ijS(N(RRRRR R(RR ((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyt__ne__9scCsdS(NtNone((R((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyt__repr__>s( t__name__t __module__t__doc__t __slots__RR R R RRRR(((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRs        tIntSetcBs–eZdZddddgZd„Zeed„Zd„Zd„Z dJd „Z e d d d d „ƒZ e dd d d„ƒZ e dd d d„ƒZe dd dd„ƒZe dd dd„ƒZe dd dd„ƒZe dd dd„ƒZe dd dd„ƒZe dd dd„ƒZe d d d!d"„ƒZe d#d d!d$„ƒZe d%d d!d&„ƒZe d'd(d)d*„ƒZe d+d(d,d-„ƒZe d.d(d/d0„d1„ƒZe d2d(d)d3„ƒZe d4d(d5d6„d7„ƒZe d8d(d9d:„d;„ƒZe d<d(d=d>„ƒZe d?d(d@dA„dB„ƒZ[ dC„Z e Z!dD„Z"dE„Z#dF„Z$dG„Z%dH„Z&dI„Z'RS(KsvInteger set class with efficient storage in a RLE format of ranges. Supports minus and plus infinity in the range.t_rangest_mint_maxt_hashcOsët|ƒdjopt|dtƒo\|otdƒ‚n|di|_|di|_|di|_|di|_dSg|_|idt ƒ|_|idt ƒ|_|idjo t |_n|idjo t |_n|otdƒ‚nt|it t fƒp |it jptdƒ‚nt|it t fƒp |it jptd ƒ‚n|it j o3|it j o#|i|ijotd ƒ‚nt|it t fƒo|id7_nxò|D]ê}t|t t fƒo||d}}n<t|tƒot|ƒd jotd ƒ‚n|\}}|djo |i}n|djo |i}nt|t t fƒp |t jptd ƒ‚nt|t t fƒp |t jptdƒ‚n|t j o!|t j o||joqïnt|t t fƒo|d7}q[n tdƒ‚||ijoqïn||ijo |i}n||ijoqïn||ijo |i}n|ii||fƒqïW|iƒdS(sŽInitialize an integer set. The constructor accepts an unlimited number of arguments that may either be tuples in the form of (start,stop) where either start or stop may be a number or None to represent maximum/minimum in that direction. The range specified by (start,stop) is always inclusive (differing from the builtin range operator). Keyword arguments that can be passed to an integer set are min and max, which specify the minimum and maximum number in the set, respectively. You can also pass None here to represent minus or plus infinity, which is also the default. iis*No keyword arguments for copy constructor.NtmintmaxsInvalid keyword argument.sInvalid type of min argument.sInvalid type of max argument.s$Minimum is not smaller than maximum.is$Invalid tuple, must be (start,stop).sInvalid type of tuple start.sInvalid type of tuple stop.sInvalid argument.(tlenRRt ValueErrorRRRRtpopt_MININFt_MAXINFRRRt TypeErrorttupletappendt _normalize(Rtargstkwargstargtstarttstop((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRRst'   ))      ##    ccs‘|}htd6td6}dt|ƒdt|ƒ}}d\} } x!| |jp | |jo| |jo~| |jo-|| d?| d@|| d?| d@jp | |jo7|| d?| d@d| d@ } } } | d7} n4|| d?| d@d| d@ } } } | d7} || jo-| |joPn||| ffV| }n| || 'st__rand__cCs|do|dS(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRS*st intersectioncCs|do|dS(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRS-st__or__sUnion of two sets as a new set.cCs|dp|dS(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRS2st__ror__cCs|dp|dS(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRS5stunioncCs|dp|dS(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRS8st__sub__s$Difference of two sets as a new set.cCs|do |d S(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRS=st__rsub__cCs|do |d S(R-R,((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRS@st differencecCs|do |d S(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSCst__xor__s.Symmetric difference of two sets as a new set.cCs|d|dAS(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSHst__rxor__cCs|d|dAS(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSKstsymmetric_differencecCs|d|dAS(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSNst __contains__RHs*Returns true if self is superset of other.cCs|dp |d S(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSSstissubsets(Returns true if self is subset of other.cCs|dp |d S(R-R,((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSVst istruesubsets-Returns true if self is true subset of other.cCs|dp |d S(R-R,((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSYscCs|do |d S(R-R,((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSZst issupersetcCs|dp |d S(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRS]stistruesupersets/Returns true if self is true superset of other.cCs|dp |d S(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRS`scCs|do |d S(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSastoverlapss)Returns true if self overlaps with other.cCstS((tTrue(RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSdscCs|do|dS(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSesRs'Returns true if self is equal to other.cCs|d|dA S(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSjsRs+Returns true if self is different to other.cCstS((Re(RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSmscCs|d|dAS(R,R-((RR((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyRSnscCs½|ii|iƒ}|i|_|i|_g|_|i}xJ|iD]?}||djo(|ii||dfƒ|d}qIqIW||ijo|ii||ifƒn|S(sInverse of set as a new set.ii(R=RBRRRR%(RRDtlaststoptr((s5/usr/lib/python2.6/site-packages/paste/util/intset.pytinversets     cCs|iS(s¦Returns a hash value representing this integer set. As the set is always stored normalized, the hash value is guaranteed to match for matching ranges.(R(R((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyt__hash__‰scCs |ipdS|iddtjp|iddtjotdƒ‚nd}x'|iD]}||d|d7}q_W|djotdƒ‚n|S( såGet length of this integer set. In case the length is larger than 2**31 (including infinitely sized integer sets), it raises an OverflowError. This is due to len() restricting the size to 0 <= len < 2**31.iiÿÿÿÿisInfinitely sized integer set.iisInteger set bigger than 2**31.l(RR!R"t OverflowError(RtrlenRg((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyt__len__“s 0  cCsx|ipdS|iddtjp|iddtjodSd}x'|iD]}||d|d7}qTW|S(s<Returns the length of this integer set as an integer. In case the length is infinite, returns -1. This function exists because of a limitation of the builtin len() function which expects values in the range 0 <= len < 2**31. Use this function in case your integer set might be larger.iiÿÿÿÿi(RR!R"(RRkRg((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyR¤s 0 cCs t|iƒS(s<Returns true if this integer set contains at least one item.(RHR(R((s5/usr/lib/python2.6/site-packages/paste/util/intset.pyt __nonzero__´sccsg}xÈ|iD]½}|dtjoS|dtjo#|iddgddgfƒqÍ|i|dddgƒq|dtjo|i|ddgƒqx$t|d|dƒD] }|Vq¾WqW|oAx>to2x+|D]#}|dV|dc|d7sD/  ÿœ *