Commit 23f48db7 authored by Jan Reimes's avatar Jan Reimes
Browse files

refactor: simplify StrEnum classes using enum.auto()

Simplify StrEnum classes by using enum.auto() instead of explicit string
values where the enum member name matches the desired value.

Changes:
- OutputFormat (base.py): TABLE, JSON, YAML now use auto()
- SortOrder (base.py): ASC, DESC now use auto()
- TDocStatus (tdocs/models.py): partial - values without spaces use auto()
- GraphNodeType (3gpp_ai/models.py): DOCUMENT, TDOC, MEETING, SPEC, COMPANY use auto()
  - WORK_ITEM and CHANGE_REQUEST kept as-is (special values)
- GraphEdgeType (3gpp_ai/models.py): all members now use auto()

Values with spaces or special abbreviations kept explicit:
- TDocStatus: CONDITIONALLY_AGREED, CONDITIONALLY_APPROVED, PARTIALLY_APPROVED,
  REPLIED_TO, NOT_PURSUED, NOT_CONCLUDED, NOT_TREATED

Closes: tdc-x9b
parent 7c7c23ba
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -17,13 +17,13 @@ from threegpp_ai.operations.workspace_names import normalize_workspace_name
class GraphNodeType(StrEnum):
    """Types of nodes in the knowledge graph."""

    DOCUMENT = "document"
    TDOC = "tdoc"
    MEETING = "meeting"
    SPEC = "spec"
    DOCUMENT = auto()
    TDOC = auto()
    MEETING = auto()
    SPEC = auto()
    WORK_ITEM = "work_item"
    CHANGE_REQUEST = "cr"
    COMPANY = "company"
    COMPANY = auto()


# Use LLM to synthesize answer from graph + embeddings (GraphRAG)
@@ -32,11 +32,11 @@ class GraphNodeType(StrEnum):
class GraphEdgeType(StrEnum):
    """Types of edges in the knowledge graph."""

    DISCUSSES = "discusses"
    REFERENCES = "references"
    AUTHORED_BY = "authored_by"
    PRESENTED_AT = "presented_at"
    REVISION_OF = "revision_of"  # is_revision_of metadata relationship
    DISCUSSES = auto()
    REFERENCES = auto()
    AUTHORED_BY = auto()
    PRESENTED_AT = auto()
    REVISION_OF = auto()  # is_revision_of metadata relationship


class SourceKind(StrEnum):
+6 −6
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ from __future__ import annotations

import os
from dataclasses import dataclass
from enum import StrEnum
from enum import StrEnum, auto
from pathlib import Path

from pydantic import BaseModel, Field
@@ -15,16 +15,16 @@ from tdoc_crawler.config import resolve_cache_manager
class OutputFormat(StrEnum):
    """Supported output formats for CLI responses."""

    TABLE = "table"
    JSON = "json"
    YAML = "yaml"
    TABLE = auto()
    JSON = auto()
    YAML = auto()


class SortOrder(StrEnum):
    """Sort orders accepted by query operations."""

    ASC = "asc"
    DESC = "desc"
    ASC = auto()
    DESC = auto()


_DEFAULT_TTL: int = 7200
+13 −13
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ from __future__ import annotations

from collections.abc import Iterable
from datetime import date, datetime
from enum import StrEnum
from enum import StrEnum, auto

import requests
from packaging.version import Version
@@ -34,24 +34,24 @@ class TDocStatus(StrEnum):
    Any status not in this enum will raise a ValueError during parsing.
    """

    RESERVED = "reserved"
    AVAILABLE = "available"
    REVISED = "revised"
    AGREED = "agreed"
    RESERVED = auto()
    AVAILABLE = auto()
    REVISED = auto()
    AGREED = auto()
    CONDITIONALLY_AGREED = "conditionally agreed"
    APPROVED = "approved"
    APPROVED = auto()
    CONDITIONALLY_APPROVED = "conditionally approved"
    PARTIALLY_APPROVED = "partially approved"
    TREATED = "treated"
    ENDORSED = "endorsed"
    TREATED = auto()
    ENDORSED = auto()
    REPLIED_TO = "replied to"
    MERGED = "merged"
    MERGED = auto()
    NOT_PURSUED = "not pursued"
    POSTPONED = "postponed"
    NOTED = "noted"
    POSTPONED = auto()
    NOTED = auto()
    NOT_CONCLUDED = "not concluded"
    WITHDRAWN = "withdrawn"
    REISSUED = "reissued"
    WITHDRAWN = auto()
    REISSUED = auto()
    NOT_TREATED = "not treated"

    @classmethod