Skip to content

Commit 6a0462b

Browse files
resolved pylint issues
1 parent 26d9331 commit 6a0462b

6 files changed

Lines changed: 22 additions & 23 deletions

File tree

src/backend/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
from azure.monitor.opentelemetry import configure_azure_monitor
13-
#from common.config.app_config import config
13+
# from common.config.app_config import config
1414
from common.models.messages_af import UserLanguage
1515

1616
# FastAPI imports
@@ -66,7 +66,7 @@ async def lifespan(app: FastAPI):
6666
)
6767

6868
# Configure logging levels from environment variables
69-
#logging.basicConfig(level=getattr(logging, config.AZURE_BASIC_LOGGING_LEVEL.upper(), logging.INFO))
69+
# logging.basicConfig(level=getattr(logging, config.AZURE_BASIC_LOGGING_LEVEL.upper(), logging.INFO))
7070

7171
# Configure Azure package logging levels
7272
azure_level = getattr(logging, config.AZURE_PACKAGE_LOGGING_LEVEL.upper(), logging.WARNING)

src/backend/v4/callbacks/response_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ async def streaming_agent_response_callback(
121121
try:
122122
# Handle various streaming update object shapes
123123
chunk_text = getattr(update, "text", None)
124-
124+
125125
# If text is None, don't fall back to str(update) as that would show object repr
126126
# Just skip if there's no actual text content
127127
if chunk_text is None:

src/backend/v4/magentic_agents/common/lifecycle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ async def _after_open(self) -> None:
149149

150150
def get_chat_client(self) -> AzureAIClient:
151151
"""Return the underlying ChatClientProtocol (AzureAIClient).
152-
152+
153153
Uses agent_name with use_latest_version=True to get the latest agent version.
154154
Agent reuse is handled automatically by the SDK via agent_name.
155155
"""
@@ -173,7 +173,7 @@ def get_chat_client(self) -> AzureAIClient:
173173

174174
def get_agent_id(self) -> str:
175175
"""Generate a local agent ID for the ChatAgent wrapper.
176-
176+
177177
The new AzureAIClient identifies agents by name (not ID) on the server side.
178178
This ID is only used locally for the ChatAgent wrapper instance.
179179
"""

src/backend/v4/magentic_agents/foundry_agent.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ async def _create_azure_search_enabled_client(self) -> Optional[AzureAIClient]:
174174
f"{self.agent_instructions} "
175175
"Always use the Azure AI Search tool and configured index for knowledge retrieval."
176176
)
177-
178177

179178
azure_agent = await self.project_client.agents.create_version(
180179
agent_name=self.agent_name, # Use original name

src/backend/v4/orchestration/human_approval_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def __init__(self, user_id: str, agent, *args, **kwargs):
8585
ORCHESTRATOR_TASK_LEDGER_PLAN_UPDATE_PROMPT + plan_append
8686
)
8787
kwargs["final_answer_prompt"] = ORCHESTRATOR_FINAL_ANSWER_PROMPT + final_append
88-
88+
8989
# Override progress ledger prompt to discourage re-calling agents
9090
from agent_framework._workflows._magentic import ORCHESTRATOR_PROGRESS_LEDGER_PROMPT
9191
kwargs["progress_ledger_prompt"] = ORCHESTRATOR_PROGRESS_LEDGER_PROMPT + progress_append
@@ -319,4 +319,4 @@ def plan_to_obj(self, magentic_context: MagenticContext, ledger) -> MPlan:
319319
task=task_text,
320320
)
321321

322-
return return_plan
322+
return return_plan

