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()
|
rag = get_rag_client()
|
||||||
assistant = AIComplianceAssistant()
|
assistant = AIComplianceAssistant()
|
||||||
query = (
|
query = (
|
||||||
f"{requirement.title} {requirement.article or ''}"
|
f"{requirement.title} {requirement.article or ''}" # type: ignore[union-attr]
|
||||||
)
|
)
|
||||||
collection = assistant._collection_for_regulation(
|
collection = assistant._collection_for_regulation(
|
||||||
regulation.code if regulation else ""
|
regulation.code if regulation else ""
|
||||||
@@ -250,7 +250,7 @@ async def delete_requirement(
|
|||||||
@router.put("/requirements/{requirement_id}")
|
@router.put("/requirements/{requirement_id}")
|
||||||
async def update_requirement(
|
async def update_requirement(
|
||||||
requirement_id: str,
|
requirement_id: str,
|
||||||
updates: dict,
|
updates: dict[str, Any],
|
||||||
svc: RegulationRequirementService = Depends(get_reg_req_service),
|
svc: RegulationRequirementService = Depends(get_reg_req_service),
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
"""Update a requirement with implementation/audit details."""
|
"""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):
|
if not export.file_path or not os.path.exists(export.file_path):
|
||||||
raise NotFoundError("Export file not found")
|
raise NotFoundError("Export file not found")
|
||||||
|
|
||||||
return export.file_path
|
return str(export.file_path)
|
||||||
|
|
||||||
def list_exports(
|
def list_exports(
|
||||||
self, limit: int, offset: int
|
self, limit: int, offset: int
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ class LegalDocumentService:
|
|||||||
|
|
||||||
html_content = ""
|
html_content = ""
|
||||||
try:
|
try:
|
||||||
import mammoth # type: ignore
|
import mammoth # noqa: F811
|
||||||
result = mammoth.convert_to_html(io.BytesIO(content_bytes))
|
result = mammoth.convert_to_html(io.BytesIO(content_bytes))
|
||||||
html_content = result.value
|
html_content = result.value
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|||||||
@@ -97,5 +97,7 @@ ignore_errors = False
|
|||||||
ignore_errors = False
|
ignore_errors = False
|
||||||
[mypy-compliance.api.dsfa_routes]
|
[mypy-compliance.api.dsfa_routes]
|
||||||
ignore_errors = False
|
ignore_errors = False
|
||||||
|
[mypy-compliance.api.routes]
|
||||||
|
ignore_errors = False
|
||||||
[mypy-compliance.api._http_errors]
|
[mypy-compliance.api._http_errors]
|
||||||
ignore_errors = False
|
ignore_errors = False
|
||||||
|
|||||||
Reference in New Issue
Block a user