ci: fix mypy and ruff tests

This commit is contained in:
Travis Abendshien
2024-12-08 15:26:51 -08:00
committed by Travis Abendshien
parent ab59fc4a50
commit f431cf7a6b
3 changed files with 7 additions and 30 deletions

View File

@@ -20,7 +20,6 @@ from PySide6.QtWidgets import (
)
from src.core.constants import TAG_ARCHIVED, TAG_FAVORITE
from src.core.library import Library, Tag
from src.core.library.alchemy.fields import _FieldID
from src.core.palette import ColorType, get_tag_color
from src.qt.flowlayout import FlowLayout
from src.qt.translations import Translations
@@ -73,7 +72,7 @@ def folders_to_tags(library: Library):
tag = add_folders_to_tree(library, tree, folders).tag
if tag and not entry.has_tag(tag):
library.add_field_tag(entry, tag, _FieldID.TAGS.name, create_field=True)
library.add_tags_to_entry(entry.id, tag.id)
logger.info("Done")
@@ -127,11 +126,10 @@ def generate_preview_data(library: Library) -> BranchData:
branch = _add_folders_to_tree(folders)
if branch:
has_tag = False
for tag_field in entry.tag_box_fields:
for tag in tag_field.tags:
if tag.name == branch.tag.name:
has_tag = True
break
for tag in entry.tags:
if tag.name == branch.tag.name:
has_tag = True
break
if not has_tag:
branch.files.append(entry.path.name)

View File

@@ -14,7 +14,6 @@ from PySide6.QtCore import (
Signal,
)
from src.core.library import Library
from src.core.library.alchemy.fields import _FieldID
from src.core.media_types import MediaCategories
from src.qt.helpers.file_tester import is_readable_video
@@ -43,27 +42,7 @@ class CollageIconRenderer(QObject):
try:
if data_tint_mode or data_only_mode:
if entry.fields:
has_any_tags: bool = False
has_content_tags: bool = False
has_meta_tags: bool = False
for field in entry.tag_box_fields:
if field.tags:
has_any_tags = True
if field.type_key == _FieldID.TAGS_CONTENT.name:
has_content_tags = True
elif field.type_key == _FieldID.TAGS_META.name:
has_meta_tags = True
if has_content_tags and has_meta_tags:
color = "#28bb48" # Green
elif has_any_tags:
color = "#ffd63d" # Yellow
# color = '#95e345' # Yellow-Green
else:
# color = '#fa9a2c' # Yellow-Orange
color = "#ed8022" # Orange
else:
color = "#e22c3c" # Red
color = "#28bb48" if entry.tags else "#e22c3c"
if data_only_mode:
pic = Image.new("RGB", size, color)

View File

@@ -76,7 +76,7 @@ def library(request):
color=TagColor.YELLOW,
)
tag2 = Tag(
Tag(
name="bar",
color=TagColor.BLUE,
subtags={subtag},