Skip to content

Commit 09ef905

Browse files
resolve pylint issue
1 parent 58b32f7 commit 09ef905

4 files changed

Lines changed: 11 additions & 12 deletions

File tree

src/api/api/api_routes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,17 @@ async def conversation(request: Request):
103103
request_json = await request.json()
104104
conversation_id = request_json.get("conversation_id")
105105
query = request_json.get("query")
106-
106+
107107
# Track chat request initiation
108108
track_event_if_configured("ChatRequestReceived", {
109109
"conversation_id": conversation_id
110110
})
111-
111+
112112
# Attach conversation_id to current span for Application Insights correlation
113113
span = trace.get_current_span()
114114
if span and conversation_id:
115115
span.set_attribute("conversation_id", conversation_id)
116-
116+
117117
chat_service = ChatService()
118118
result = await chat_service.stream_chat_request(conversation_id, query)
119119
track_event_if_configured(
@@ -124,14 +124,14 @@ async def conversation(request: Request):
124124

125125
except Exception as ex:
126126
logger.exception("Error in conversation endpoint: %s", str(ex))
127-
127+
128128
# Track specific error type
129129
track_event_if_configured("ChatRequestError", {
130130
"conversation_id": request_json.get("conversation_id") if 'request_json' in locals() else "",
131131
"error": str(ex),
132132
"error_type": type(ex).__name__
133133
})
134-
134+
135135
span = trace.get_current_span()
136136
if span is not None:
137137
span.record_exception(ex)

src/api/api/history_routes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging
2-
import os
32
from fastapi import APIRouter, HTTPException, Query, Request
43
from fastapi.responses import JSONResponse
54
from auth.auth_utils import get_authenticated_user_details

src/api/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
logging.getLogger("azure.monitor.opentelemetry.exporter.export._base").setLevel(logging.WARNING)
4949

5050
# Configure Azure Monitor and OpenTelemetry before importing routes
51-
from azure.monitor.opentelemetry import configure_azure_monitor
52-
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
51+
from azure.monitor.opentelemetry import configure_azure_monitor # noqa: E402
52+
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor # noqa: E402
5353

5454

5555
def build_app() -> FastAPI:
@@ -89,7 +89,7 @@ async def health_check():
8989
enable_live_metrics=True,
9090
disable_offline_storage=True # Reduces "Storing events" logs
9191
)
92-
92+
9393
# Instrument FastAPI app to automatically trace all requests
9494
FastAPIInstrumentor.instrument_app(fastapi_app)
9595
logging.info("Application Insights configured with live metrics and FastAPI instrumentation enabled")

src/api/services/history_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ async def delete_conversation(self, user_id: str, conversation_id: str) -> bool:
236236
logger.info("Successfully deleted conversation %s for user %s", conversation_id, user_id)
237237
return True
238238

239-
except Exception as e:
239+
except Exception:
240240
logger.exception("Error deleting conversation %s for user %s", conversation_id, user_id)
241241
return False
242242

@@ -288,7 +288,7 @@ async def get_messages(self, user_id: str, conversation_id: str):
288288
messages = await cosmos_conversation_client.get_messages(conversation_id)
289289
return messages
290290

291-
except Exception as e:
291+
except Exception:
292292
logger.exception(
293293
"Error retrieving messages for conversation %s", conversation_id)
294294
return []
@@ -371,7 +371,7 @@ async def clear_messages(self, user_id: str, conversation_id: str) -> bool:
371371
"Successfully cleared messages in conversation %s for user %s", conversation_id, user_id)
372372
return True
373373

374-
except Exception as e:
374+
except Exception:
375375
logger.exception(
376376
"Error clearing messages for conversation %s", conversation_id)
377377
return False

0 commit comments

Comments
 (0)