Fix more ruff issues

This commit is contained in:
2025-12-07 05:42:29 +01:00
parent 10704896f9
commit a21121d025
4 changed files with 15 additions and 18 deletions

View File

@@ -86,9 +86,9 @@ def make_tools() -> dict[str, Tool]:
Dictionary mapping tool names to Tool objects Dictionary mapping tool names to Tool objects
""" """
# Import tools here to avoid circular dependencies # Import tools here to avoid circular dependencies
from .tools import api as api_tools from .tools import api as api_tools # noqa: PLC0415
from .tools import filesystem as fs_tools from .tools import filesystem as fs_tools # noqa: PLC0415
from .tools import language as lang_tools from .tools import language as lang_tools # noqa: PLC0415
# List of all tool functions # List of all tool functions
tool_functions = [ tool_functions = [

View File

@@ -4,7 +4,8 @@ import logging
from pathlib import Path from pathlib import Path
from domain.movies.entities import Movie from domain.movies.entities import Movie
from domain.tv_shows.entities import Episode, TVShow from domain.tv_shows.entities import Episode, Season, TVShow
from domain.tv_shows.value_objects import SeasonNumber
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -74,8 +75,6 @@ class MediaOrganizer:
show_dir = self.tvshow_folder / show_folder_name show_dir = self.tvshow_folder / show_folder_name
# Create season folder # Create season folder
from domain.tv_shows.entities import Season
season = Season( season = Season(
show_imdb_id=show.imdb_id, show_imdb_id=show.imdb_id,
season_number=episode.season_number, season_number=episode.season_number,
@@ -124,9 +123,6 @@ class MediaOrganizer:
Returns: Returns:
True if successful True if successful
""" """
from domain.tv_shows.entities import Season
from domain.tv_shows.value_objects import SeasonNumber
show_folder_name = show.get_folder_name() show_folder_name = show.get_folder_name()
show_dir = self.tvshow_folder / show_folder_name show_dir = self.tvshow_folder / show_folder_name

View File

@@ -110,4 +110,8 @@ select = [
"PL", "PL",
"UP", "UP",
] ]
ignore = ["PLR0913", "PLR2004"] ignore = ["PLR0913", "PLR2004", "TID252", "E501"]
[tool.ruff.per-file-ignores]
"tests/**/*.py" = ["PLC0415"]
"conftest.py" = ["PLC0415"]

View File

@@ -187,17 +187,14 @@ class TestToolRegistry:
for expected in expected_tools: for expected in expected_tools:
assert expected in tools, f"Expected tool {expected} not registered" assert expected in tools, f"Expected tool {expected} not registered"
def test_tool_functions_return_dict(self): def test_tool_functions_are_valid(self):
"""Verify all tool functions return dictionaries.""" """Verify all tool functions are properly structured."""
tools = make_tools() tools = make_tools()
# Test with minimal valid arguments # Verify structure without calling functions
# Note: This is a smoke test, not full integration # (calling would require full setup with memory, clients, etc.)
for name, tool in tools.items(): for name, tool in tools.items():
sig = inspect.signature(tool.func) assert callable(tool.func), f"Tool {name} function is not callable"
# We can't call all tools without proper setup,
# but we can verify they're structured correctly
assert callable(tool.func)
class TestToolDataclass: class TestToolDataclass: