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,11 +2,12 @@
|
||||
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class PatternType(str, Enum):
|
||||
"""Types of requirement patterns."""
|
||||
|
||||
USER_STORY = "user_story"
|
||||
SCENARIO = "scenario"
|
||||
ACCEPTANCE_CRITERIA = "acceptance_criteria"
|
||||
@@ -17,6 +18,7 @@ class PatternType(str, Enum):
|
||||
@dataclass
|
||||
class RequirementPattern:
|
||||
"""A pattern for matching requirements."""
|
||||
|
||||
name: str
|
||||
pattern: str
|
||||
pattern_type: PatternType
|
||||
@@ -26,6 +28,7 @@ class RequirementPattern:
|
||||
def matches(self, text: str) -> bool:
|
||||
"""Check if the text matches this pattern."""
|
||||
import re
|
||||
|
||||
return bool(re.search(self.pattern, text, re.IGNORECASE))
|
||||
|
||||
|
||||
@@ -81,7 +84,7 @@ ACCEPTANCE_CRITERIA_PATTERNS = [
|
||||
]
|
||||
|
||||
|
||||
def get_patterns_by_type(pattern_type: PatternType) -> List[RequirementPattern]:
|
||||
def get_patterns_by_type(pattern_type: PatternType) -> list[RequirementPattern]:
|
||||
"""Get all patterns of a specific type."""
|
||||
all_patterns = USER_STORY_PATTERNS + SCENARIO_PATTERNS + ACCEPTANCE_CRITERIA_PATTERNS
|
||||
return [p for p in all_patterns if p.pattern_type == pattern_type]
|
||||
|
||||
Reference in New Issue
Block a user