src/backend/v4/orchestration/orchestration_manager.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def __init__(self):
5050
def _extract_response_text(self, data) -> str:
5151
"""
5252
Extract text content from various agent_framework response types.
53-
53+
5454
Handles:
5555
- ChatMessage: Extract .text
5656
- AgentResponse: Extract .text
@@ -59,15 +59,15 @@ def _extract_response_text(self, data) -> str:
5959
"""
6060
if data is None:
6161
return ""
62-
62+
6363
# Direct ChatMessage
6464
if isinstance(data, ChatMessage):
6565
return data.text or ""
66-
66+
6767
# Has .text attribute directly (AgentResponse, etc.)
6868
if hasattr(data, "text") and data.text:
6969
return data.text
70-
70+
7171
# AgentExecutorResponse - has agent_response and full_conversation
7272
if hasattr(data, "agent_response"):
7373
# Try to get text from agent_response first
@@ -79,7 +79,7 @@ def _extract_response_text(self, data) -> str:
7979
last_msg = data.full_conversation[-1]
8080
if isinstance(last_msg, ChatMessage) and last_msg.text:
8181
return last_msg.text
82-
82+
8383
# List of items - could be AgentExecutorResponse, ChatMessage, etc.
8484
if isinstance(data, list) and len(data) > 0:
8585
texts = []
@@ -91,7 +91,7 @@ def _extract_response_text(self, data) -> str:
9191
if texts:
9292
# Return the last non-empty response (most recent)
9393
return texts[-1]
94-
94+
9595
return ""
9696

9797
# ---------------------------
@@ -195,12 +195,12 @@ async def init_orchestration(
195195

196196
# Assemble workflow with callback
197197
storage = InMemoryCheckpointStorage()
198-
198+
199199
# New SDK: participants() accepts a Sequence (list) of agents
200200
# The orchestrator uses agent.name to identify them
201201
participant_list = list(participants.values())
202202
cls.logger.info("Participants for workflow: %s", list(participants.keys()))
203-
203+
204204
builder = (
205205
MagenticBuilder()
206206
.participants(participant_list) # New SDK: pass as list
@@ -241,7 +241,7 @@ async def get_current_or_new_orchestration(
241241
"""
242242
current = orchestration_config.get_current_orchestration(user_id)
243243
needs_rebuild = current is None or team_switched or force_rebuild
244-
244+
245245
if needs_rebuild:
246246
if current is not None and (team_switched or force_rebuild):
247247
reason = "team switched" if team_switched else "force rebuild for new task"
@@ -387,7 +387,7 @@ async def run_orchestration(self, user_id: str, input_task) -> None:
387387
event_type_name = type(event).__name__
388388
if event_type_name != "AgentRunUpdateEvent":
389389
self.logger.info("[EVENT] %s", event_type_name)
390-
390+
391391
# Handle orchestrator events (plan, progress ledger)
392392
if isinstance(event, MagenticOrchestratorEvent):
393393
self.logger.info(
@@ -403,7 +403,7 @@ async def run_orchestration(self, user_id: str, input_task) -> None:
403403
elif isinstance(event, AgentRunUpdateEvent):
404404
message_id = event.data.message_id if hasattr(event.data, 'message_id') else None
405405
executor_id = event.executor_id
406-
406+
407407
# Stream the update
408408
try:
409409
await streaming_agent_response_callback(
@@ -417,7 +417,7 @@ async def run_orchestration(self, user_id: str, input_task) -> None:
417417
"Error in streaming callback for agent %s: %s",
418418
executor_id, e
419419
)
420-
420+
421421
# Track message for formatting
422422
if message_id != last_message_id:
423423
last_message_id = message_id
@@ -427,14 +427,14 @@ async def run_orchestration(self, user_id: str, input_task) -> None:
427427
agent_name = event.participant_name
428428
agent_call_counts[agent_name] = agent_call_counts.get(agent_name, 0) + 1
429429
call_num = agent_call_counts[agent_name]
430-
430+
431431
self.logger.info(
432432
"[REQUEST SENT (round %d)] to agent: %s (call #%d)",
433433
event.round_index,
434434
agent_name,
435435
call_num
436436
)
437-
437+
438438
if call_num > 1:
439439
self.logger.warning("Agent '%s' called %d times", agent_name, call_num)
440440

@@ -448,7 +448,7 @@ async def run_orchestration(self, user_id: str, input_task) -> None:
448448
# Send the agent response to the UI
449449
if event.data:
450450
response_text = self._extract_response_text(event.data)
451-
451+
452452
if response_text:
453453
self.logger.info("Sending agent response to UI from %s", event.participant_name)
454454
agent_response_callback(

0 commit comments

Comments
 (0)