MCPcopy
hub / github.com/borgbackup/borg / __init__

Method __init__

src/borg/helpers/datastruct.py:19–28  ·  view source on GitHub ↗

Initialize the buffer by using allocator(size) to allocate a buffer. Optionally, set an upper limit for the buffer size.

(self, allocator, size=4096, limit=None)

Source from the content-addressed store, hash-verified

17 """Requested buffer size {} is above the limit of {}."""
18
19 def __init__(self, allocator, size=4096, limit=None):
20 """
21 Initialize the buffer by using allocator(size) to allocate a buffer.
22 Optionally, set an upper limit for the buffer size.
23 """
24 assert callable(allocator), "must give alloc(size) function as first param"
25 assert limit is None or size <= limit, "initial size must be <= limit"
26 self.allocator = allocator
27 self.limit = limit
28 self.resize(size, init=True)
29
30 def __len__(self):
31 return len(self.buffer)

Callers

nothing calls this directly

Calls 1

resizeMethod · 0.95

Tested by

no test coverage detected