diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 0000000..64b8f50 --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1 @@ +# Testing GitHub Actions diff --git a/rmagent/agent/formatters.py b/rmagent/agent/formatters.py index d2b88cc..783379f 100644 --- a/rmagent/agent/formatters.py +++ b/rmagent/agent/formatters.py @@ -8,7 +8,6 @@ from __future__ import annotations from rmagent.rmlib.parsers.date_parser import parse_rm_date -from rmagent.rmlib.queries import QueryService class GenealogyFormatters: diff --git a/rmagent/cli/commands/search.py b/rmagent/cli/commands/search.py index 06d371f..b6e22e2 100644 --- a/rmagent/cli/commands/search.py +++ b/rmagent/cli/commands/search.py @@ -1,6 +1,7 @@ """Search command - Search database by name or place.""" import re + import click from rich.console import Console from rich.table import Table diff --git a/rmagent/cli/main.py b/rmagent/cli/main.py index e72045e..e0691a3 100644 --- a/rmagent/cli/main.py +++ b/rmagent/cli/main.py @@ -154,7 +154,6 @@ def completion(shell: str): # For fish rmagent completion fish """ - shell_upper = shell.upper() prog_name = "rmagent" if shell == "zsh": diff --git a/rmagent/generators/biography.py b/rmagent/generators/biography.py index 50b1913..7793dee 100644 --- a/rmagent/generators/biography.py +++ b/rmagent/generators/biography.py @@ -8,11 +8,11 @@ from __future__ import annotations +import time from dataclasses import dataclass, field -from datetime import datetime, timezone +from datetime import UTC, datetime from enum import Enum from pathlib import Path -import time from rmagent.agent.genealogy_agent import GenealogyAgent from rmagent.rmlib.database import RMDatabase @@ -141,7 +141,7 @@ class Biography: sources: str # Metadata - generated_at: datetime = field(default_factory=lambda: datetime.now(timezone.utc).astimezone()) + generated_at: datetime = field(default_factory=lambda: datetime.now(UTC).astimezone()) word_count: int = 0 privacy_applied: bool = False birth_year: int | None = None @@ -1436,7 +1436,6 @@ def _generate_bibliography_from_fields(self, citation: dict) -> str: First checks for pre-formatted Bibliography field, then constructs from individual fields. Returns source name with WARNING only if all approaches fail. """ - source_id = _get_row_value(citation, "SourceID", 0) source_name = _get_row_value(citation, "SourceName", "[Unknown Source]") fields_blob = _get_row_value(citation, "SourceFields") diff --git a/rmagent/generators/biography/citations.py b/rmagent/generators/biography/citations.py index 3d1eb28..7b0e004 100644 --- a/rmagent/generators/biography/citations.py +++ b/rmagent/generators/biography/citations.py @@ -162,7 +162,6 @@ def _generate_bibliography_from_fields(self, citation: dict) -> str: First checks for pre-formatted Bibliography field, then constructs from individual fields. Returns source name with WARNING only if all approaches fail. """ - source_id = get_row_value(citation, "SourceID", 0) source_name = get_row_value(citation, "SourceName", "[Unknown Source]") fields_blob = get_row_value(citation, "SourceFields") diff --git a/rmagent/generators/biography/generator.py b/rmagent/generators/biography/generator.py index 10905cf..113fbde 100644 --- a/rmagent/generators/biography/generator.py +++ b/rmagent/generators/biography/generator.py @@ -6,9 +6,9 @@ from __future__ import annotations +import time from datetime import datetime from pathlib import Path -import time from rmagent.agent.genealogy_agent import GenealogyAgent from rmagent.rmlib.database import RMDatabase @@ -18,6 +18,7 @@ from rmagent.rmlib.parsers.place_parser import format_place_medium, format_place_short from rmagent.rmlib.queries import QueryService +from .citations import CitationProcessor from .models import ( Biography, BiographyLength, @@ -27,7 +28,6 @@ PersonContext, get_row_value, ) -from .citations import CitationProcessor from .templates import BiographyTemplates diff --git a/rmagent/generators/biography/models.py b/rmagent/generators/biography/models.py index f164435..19fa9ff 100644 --- a/rmagent/generators/biography/models.py +++ b/rmagent/generators/biography/models.py @@ -7,8 +7,9 @@ from __future__ import annotations from dataclasses import dataclass, field -from datetime import datetime, timezone +from datetime import UTC, datetime from enum import Enum +from pathlib import Path class BiographyLength(str, Enum): @@ -129,7 +130,7 @@ class Biography: sources: str # Metadata - generated_at: datetime = field(default_factory=lambda: datetime.now(timezone.utc).astimezone()) + generated_at: datetime = field(default_factory=lambda: datetime.now(UTC).astimezone()) word_count: int = 0 privacy_applied: bool = False birth_year: int | None = None @@ -138,7 +139,7 @@ class Biography: citation_count: int = 0 source_count: int = 0 media_files: list[dict] = field(default_factory=list) # Media files for images - media_root_directory: "Path | None" = None # Root directory for media files (replaces ? in MediaPath) + media_root_directory: Path | None = None # Root directory for media files (replaces ? in MediaPath) def calculate_word_count(self) -> int: """ diff --git a/rmagent/generators/biography/templates.py b/rmagent/generators/biography/templates.py index cbdf0e9..f90eec1 100644 --- a/rmagent/generators/biography/templates.py +++ b/rmagent/generators/biography/templates.py @@ -6,10 +6,11 @@ from __future__ import annotations -from .models import PersonContext, get_row_value from rmagent.rmlib.parsers.date_parser import is_unknown_date, parse_rm_date from rmagent.rmlib.parsers.name_parser import format_full_name +from .models import PersonContext, get_row_value + class BiographyTemplates: """Generates biography sections using templates (no AI).""" diff --git a/rmagent/rmlib/quality.py b/rmagent/rmlib/quality.py index 7af0057..3383ccf 100644 --- a/rmagent/rmlib/quality.py +++ b/rmagent/rmlib/quality.py @@ -20,7 +20,7 @@ parse_source_fields, parse_template_field_defs, ) -from .parsers.date_parser import UNKNOWN_SORT_DATE, parse_rm_date +from .parsers.date_parser import UNKNOWN_SORT_DATE # Numeric constants YEAR_SECONDS = 31557600 diff --git a/rmagent/rmlib/queries.py b/rmagent/rmlib/queries.py index 991923d..2be707d 100644 --- a/rmagent/rmlib/queries.py +++ b/rmagent/rmlib/queries.py @@ -562,7 +562,7 @@ def _haversine_distance(lat1: float, lon1: float, lat2: float, lon2: float) -> f import math # Earth radius in kilometers - R = 6371.0 + earth_radius_km = 6371.0 # Convert degrees to radians lat1_rad = math.radians(lat1) @@ -577,5 +577,5 @@ def _haversine_distance(lat1: float, lon1: float, lat2: float, lon2: float) -> f ) c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a)) - distance = R * c + distance = earth_radius_km * c return distance diff --git a/tests/unit/test_quality.py b/tests/unit/test_quality.py index d9a3b69..d3b4c53 100644 --- a/tests/unit/test_quality.py +++ b/tests/unit/test_quality.py @@ -7,11 +7,8 @@ from __future__ import annotations -from collections.abc import Iterable from pathlib import Path -import pytest - # Ensure repository root is available on sys.path when running with pytest -o addopts='' PROJECT_ROOT = Path(__file__).resolve().parents[2] import sys