403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/mercurial/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/__pycache__/smartset.cpython-39.opt-1.pyc
a

�+�b���@s�ddlmZddlmZddlmZmZmZmZddlm	Z	dd�Z
Gdd	�d	e�ZGd
d�de�Z
Gdd
�d
e�Zdd�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Zddd�ZGdd�de�ZGdd�de�ZdS) �)�absolute_import�)�getattr)�encoding�error�pycompat�util)�
stringutilcCst�t|�j��d�S)N�_)rZsysbytes�type�__name__�lstrip)�o�r�8/usr/lib64/python3.9/site-packages/mercurial/smartset.py�	_typenamesrc@s�eZdZdd�ZeZdd�Zdd�ZdZdZdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd*dd�Zdd�Zdd �Zd!d"�Zd+d$d%�Zd&d'�Zd(d)�ZdS),�abstractsmartsetcCs
t��dS)z!True if the smartset is not emptyN��NotImplementedError��selfrrr�__nonzero__szabstractsmartset.__nonzero__cCs
t��dS)zprovide fast membership testingNr)r�revrrr�__contains__szabstractsmartset.__contains__cCs
t��dS)z:iterate the set in the order it is supposed to be iteratedNrrrrr�__iter__#szabstractsmartset.__iter__NcCs
t��dS)z/True if the set will iterate in ascending orderNrrrrr�isascending/szabstractsmartset.isascendingcCs
t��dS)z0True if the set will iterate in descending orderNrrrrr�isdescending3szabstractsmartset.isdescendingcCs
t��dS)z3True if the set will iterate in topographical orderNrrrrr�istopo7szabstractsmartset.istopocs@|jdurt|��n|��D]�q.qtd���fdd�|_�S)z%return the minimum element in the setN�arg is an empty sequencecs�S�Nrr��vrr�<lambda>D�z&abstractsmartset.min.<locals>.<lambda>)�fastasc�min�
ValueErrorrrr rr%;s

zabstractsmartset.mincs>|jdurt|�S|��D]�q,qtd���fdd�|_�S)z%return the maximum element in the setNrcs�Srrrr rrr"Pr#z&abstractsmartset.max.<locals>.<lambda>)�fastdesc�maxr&rrr rr(Gs
zabstractsmartset.maxcCs
t��dS)zireturn the first element in the set (user iteration perspective)

        Return None if the set is emptyNrrrrr�firstSszabstractsmartset.firstcCs
t��dS)zhreturn the last element in the set (user iteration perspective)

        Return None if the set is emptyNrrrrr�lastYszabstractsmartset.lastcCs
t��dS)zkreturn the length of the smartsets

        This can be expensive on smartset that could be lazy otherwise.Nrrrrr�__len___szabstractsmartset.__len__cCs
t��dS)z$reverse the expected iteration orderNrrrrr�reverseeszabstractsmartset.reverseFcCs
t��dS)z:get the set to iterate in an ascending or descending orderNr�rr,rrr�sortiszabstractsmartset.sortcCs t|t�r|S|j|j|dd�S)z{Returns a new object with the intersection of the two collections.

        This is part of the mandatory API for smartset.F��condrepr�cache)�
isinstance�fullreposet�filterr�r�otherrrr�__and__ms
zabstractsmartset.__and__cCs
t||�S)ztReturns a new object with the union of the two collections.

        This is part of the mandatory API for smartset.)�addsetr5rrr�__add__uszabstractsmartset.__add__cs"|j�|j�fdd�d|fdd�S)z{Returns a new object with the substraction of the two collections.

        This is part of the mandatory API for smartset.cs
�|�Srr)�r��crrr"�r#z*abstractsmartset.__sub__.<locals>.<lambda>s<not %r>Fr/)rr4r5rr;r�__sub__{s�zabstractsmartset.__sub__TcCs&|rt�|d�rt�|�}t|||�S)a1Returns this smartset filtered by condition as a new smartset.

        `condition` is a callable which takes a revision number and returns a
        boolean. Optional `condrepr` provides a printable representation of
        the given `condition`.

        This is part of the mandatory API for smartset.s__code__)r�safehasattrZ	cachefunc�filteredset)r�	conditionr0r1rrrr4�s	
