mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-06-17 04:46:46 +00:00
Compare commits
3 Commits
translatio
...
bump-ruff
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ea33d1ac0 | ||
|
|
6f3c66efd9 | ||
|
|
2c85c082b7 |
41
.gitignore
vendored
41
.gitignore
vendored
@@ -7,10 +7,10 @@ __pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
# C Extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
# Distribution / Packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
@@ -41,7 +41,7 @@ MANIFEST
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
# Unit test / Coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
@@ -88,6 +88,8 @@ profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
.python-version
|
||||
|
||||
# pipenv
|
||||
@@ -95,14 +97,21 @@ ipython_config.py
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
poetry.lock
|
||||
poetry.toml
|
||||
|
||||
# uv
|
||||
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
uv.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
@@ -111,6 +120,8 @@ ipython_config.py
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
.pdm-python
|
||||
.pdm-build/
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
@@ -138,8 +149,24 @@ venv.bak/
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# macoS
|
||||
*.DS_Store
|
||||
# macOS
|
||||
.DocumentRevisions-V100
|
||||
.DS_Store
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
|
||||
# Linux
|
||||
.directory
|
||||
.fuse_hidden*
|
||||
.nfs*
|
||||
.Trash-*
|
||||
|
||||
# Windows
|
||||
[Dd]esktop.ini
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
@@ -54,7 +54,7 @@ pytest = [
|
||||
"pytest-qt==4.4.0",
|
||||
"syrupy==5.1.0",
|
||||
]
|
||||
ruff = ["ruff==0.11.8"]
|
||||
ruff = ["ruff==0.15.17"]
|
||||
|
||||
[project.gui-scripts]
|
||||
tagstudio = "tagstudio.main:main"
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
import enum
|
||||
|
||||
|
||||
class SettingItems(str, enum.Enum):
|
||||
class SettingItems(enum.StrEnum):
|
||||
"""List of setting item names."""
|
||||
|
||||
LAST_LIBRARY = "last_library"
|
||||
LIBS_LIST = "libs_list"
|
||||
|
||||
|
||||
class ShowFilepathOption(int, enum.Enum):
|
||||
class ShowFilepathOption(enum.IntEnum):
|
||||
"""Values representing the options for the "show_filenames" setting."""
|
||||
|
||||
SHOW_FULL_PATHS = 0
|
||||
@@ -21,7 +21,7 @@ class ShowFilepathOption(int, enum.Enum):
|
||||
DEFAULT = SHOW_RELATIVE_PATHS
|
||||
|
||||
|
||||
class TagClickActionOption(int, enum.Enum):
|
||||
class TagClickActionOption(enum.IntEnum):
|
||||
"""Values representing the options for the "tag_click_action" setting."""
|
||||
|
||||
OPEN_EDIT = 0
|
||||
@@ -30,7 +30,7 @@ class TagClickActionOption(int, enum.Enum):
|
||||
DEFAULT = OPEN_EDIT
|
||||
|
||||
|
||||
class Theme(str, enum.Enum):
|
||||
class Theme(enum.StrEnum):
|
||||
COLOR_BG_DARK = "#65000000"
|
||||
COLOR_BG_LIGHT = "#22000000"
|
||||
COLOR_DARK_LABEL = "#DD000000"
|
||||
@@ -49,7 +49,7 @@ class OpenStatus(enum.IntEnum):
|
||||
CORRUPTED = 2
|
||||
|
||||
|
||||
class MacroID(enum.Enum):
|
||||
class MacroID(enum.StrEnum):
|
||||
AUTOFILL = "autofill"
|
||||
SIDECAR = "sidecar"
|
||||
BUILD_URL = "build_url"
|
||||
|
||||
@@ -4,14 +4,12 @@
|
||||
|
||||
from collections.abc import Iterator
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
|
||||
import structlog
|
||||
|
||||
from tagstudio.core.library.alchemy.library import Library
|
||||
from tagstudio.core.library.alchemy.models import Entry
|
||||
from tagstudio.core.library.ignore import Ignore
|
||||
from tagstudio.core.utils.types import unwrap
|
||||
|
||||
logger = structlog.get_logger(__name__)
|
||||
|
||||
@@ -35,13 +33,12 @@ class IgnoredRegistry:
|
||||
logger.info("[IgnoredRegistry] Refreshing ignored entries...")
|
||||
|
||||
self.ignored_entries = []
|
||||
library_dir: Path = unwrap(self.lib.library_dir)
|
||||
|
||||
for i, entry in enumerate(self.lib.all_entries()):
|
||||
if not Ignore.compiled_patterns:
|
||||
# If the compiled_patterns has malfunctioned, don't consider that a false positive
|
||||
yield i
|
||||
elif Ignore.compiled_patterns.match(library_dir / entry.path):
|
||||
elif Ignore.compiled_patterns.match(entry.path):
|
||||
self.ignored_entries.append(entry)
|
||||
yield i
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
|
||||
import enum
|
||||
import mimetypes
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
|
||||
import structlog
|
||||
@@ -23,7 +23,7 @@ FILETYPE_EQUIVALENTS = [
|
||||
]
|
||||
|
||||
|
||||
class MediaType(str, Enum):
|
||||
class MediaType(enum.StrEnum):
|
||||
"""Names of media types."""
|
||||
|
||||
ADOBE_PHOTOSHOP = "adobe_photoshop"
|
||||
|
||||
@@ -24,7 +24,7 @@ class ConstraintType(Enum):
|
||||
"filetype": ConstraintType.FileType,
|
||||
"path": ConstraintType.Path,
|
||||
"special": ConstraintType.Special,
|
||||
}.get(text.lower(), None)
|
||||
}.get(text.lower())
|
||||
|
||||
|
||||
class AST:
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
|
||||
from typing import TypeVar
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
def unwrap(optional: T | None, default: T | None = None) -> T:
|
||||
def unwrap[T](optional: T | None, default: T | None = None) -> T:
|
||||
if optional is not None:
|
||||
return optional
|
||||
if default is not None:
|
||||
|
||||
@@ -447,7 +447,7 @@ class FieldContainers(QWidget):
|
||||
inner_widget.set_tags(tags)
|
||||
|
||||
inner_widget.on_update.connect(
|
||||
lambda: (self.update_from_entry(self.cached_entries[0].id, update_badges=True))
|
||||
lambda: self.update_from_entry(self.cached_entries[0].id, update_badges=True)
|
||||
)
|
||||
else:
|
||||
text = "<i>Mixed Data</i>"
|
||||
|
||||
@@ -366,8 +366,8 @@ class QtDriver(DriverMixin, QObject):
|
||||
self.tag_manager_panel = PanelModal(
|
||||
widget=TagDatabasePanel(self, self.lib),
|
||||
title=Translations["tag_manager.title"],
|
||||
done_callback=lambda checked=False: (
|
||||
self.main_window.preview_panel.set_selection(self.selected, update_preview=False)
|
||||
done_callback=lambda checked=False: self.main_window.preview_panel.set_selection(
|
||||
self.selected, update_preview=False
|
||||
),
|
||||
has_save=False,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user