fix(lint): resolve pylint and pyright issues on egress-log-option
lint / lint (push) Failing after 1m34s
test / unit (pull_request) Successful in 32s
test / integration (pull_request) Successful in 44s

- egress.py: extract _render_match_entry helper to reduce nesting depth
- egress_addon_core.py: make request_method/request_headers keyword-only
  to satisfy too-many-positional-arguments; wrap long lazy import lines
- egress_addon.py: remove unused Route import; add pylint disable for
  import-error on sidecar-only mitmproxy/egress_addon_core imports
- dlp_detectors.py: remove dead _min_distance function (superseded by
  _closest_pair)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 20:10:27 -04:00
parent 8743299226
commit 545ff3582f
4 changed files with 42 additions and 53 deletions
+7 -2
View File
@@ -470,6 +470,7 @@ def decide(
request_host: str,
request_path: str,
environ: typing.Mapping[str, str],
*,
request_method: str = "GET",
request_headers: typing.Mapping[str, str] | None = None,
) -> Decision:
@@ -537,9 +538,13 @@ def scan_outbound(
# Lazy import to avoid circular deps and keep dlp_detectors optional
# at import time (the sidecar copies it flat alongside this file).
try:
from dlp_detectors import scan_token_patterns, scan_known_secrets # type: ignore[import-not-found]
from dlp_detectors import ( # type: ignore[import-not-found]
scan_token_patterns, scan_known_secrets,
)
except ImportError: # pragma: no cover - host-side path
from .dlp_detectors import scan_token_patterns, scan_known_secrets # type: ignore[import-not-found]
from .dlp_detectors import ( # type: ignore[import-not-found]
scan_token_patterns, scan_known_secrets,
)
text = body if isinstance(body, str) else body.decode("utf-8", errors="replace")