MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / _file_id

Method _file_id

pipcl.py:3307–3314  ·  view source on GitHub ↗
(self, path)

Source from the content-addressed store, hash-verified

3305 '''
3306 return self.get_n(1)[0]
3307 def _file_id(self, path):
3308 mtime = os.stat(path).st_mtime
3309 with open(path, 'rb') as f:
3310 content = f.read()
3311 hash_ = hashlib.md5(content).digest()
3312 # With python >= 3.11 we can do:
3313 #hash_ = hashlib.file_digest(f, hashlib.md5).digest()
3314 return mtime, hash_
3315 def _items(self):
3316 ret = dict()
3317 for path in glob.glob(self.glob_pattern):

Callers 1

_itemsMethod · 0.95

Calls 1

digestMethod · 0.80

Tested by

no test coverage detected