Skip to content

Commit 24bdb9e

Browse files
marc-shadeclaude
andcommitted
Fix Pyright type errors: use local variable for Optional narrowing
audit_trail.py: Bind self.log_path to local var before None guard so Pyright can narrow the type (instance attrs aren't narrowed). cui_detector.py: Prefix unused text param with underscore. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5de60b4 commit 24bdb9e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

docsingest/compliance/audit_trail.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,10 +613,11 @@ def _get_local_ip() -> str:
613613
def _append_to_log(self, entry: AuditEntry) -> None:
614614
"""Append an entry to the audit log file."""
615615
try:
616-
if self.log_path is None:
616+
log_path = self.log_path
617+
if log_path is None:
617618
raise ValueError("log_path is required for file operations")
618-
os.makedirs(os.path.dirname(os.path.abspath(self.log_path)), exist_ok=True)
619-
with open(self.log_path, 'a', encoding='utf-8') as f:
619+
os.makedirs(os.path.dirname(os.path.abspath(log_path)), exist_ok=True)
620+
with open(log_path, 'a', encoding='utf-8') as f:
620621
f.write(json.dumps(entry.to_dict(), separators=(',', ':')) + '\n')
621622
except Exception as e:
622623
logger.error("Failed to write audit entry to %s: %s", self.log_path, e)

docsingest/compliance/cui_detector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def _detect_dissemination_controls(self, text: str) -> List[DisseminationMarking
432432

433433
def _check_marking_compliance(
434434
self,
435-
text: str,
435+
_text: str,
436436
cui_markings: List[CUIMarking],
437437
banners: List[ClassificationBanner],
438438
dissemination_controls: List[DisseminationMarking],

0 commit comments

Comments
 (0)