zabstractsmartset.filtercCs&|dks|dkrt�d��|�||�S)zAReturn new smartset that contains selected elements from this setrsnegative index not allowed)rZProgrammingError�_slice)r�start�stoprrr�slice�s
zabstractsmartset.slicecCszg}t|�}t�|�D]}t|d�}|durq2qt�||�D]$}t|d�}|durZqf|�|�q@t|d|||fd�S)Nsslice=%d:%d %r)�datarepr)�iterr�xrange�next�append�baseset)rrBrCZys�it�x�yrrrrA�s

zabstractsmartset._slice)F)NT)r�
__module__�__qualname__r�__bool__rrr$r'rrrr%r(r)r*r+r,r.r7r9r=r4rDrArrrrrs,	
	

rcs�eZdZdZd1dd�Zejdd��Zejd	d
��Zejdd��Z	d
d�Z
dd�Zdd�Zejdd��Z
dd�ZeZd2dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Z�fd'd(�Zd)d*�Zd+d,�Zd-d.�Zejd/d0��Z�ZS)3rJa�Basic data structure that represents a revset and contains the basic
    operation that it should be able to perform.

    Every method in this class should be implemented by any smartset class.

    This class could be constructed by an (unordered) set, or an (ordered)
    list-like object. If a set is provided, it'll be sorted lazily.

    >>> x = [4, 0, 7, 6]
    >>> y = [5, 6, 7, 3]

    Construct by a set:
    >>> xs = baseset(set(x))
    >>> ys = baseset(set(y))
    >>> [list(i) for i in [xs + ys, xs & ys, xs - ys]]
    [[0, 4, 6, 7, 3, 5], [6, 7], [0, 4]]
    >>> [type(i).__name__ for i in [xs + ys, xs & ys, xs - ys]]
    ['addset', 'baseset', 'baseset']

    Construct by a list-like:
    >>> xs = baseset(x)
    >>> ys = baseset(i for i in y)
    >>> [list(i) for i in [xs + ys, xs & ys, xs - ys]]
    [[4, 0, 7, 6, 5, 3], [7, 6], [4, 0]]
    >>> [type(i).__name__ for i in [xs + ys, xs & ys, xs - ys]]
    ['addset', 'filteredset', 'filteredset']

    Populate "_set" fields in the lists so set optimization may be used:
    >>> [1 in xs, 3 in ys]
    [False, True]

    Without sort(), results won't be changed:
    >>> [list(i) for i in [xs + ys, xs & ys, xs - ys]]
    [[4, 0, 7, 6, 5, 3], [7, 6], [4, 0]]
    >>> [type(i).__name__ for i in [xs + ys, xs & ys, xs - ys]]
    ['addset', 'filteredset', 'filteredset']

    With sort(), set optimization could be used:
    >>> xs.sort(reverse=True)
    >>> [list(i) for i in [xs + ys, xs & ys, xs - ys]]
    [[7, 6, 4, 0, 5, 3], [7, 6], [4, 0]]
    >>> [type(i).__name__ for i in [xs + ys, xs & ys, xs - ys]]
    ['addset', 'baseset', 'baseset']

    >>> ys.sort()
    >>> [list(i) for i in [xs + ys, xs & ys, xs - ys]]
    [[7, 6, 4, 0, 3, 5], [7, 6], [4, 0]]
    >>> [type(i).__name__ for i in [xs + ys, xs & ys, xs - ys]]
    ['addset', 'baseset', 'baseset']

    istopo is preserved across set operations
    >>> xs = baseset(set(x), istopo=True)
    >>> rs = xs & ys
    >>> type(rs).__name__
    'baseset'
    >>> rs._istopo
    True
    rNFcCsFd|_||_t|t�r$||_d|_nt|t�s6t|�}||_||_dS)z�
        datarepr: a tuple of (format, obj, ...), a function or an object that
                  provides a printable representation of the given data.
        NT)�
_ascending�_istopor2�set�_set�list�_list�	_datarepr)r�datarErrrr�__init__�s

