chore: mypy fixes for routes.py + legal_document_service + control_export_service
- Add [mypy-compliance.api.routes] to mypy.ini strict scope - Fix bare `dict` type annotation in routes.py update_requirement handler - Fix Column[str] return type in control_export_service.download_file - Fix unused type:ignore in legal_document_service.upload_word - Add union-attr ignore for optional requirement null access in routes.py mypy compliance/ -> Success on 149 source files 173/173 pytest pass Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -167,7 +167,7 @@ async def get_requirement(
|
||||
rag = get_rag_client()
|
||||
assistant = AIComplianceAssistant()
|
||||
query = (
|
||||
f"{requirement.title} {requirement.article or ''}"
|
||||
f"{requirement.title} {requirement.article or ''}" # type: ignore[union-attr]
|
||||
)
|
||||
collection = assistant._collection_for_regulation(
|
||||
regulation.code if regulation else ""
|
||||
@@ -250,7 +250,7 @@ async def delete_requirement(
|
||||
@router.put("/requirements/{requirement_id}")
|
||||
async def update_requirement(
|
||||
requirement_id: str,
|
||||
updates: dict,
|
||||
updates: dict[str, Any],
|
||||
svc: RegulationRequirementService = Depends(get_reg_req_service),
|
||||
) -> dict[str, Any]:
|
||||
"""Update a requirement with implementation/audit details."""
|
||||
|
||||
@@ -317,7 +317,7 @@ class ControlExportService:
|
||||
if not export.file_path or not os.path.exists(export.file_path):
|
||||
raise NotFoundError("Export file not found")
|
||||
|
||||
return export.file_path
|
||||
return str(export.file_path)
|
||||
|
||||
def list_exports(
|
||||
self, limit: int, offset: int
|
||||
|
||||
@@ -248,7 +248,7 @@ class LegalDocumentService:
|
||||
|
||||
html_content = ""
|
||||
try:
|
||||
import mammoth # type: ignore
|
||||
import mammoth # noqa: F811
|
||||
result = mammoth.convert_to_html(io.BytesIO(content_bytes))
|
||||
html_content = result.value
|
||||
except ImportError:
|
||||
|
||||
@@ -97,5 +97,7 @@ ignore_errors = False
|
||||
ignore_errors = False
|
||||
[mypy-compliance.api.dsfa_routes]
|
||||
ignore_errors = False
|
||||
[mypy-compliance.api.routes]
|
||||
ignore_errors = False
|
||||
[mypy-compliance.api._http_errors]
|
||||
ignore_errors = False
|
||||
|
||||
Reference in New Issue
Block a user