From d1eb102e4426563300806b5b26a4a52a30161c3d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 11 Feb 2026 21:43:37 +0000 Subject: [PATCH] Fix code review issues: remove unused imports and fix exception handling Co-authored-by: ferdzo <6640598+ferdzo@users.noreply.github.com> --- create_user.py | 2 +- iotDashboard/dashboard_models.py | 1 - iotDashboard/health_insights.py | 2 +- iotDashboard/run_suitability.py | 2 +- services/gpt_service/gpt_service.py | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/create_user.py b/create_user.py index ff9f439..9f9268b 100755 --- a/create_user.py +++ b/create_user.py @@ -26,7 +26,7 @@ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'iotDashboard.settings') # Import Django settings and configure password hasher manually from django.conf import settings if not settings.configured: - from iotDashboard.settings import * + from iotDashboard.settings import SECRET_KEY settings.configure( PASSWORD_HASHERS=[ 'django.contrib.auth.hashers.PBKDF2PasswordHasher', diff --git a/iotDashboard/dashboard_models.py b/iotDashboard/dashboard_models.py index 4de5755..61cd234 100644 --- a/iotDashboard/dashboard_models.py +++ b/iotDashboard/dashboard_models.py @@ -10,7 +10,6 @@ PostgreSQL is chosen over Redis because: """ from django.db import models -from django.utils import timezone class DashboardLayout(models.Model): diff --git a/iotDashboard/health_insights.py b/iotDashboard/health_insights.py index ed61b04..9da70a6 100644 --- a/iotDashboard/health_insights.py +++ b/iotDashboard/health_insights.py @@ -7,7 +7,7 @@ Shows how weather and air quality affect health metrics. from typing import Dict, List, Optional from dataclasses import dataclass -from datetime import datetime, timedelta +from datetime import datetime @dataclass diff --git a/iotDashboard/run_suitability.py b/iotDashboard/run_suitability.py index 9e11dc8..c8802d6 100644 --- a/iotDashboard/run_suitability.py +++ b/iotDashboard/run_suitability.py @@ -5,7 +5,7 @@ Combines weather, air quality, and health data to determine if conditions are su Provides time-based recommendations and personalized insights. """ -from typing import Dict, List, Optional, Tuple +from typing import List, Optional, Tuple from dataclasses import dataclass from datetime import datetime, time diff --git a/services/gpt_service/gpt_service.py b/services/gpt_service/gpt_service.py index 76753c0..d71f53f 100644 --- a/services/gpt_service/gpt_service.py +++ b/services/gpt_service/gpt_service.py @@ -405,7 +405,7 @@ Keep all text concise: summary under 50 words, each item under 20 words.""", try: dt = datetime.fromisoformat(current_time.replace('Z', '+00:00')) time_str = dt.strftime("%A, %B %d at %I:%M %p") - except: + except (ValueError, AttributeError): time_str = current_time context_sections.append(f"Current Time: {time_str}")