fix: resolve CI type annotation issues
- Replaced deprecated typing.List/Dict/Tuple with native list/dict/tuple - Fixed trailing whitespace issues - Fixed blank line whitespace issues - Removed unused variables and imports - Applied black formatting
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from enum import Enum
|
||||
from typing import Any, Dict, List, Optional, TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Any, Optional
|
||||
|
||||
import spacy
|
||||
from spacy.tokens import Doc
|
||||
@@ -13,6 +13,7 @@ if TYPE_CHECKING:
|
||||
|
||||
class ActorType(str, Enum):
|
||||
"""Types of actors in requirements."""
|
||||
|
||||
USER = "user"
|
||||
SYSTEM = "system"
|
||||
ADMIN = "admin"
|
||||
@@ -22,6 +23,7 @@ class ActorType(str, Enum):
|
||||
|
||||
class ActionType(str, Enum):
|
||||
"""Types of actions in requirements."""
|
||||
|
||||
CREATE = "create"
|
||||
READ = "read"
|
||||
UPDATE = "update"
|
||||
@@ -41,6 +43,7 @@ class ActionType(str, Enum):
|
||||
@dataclass
|
||||
class RequirementAnalysis:
|
||||
"""Structured analysis of a requirement."""
|
||||
|
||||
raw_text: str
|
||||
actor: Optional[str] = None
|
||||
actor_type: ActorType = ActorType.UNKNOWN
|
||||
@@ -49,10 +52,10 @@ class RequirementAnalysis:
|
||||
target: Optional[str] = None
|
||||
condition: Optional[str] = None
|
||||
benefit: Optional[str] = None
|
||||
examples: List[str] = field(default_factory=list)
|
||||
variables: Dict[str, str] = field(default_factory=dict)
|
||||
examples: list[str] = field(default_factory=list)
|
||||
variables: dict[str, str] = field(default_factory=dict)
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
"""Convert to dictionary."""
|
||||
return {
|
||||
"raw_text": self.raw_text,
|
||||
@@ -81,6 +84,7 @@ class NLPAnalyzer:
|
||||
self.nlp = spacy.load(model)
|
||||
except OSError:
|
||||
import subprocess
|
||||
|
||||
subprocess.run(
|
||||
["python", "-m", "spacy", "download", model],
|
||||
check=True,
|
||||
|
||||
Reference in New Issue
Block a user