From 2dc7479d1135f1dc30e462d8bb6880b646a4f6a5 Mon Sep 17 00:00:00 2001 From: Mark Paronyan Date: Wed, 30 Sep 2026 20:45:44 +0300 Subject: [PATCH] style: remove f-strings without placeholders --- gns3server/agent/mcp/templates.py | 2 +- gns3server/compute/qemu/__init__.py | 2 +- gns3server/compute/virtualbox/virtualbox_vm.py | 2 +- gns3server/controller/__init__.py | 2 +- gns3server/db/tasks.py | 2 +- gns3server/utils/images.py | 2 +- scripts/extract_mermaid.py | 2 +- tests/agent/mcp/test_handlers.py | 2 +- tests/api/routes/controller/test_acl.py | 12 ++++++------ tests/stress/benchmark_running_server.py | 2 +- tests/stress/telnet_race_condition_test.py | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/gns3server/agent/mcp/templates.py b/gns3server/agent/mcp/templates.py index a80f08ff9..56e02680a 100644 --- a/gns3server/agent/mcp/templates.py +++ b/gns3server/agent/mcp/templates.py @@ -173,7 +173,7 @@ def delete_template_handler(params: dict[str, Any], gns3_ctx: dict[str, Any]) -> template_id = matches[0]["template_id"] conn.http_call("delete", f"{conn.base_url}/templates/{template_id}") - return {"message": f"Template deleted"} + return {"message": "Template deleted"} # ── Tool definitions ─────────────────────────────────────────────────────── diff --git a/gns3server/compute/qemu/__init__.py b/gns3server/compute/qemu/__init__.py index f01fdb68e..5a01be047 100644 --- a/gns3server/compute/qemu/__init__.py +++ b/gns3server/compute/qemu/__init__.py @@ -178,7 +178,7 @@ class Qemu(BaseManager): qemu_img_path = shutil.which("qemu-img") if not qemu_img_path: - raise QemuError(f"Could not find qemu-img binary") + raise QemuError("Could not find qemu-img binary") try: if os.path.exists(disk_image_path): diff --git a/gns3server/compute/virtualbox/virtualbox_vm.py b/gns3server/compute/virtualbox/virtualbox_vm.py index 8cb9f8016..1a6f43183 100644 --- a/gns3server/compute/virtualbox/virtualbox_vm.py +++ b/gns3server/compute/virtualbox/virtualbox_vm.py @@ -241,7 +241,7 @@ class VirtualBoxVM(BaseNode): try: tree = ET.parse(linked_vbox_file) except ET.ParseError: - raise VirtualBoxError(f"Cannot modify VirtualBox linked node file. File {{linked_vbox_file}} is corrupted.") + raise VirtualBoxError("Cannot modify VirtualBox linked node file. File {linked_vbox_file} is corrupted.") except OSError as e: raise VirtualBoxError(f"Cannot modify VirtualBox linked nodes file '{self._linked_vbox_file()}': {e}") diff --git a/gns3server/controller/__init__.py b/gns3server/controller/__init__.py index debc6960a..026cd2b6e 100644 --- a/gns3server/controller/__init__.py +++ b/gns3server/controller/__init__.py @@ -176,7 +176,7 @@ class Controller: protocol = server_config.protocol.value if self._ssl_context and protocol != "https": - log.warning(f"Protocol changed to 'https' for local compute because SSL is enabled") + log.warning("Protocol changed to 'https' for local compute because SSL is enabled") protocol = "https" try: self._local_server = await self.add_compute( diff --git a/gns3server/db/tasks.py b/gns3server/db/tasks.py index b9decd868..3045fd2c1 100644 --- a/gns3server/db/tasks.py +++ b/gns3server/db/tasks.py @@ -168,7 +168,7 @@ async def disconnect_from_db(app: FastAPI) -> None: # dispose of the connection pool used by the database engine if app.state._db_engine: await app.state._db_engine.dispose() - log.info(f"Disconnected from database") + log.info("Disconnected from database") async def get_computes(app: FastAPI) -> List[schemas.Compute]: diff --git a/gns3server/utils/images.py b/gns3server/utils/images.py index cbb5f20ca..51f84f75a 100644 --- a/gns3server/utils/images.py +++ b/gns3server/utils/images.py @@ -214,7 +214,7 @@ def default_images_directory(image_type): elif image_type == "dynamips" or image_type == "ios": return os.path.join(img_dir, "IOS") else: - raise NotImplementedError(f"%s node type is not supported", image_type) + raise NotImplementedError("%s node type is not supported", image_type) def images_directories(image_type, include_parent_directory=True): diff --git a/scripts/extract_mermaid.py b/scripts/extract_mermaid.py index aae2044b9..a134e3eed 100755 --- a/scripts/extract_mermaid.py +++ b/scripts/extract_mermaid.py @@ -337,7 +337,7 @@ def main(): versions = os.listdir(item_path) print(f" {item}: {', '.join(versions)}") else: - print(f" Puppeteer cache: NOT FOUND") + print(" Puppeteer cache: NOT FOUND") print(f"\n Result: {'✓ ALL CHECKS PASSED' if ok else '✗ SOME CHECKS FAILED'}") sys.exit(0 if ok else 1) diff --git a/tests/agent/mcp/test_handlers.py b/tests/agent/mcp/test_handlers.py index d98f754b0..97938a35d 100644 --- a/tests/agent/mcp/test_handlers.py +++ b/tests/agent/mcp/test_handlers.py @@ -553,7 +553,7 @@ class TestLink: # a short path-bound ticket replaces the long Bearer JWT in the URL assert "?token=gns3t_" in result["download_url"] assert "Bearer" not in result["curl_command"] - path = f"/v3/projects/p1/links/l1/capture/file" + path = "/v3/projects/p1/links/l1/capture/file" ticket = result["download_url"].split("token=")[1] assert result["curl_command"] == f"curl -L -o capture.pcap '{result['download_url']}'" redeemed = access_ticket_service.redeem_for_path(ticket, path) diff --git a/tests/api/routes/controller/test_acl.py b/tests/api/routes/controller/test_acl.py index 915ab6da5..ed1fee046 100644 --- a/tests/api/routes/controller/test_acl.py +++ b/tests/api/routes/controller/test_acl.py @@ -59,7 +59,7 @@ class TestACLRoutes: await rbac_repo.create_ace(ace) # add an ACE on /projects to allow user to create a project - path = f"/projects" + path = "/projects" new_ace = {"path": path, "ace_type": "user", "user_id": str(test_user.user_id), "role_id": role_id} response = await authorized_client.post(app.url_path_for("create_ace"), json=new_ace) @@ -99,7 +99,7 @@ class TestACLRoutes: async def test_get_ace(self, app: FastAPI, client: AsyncClient, db_session: AsyncSession) -> None: rbac_repo = RbacRepository(db_session) - ace_in_db = await rbac_repo.get_ace_by_path(f"/projects") + ace_in_db = await rbac_repo.get_ace_by_path("/projects") response = await client.get(app.url_path_for("get_ace", ace_id=ace_in_db.ace_id)) assert response.status_code == status.HTTP_200_OK assert response.json()["ace_id"] == str(ace_in_db.ace_id) @@ -115,13 +115,13 @@ class TestACLRoutes: ) -> None: rbac_repo = RbacRepository(db_session) - ace_in_db = await rbac_repo.get_ace_by_path(f"/projects") + ace_in_db = await rbac_repo.get_ace_by_path("/projects") - update_ace = {"path": f"/appliances", "ace_type": "user", "user_id": str(test_user.user_id), "role_id": role_id} + update_ace = {"path": "/appliances", "ace_type": "user", "user_id": str(test_user.user_id), "role_id": role_id} response = await client.put(app.url_path_for("update_ace", ace_id=ace_in_db.ace_id), json=update_ace) assert response.status_code == status.HTTP_200_OK updated_ace_in_db = await rbac_repo.get_ace(ace_in_db.ace_id) - assert updated_ace_in_db.path == f"/appliances" + assert updated_ace_in_db.path == "/appliances" async def test_delete_ace( self, @@ -131,7 +131,7 @@ class TestACLRoutes: ) -> None: rbac_repo = RbacRepository(db_session) - ace_in_db = await rbac_repo.get_ace_by_path(f"/appliances") + ace_in_db = await rbac_repo.get_ace_by_path("/appliances") response = await client.delete(app.url_path_for("delete_ace", ace_id=ace_in_db.ace_id)) assert response.status_code == status.HTTP_204_NO_CONTENT diff --git a/tests/stress/benchmark_running_server.py b/tests/stress/benchmark_running_server.py index 234372100..fcc5e7640 100644 --- a/tests/stress/benchmark_running_server.py +++ b/tests/stress/benchmark_running_server.py @@ -89,7 +89,7 @@ async def benchmark_get_projects(base_url, headers, project_count, iterations=10 """Benchmark GET /projects endpoint""" print(f"\n{'=' * 60}") - print(f"GET /projects Performance Benchmark") + print("GET /projects Performance Benchmark") print(f"{'=' * 60}") print(f"Server: {base_url}") print(f"{'=' * 60}\n") diff --git a/tests/stress/telnet_race_condition_test.py b/tests/stress/telnet_race_condition_test.py index 05d245201..e808d319f 100644 --- a/tests/stress/telnet_race_condition_test.py +++ b/tests/stress/telnet_race_condition_test.py @@ -288,7 +288,7 @@ async def run_stress_test( log.info(f"Device Type: {device_type}") log.info(f"Rapid clients: {rapid_clients} (each {iterations_per_client} iterations)") log.info(f"Long-lived clients: {long_lived_clients} (duration: {test_duration}s)") - log.info(f"Expected behavior: Rapid clients disconnect, long-lived clients unaffected") + log.info("Expected behavior: Rapid clients disconnect, long-lived clients unaffected") log.info("=" * 70) tasks: List[asyncio.Task] = []