Skip to content

Commit 2b5d25e

Browse files
committed
fixes: linting for whitespace on blank lines
1 parent 4089af7 commit 2b5d25e

22 files changed

+519
-685
lines changed

app/api/logs.py

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,7 @@ async def get_log(
9191
log = await log_service.get_log_by_id(log_id)
9292

9393
if not log:
94-
raise HTTPException(
95-
status_code=status.HTTP_404_NOT_FOUND,
96-
detail="Log entry not found"
97-
)
94+
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Log entry not found")
9895

9996
return LogEntryResponse.model_validate(log)
10097

@@ -114,18 +111,18 @@ async def get_ai_status(
114111
Note: When AI fails, system automatically falls back to basic analysis.
115112
"""
116113
settings = get_settings()
117-
ai_enabled = getattr(settings, 'ai_analysis_enabled', True)
114+
ai_enabled = getattr(settings, "ai_analysis_enabled", True)
118115

119116
return APIResponse(
120117
data={
121118
"ai_enabled": ai_enabled,
122119
"processing_mode": (
123120
"AI with automatic fallback" if ai_enabled else "Basic analysis only"
124121
),
125-
"ai_timeout_seconds": getattr(settings, 'ai_timeout_seconds', 10),
126-
"ai_retry_attempts": getattr(settings, 'ai_retry_attempts', 2),
127-
"ai_confidence_threshold": getattr(settings, 'ai_confidence_threshold', 0.5),
128-
"real_time_processing": getattr(settings, 'enable_real_time_processing', True),
122+
"ai_timeout_seconds": getattr(settings, "ai_timeout_seconds", 10),
123+
"ai_retry_attempts": getattr(settings, "ai_retry_attempts", 2),
124+
"ai_confidence_threshold": getattr(settings, "ai_confidence_threshold", 0.5),
125+
"real_time_processing": getattr(settings, "enable_real_time_processing", True),
129126
"note": "When AI fails, system automatically uses basic analysis as fallback",
130127
},
131128
status_code=200,
@@ -157,9 +154,7 @@ async def toggle_ai_processing(
157154
logger.info(
158155
"ai_processing_toggled",
159156
ai_enabled=enable_ai,
160-
processing_mode=(
161-
"AI with automatic fallback" if enable_ai else "Basic analysis only"
162-
),
157+
processing_mode=("AI with automatic fallback" if enable_ai else "Basic analysis only"),
163158
user=current_user.get("sub", "unknown"),
164159
)
165160

@@ -204,24 +199,15 @@ async def get_processing_stats(
204199
start_date = end_date - timedelta(hours=24)
205200

206201
_, error_count = await log_service.get_logs(
207-
log_level="ERROR",
208-
start_date=start_date,
209-
end_date=end_date,
210-
limit=1
202+
log_level="ERROR", start_date=start_date, end_date=end_date, limit=1
211203
)
212204

213205
_, warning_count = await log_service.get_logs(
214-
log_level="WARNING",
215-
start_date=start_date,
216-
end_date=end_date,
217-
limit=1
206+
log_level="WARNING", start_date=start_date, end_date=end_date, limit=1
218207
)
219208

220209
_, info_count = await log_service.get_logs(
221-
log_level="INFO",
222-
start_date=start_date,
223-
end_date=end_date,
224-
limit=1
210+
log_level="INFO", start_date=start_date, end_date=end_date, limit=1
225211
)
226212

227213
total_24h = error_count + warning_count + info_count
@@ -238,9 +224,9 @@ async def get_processing_stats(
238224
"error_rate": round(error_rate, 2),
239225
},
240226
"processing_status": {
241-
"ai_enabled": getattr(get_settings(), 'ai_analysis_enabled', True),
227+
"ai_enabled": getattr(get_settings(), "ai_analysis_enabled", True),
242228
"real_time_processing": getattr(
243-
get_settings(), 'enable_real_time_processing', True
229+
get_settings(), "enable_real_time_processing", True
244230
),
245231
},
246232
},

app/core/auth_external.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async def validate_token_with_external_service(token: str) -> Optional[Dict[str,
3434
response = await client.post(
3535
f"{settings.auth_service_url}/validate-token",
3636
json={"token": token},
37-
headers={"Content-Type": "application/json"}
37+
headers={"Content-Type": "application/json"},
3838
)
3939

4040
if response.status_code == 200:
@@ -164,11 +164,7 @@ def create_test_token(user_id: str = "test-user", roles: list = None) -> str:
164164
"exp": datetime.utcnow() + timedelta(minutes=settings.jwt_expiration_minutes),
165165
}
166166

167-
token = jwt.encode(
168-
payload,
169-
settings.jwt_secret_key,
170-
algorithm=settings.jwt_algorithm
171-
)
167+
token = jwt.encode(payload, settings.jwt_secret_key, algorithm=settings.jwt_algorithm)
172168

173169
logger.info("test_token_created", user_id=user_id)
174170
return token

app/core/config.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ class Settings(BaseSettings):
4747
rabbitmq_user: str = Field(default="guest", description="RabbitMQ username")
4848
rabbitmq_password: str = Field(default="guest", description="RabbitMQ password")
4949
rabbitmq_vhost: str = Field(default="/", description="RabbitMQ virtual host")
50-
rabbitmq_prefetch_count: int = Field(
51-
default=10, ge=1, description="RabbitMQ prefetch count"
52-
)
50+
rabbitmq_prefetch_count: int = Field(default=10, ge=1, description="RabbitMQ prefetch count")
5351
rabbitmq_reconnect_delay: int = Field(
5452
default=5, ge=1, description="RabbitMQ reconnect delay in seconds"
5553
)
@@ -69,9 +67,7 @@ class Settings(BaseSettings):
6967
description="JWT secret key",
7068
)
7169
jwt_algorithm: str = Field(default="HS256", description="JWT algorithm")
72-
jwt_expiration_minutes: int = Field(
73-
default=60, ge=1, description="JWT expiration in minutes"
74-
)
70+
jwt_expiration_minutes: int = Field(default=60, ge=1, description="JWT expiration in minutes")
7571
api_gateway_public_key: Optional[str] = Field(
7672
default=None, description="API Gateway public key for JWT verification"
7773
)
@@ -103,13 +99,10 @@ class Settings(BaseSettings):
10399

104100
# AI Configuration
105101
ai_analysis_enabled: bool = Field(
106-
default=True, description=(
107-
"Enable AI-powered log analysis (if disabled, uses basic analysis)"
108-
)
109-
)
110-
ai_timeout_seconds: int = Field(
111-
default=10, ge=1, description="AI analysis timeout in seconds"
102+
default=True,
103+
description=("Enable AI-powered log analysis (if disabled, uses basic analysis)"),
112104
)
105+
ai_timeout_seconds: int = Field(default=10, ge=1, description="AI analysis timeout in seconds")
113106
ai_retry_attempts: int = Field(
114107
default=2, ge=0, description="Number of AI analysis retry attempts"
115108
)
@@ -132,9 +125,7 @@ class Settings(BaseSettings):
132125
rate_limit_requests: int = Field(
133126
default=100, ge=1, description="Rate limit requests per period"
134127
)
135-
rate_limit_period: int = Field(
136-
default=60, ge=1, description="Rate limit period in seconds"
137-
)
128+
rate_limit_period: int = Field(default=60, ge=1, description="Rate limit period in seconds")
138129

139130
# CORS Settings
140131
cors_enabled: bool = Field(default=True, description="Enable CORS")
@@ -164,9 +155,7 @@ class Settings(BaseSettings):
164155
enable_real_time_processing: bool = Field(
165156
default=True, description="Enable real-time log processing"
166157
)
167-
enable_pattern_clustering: bool = Field(
168-
default=True, description="Enable pattern clustering"
169-
)
158+
enable_pattern_clustering: bool = Field(default=True, description="Enable pattern clustering")
170159
enable_ml_anomaly_detection: bool = Field(
171160
default=True, description="Enable ML-based anomaly detection"
172161
)

0 commit comments

Comments
 (0)