zbaseset.__init__cCs
t|j�Sr)rSrVrrrrrT�szbaseset._setcCs|jdd�}|��|Sr)rVr.)rZasclistrrr�_asclist�szbaseset._asclistcCs
t|j�Sr)rUrTrrrrrVsz
baseset._listcCs2|jdurt|j�S|jr$t|j�St|j�SdSr)rQrFrVrZ�reversedrrrrrs



zbaseset.__iter__cCs
t|j�Sr)rFrZrrrrr$szbaseset.fastasccCs
t|j�Sr)r[rZrrrrr'szbaseset.fastdesccCs|jjSr)rTrrrrrrszbaseset.__contains__cCstt|��Sr)�bool�lenrrrrrszbaseset.__nonzero__cCst|�|_d|_dS�NF)r\rQrRr-rrrr.szbaseset.sortcCs*|jdur|j��n
|j|_d|_dSr^)rQrVr,rRrrrrr,!s

zbaseset.reversecCs"d|jvrt|j�St|j�SdS)NrV)�__dict__r]rVrTrrrrr+(s

zbaseset.__len__cCs t|�dkrdS|jduo|jS)zyReturns True if the collection is ascending order, False if not.

        This is part of the mandatory API for smartset.rTN�r]rQrrrrr.szbaseset.isascendingcCs"t|�dkrdS|jduo |jS)zzReturns True if the collection is descending order, False if not.

        This is part of the mandatory API for smartset.rTNr`rrrrr6szbaseset.isdescendingcCst|�dkrdS|jS)zlIs the collection is in topographical order or not.

        This is part of the mandatory API for smartset.rT)r]rRrrrrr>szbaseset.istopocCs6|r2|jdur|jdS|jr(|jdS|jdSdS)Nr����rQrVrZrrrrr)Fs



z
baseset.firstcCs6|r2|jdur|jdS|jr(|jdS|jdSdS)Nrarrbrrrrr*Ps



zbaseset.lastcsht|�turPd|jvrPd|jvrP|jdurPtt|j|�|j�|jd�}|j|_nttt|�|�|�}|S)NrT)rXr)rrJr_rQrrTrR�super)rr6�op�s��	__class__rr�
_fastsetopZs
�����
zbaseset._fastsetopcCs|�|d�S)Ns__and__�rhr5rrrr7jszbaseset.__and__cCs|�|d�S)Ns__sub__rir5rrrr=mszbaseset.__sub__cCsv|jdur"t|j||�|jd�S|j}|jsTtt|�|d�tt|�|d�}}t|||�|jd�}|j|_|S)N)rr)rQrJrVrRrZr(r])rrBrCrXrerrrrAps
&zbaseset._slicecCsTdddd�|j}t�|j�}|sB|j}|jdur8|j}t�|�}dt|�||fS)Nr#�-�+�NFTs	<%s%s %s>)	rQr	�	buildreprrWrVrZr�bytereprr)r�dre�lrrr�__repr__|s

zbaseset.__repr__)rNF)F) rrNrO�__doc__rYr�
propertycacherTrZrVrr$r'rrrPr.r,r+rrrr)r*rhr7r=rAr�	strmethodrq�
__classcell__rrrfrrJ�s:;







rJc@s�eZdZdZdd�dfdd�Zdd�Zd	d
�Zdd�Zed
d��Z	edd��Z
dd�ZeZdd�Z
d&dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zejd$d%��ZdS)'r?z�Duck type for baseset class which iterates lazily over the revisions in
    the subset and contains a function which tests for membership in the
    revset
    cCsdS�NTr)rLrrrr"�r#zfilteredset.<lambda>NcCs||_||_||_dS)a!
        condition: a function that decide whether a revision in the subset
                   belongs to the revset or not.
        condrepr: a tuple of (format, obj, ...), a function or an object that
                  provides a printable representation of the given condition.
        N)�_subset�
_condition�	_condrepr)rZsubsetr@r0rrrrY�szfilteredset.__init__cCs||jvo|�|�Sr)rwrx�rrLrrrr�szfilteredset.__contains__cCs|�|j�Sr)�_iterfilterrwrrrrr�szfilteredset.__iter__ccs"|j}|D]}||�r
|Vq
dSr)rx)rrKZcondrLrrrr{�szfilteredset._iterfiltercs"�jj��durdS��fdd�S)Ncs�����Sr�r{r�rKrrrr"�r#z%filteredset.fastasc.<locals>.<lambda>)rwr$rrr}rr$�szfilteredset.fastasccs"�jj��durdS��fdd�S)Ncs�����Srr|rr}rrr"�r#z&filteredset.fastdesc.<locals>.<lambda>)rwr'rrr}rr'�szfilteredset.fastdesccCspd}|��r|jnd|��r"|jnd|j|jg}|D]}|dur4|}qJq4|durZ|�}n|}|D]}dSdS�NTF)rr$rr')rZfastZ
candidates�	candidaterKr:rrrr�s �zfilteredset.__nonzero__cCstdd�|D��}t|�S)Ncss|]
}|VqdSrr)�.0r:rrr�	<genexpr>�r#z&filteredset.__len__.<locals>.<genexpr>)rJr])rrprrrr+�szfilteredset.__len__FcCs|jj|d�dS)N�r,)rwr.r-rrrr.�szfilteredset.sortcCs|j��dSr)rwr,rrrrr,�szfilteredset.reversecCs
|j��Sr)rwrrrrrr�szfilteredset.isascendingcCs
|j��Sr)rwrrrrrr�szfilteredset.isdescendingcCs
|j��Sr)rwrrrrrr�szfilteredset.istopocCs|D]
}|SdSrrrzrrrr)�szfilteredset.firstcCsVd}|��r|j}n|��r"|j}|dur@|�D]
}|SdSd}|D]}qH|SdSr)rr'rr$�rrKrLrrrr*�s
zfilteredset.lastcCs>t�|j�g}t�|j�}|r(|�|�dt|�d�|�fS)Ns<%s %s>s, )	rrnrwr	rmryrIr�join)rZxsrerrrrq�s

zfilteredset.__repr__)F)rrNrOrrrYrrr{�propertyr$r'rrPr+r.r,rrrr)r*rrtrqrrrrr?�s*


r?c	cs�t}|rt}d}d}zN|dur&t|�}|dur6t|�}|||�}|V||krRd}||krd}qWnHty�|}|dur�|V|}n|dur�|V|D]
}|Vq�Yn0dS)z�produce an ordered iteration from two iterators with the same order

    The ascending is used to indicated the iteration direction.
    N)r(r%rH�
StopIteration)	�	ascending�iter1�iter2�choiceZval1Zval2�nrK�valrrr�_iterordereds2

r�c@s�eZdZdZd&dd�Zdd�Zdd�ZeZej	d	d
��Z
dd�Zd
d�Ze
dd��Ze
dd��Zdd�Zd'dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zejd$d%��ZdS)(r8a	Represent the addition of two sets

    Wrapper structure for lazily adding two structures without losing much
    performance on the __contains__ method

    If the ascending attribute is set, that means the two structures are
    ordered in either an ascending or descending way. Therefore, we can add
    them maintaining the order by iterating over both at the same time

    >>> xs = baseset([0, 3, 2])
    >>> ys = baseset([5, 2, 4])

    >>> rs = addset(xs, ys)
    >>> bool(rs), 0 in rs, 1 in rs, 5 in rs, rs.first(), rs.last()
    (True, True, False, True, 0, 4)
    >>> rs = addset(xs, baseset([]))
    >>> bool(rs), 0 in rs, 1 in rs, rs.first(), rs.last()
    (True, True, False, 0, 2)
    >>> rs = addset(baseset([]), baseset([]))
    >>> bool(rs), 0 in rs, rs.first(), rs.last()
    (False, False, None, None)

    iterate unsorted:
    >>> rs = addset(xs, ys)
    >>> # (use generator because pypy could call len())
    >>> list(x for x in rs)  # without _genlist
    [0, 3, 2, 5, 4]
    >>> assert not rs._genlist
    >>> len(rs)
    5
    >>> [x for x in rs]  # with _genlist
    [0, 3, 2, 5, 4]
    >>> assert rs._genlist

    iterate ascending:
    >>> rs = addset(xs, ys, ascending=True)
    >>> # (use generator because pypy could call len())
    >>> list(x for x in rs), list(x for x in rs.fastasc())  # without _asclist
    ([0, 2, 3, 4, 5], [0, 2, 3, 4, 5])
    >>> assert not rs._asclist
    >>> len(rs)
    5
    >>> [x for x in rs], [x for x in rs.fastasc()]
    ([0, 2, 3, 4, 5], [0, 2, 3, 4, 5])
    >>> assert rs._asclist

    iterate descending:
    >>> rs = addset(xs, ys, ascending=False)
    >>> # (use generator because pypy could call len())
    >>> list(x for x in rs), list(x for x in rs.fastdesc())  # without _asclist
    ([5, 4, 3, 2, 0], [5, 4, 3, 2, 0])
    >>> assert not rs._asclist
    >>> len(rs)
    5
    >>> [x for x in rs], [x for x in rs.fastdesc()]
    ([5, 4, 3, 2, 0], [5, 4, 3, 2, 0])
    >>> assert rs._asclist

    iterate ascending without fastasc:
    >>> rs = addset(xs, generatorset(ys), ascending=True)
    >>> assert rs.fastasc is None
    >>> [x for x in rs]
    [0, 2, 3, 4, 5]

    iterate descending without fastdesc:
    >>> rs = addset(generatorset(xs), ys, ascending=False)
    >>> assert rs.fastdesc is None
    >>> [x for x in rs]
    [5, 4, 3, 2, 0]
    NcCs(||_||_d|_||_d|_d|_dSr)�_r1�_r2Z_iterrQ�_genlistrZ)rZrevs1Zrevs2r�rrrrYpszaddset.__init__cCs
t|j�Sr)r]rVrrrrr+xszaddset.__len__cCst|j�pt|j�Sr)r\r�r�rrrrr{szaddset.__nonzero__cCs|jstt|��|_|jSr)r�rJrFrrrrrV�szaddset._listcs��jdur,�jrt�j�S�fdd�}|�S����jr@d}nd}t�|�}|dur\|�St�j|�}|dur�tt�j�jd��}n|�}t�j|�}|dur�tt�j�jd��}n|�}t�j||�S)a�Iterate over both collections without repeating elements

        If the ascending attribute is not set, iterate over the first one and
        then over the second one checking for membership on the first one so we
        dont yield any duplicates.

        If the ascending attribute is set, iterate over both collections at the
        same time, yielding only one value at a time in the given order.
        Nc3s8�jD]
}|Vq�jj}�jD]}||�s |Vq dSr)r�rr�)r:Zinr1rrr�arbitraryordergen�s

z*addset.__iter__.<locals>.arbitraryordergensfastascsfastdescr�)	rQr�rF�_trysetasclistrr��sortedr�r�)rr��attrrKr�r�rrrr�s*



zaddset.__iter__cCs$|jdur |jdur t|j�|_dS)z9populate the _asclist attribute if possible and necessaryN)r�rZr�rrrrr��szaddset._trysetasclistcsH|��|jdur|jjS|jj�|jj�d��fvr:dS��fdd�S)Ncstd�����Srv�r�r�r�r�rrr"�r#z addset.fastasc.<locals>.<lambda>)r�rZrr�r$r�rrr�rr$�s
zaddset.fastasccsH|��|jdur|jjS|jj�|jj�d��fvr:dS��fdd�S)Ncstd�����Sr^r�rr�rrr"�r#z!addset.fastdesc.<locals>.<lambda>)r�rZ�__reversed__r�r'r�rrr�rr'�s
zaddset.fastdesccCs||jvp||jvSr)r�r�rzrrrr�szaddset.__contains__FcCs||_dS)z�Sort the added set

        For this we use the cached list with all the generated values and if we
        know they are ascending or descending we can sort them in a smart way.
        N�rQr-rrrr.�szaddset.sortcCs|jduo|jSrr�rrrrr�szaddset.isascendingcCs|jduo|jSrr�rrrrr�szaddset.isdescendingcCsdSr^rrrrrr�sz
addset.istopocCs$|jdur|j��n
|j|_dSr)rQrVr,rrrrr,�s
zaddset.reversecCs|D]
}|SdSrrrzrrrr)�szaddset.firstcCs|��|��}|��|Sr)r,r))rr�rrrr*�szaddset.lastcCs*dddd�|j}dt|�||j|jfS)Nr#rjrkrls
<%s%s %r, %r>)rQrr�r��rrorrrrq�szaddset.__repr__)N)F)rrNrOrrrYr+rrPrrsrVrr�r�r$r'rr.rrrr,r)r*rrtrqrrrrr8(s.G

1




r8cs�eZdZdZd$�fdd�	Zd%dd�Zdd�ZeZd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zd&dd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zejd"d#��Z�ZS)'�generatorseta�Wrap a generator for lazy iteration

    Wrapper structure for generators that provides lazy membership and can
    be iterated more than once.
    When asked for membership it generates values until either it finds the
    requested one or has gone through all the elements in the generator

    >>> xs = generatorset([0, 1, 4], iterasc=True)
    >>> assert xs.last() == xs.last()
    >>> xs.last()  # cached
    4
    Ncs,|dur|}n|rt}nt}tt|��|�Sr)�_generatorsetasc�_generatorsetdescrcr��__new__)�cls�gen�iterasc�typrfrrr�szgeneratorset.__new__cCs(||_d|_i|_g|_d|_d|_dS)zM
        gen: a generator producing the values for the generatorset.
        NFT)�_genrZ�_cacher��	_finishedrQ)rr�r�rrrrYszgeneratorset.__init__cCs |jr
dS|��D]}dSdSr~)r��_consumegen�rr:rrrr#s
zgeneratorset.__nonzero__cCs>||jvr|j|S|��D]}||krdSqd|j|<dSr~�r�r��rrLrprrrr/s


zgeneratorset.__contains__cCs8|jr|j}n|j}|dur"|�S|��D]}q*t|�Sr)rQr$r'r�rFr�rrrr;szgeneratorset.__iter__cs@|jrt|j�S|j�|���tt������fdd�}|�S)Nc3sNd}|���kr�|Vn$z���VWnty>YdS0|d7}qdS�Nrr)r�)�i��_lenZ_next�genlistZnextgenrrr�Vsz#generatorset._iterator.<locals>.gen)r�rFr�r�r]rH)rr�rr�r�	_iteratorHs

zgeneratorset._iteratorccsl|j}|jj}|jD]}d||<||�|Vq|jshd|_|jdd�}|��||_|j|_|j	|_
dSrv)r�r�rIr�r�r.rZrr$r�r')rr1r��itemZascrrrr�ds
zgeneratorset._consumegencCs|��D]}qt|j�Sr)r�r]r�rzrrrr+sszgeneratorset.__len__FcCs||_dSrr�r-rrrr.xszgeneratorset.sortcCs|j|_dSrr�rrrrr,{szgeneratorset.reversecCs|jSrr�rrrrr~szgeneratorset.isascendingcCs|jSrr�rrrrr�szgeneratorset.isdescendingcCsdSr^rrrrrr�szgeneratorset.istopocCs>|jr|j}n|j}|dur2|��D]}q$|��St|�d�Sr)rQr$r'r�r)rHr�rrrr)�szgeneratorset.firstcCs>|jr|j}n|j}|dur2|��D]}q$|��St|�d�Sr)rQr'r$r�r*rHr�rrrr*�szgeneratorset.lastcCs ddd�|j}dt|�|fS)Nrjrk�FTs<%s%s>)rQrr�rrrrq�szgeneratorset.__repr__)N)N)F)rrNrOrrr�rYrrPrrr�r�r+r.r,rrrr)r*rrtrqrurrrfrr�s&





r�c@seZdZdZejZdd�ZdS)r�z@Special case of generatorset optimized for ascending generators.cCsJ||jvr|j|S|��D]}||kr.dS||krq<qd|j|<dSr~r�r�rrrr�s


z_generatorsetasc.__contains__N)rrNrOrrr�r�r$rrrrrr��sr�c@seZdZdZejZdd�ZdS)r�zASpecial case of generatorset optimized for descending generators.cCsJ||jvr|j|S|��D]}||kr.dS||krq<qd|j|<dSr~r�r�rrrr�s


z_generatorsetdesc.__contains__N)rrNrOrrr�r�r'rrrrrr��sr�NcCs@|durt|�}||k}|s.|d|d}}t||||jj�S)z�Create a spanset that represents a range of repository revisions

    start: first revision included the set (default to 0)
    end:   first revision excluded (last+1) (default to len(repo))

    Spanset will be descending if `end` < `start`.
    Nr)r]�_spanset�	changelog�filteredrevs)�reporB�endr�rrr�spanset�sr�cs�eZdZdZdd�Zd%dd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
e
Zdd�Zdd�Zdd�Zdd�Zdd �Z�fd!d"�Zejd#d$��Z�ZS)&r�a\Duck type for baseset class which represents a range of revisions and
    can work lazily and without having all the range in memory

    Note that spanset(x, y) behave almost like xrange(x, y) except for two
    notable points:
    - when x < y it will be automatically descending,
    - revision filtered with this repoview will be skipped.

    cCs||_||_||_||_dSr)�_start�_endrQ�_hiddenrevs)rrBr�r�Z
hiddenrevsrrrrY�sz_spanset.__init__FcCs||_dSrr�r-rrrr.�sz
_spanset.sortcCs|j|_dSrr�rrrrr,�sz_spanset.reversecCsdSr^rrrrrr�sz_spanset.istopoccs"|j}|D]}||vr
|Vq
dSr)r�)r�	iterrangerer:rrrr{�sz_spanset._iterfiltercCs|jr|��S|��SdSr�rQr$r'rrrrrsz_spanset.__iter__cCs(t�|j|j�}|jr |�|�St|�Sr)rrGr�r�r�r{rF�rr�rrrr$	s
z_spanset.fastasccCs2t�|jd|jdd�}|jr*|�|�St|�S)Nrra)rrGr�r�r�r{rFr�rrrr's
z_spanset.fastdesccCs0|j}|j|ko|jkno.|o,||vSr)r�r�r�)rrZhiddenrrrrs
�z_spanset.__contains__cCs|D]}dSdSr~rr�rrrrsz_spanset.__nonzero__cCs�|jst|j|j�Sd}|j}|j}|jD]:}||krD|ks^n||krZ|kr,nq,|d7}q,t|j|j�|SdSr�)r��absr�r�)r�countrBr�rrrrr+"s
.
z_spanset.__len__cCs|jSrr�rrrrr.sz_spanset.isascendingcCs|jSrr�rrrrr1sz_spanset.isdescendingcCs*|jr|j}n|j}|�D]
}|SdSrr�r�rrrr)4s
z_spanset.firstcCs*|jr|j}n|j}|�D]
}|SdSr)rQr'r$r�rrrr*=s
z
_spanset.lastcsz|jrtt|��||�S|jrDt|j||j�}t|j||j�}n$t|j||j�}t|j||j�}t|||j|j�Sr)	r�rcr�rArQr%r�r�r()rrBrCrLrMrfrrrAFsz_spanset._slicecCs(ddd�|j}dt|�||j|jfS)Nrjrkr�s<%s%s %d:%d>)rQrr�r�r�rrrrqRsz_spanset.__repr__)F)rrNrOrrrYr.r,rr{rr$r'rrrPr+rrr)r*rArrtrqrurrrfrr��s(

		r�cs(eZdZdZ�fdd�Zdd�Z�ZS)r3z�a set containing all revisions in the repo

    This class exists to host special optimization and magic to handle virtual
    revisions such as "null".
    cs"tt|��dt|�d|jj�dS)NrT)rcr3rYr]r�r�)rr�rfrrrY_s
�zfullreposet.__init__cCs.t�|d�st||j�}|j|��d�|S)z�As self contains the whole repo, all of the other set should also be
        in self. Therefore `self & other = other`.

        This boldly assumes the other contains valid revs only.
        sisascendingr�)rr>rJr�r.rr5rrrr7dszfullreposet.__and__)rrNrOrrrYr7rurrrfrr3Xsr3)rN)Z
__future__rrr�rrrZutilsr	r�objectrrJr?r�r8r�r�r�r�r�r3rrrr�<module>s&dx%Y)
x

Youez - 2016 - github.com/yon3zu
LinuXploit