def extract_hashs(self, metadata_rp): """Return list of hashes in the metadata_rp""" result = [] comp = metadata_rp.isinccompressed() extractor = metadata.RorpExtractor(metadata_rp.open("r", comp)) for rorp in extractor.iterate(): if rorp.has_sha1(): result.append(rorp.get_sha1()) else: result.append(None) return result
def extract_metadata(self, metadata_rp): """Return lists of hashes and hardlink counts in the metadata_rp""" hashes = [] link_counts = [] comp = metadata_rp.isinccompressed() extractor = metadata.RorpExtractor(metadata_rp.open("r", comp)) for rorp in extractor.iterate(): link_counts.append(rorp.getnumlinks()) if rorp.has_sha1(): hashes.append(rorp.get_sha1()) else: hashes.append(None) return (hashes, link_counts)