Ruff format

This commit is contained in:
Hidorikun
2024-05-08 17:32:15 +03:00
parent fb7c73d96b
commit b6848bb81f
4 changed files with 13 additions and 12 deletions

View File

@@ -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",
]
]

View File

@@ -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()

View File

@@ -9,6 +9,7 @@ import os
from src.core.library import Entry, Library
class TagStudioCore:
"""
Instantiate this to establish a TagStudio session.

View File

@@ -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