Skip to content

Commit e8f097d

Browse files
committed
fix: resolve isort/black/pylint lint failures
- Remove extra blank line after imports in test_versioning.py (isort) - Black-format all 4 changed files - Rename unused _validate_external sku param to _sku (pylint W0613) - Add pylint: disable=invalid-name for intentional _v1/_v2 class suffixes - Achieves 10.00/10 pylint score on changed lib files
1 parent c73baca commit e8f097d

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

lib/src/holiday_peak_lib/agents/guardrails/enrichment_guardrail.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,7 @@ class SourceRef:
190190
source_system: str
191191
source_id: str
192192
confidence: float = 1.0
193-
retrieved_at: str = field(
194-
default_factory=lambda: datetime.now(tz=timezone.utc).isoformat()
195-
)
193+
retrieved_at: str = field(default_factory=lambda: datetime.now(tz=timezone.utc).isoformat())
196194

197195
def as_tag(self) -> str:
198196
"""Return a compact string tag suitable for embedding in content metadata."""
@@ -256,7 +254,7 @@ async def validate(
256254

257255
return refs if refs else None
258256

259-
async def _validate_external(self, sku: str) -> list[SourceRef]: # noqa: ARG002
257+
async def _validate_external(self, _sku: str) -> list[SourceRef]:
260258
"""Hook for subclasses to add cross-service source validation.
261259
262260
Default implementation returns an empty list (no external check).

lib/src/holiday_peak_lib/connectors/common/versioning.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class BaseConnectorProtocol(ABC, metaclass=_ProtocolMeta):
207207
# ---------------------------------------------------------------------------
208208

209209

210-
class PIMConnectorProtocol_v1(BaseConnectorProtocol):
210+
class PIMConnectorProtocol_v1(BaseConnectorProtocol): # pylint: disable=invalid-name
211211
"""PIM connector protocol v1 — baseline product data operations.
212212
213213
Provides fundamental read operations against any product information
@@ -248,7 +248,7 @@ async def list_products(
248248
# ---------------------------------------------------------------------------
249249

250250

251-
class PIMConnectorProtocol_v2(PIMConnectorProtocol_v1):
251+
class PIMConnectorProtocol_v2(PIMConnectorProtocol_v1): # pylint: disable=invalid-name
252252
"""PIM connector protocol v2 — adds lifecycle, variants, and keyword search.
253253
254254
v2 is backward-compatible with v1 (same major version). All v1 methods
@@ -480,11 +480,7 @@ def _apply_version_mask(self, data: dict[str, Any]) -> dict[str, Any]:
480480

481481
known_at_client = self._fields_for_version(self._client_version)
482482
all_protocol = self._all_protocol_fields()
483-
return {
484-
k: v
485-
for k, v in data.items()
486-
if k in known_at_client or k not in all_protocol
487-
}
483+
return {k: v for k, v in data.items() if k in known_at_client or k not in all_protocol}
488484

489485
# ------------------------------------------------------------------
490486
# Core PIM method delegates with version masking
@@ -540,19 +536,13 @@ def diff_protocols(
540536
"""
541537
for arg, label in ((from_version, "from_version"), (to_version, "to_version")):
542538
if not (isinstance(arg, type) and issubclass(arg, BaseConnectorProtocol)):
543-
raise TypeError(
544-
f"{label} must be a BaseConnectorProtocol subclass, got {arg!r}"
545-
)
539+
raise TypeError(f"{label} must be a BaseConnectorProtocol subclass, got {arg!r}")
546540

547541
from_fields = {f.name: f for f in getattr(from_version, "FIELDS", [])}
548542
to_fields = {f.name: f for f in getattr(to_version, "FIELDS", [])}
549543

550544
added = [name for name in to_fields if name not in from_fields]
551545
removed = [name for name in from_fields if name not in to_fields]
552-
deprecated = [
553-
name
554-
for name, f in to_fields.items()
555-
if f.deprecated and name not in removed
556-
]
546+
deprecated = [name for name, f in to_fields.items() if f.deprecated and name not in removed]
557547

558548
return ProtocolDiff(added=added, removed=removed, deprecated=deprecated)

lib/tests/test_connectors/test_versioning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
register_protocol,
1919
)
2020

21-
2221
# ---------------------------------------------------------------------------
2322
# Helpers / fixtures
2423
# ---------------------------------------------------------------------------
@@ -300,6 +299,7 @@ async def test_unknown_keys_are_preserved(self, connector):
300299
protocol_class=PIMConnectorProtocol_v2,
301300
client_version=ProtocolVersion(1, 0),
302301
)
302+
303303
# Monkey-patch connector to return an internal key
304304
async def patched_get(product_id: str) -> dict[str, Any]:
305305
data = await ConcretePIMv2().get_product(product_id)

0 commit comments

Comments
 (0)