Skip to content

Commit 89e22ca

Browse files
committed
Don't redefine built-ins.
1 parent 1448034 commit 89e22ca

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

fsutil/info.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ def get_dir_hash(path: PathIn, *, func: str = "md5") -> str:
4040
"""
4141
path = _get_path(path)
4242
assert_dir(path)
43-
hash = hashlib.new(func)
43+
hash_ = hashlib.new(func)
4444
files = search_files(path)
4545
for file in sorted(files):
4646
file_hash = get_file_hash(file, func=func)
4747
file_hash_b = bytes(file_hash, "utf-8")
48-
hash.update(file_hash_b)
49-
hash_hex = hash.hexdigest()
48+
hash_.update(file_hash_b)
49+
hash_hex = hash_.hexdigest()
5050
return hash_hex
5151

5252

fsutil/operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def rename_file(path: PathIn, name: str) -> None:
413413
"""
414414
path = _get_path(path)
415415
assert_file(path)
416-
dirpath, filename = split_filepath(path)
416+
dirpath, _ = split_filepath(path)
417417
dest = join_filepath(dirpath, name)
418418
assert_not_exists(dest)
419419
os.rename(path, dest)

tests/test_info.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def test_get_dir_hash(temp_path):
5050
fsutil.create_file(f4_path, content="hello world 4")
5151
fsutil.create_file(f5_path, content="hello world 5")
5252
fsutil.create_file(f6_path, content="hello world 6")
53-
hash = fsutil.get_dir_hash(temp_path("x/"))
54-
assert hash == "eabe619c41f0c4611b7b9746bededfcb"
53+
dir_hash = fsutil.get_dir_hash(temp_path("x/"))
54+
assert dir_hash == "eabe619c41f0c4611b7b9746bededfcb"
5555

5656

5757
def test_get_dir_last_modified_date(temp_path):
@@ -123,8 +123,8 @@ def test_get_file_creation_date_formatted(temp_path):
123123
def test_get_file_hash(temp_path):
124124
path = temp_path("a/b/c.txt")
125125
fsutil.create_file(path, content="Hello World")
126-
hash = fsutil.get_file_hash(path)
127-
assert hash == "b10a8db164e0754105b7a99be72e3fe5"
126+
file_hash = fsutil.get_file_hash(path)
127+
assert file_hash == "b10a8db164e0754105b7a99be72e3fe5"
128128

129129

130130
def test_get_file_last_modified_date(temp_path):

0 commit comments

Comments
 (0)