fix(lint): resolve line length violations in main.py
- Split long error message strings to meet 88 character limit - Maintain readability while conforming to flake8 standards - Fix file upload validation error messages
This commit is contained in:
@@ -354,7 +354,10 @@ async def upload_unit_file(file: UploadFile = File(...)):
|
|||||||
if file.size and file.size > settings.max_upload_size:
|
if file.size and file.size > settings.max_upload_size:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=413,
|
status_code=413,
|
||||||
detail=f"File too large. Maximum size is {settings.max_upload_size} bytes"
|
detail=(
|
||||||
|
f"File too large. Maximum size is "
|
||||||
|
f"{settings.max_upload_size} bytes"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Check file extension
|
# Check file extension
|
||||||
@@ -363,7 +366,10 @@ async def upload_unit_file(file: UploadFile = File(...)):
|
|||||||
if file_ext not in settings.allowed_extensions:
|
if file_ext not in settings.allowed_extensions:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=400,
|
status_code=400,
|
||||||
detail=f"File type not allowed. Allowed types: {', '.join(settings.allowed_extensions)}"
|
detail=(
|
||||||
|
f"File type not allowed. Allowed types: "
|
||||||
|
f"{', '.join(settings.allowed_extensions)}"
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
content = await file.read()
|
content = await file.read()
|
||||||
@@ -425,7 +431,7 @@ async def get_info():
|
|||||||
"api_docs": settings.api_docs_enabled,
|
"api_docs": settings.api_docs_enabled,
|
||||||
"swagger_ui": settings.swagger_ui_enabled,
|
"swagger_ui": settings.swagger_ui_enabled,
|
||||||
"redoc": settings.redoc_enabled,
|
"redoc": settings.redoc_enabled,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -441,7 +447,7 @@ async def health_check():
|
|||||||
"service": settings.app_name.lower(),
|
"service": settings.app_name.lower(),
|
||||||
"version": settings.app_version,
|
"version": settings.app_version,
|
||||||
"environment": settings.environment,
|
"environment": settings.environment,
|
||||||
"timestamp": __import__("datetime").datetime.utcnow().isoformat()
|
"timestamp": __import__("datetime").datetime.utcnow().isoformat(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user