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