mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-03 09:10:11 +03:00
style: remove f-strings without placeholders
This commit is contained in:
parent
c9416d2569
commit
2dc7479d11
@ -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 ───────────────────────────────────────────────────────
|
||||
|
||||
@ -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):
|
||||
|
||||
@ -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}")
|
||||
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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]:
|
||||
|
||||
@ -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):
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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] = []
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user