Spaces:
Sleeping
Sleeping
Tobias Pasquale
commited on
Commit
·
d123e01
1
Parent(s):
3d8e949
Fix CI/CD pipeline issues - line length and formatting
Browse files- Fixed all E501 line length violations (>88 characters)
- Applied black formatting automatically
- Resolved flake8 and pre-commit hook issues
- All tests passing (94/94)
- Ready for CI/CD pipeline
src/document_management/processing_service.py
CHANGED
|
@@ -114,9 +114,8 @@ class ProcessingService:
|
|
| 114 |
# Add to processing queue
|
| 115 |
self.job_queue.put(job)
|
| 116 |
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
)
|
| 120 |
|
| 121 |
# Notify status callbacks
|
| 122 |
self._notify_status_change(job, DocumentStatus.UPLOADED)
|
|
|
|
| 114 |
# Add to processing queue
|
| 115 |
self.job_queue.put(job)
|
| 116 |
|
| 117 |
+
original_name = file_info["original_name"]
|
| 118 |
+
logging.info(f"Submitted processing job {job.job_id} for file {original_name}")
|
|
|
|
| 119 |
|
| 120 |
# Notify status callbacks
|
| 121 |
self._notify_status_change(job, DocumentStatus.UPLOADED)
|
src/document_management/upload_service.py
CHANGED
|
@@ -101,9 +101,10 @@ class UploadService:
|
|
| 101 |
results["message"] = "All uploads failed"
|
| 102 |
else:
|
| 103 |
results["status"] = "partial"
|
| 104 |
-
results[
|
| 105 |
-
"
|
| 106 |
-
|
|
|
|
| 107 |
else:
|
| 108 |
results[
|
| 109 |
"message"
|
|
@@ -136,10 +137,13 @@ class UploadService:
|
|
| 136 |
validation_result = self.document_service.validate_file(filename, file_size)
|
| 137 |
|
| 138 |
if not validation_result["valid"]:
|
|
|
|
|
|
|
|
|
|
| 139 |
return {
|
| 140 |
"filename": filename,
|
| 141 |
"status": "error",
|
| 142 |
-
"error":
|
| 143 |
"validation": validation_result,
|
| 144 |
}
|
| 145 |
|
|
@@ -168,13 +172,17 @@ class UploadService:
|
|
| 168 |
file_info, processing_options
|
| 169 |
)
|
| 170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
return {
|
| 172 |
"filename": filename,
|
| 173 |
"status": "success",
|
| 174 |
"file_info": file_info,
|
| 175 |
"job_id": job_id,
|
| 176 |
"validation": validation_result,
|
| 177 |
-
"message":
|
| 178 |
}
|
| 179 |
|
| 180 |
except Exception as e:
|
|
@@ -223,9 +231,8 @@ class UploadService:
|
|
| 223 |
errors = []
|
| 224 |
|
| 225 |
if len(files) > self.document_service.max_batch_size:
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
)
|
| 229 |
return [], errors
|
| 230 |
|
| 231 |
total_size = 0
|
|
|
|
| 101 |
results["message"] = "All uploads failed"
|
| 102 |
else:
|
| 103 |
results["status"] = "partial"
|
| 104 |
+
results["message"] = (
|
| 105 |
+
f"{results['successful_uploads']} files uploaded, "
|
| 106 |
+
f"{results['failed_uploads']} failed"
|
| 107 |
+
)
|
| 108 |
else:
|
| 109 |
results[
|
| 110 |
"message"
|
|
|
|
| 137 |
validation_result = self.document_service.validate_file(filename, file_size)
|
| 138 |
|
| 139 |
if not validation_result["valid"]:
|
| 140 |
+
error_msg = (
|
| 141 |
+
f"Validation failed: {', '.join(validation_result['errors'])}"
|
| 142 |
+
)
|
| 143 |
return {
|
| 144 |
"filename": filename,
|
| 145 |
"status": "error",
|
| 146 |
+
"error": error_msg,
|
| 147 |
"validation": validation_result,
|
| 148 |
}
|
| 149 |
|
|
|
|
| 172 |
file_info, processing_options
|
| 173 |
)
|
| 174 |
|
| 175 |
+
upload_msg = "File uploaded"
|
| 176 |
+
if job_id:
|
| 177 |
+
upload_msg += " and submitted for processing"
|
| 178 |
+
|
| 179 |
return {
|
| 180 |
"filename": filename,
|
| 181 |
"status": "success",
|
| 182 |
"file_info": file_info,
|
| 183 |
"job_id": job_id,
|
| 184 |
"validation": validation_result,
|
| 185 |
+
"message": upload_msg,
|
| 186 |
}
|
| 187 |
|
| 188 |
except Exception as e:
|
|
|
|
| 231 |
errors = []
|
| 232 |
|
| 233 |
if len(files) > self.document_service.max_batch_size:
|
| 234 |
+
max_batch = self.document_service.max_batch_size
|
| 235 |
+
errors.append(f"Too many files: {len(files)} (max: {max_batch})")
|
|
|
|
| 236 |
return [], errors
|
| 237 |
|
| 238 |
total_size = 0
|