*)Zz, dZddlmZddlmZer ddlmZmZnddlmZmZddl m Z ddl m Z e Z GddeZGd d eZdgZd S) aw 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 )absolute_import)PY2)SequenceIterator)islice)countceZdZdZdZedZedZedZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdS)newrangez Pure-Python backport of Python 3's range object. See `the CPython documentation for details: `_ cdt|dkr d|dd}}}nOt|dkr|d|dd}}}n)t|dkr|\}}}ntd t|t|t|}}}n#t$rtdwxYw|dkrtd|dkrt ||}nt ||}||_||_||_||z |zt||z |zz|_ dS)Nrz"range() requires 1-3 int argumentszan integer is requiredzrange() arg 3 must not be zero) len TypeErrorint ValueErrorminmax_start_stop_stepbool_len)selfargsstartstopsteps g/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/future/types/newrange.py__init__znewrange.__init__*sH t99>> !47A4EE YY!^^ $Qa!4EE YY!^^ $ E4@AA A 6 #E CIIs4yy4EE 6 6 6455 5 6 199=>> > AXXtU##DDtU##D   E\d*T4%<42G-H-HH s 1-BB9c|jSN)rrs rrznewrange.startEs {c|jSr")rr#s rrz newrange.stopI zr$c|jSr"rr#s rrz newrange.stepMr&r$ch|jdkrd|j|jfzSd|j|j|jfzS)Nr z range(%d, %d)zrange(%d, %d, %d))rrrr#s r__repr__znewrange.__repr__Qs9 :??"dk4:%>> >"dk4:tz%JJJr$ct|toC|jdcxko |jkncp)|j|j|jf|j|j|jfkS)Nr) isinstancer rrr)rothers r__eq__znewrange.__eq__Vsf5(++:a----5:----9+tz495, UZ89 ;r$c|jSr")rr#s r__len__znewrange.__len__\s yr$c ||jz }n #t$rtd|zwxYwt||j\}}|dkr$d|cxkr |jkrnnt |Std|z)z]Return the 0-based position of integer `value` in the sequence this range represents.z%r is not in ranger)rrrdivmodrrabs)rvaluediffquotient remainders rindexznewrange.index_s ;4;&DD ; ; ;1E9:: : ;$T4:66) >>a87777di77777x== -5666s *c$t||vS)zaReturn the number of ocurrences of integer `value` in the sequence this range represents.)rrr4s rrznewrange.countks5D=!!!r$cT ||dS#t$rYdSwxYw)z\Return ``True`` if the integer `value` occurs in the sequence this range represents.TF)r8rr:s r __contains__znewrange.__contains__qs@  JJu   4   55 s  ''c2t|dddS)N)iterr#s r __reversed__znewrange.__reversed__zsD2Jr$ct|tr||S|dkr |j|z}|dks ||jkrt d|j||jzzS)zReturn the element at position ``index`` in the sequence this range represents, or raise :class:`IndexError` if the position is out of range.rzrange object index out of range)r,slice_newrange__getitem_slicer IndexErrorrr)rr8s r __getitem__znewrange.__getitem__}sw eU # # /''.. . 199I%E 199**>?? ?{UTZ///r$cfd|jD}|\}}}tj|zj|z|S)znReturn a range which represents the requested slce of the sequence represented by this range. c3,K|]}j|zVdSr"r().0nrs r z+newrange.__getitem_slice..s)JJQ$*q.JJJJJJr$)indicesrr r)rslcescaled_indices start_offset stop_offsetnew_steps` r__getitem_sliceznewrange.__getitem_slicesaKJJJ$,,ty2I2IJJJ.<+ k8 l2 k1 "" "r$c t|S)z_Return an iterator which enumerates the elements of the sequence this range represents.)range_iteratorr#s r__iter__znewrange.__iter__sd###r$N)__name__ __module__ __qualname____doc__r propertyrrrr*r.r0r8rr<r@rErCrTr$rr r #s III6XXXKKK ;;;  7 7 7"""     0 0 0"""$$$$$r$r c*eZdZdZdZdZdZdZdS)rSz&An iterator for a :class:`range`. cztt|j|jt ||_dSr")rrrrr_stepper)rrange_s rr zrange_iterator.__init__s+uV\6;??VMM r$c|Sr"rZr#s rrTzrange_iterator.__iter__s r$c*t|jSr"nextr]r#s r__next__zrange_iterator.__next__DM"""r$c*t|jSr"rar#s rrbzrange_iterator.nextrdr$N)rUrVrWrXr rTrcrbrZr$rrSrSs]NNN########r$rSN)rX __future__r future.utilsr collectionsrrcollections.abc itertoolsrfuture.backports.miscr_countr rS__all__rZr$rrns&'&&&&&3.........22222222'''''' t$t$t$t$t$xt$t$t$n # # # # #X # # # ,r$