MCPcopy Create free account
hub / github.com/tox-dev/filelock / host_digest

Function host_digest

tests/sqlite/link_support.py:20–28  ·  view source on GitHub ↗
(shared_database: Path, *, legacy: bool = False)

Source from the content-addressed store, hash-verified

18
19
20def host_digest(shared_database: Path, *, legacy: bool = False) -> str:
21 if legacy: # pragma: linux cover
22 return hashlib.sha256(host_name().encode()).hexdigest()[:16]
23 # Taken from a link of another database, so the sweep for this one has not run yet.
24 seed: Final[Path] = shared_database.parent.with_name("seed")
25 seed.mkdir(mode=0o777)
26 seed.chmod(0o777)
27 with ReadWriteLock(seed / "lock.db", is_singleton=False).read_lock():
28 return next(seed.glob(".filelock-*")).name.rsplit("-", 2)[1]
29
30
31__all__ = [

Calls 4

host_nameFunction · 0.90
ReadWriteLockClass · 0.90
encodeMethod · 0.80
read_lockMethod · 0.45