mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-01-31 07:10:45 +00:00
Ruff format
This commit is contained in:
@@ -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",
|
||||
]
|
||||
]
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import os
|
||||
|
||||
from src.core.library import Entry, Library
|
||||
|
||||
|
||||
class TagStudioCore:
|
||||
"""
|
||||
Instantiate this to establish a TagStudio session.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user