From af81a109eb3f90b115addbbec202222bf2ba4ca9 Mon Sep 17 00:00:00 2001 From: Sourcery AI <> Date: Tue, 27 Sep 2022 13:18:23 +0000 Subject: [PATCH] 'Refactored by Sourcery' --- audioman/files/restructure.py | 9 +++++++-- audioman/fingerprint/api.py | 6 ++---- audioman/locator/audio_file_locator.py | 6 ++---- test.py | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/audioman/files/restructure.py b/audioman/files/restructure.py index fd49973..6776ce2 100644 --- a/audioman/files/restructure.py +++ b/audioman/files/restructure.py @@ -15,8 +15,13 @@ def __init__(self, root: str, struct: Structure): def move(self, file: str, meta: Metadata): self.meta = meta self.__create_dir_structure() - shutil.move(file, os.path.join( - self.root, self.__create_file_name_structure() + "." + file.split(".")[-1])) + shutil.move( + file, + os.path.join( + self.root, + f"{self.__create_file_name_structure()}." + file.split(".")[-1], + ), + ) def __create_dir_structure(self): dir_path = self.struct.folder_struct.human_readable().lower().replace( diff --git a/audioman/fingerprint/api.py b/audioman/fingerprint/api.py index 3f55255..bdf36a2 100644 --- a/audioman/fingerprint/api.py +++ b/audioman/fingerprint/api.py @@ -18,10 +18,8 @@ def get_api_key() -> str: """ url = 'https://acoustid.org/webservice' html = requests.get(url) - match = re.search(table_pattern, html.text) - if match: - match = re.search(id_section_pattern, match.group()) - if match: + if match := re.search(table_pattern, html.text): + if match := re.search(id_section_pattern, match.group()): return match.group().replace("