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

Class BigArray

lib/core/bigarray.py:65–315  ·  view source on GitHub ↗

List-like class used for storing large amounts of data (disk cached) >>> _ = BigArray(xrange(100000), chunk_size=500 * 1024) >>> _[20] = 0 >>> _[-1] = 999 >>> _[99999] 999 >>> _[100000] Traceback (most recent call last): ... IndexError: BigArray index out of

Source from the content-addressed store, hash-verified

63 self.dirty = dirty
64
65class BigArray(list):
66 """
67 List-like class used for storing large amounts of data (disk cached)
68
69 >>> _ = BigArray(xrange(100000), chunk_size=500 * 1024)
70 >>> _[20] = 0
71 >>> _[-1] = 999
72 >>> _[99999]
73 999
74 >>> _[100000]
75 Traceback (most recent call last):
76 ...
77 IndexError: BigArray index out of range
78 >>> _ += [0]
79 >>> sum(_)
80 4999850980
81 >>> _[len(_) // 2] = 17
82 >>> sum(_)
83 4999800997
84 >>> _[100000]
85 0
86 >>> _[0] = [None]
87 >>> _.index(0)
88 20
89 >>> import pickle; __ = pickle.loads(pickle.dumps(_))
90 >>> __.append(1)
91 >>> len(_)
92 100001
93 >>> _ = __
94 >>> _[-1]
95 1
96 >>> len([_ for _ in BigArray(xrange(100000))])
97 100000
98 """
99
100 def __init__(self, items=None, chunk_size=BIGARRAY_CHUNK_SIZE):
101 self.chunks = [[]]
102 self.chunk_length = sys.maxsize
103 self.cache = None
104 self.filenames = set()
105 self._lock = threading.Lock()
106 self._os_remove = os.remove
107 self._size_counter = 0
108 self._chunk_size = chunk_size
109
110 for item in (items or []):
111 self.append(item)
112
113 def __add__(self, value):
114 retval = BigArray(self)
115
116 for _ in value:
117 retval.append(_)
118
119 return retval
120
121 def __iadd__(self, value):
122 for _ in value:

Callers 8

pivotDumpTableFunction · 0.90
__init__Method · 0.90
_goInferenceProxyFunction · 0.90
parseUnionPageFunction · 0.90
unionUseFunction · 0.90
errorUseFunction · 0.90
dumpTableMethod · 0.90
__add__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…