From b6848bb81f6483b9c3707f49ce5b28c80befdbb2 Mon Sep 17 00:00:00 2001 From: Hidorikun Date: Wed, 8 May 2024 17:32:15 +0300 Subject: [PATCH] Ruff format --- tagstudio/src/core/constants.py | 3 +-- tagstudio/src/core/library.py | 20 ++++++++++---------- tagstudio/src/core/ts_core.py | 1 + tagstudio/tests/core/test_tags.py | 1 + 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/tagstudio/src/core/constants.py b/tagstudio/src/core/constants.py index 4198e51a..b4ff6dde 100644 --- a/tagstudio/src/core/constants.py +++ b/tagstudio/src/core/constants.py @@ -1,4 +1,3 @@ - VERSION: str = "9.2.0" # Major.Minor.Patch VERSION_BRANCH: str = "Alpha" # 'Alpha', 'Beta', or '' for Full Release @@ -134,4 +133,4 @@ TAG_COLORS = [ "warm gray", "cool gray", "olive", -] \ No newline at end of file +] diff --git a/tagstudio/src/core/library.py b/tagstudio/src/core/library.py index 6d4ca7d3..c24e61c7 100644 --- a/tagstudio/src/core/library.py +++ b/tagstudio/src/core/library.py @@ -19,7 +19,13 @@ import ujson from src.core.json_typing import JsonCollation, JsonEntry, JsonLibary, JsonTag from src.core.utils.str import strip_punctuation from src.core.utils.web import strip_web_protocol -from src.core.constants import BACKUP_FOLDER_NAME, COLLAGE_FOLDER_NAME, TEXT_FIELDS, TS_FOLDER_NAME, VERSION +from src.core.constants import ( + BACKUP_FOLDER_NAME, + COLLAGE_FOLDER_NAME, + TEXT_FIELDS, + TS_FOLDER_NAME, + VERSION, +) TYPE = ["file", "meta", "alt", "mask"] @@ -502,14 +508,10 @@ class Library: if TS_FOLDER_NAME in path: path = path.split(TS_FOLDER_NAME)[0] - if os.path.exists( - os.path.normpath(f"{path}/{TS_FOLDER_NAME}/ts_library.json") - ): + if os.path.exists(os.path.normpath(f"{path}/{TS_FOLDER_NAME}/ts_library.json")): try: with open( - os.path.normpath( - f"{path}/{TS_FOLDER_NAME}/ts_library.json" - ), + os.path.normpath(f"{path}/{TS_FOLDER_NAME}/ts_library.json"), "r", encoding="utf-8", ) as f: @@ -720,9 +722,7 @@ class Library: if not os.path.exists( os.path.normpath(f"{self.library_dir}/{TS_FOLDER_NAME}") ): - os.makedirs( - os.path.normpath(f"{self.library_dir}/{TS_FOLDER_NAME}") - ) + os.makedirs(os.path.normpath(f"{self.library_dir}/{TS_FOLDER_NAME}")) self._map_filenames_to_entry_ids() diff --git a/tagstudio/src/core/ts_core.py b/tagstudio/src/core/ts_core.py index 6edab037..ca623c33 100644 --- a/tagstudio/src/core/ts_core.py +++ b/tagstudio/src/core/ts_core.py @@ -9,6 +9,7 @@ import os from src.core.library import Entry, Library + class TagStudioCore: """ Instantiate this to establish a TagStudio session. diff --git a/tagstudio/tests/core/test_tags.py b/tagstudio/tests/core/test_tags.py index 6a82215c..e8e48754 100644 --- a/tagstudio/tests/core/test_tags.py +++ b/tagstudio/tests/core/test_tags.py @@ -12,6 +12,7 @@ def test_construction(): ) assert tag + def test_empty_construction(): tag = Tag(id=1, name="", shorthand="", aliases=[], subtags_ids=[], color="") assert tag