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

Method read_directory

recipes/Python/492211_dal3py/recipe-492211.py:91–112  ·  view source on GitHub ↗
(self, block)

Source from the content-addressed store, hash-verified

89
90 # Read A Directory
91 def read_directory(self, block):
92 assert type(block) is int and 1 <= block <= self.__blocks
93 status = self.__disk.status(block)
94 assert self.STATUS.d1 <= status <= self.STATUS.dZ
95 if status == self.STATUS.d1:
96 temp = self.__disk.read(block)
97 size = (ord(temp[0]) << 8) + ord(temp[1])
98 return temp[2:size+2]
99 else:
100 while self.__disk.status(block) != self.STATUS.dA:
101 temp = self.__disk.read(block)
102 block = (ord(temp[0]) << 8) + ord(temp[1])
103 temp = self.__disk.read(block)
104 size = (ord(temp[0]) << 8) + ord(temp[1])
105 data = temp[2:-2]
106 block = (ord(temp[-2]) << 8) + ord(temp[-1])
107 while self.__disk.status(block) == self.STATUS.dB:
108 temp = self.__disk.read(block)
109 data += temp[2:-2]
110 block = (ord(temp[-2]) << 8) + ord(temp[-1])
111 temp = self.__disk.read(block)
112 return data + temp[2:size-len(data)+2]
113
114 # Write A Directory
115 def write_directory(self, block, data):

Callers 8

make_directoryMethod · 0.80
remove_directoryMethod · 0.80
make_fileMethod · 0.80
remove_fileMethod · 0.80
list_directoryMethod · 0.80
emptyMethod · 0.80
nameMethod · 0.80
renameMethod · 0.80

Calls 2

statusMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected