mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-12-22 10:40:44 -06:00
refactor: remove unnecessary hashlib calls
This commit is contained in:
parent
44c8beac51
commit
a4b81d17ce
1 changed files with 4 additions and 8 deletions
|
@ -52,7 +52,7 @@ from typing import (
|
||||||
Union,
|
Union,
|
||||||
)
|
)
|
||||||
|
|
||||||
__version__ = "23.8b2-13-g0136568-dev"
|
__version__ = "23.8b2-14-g44c8bea-dev"
|
||||||
|
|
||||||
|
|
||||||
class Spinner:
|
class Spinner:
|
||||||
|
@ -842,14 +842,11 @@ def get_hash(spec: Tuple[str, ...] | List[str], track_exe: bool = False) -> str:
|
||||||
sha256 representation of dependencies for vivenv
|
sha256 representation of dependencies for vivenv
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sha256 = hashlib.sha256()
|
return hashlib.sha256(
|
||||||
sha256.update(
|
|
||||||
(
|
(
|
||||||
str(spec) + (str(Path(sys.executable).resolve()) if track_exe else "N/A")
|
str(spec) + (str(Path(sys.executable).resolve()) if track_exe else "N/A")
|
||||||
).encode()
|
).encode()
|
||||||
)
|
).hexdigest()
|
||||||
|
|
||||||
return sha256.hexdigest()
|
|
||||||
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -1220,8 +1217,7 @@ def fetch_source(reference: str) -> str:
|
||||||
+ "/src/viv/viv.py"
|
+ "/src/viv/viv.py"
|
||||||
)
|
)
|
||||||
|
|
||||||
(hash := hashlib.sha256()).update(src.encode())
|
sha256 = hashlib.sha256(src.encode()).hexdigest()
|
||||||
sha256 = hash.hexdigest()
|
|
||||||
|
|
||||||
cached_src_file = Cfg().cache_src / f"{sha256}.py"
|
cached_src_file = Cfg().cache_src / f"{sha256}.py"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue