Spade

Mini Shell

Directory:~$ /proc/self/root/usr/lib/python2.7/site-packages/future/types/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/usr/lib/python2.7/site-packages/future/types/newrange.pyc

�
,�]c@@s�dZddlmZddlmZerEddlmZmZnddlmZmZddl	m
Z
ddlmZeZ
defd��YZd	efd
��YZdgZdS(sw
Nearly identical to xrange.py, by Dan Crosta, from

    https://github.com/dcrosta/xrange.git

This is included here in the ``future`` package rather than pointed to as
a dependency because there is no package for ``xrange`` on PyPI. It is
also tweaked to appear like a regular Python 3 ``range`` object rather
than a Python 2 xrange.

From Dan Crosta's README:

    "A pure-Python implementation of Python 2.7's xrange
built-in, with
    some features backported from the Python 3.x range built-in (which
    replaced xrange) in that version."

    Read more at
        https://late.am/post/2012/06/18/what-the-heck-is-an-xrange
i(tabsolute_import(tPY2(tSequencetIterator(tislice(tcounttnewrangecB@s�eZdZd�Zed��Zed��Zed��Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�ZRS(s�
    Pure-Python backport of Python 3's range object.  See `the CPython
    documentation for details:
    <http://docs.python.org/py3k/library/functions.html#range>`_
   
cG@sbt|�dkr-d|dd}}}nat|�dkr^|d|dd}}}n0t|�dkr�|\}}}ntd��y*t|�t|�t|�}}}Wntk
r�td��nX|dkr�td��n-|dkrt||�}nt||�}||_||_||_|||t	|||�|_
dS(Niiiis"range() requires 1-3 int argumentssan integer is
requiredsrange() arg 3 must not be zero(tlent	TypeErrortintt
ValueErrortmintmaxt_startt_stopt_steptboolt_len(tselftargststarttstoptstep((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyt__init__*s(*
			cC@s|jS(N(R
(R((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyREscC@s|jS(N(R(R((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyRIscC@s|jS(N(R(R((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyRMscC@s=|jdkr#d|j|jfSd|j|j|jfS(Nis
range(%d,
%d)srange(%d, %d,
%d)(RR
R(R((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyt__repr__QscC@s_t|t�o^|jdko,|jknp^|j|j|jf|j|j|jfkS(Ni(t
isinstanceRRR
R(Rtother((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyt__eq__Vs"cC@s|jS(N(R(R((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyt__len__\scC@s�y||j}Wn!tk
r4td|��nXt||j�\}}|dkr�d|kos|jknr�t|�Std|��dS(s]Return
the 0-based position of integer `value` in
        the sequence this range represents.s%r is not in rangeiN(R
RR
tdivmodRRtabs(Rtvaluetdifftquotientt	remainder((s9/usr/lib/python2.7/site-packages/future/types/newrange.pytindex_s
+
cC@st||k�S(saReturn the number of ocurrences of integer `value`
        in the sequence this range
represents.(R	(RR((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyRkscC@s.y|j|�tSWntk
r)tSXdS(s\Return ``True`` if the integer `value` occurs in
        the sequence this range represents.N(R#tTrueR
tFalse(RR((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyt__contains__qs


cC@st|ddd��S(Ni����(titer(R((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyt__reversed__zscC@stt|t�r|j|�S|dkr8|j|}n|dksS||jkrbtd��n|j||jS(s�Return
the element at position ``index`` in the sequence
        this range represents, or raise :class:`IndexError` if the
        position is out of range.isrange object index out of
range(Rtslicet_newrange__getitem_sliceRt
IndexErrorR
R(RR#((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyt__getitem__}s
c@sO�fd�|j�j�D�}|\}}}t�j|�j||�S(snReturn
a range which represents the requested slce
        of the sequence represented by this range.
       
c3@s|]}�j|VqdS(N(R(t.0tn(R(s9/usr/lib/python2.7/site-packages/future/types/newrange.pys	<genexpr>�s(tindicesRRR
(Rtslcetscaled_indiceststart_offsettstop_offsettnew_step((Rs9/usr/lib/python2.7/site-packages/future/types/newrange.pyt__getitem_slice�s
"

cC@s
t|�S(s_Return an iterator which enumerates the elements of the
        sequence this range
represents.(trange_iterator(R((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyt__iter__�s(t__name__t
__module__t__doc__RtpropertyRRRRRRR#RR&R(R,R*R7(((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyR#s										
	
R6cB@s2eZdZd�Zd�Zd�Zd�ZRS(s&An iterator for a
:class:`range`.
   
cC@s+tt|j|j�t|��|_dS(N(RRRRRt_stepper(Rtrange_((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyR�scC@s|S(N((R((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyR7�scC@s
t|j�S(N(tnextR<(R((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyt__next__�scC@s
t|j�S(N(R>R<(R((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyR>�s(R8R9R:RR7R?R>(((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyR6�s
			N(R:t
__future__Rtfuture.utilsRtcollectionsRRtcollections.abct	itertoolsRtfuture.backports.miscRt_countRR6t__all__(((s9/usr/lib/python2.7/site-packages/future/types/newrange.pyt<module>sw