Skip to content

Commit 64a9445

Browse files
committed
LCORE-1831: move RedactionResult to core.py
1 parent f80040a commit 64a9445

5 files changed

Lines changed: 19 additions & 31 deletions

File tree

src/models/config.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,22 +2272,6 @@ def compiled_patterns(self) -> list[tuple[Pattern[str], str]]:
22722272
return list(self._compiled_patterns)
22732273

22742274

2275-
class RedactionResult(BaseModel):
2276-
"""Result of applying PII redaction rules to text.
2277-
2278-
Attributes:
2279-
content: The text after all redaction rules have been applied.
2280-
redacted: True if at least one rule matched and changed the text.
2281-
redaction_count: Total number of substitutions made across all rules.
2282-
"""
2283-
2284-
model_config = ConfigDict(frozen=True)
2285-
2286-
content: str
2287-
redacted: bool
2288-
redaction_count: int
2289-
2290-
22912275
class Configuration(ConfigurationBase):
22922276
"""Global service configuration."""
22932277

src/pydantic_ai_lightspeed/capabilities/redaction/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
from models.config import (
44
RedactionConfig,
5-
RedactionResult,
65
RedactionRule,
76
)
87
from pydantic_ai_lightspeed.capabilities.redaction.capability import (
98
PiiRedactionCapability,
109
)
1110
from pydantic_ai_lightspeed.capabilities.redaction.core import (
11+
RedactionResult,
1212
redact_text,
1313
)
1414

src/pydantic_ai_lightspeed/capabilities/redaction/config.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/pydantic_ai_lightspeed/capabilities/redaction/core.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,27 @@
22

33
from re import Pattern
44

5-
from models.config import RedactionResult
5+
from pydantic import BaseModel, ConfigDict
66

77
CompiledPatterns = list[tuple[Pattern[str], str]]
88

99

10+
class RedactionResult(BaseModel):
11+
"""Result of applying PII redaction rules to text.
12+
13+
Attributes:
14+
content: The text after all redaction rules have been applied.
15+
redacted: True if at least one rule matched and changed the text.
16+
redaction_count: Total number of substitutions made across all rules.
17+
"""
18+
19+
model_config = ConfigDict(frozen=True)
20+
21+
content: str
22+
redacted: bool
23+
redaction_count: int
24+
25+
1026
def redact_text(
1127
content: str,
1228
compiled_patterns: CompiledPatterns,

tests/unit/pydantic_ai_lightspeed/capabilities/redaction/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import pytest
66
from pydantic import ValidationError
77

8-
from models.config import RedactionResult
98
from pydantic_ai_lightspeed.capabilities.redaction.core import (
109
CompiledPatterns,
10+
RedactionResult,
1111
redact_text,
1212
)
1313

0 commit comments

Comments
 (0)