Skip to content

Commit 545462d

Browse files
committed
Remove unnecessary abspath hashing
1 parent 0b3c991 commit 545462d

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/pip_sync_faster/main.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ def path(self):
2323
def abspath(self):
2424
return os.path.abspath(self._path)
2525

26-
@property
27-
@lru_cache
28-
def abspath_hash(self):
29-
hash_ = hashlib.sha512()
30-
hash_.update(self.abspath.encode("utf8"))
31-
return hash_.hexdigest()
32-
3326
@property
3427
@lru_cache
3528
def contents_hash(self):
@@ -52,7 +45,7 @@ def pip_sync_maybe(src_files, args):
5245
src_files = [SrcFile(src_file) for src_file in src_files]
5346

5447
for src_file in src_files:
55-
if src_file.contents_hash != cached_hashes.get(src_file.abspath_hash):
48+
if src_file.contents_hash != cached_hashes.get(src_file.abspath):
5649
break
5750
else:
5851
# All of the source files already had matching hashes in the cache.
@@ -66,7 +59,7 @@ def pip_sync_maybe(src_files, args):
6659
sys.exit(err.returncode)
6760
else:
6861
for src_file in src_files:
69-
cached_hashes[src_file.abspath_hash] = src_file.contents_hash
62+
cached_hashes[src_file.abspath] = src_file.contents_hash
7063

7164
# pip-sync succeeded so update the cache.
7265
with open(cached_hashes_path, "w", encoding="utf8") as cached_hashes_file:

0 commit comments

Comments
 (0)