Remove unused Python variables in torch/[_-a]* (#133492)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/133492
Approved by: https://github.com/albanD
This commit is contained in:
Tom Ritchford
2024-12-10 16:40:26 +00:00
committed by PyTorch MergeBot
parent 2268319596
commit fda975a7b3
143 changed files with 275 additions and 457 deletions

View File

@ -438,8 +438,7 @@ def write(
# hashes just because the content begins/ends with different number of
# spaces.
key: str = get_hash(content.strip(), extra, hash_type)
basename, subdir, path = get_path(key, extension, specified_dir)
encode_utf_8: bool = hash_type == "code"
basename, _subdir, path = get_path(key, extension, specified_dir)
if not os.path.exists(path):
write_atomic(path, content, make_dirs=True)
return basename, path
@ -472,7 +471,7 @@ def write_atomic(
f.write(content)
try:
tmp_path.rename(target=path)
except FileExistsError as e_file_exist:
except FileExistsError:
if not _IS_WINDOWS:
raise
# On Windows file exist is expected: https://docs.python.org/3/library/pathlib.html#pathlib.Path.rename