From 886494757538ff9ce39d8fb20723020c884537dc Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Sun, 12 Dec 2021 10:12:58 +0100 Subject: [PATCH] renamed that function again to make it even more clear what it does --- filetags.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/filetags.py b/filetags.py index c06dde0..eac2ebc 100644 --- a/filetags.py +++ b/filetags.py @@ -126,7 +126,7 @@ def get_hashes_by_tag(storage_directory, tag): return file_hashes -def file_hash_or_path_is_hash(storage_directory, file_hash_or_path, compress): +def file_hash_or_path_is_known_hash(storage_directory, file_hash_or_path, compress): suffix="" if compress: suffix=".xz" @@ -301,19 +301,19 @@ if __name__ == "__main__": hash_allowed=True if 'file' in command: hash_allowed=False - if not any([hash_allowed and file_hash_or_path_is_hash(storage_directory, file_hash_or_path, compress), os.path.isfile(file_hash_or_path)]): + if not any([hash_allowed and file_hash_or_path_is_known_hash(storage_directory, file_hash_or_path, compress), os.path.isfile(file_hash_or_path)]): print("Unknown file!", file=sys.stderr) print(USAGE, file=sys.stderr) sys.exit(PATH_ERROR) tags = sys.argv[4:] - if hash_allowed and file_hash_or_path_is_hash(storage_directory, file_hash_or_path, compress): + if hash_allowed and file_hash_or_path_is_known_hash(storage_directory, file_hash_or_path, compress): file_hash = file_hash_or_path print("Hash for file in storage: "+file_hash) else: file_hash = calculate_file_hash(checksum_algorithm, file_hash_or_path) - if file_hash_or_path_is_hash(storage_directory, file_hash, compress): + if file_hash_or_path_is_known_hash(storage_directory, file_hash, compress): print("File already in storage.") #this assumes that the storage directory has not been tampered with or corrupted, FIXME! if 'move' in command: @@ -367,7 +367,7 @@ if __name__ == "__main__": file_tags_or_hash = sys.argv[3:] if not 'tags' in command: - if file_hash_or_path_is_hash(storage_directory, file_tags_or_hash[0], compress): + if file_hash_or_path_is_known_hash(storage_directory, file_tags_or_hash[0], compress): tags = get_tags_by_hash(storage_directory, file_tags_or_hash[0]) print("Tags for file:") print(tags)