MCPcopy Create free account
hub / github.com/ActiveState/code / __init__

Method __init__

recipes/Python/492210_dal2py/recipe-492210.py:13–23  ·  view source on GitHub ↗
(self, blocks, size)

Source from the content-addressed store, hash-verified

11
12 # Disk Abstraction Layer
13 def __init__(self, blocks, size):
14 assert type(blocks) is int and 1 <= blocks <= self.MAX_BLOCKS
15 assert type(size) is int and 1 <= size <= self.MAX_SIZE
16 blocks = int(ceil(float(blocks * (size + 1)) / size))
17 assert blocks <= self.MAX_SIZE
18 DAL1.BLOCKS = blocks
19 DAL1.SIZE = size
20 self.__disk = DAL1()
21 self.__blocks = (blocks * size) / (size + 1)
22 self.__index = (blocks - self.__blocks) * size
23 self.__BIT = [0 for index in range(self.__blocks)]
24
25 # Open A Block
26 def open(self, status):

Callers

nothing calls this directly

Calls 2

DAL1Class · 0.85
rangeFunction · 0.85

Tested by

no test coverage detected