Skip to content

Commit 5a683db

Browse files
Pylint issues fixed
1 parent 3105a0e commit 5a683db

File tree

17 files changed

+192
-98
lines changed

17 files changed

+192
-98
lines changed

src/backend/agents/agentutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from pydantic import BaseModel
88

99
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
10-
from src.backend.models.messages import InputTask, PlanStatus, Step, StepStatus
10+
from src.backend.models.messages import Step
1111

1212
common_agent_system_message = "If you do not have the information for the arguments of the function you need to call, do not call the function. Instead, respond back to the user requesting further information. You must not hallucinate or invent any of the information used as arguments in the function. For example, if you need to call a function that requires a delivery address, you must not generate 123 Example St. You must skip calling functions and return a clarification message along the lines of: Sorry, I'm missing some information I need to help you with that. Could you please provide the delivery address so I can do that for you?"
1313

src/backend/agents/base_agent.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
1717
from src.backend.models.messages import (
18-
ActionRequest,
18+
ActionRequest,
1919
ActionResponse,
20-
AgentMessage,
21-
Step,
22-
StepStatus
20+
AgentMessage,
21+
Step,
22+
StepStatus,
2323
)
2424
from azure.monitor.events.extension import track_event
2525

src/backend/agents/planner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
1717
from src.backend.models.messages import (
18-
ActionRequest,
1918
AgentMessage,
2019
HumanClarification,
2120
BAgentType,

src/backend/app.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@
66
from typing import List, Optional
77
from src.backend.middleware.health_check import HealthCheckMiddleware
88
from autogen_core.base import AgentId
9-
from fastapi import Depends, FastAPI, HTTPException, Query, Request
10-
from fastapi.responses import RedirectResponse
11-
from fastapi.staticfiles import StaticFiles
9+
from fastapi import FastAPI, HTTPException, Query, Request
1210
from src.backend.auth.auth_utils import get_authenticated_user_details
1311
from src.backend.config import Config
1412
from src.backend.context.cosmos_memory import CosmosBufferedChatCompletionContext
1513
from src.backend.models.messages import (
16-
BaseDataModel,
1714
HumanFeedback,
1815
HumanClarification,
1916
InputTask,
@@ -22,7 +19,11 @@
2219
AgentMessage,
2320
PlanWithSteps,
2421
)
25-
from src.backend.utils import initialize_runtime_and_context, retrieve_all_agent_tools, rai_success
22+
from src.backend.utils import (
23+
initialize_runtime_and_context,
24+
retrieve_all_agent_tools,
25+
rai_success,
26+
)
2627
import asyncio
2728
from fastapi.middleware.cors import CORSMiddleware
2829
from azure.monitor.opentelemetry import configure_azure_monitor

src/backend/models/messages.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ class RequestToSpeak(BaseModel):
294294
def to_dict(self):
295295
return self.model_dump()
296296

297+
297298
class GetHumanInputMessage:
298299
def __init__(self, message):
299300
self.message = message

src/backend/tests/agents/test_tech_support.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import os
22
import sys
33
import pytest
4-
from unittest.mock import AsyncMock, MagicMock
4+
from unittest.mock import MagicMock
55
from autogen_core.components.tools import FunctionTool
66

7-
sys.modules['azure.monitor.events.extension'] = MagicMock()
7+
sys.modules["azure.monitor.events.extension"] = MagicMock()
88

99
# Set environment variables to mock Config dependencies before any import
1010
os.environ["COSMOSDB_ENDPOINT"] = "https://mock-endpoint"
@@ -36,11 +36,9 @@
3636
configure_server,
3737
grant_database_access,
3838
provide_tech_training,
39-
resolve_technical_issue,
4039
configure_printer,
4140
set_up_email_signature,
4241
configure_mobile_device,
43-
manage_software_licenses,
4442
set_up_remote_desktop,
4543
troubleshoot_hardware_issue,
4644
manage_network_security,
@@ -80,25 +78,29 @@ async def test_send_welcome_email():
8078
assert "John Doe" in result
8179
assert "[email protected]" in result
8280

81+
8382
@pytest.mark.asyncio
8483
async def test_set_up_office_365_account():
8584
result = await set_up_office_365_account("Jane Smith", "[email protected]")
8685
assert "Office 365 Account Setup" in result
8786
assert "Jane Smith" in result
8887
assert "[email protected]" in result
8988

89+
9090
@pytest.mark.asyncio
9191
async def test_configure_laptop():
9292
result = await configure_laptop("John Doe", "Dell XPS 15")
9393
assert "Laptop Configuration" in result
9494
assert "Dell XPS 15" in result
9595

96+
9697
@pytest.mark.asyncio
9798
async def test_reset_password():
9899
result = await reset_password("John Doe")
99100
assert "Password Reset" in result
100101
assert "John Doe" in result
101102

103+
102104
@pytest.mark.asyncio
103105
async def test_setup_vpn_access():
104106
result = await setup_vpn_access("John Doe")
@@ -147,12 +149,14 @@ async def test_assist_procurement_with_tech_equipment():
147149
assert "Technical Specifications Provided" in result
148150
assert "Dell Workstation specs" in result
149151

152+
150153
@pytest.mark.asyncio
151154
async def test_provide_tech_support_for_marketing():
152155
result = await provide_tech_support_for_marketing("Holiday Campaign")
153156
assert "Tech Support for Marketing Campaign" in result
154157
assert "Holiday Campaign" in result
155158

159+
156160
@pytest.mark.asyncio
157161
async def test_assist_product_launch():
158162
result = await assist_product_launch("Smartphone X")
@@ -220,6 +224,7 @@ async def test_configure_mobile_device():
220224
assert "Emily" in result
221225
assert "iPhone 13" in result
222226

227+
223228
@pytest.mark.asyncio
224229
async def test_set_up_remote_desktop():
225230
result = await set_up_remote_desktop("Frank")
@@ -261,6 +266,7 @@ async def test_manage_it_inventory():
261266
result = await manage_it_inventory()
262267
assert "IT Inventory Managed" in result
263268

269+
264270
@pytest.mark.asyncio
265271
async def test_configure_firewall_rules():
266272
result = await configure_firewall_rules("Allow traffic on port 8080")
@@ -336,7 +342,9 @@ async def test_manage_system_updates():
336342

337343
@pytest.mark.asyncio
338344
async def test_configure_digital_signatures():
339-
result = await configure_digital_signatures("John Doe", "Company Approved Signature")
345+
result = await configure_digital_signatures(
346+
"John Doe", "Company Approved Signature"
347+
)
340348
assert "Digital Signatures Configured" in result
341349
assert "John Doe" in result
342350
assert "Company Approved Signature" in result
@@ -373,4 +381,4 @@ def test_get_tech_support_tools():
373381
tools = get_tech_support_tools()
374382
assert isinstance(tools, list)
375383
assert len(tools) > 40 # Ensure all tools are included
376-
assert all(isinstance(tool, FunctionTool) for tool in tools)
384+
assert all(isinstance(tool, FunctionTool) for tool in tools)

src/backend/tests/auth/test_auth_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import pytest
21
from unittest.mock import patch, Mock
32
import base64
43
import json
@@ -51,4 +50,4 @@ def test_get_tenantid_with_invalid_b64(mock_logger):
5150
tenant_id = get_tenantid(invalid_b64)
5251

5352
assert tenant_id == ""
54-
mock_logger().exception.assert_called_once()
53+
mock_logger().exception.assert_called_once()

src/backend/tests/auth/test_sample_user.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import pytest
21
from src.backend.auth.sample_user import sample_user # Adjust path as necessary
32

43

@@ -48,10 +47,13 @@ def test_sample_user_keys():
4847

4948
def test_sample_user_values():
5049
# Proceed with assertions
51-
assert sample_user["Accept"].strip() == '*/*' # Ensure no hidden characters
50+
assert sample_user["Accept"].strip() == "*/*" # Ensure no hidden characters
5251
assert sample_user["Content-Type"] == "application/json"
5352
assert sample_user["Disguised-Host"] == "your_app_service.azurewebsites.net"
54-
assert sample_user["X-Ms-Client-Principal-Id"] == "00000000-0000-0000-0000-000000000000"
53+
assert (
54+
sample_user["X-Ms-Client-Principal-Id"]
55+
== "00000000-0000-0000-0000-000000000000"
56+
)
5557
assert sample_user["X-Ms-Client-Principal-Name"] == "[email protected]"
5658
assert sample_user["X-Forwarded-Proto"] == "https"
5759

@@ -79,4 +81,4 @@ def test_sample_user_user_agent():
7981
user_agent = sample_user["User-Agent"]
8082
assert "Mozilla/5.0" in user_agent
8183
assert "Windows NT 10.0" in user_agent
82-
assert "Edg/" in user_agent # Matches Edge's identifier more accurately
84+
assert "Edg/" in user_agent # Matches Edge's identifier more accurately

0 commit comments

Comments
 (0)