def read_directory_entries(self, file): while True: node_type = Format.read_int(file) if node_type is None: raise StopIteration node_name = Format.read_string(file) node_digest = file.read(Digest.dataDigestSize()) node_level = IntegerEncodings.binary_read_int_varlen(file) node_stat = unserialize_stats(file) try: node_name_decoded = unicode(node_name, 'utf8') yield (node_type, node_name_decoded, node_stat, node_digest, node_level) except: logging.info("Encountered bad file name in " + self.path())
def unserialize_stats(file): stats = {} for mode in STAT_PRESERVED_MODES: stats[mode] = Format.read_int(file) return stats