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

Method empty

recipes/Python/492212_dal4py/recipe-492212.py:186–199  ·  view source on GitHub ↗
(self, block)

Source from the content-addressed store, hash-verified

184
185 # Check If Empty
186 def empty(self, block):
187 assert type(block) is int and 1 <= block <= self.__blocks
188 status = self.status(block)
189 assert status == self.STATUS.directory or status == self.STATUS.file
190 if status == self.STATUS.directory:
191 data = self.__disk.read_directory(block)
192 else:
193 data = self.__disk.read_file(block)
194 size = ord(data[2])
195 data = data[3+size:]
196 if status == self.STATUS.directory:
197 return not bool(data)
198 else:
199 return len(data) == 4
200
201 # Looks For Name
202 def find(self, block, name):

Callers 6

remove_directoryMethod · 0.95
consumerFunction · 0.45
printerFunction · 0.45
recipe-284631.pyFile · 0.45
consumeFunction · 0.45
recipe-578461.javaFile · 0.45

Calls 3

statusMethod · 0.95
read_directoryMethod · 0.80
read_fileMethod · 0.45

Tested by

no test coverage detected