Skip to content

Commit 5de60b4

Browse files
marc-shadeclaude
andcommitted
Fix Pyright type errors and remove unused imports
- audit_trail.py: Add None guard for self.log_path before os.path.abspath() and open() calls; remove unused imports (time, asdict, field, Path) - cui_detector.py: Remove unused imports (Dict, Set, Tuple); remove unused `lines` variable in _check_marking_compliance - enhanced_pii.py: Remove unused imports (field, Optional) - sanitizer.py: Remove unused imports (json, struct, field, BinaryIO, Tuple) - export_control.py: Remove unused import (field) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ab24a3a commit 5de60b4

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

docsingest/compliance/audit_trail.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@
1717
import logging
1818
import os
1919
import socket
20-
import time
2120
import uuid
22-
from dataclasses import asdict, dataclass, field
21+
from dataclasses import dataclass
2322
from datetime import datetime, timezone
2423
from enum import Enum
25-
from pathlib import Path
2624
from typing import Any, Dict, List, Optional
2725

2826
logger = logging.getLogger(__name__)
@@ -615,6 +613,8 @@ def _get_local_ip() -> str:
615613
def _append_to_log(self, entry: AuditEntry) -> None:
616614
"""Append an entry to the audit log file."""
617615
try:
616+
if self.log_path is None:
617+
raise ValueError("log_path is required for file operations")
618618
os.makedirs(os.path.dirname(os.path.abspath(self.log_path)), exist_ok=True)
619619
with open(self.log_path, 'a', encoding='utf-8') as f:
620620
f.write(json.dumps(entry.to_dict(), separators=(',', ':')) + '\n')

docsingest/compliance/cui_detector.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import re
1616
from dataclasses import dataclass, field
1717
from enum import Enum
18-
from typing import Dict, List, Optional, Set, Tuple
18+
from typing import List, Optional
1919

2020
logger = logging.getLogger(__name__)
2121

@@ -443,7 +443,6 @@ def _check_marking_compliance(
443443
Returns list of deficiency descriptions.
444444
"""
445445
deficiencies: List[str] = []
446-
lines = text.split('\n')
447446

448447
# Check 1: CUI content without proper header banner
449448
if cui_markings and not any(b.position_in_document == "header" for b in banners):

docsingest/compliance/enhanced_pii.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020

2121
import logging
2222
import re
23-
from dataclasses import dataclass, field
23+
from dataclasses import dataclass
2424
from enum import Enum
25-
from typing import Dict, List, Optional, Tuple
25+
from typing import Dict, List, Tuple
2626

2727
logger = logging.getLogger(__name__)
2828

docsingest/compliance/export_control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import logging
2121
import re
22-
from dataclasses import dataclass, field
22+
from dataclasses import dataclass
2323
from enum import Enum
2424
from typing import Dict, List, Optional, Set, Tuple
2525

docsingest/compliance/sanitizer.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@
1818
"""
1919

2020
import hashlib
21-
import json
2221
import logging
2322
import os
2423
import re
25-
import struct
2624
import zipfile
27-
from dataclasses import dataclass, field
25+
from dataclasses import dataclass
2826
from enum import Enum
29-
from typing import Any, BinaryIO, Dict, List, Optional, Set, Tuple
27+
from typing import Any, Dict, List, Optional, Set
3028

3129
logger = logging.getLogger(__name__)
3230

0 commit comments

Comments
 (0)