style: fix all flake8 linter errors across app/ directory

- Run Black formatter and isort on all app/ files
- Remove unused imports (F401) across multiple files
- Add # noqa: F401 for intentional re-exports in celery_worker.py,
  tasks/__init__.py, utils.py, frontend.py, views/base.py
- Fix f-strings without placeholders (F541) in azure.py, notification.py,
  check_credentials.py, upload_to_onedrive.py, settings.py
- Fix bare except (E722) in upload_to_sftp.py
- Fix block comment format (E265) in models.py
- Move imports to top of file to fix E402 in celery_app.py, celery_worker.py
- Fix line-too-long (E501) by wrapping strings in multiple files
- Remove unused variable (F841) in upload_to_nextcloud.py

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-08 17:42:33 +00:00
parent 7827b97e06
commit d08040ac4a
73 changed files with 2200 additions and 2185 deletions
+44 -42
View File
@@ -1,17 +1,19 @@
"""
Status and configuration views for the application.
"""
from fastapi import Request
from fastapi.responses import JSONResponse
from datetime import datetime
import os
import logging
from app.views.base import APIRouter, templates, require_login, settings
import logging
import os
from datetime import datetime
from fastapi import Request
from app.views.base import APIRouter, require_login, settings, templates
logger = logging.getLogger(__name__)
router = APIRouter()
@router.get("/status")
@require_login
async def status_dashboard(request: Request):
@@ -19,75 +21,74 @@ async def status_dashboard(request: Request):
Status dashboard showing all configured integration targets
"""
from app.utils.config_validator import get_provider_status
# Get provider status
providers = get_provider_status()
# Get build date from settings
build_date = getattr(settings, 'build_date', 'Unknown')
build_date = getattr(settings, "build_date", "Unknown")
# Try to get container information
container_info = {}
try:
# Check for Docker environment
if os.path.exists('/.dockerenv'):
if os.path.exists("/.dockerenv"):
# We're inside a Docker container
container_info['is_docker'] = True
container_info["is_docker"] = True
# Try to get container ID
try:
with open('/proc/self/cgroup', 'r') as f:
with open("/proc/self/cgroup", "r") as f:
for line in f:
if 'docker' in line:
container_id = line.split('/')[-1].strip()
container_info['id'] = container_id[:12] # Short ID format
if "docker" in line:
container_id = line.split("/")[-1].strip()
container_info["id"] = container_id[:12] # Short ID format
break
except Exception:
container_info['id'] = 'Unknown'
container_info["id"] = "Unknown"
# Get Git commit SHA from settings
try:
git_sha = settings.git_sha
container_info['git_sha'] = git_sha[:7] if git_sha and git_sha != 'unknown' else 'Unknown'
container_info["git_sha"] = git_sha[:7] if git_sha and git_sha != "unknown" else "Unknown"
except Exception:
container_info['git_sha'] = 'Unknown'
container_info["git_sha"] = "Unknown"
# Try to get runtime information
try:
container_info['runtime_info'] = settings.runtime_info
container_info["runtime_info"] = settings.runtime_info
except Exception:
pass
else:
container_info['is_docker'] = False
container_info["is_docker"] = False
# If not in Docker, get Git info from settings
try:
git_sha = settings.git_sha
container_info['git_sha'] = git_sha[:7] if git_sha and git_sha != 'unknown' else 'Unknown'
container_info["git_sha"] = git_sha[:7] if git_sha and git_sha != "unknown" else "Unknown"
except Exception:
container_info['git_sha'] = 'Unknown'
container_info["git_sha"] = "Unknown"
except Exception:
container_info = {'is_docker': False, 'id': 'Unknown', 'git_sha': 'Unknown'}
container_info = {"is_docker": False, "id": "Unknown", "git_sha": "Unknown"}
# Get notification URLs for the notification box
notification_urls = getattr(settings, 'notification_urls', [])
notification_urls = getattr(settings, "notification_urls", [])
return templates.TemplateResponse(
"status_dashboard.html",
{
"request": request,
"request": request,
"providers": providers,
"app_version": settings.version,
"build_date": build_date,
"debug_enabled": getattr(settings, 'debug', False),
"debug_enabled": getattr(settings, "debug", False),
"last_check": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
"container_info": container_info,
"settings": {
"notification_urls": notification_urls
}
}
"settings": {"notification_urls": notification_urls},
},
)
@router.get("/env")
@require_login
async def env_debug(request: Request):
@@ -97,17 +98,18 @@ async def env_debug(request: Request):
"""
# Use the actual debug setting from configuration
debug_enabled = settings.debug
# Get settings data
from app.utils.config_validator import get_settings_for_display
settings_data = get_settings_for_display(show_values=debug_enabled)
return templates.TemplateResponse(
"env_debug.html",
{
"request": request,
"request": request,
"settings": settings_data,
"debug_enabled": debug_enabled,
"app_version": settings.version
}
"app_version": settings.version,
},
)