MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / xrange

Class xrange

lib/utils/xrange.py:10–104  ·  view source on GitHub ↗

Advanced (re)implementation of xrange (supports slice/copy/etc.) Reference: http://code.activestate.com/recipes/521885-a-pythonic-implementation-of-xrange/ >>> list(xrange(1, 9)) == list(range(1, 9)) True >>> list(xrange(8, 0, -16)) == list(range(8, 0, -16)) True >>> li

Source from the content-addressed store, hash-verified

8import numbers
9
10class xrange(object):
11 """
12 Advanced (re)implementation of xrange (supports slice/copy/etc.)
13 Reference: http://code.activestate.com/recipes/521885-a-pythonic-implementation-of-xrange/
14
15 >>> list(xrange(1, 9)) == list(range(1, 9))
16 True
17 >>> list(xrange(8, 0, -16)) == list(range(8, 0, -16))
18 True
19 >>> list(xrange(0, 8, 16)) == list(range(0, 8, 16))
20 True
21 >>> list(xrange(0, 4, 5)) == list(range(0, 4, 5))
22 True
23 >>> list(xrange(4, 0, 3)) == list(range(4, 0, 3))
24 True
25 >>> list(xrange(0, -3)) == list(range(0, -3))
26 True
27 >>> list(xrange(0, 7, 2)) == list(range(0, 7, 2))
28 True
29 >>> foobar = xrange(1, 10)
30 >>> 7 in foobar
31 True
32 >>> 11 in foobar
33 False
34 >>> foobar[0]
35 1
36 """
37
38 __slots__ = ['_slice']
39
40 def __init__(self, *args):
41 if args and isinstance(args[0], type(self)):
42 self._slice = slice(args[0].start, args[0].stop, args[0].step)
43 else:
44 self._slice = slice(*args)
45 if self._slice.stop is None:
46 raise TypeError("xrange stop must not be None")
47
48 @property
49 def start(self):
50 if self._slice.start is not None:
51 return self._slice.start
52 return 0
53
54 @property
55 def stop(self):
56 return self._slice.stop
57
58 @property
59 def step(self):
60 if self._slice.step is not None:
61 return self._slice.step
62 return 1
63
64 def __hash__(self):
65 return hash(self._slice)
66
67 def __repr__(self):

Callers 15

getCharFunction · 0.90
blindThreadFunction · 0.90
mainFunction · 0.85
__setitem__Method · 0.85
__eq__Method · 0.85
_popToTagMethod · 0.85
_smartPopMethod · 0.85
start_metaMethod · 0.85
_ebcdic_to_asciiMethod · 0.85
addheaderMethod · 0.85
_ParseFileExFunction · 0.85
add_to_formMethod · 0.85

Calls

no outgoing calls

Tested by 2

_findUnionCharCountFunction · 0.68
_unionPositionFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…