Skip to content

Commit 481f67e

Browse files
committed
Lint: Fix import order, remove unused imports, and clean up per ruff recommendations
1 parent 14c5353 commit 481f67e

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

run_graphistry_mcp.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def find_available_port(start_port=8080, max_attempts=20):
8282

8383
# Check if MCP server port is available (commonly uses port 8080)
8484
if not is_port_available(8080):
85-
logger.warning(f"⚠️ Port 8080 is already in use by another process")
86-
print(f"⚠️ Warning: Port 8080 is already in use by another process.", file=sys.stderr)
85+
logger.warning("⚠️ Port 8080 is already in use by another process")
86+
print("⚠️ Warning: Port 8080 is already in use by another process.", file=sys.stderr)
8787

8888
# Find an alternative port
8989
alt_port = find_available_port(8081)
@@ -94,7 +94,7 @@ def find_available_port(start_port=8080, max_attempts=20):
9494
# Set environment variable with alternative port suggestion
9595
os.environ["GRAPHISTRY_SUGGESTED_PORT"] = str(alt_port)
9696
else:
97-
print(f"❌ No alternative ports available in range 8081-8100.", file=sys.stderr)
97+
print("❌ No alternative ports available in range 8081-8100.", file=sys.stderr)
9898
logger.warning("No alternative ports available in range 8081-8100")
9999

100100
try:
@@ -106,7 +106,7 @@ def find_available_port(start_port=8080, max_attempts=20):
106106
if result.stdout:
107107
print(f"Process using port 8080:\n{result.stdout}", file=sys.stderr)
108108
logger.info(f"Process using port 8080:\n{result.stdout}")
109-
print(f"To free the port, you can terminate the process using: kill <PID>", file=sys.stderr)
109+
print("To free the port, you can terminate the process using: kill <PID>", file=sys.stderr)
110110
except Exception as e:
111111
logger.error(f"Unable to check what's using port 8080: {e}")
112112
except Exception as e:
@@ -255,7 +255,7 @@ def install_dependency(package):
255255
env_username = os.environ.get("GRAPHISTRY_USERNAME")
256256
env_password = os.environ.get("GRAPHISTRY_PASSWORD")
257257

258-
print(f"Environment variables:")
258+
print("Environment variables:")
259259
print(f"GRAPHISTRY_USERNAME found: {'Yes' if env_username else 'No'}")
260260
print(f"GRAPHISTRY_PASSWORD found: {'Yes' if env_password else 'No'}")
261261

@@ -268,7 +268,7 @@ def install_dependency(package):
268268
env_values = dotenv_values(dotenv_path)
269269
dotenv_username = env_values.get('GRAPHISTRY_USERNAME')
270270
dotenv_password = env_values.get('GRAPHISTRY_PASSWORD')
271-
print(f"Credentials from .env file:")
271+
print("Credentials from .env file:")
272272
print(f"GRAPHISTRY_USERNAME found: {'Yes' if dotenv_username else 'No'}")
273273
print(f"GRAPHISTRY_PASSWORD found: {'Yes' if dotenv_password else 'No'}")
274274

src/graphistry_mcp_server/server.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
GPU-accelerated visualization capabilities.
1010
"""
1111

12-
import asyncio
13-
import json
1412
import logging
15-
from typing import Any, Dict, List, Optional, Tuple, Union, cast
13+
from typing import Any, Dict, Optional
1614
import os
1715

1816
from dotenv import load_dotenv

tests/test_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44
import json
55
import os
6-
from typing import Dict, Any, List
6+
from typing import Dict, Any
77
import pytest
88
import graphistry
99
from dotenv import load_dotenv
@@ -21,7 +21,7 @@
2121
print(f"\nInitializing Graphistry with username: {username}")
2222
graphistry.register(api=3, protocol="https", server="hub.graphistry.com", username=username, password=password)
2323

24-
def parse_mcp_response(response) -> Dict[str, Any]:
24+
def parse_mcp_response(response: Any) -> Dict[str, Any]:
2525
"""Parse MCP response into a dictionary."""
2626
if isinstance(response, list) and len(response) > 0:
2727
content = response[0]

0 commit comments

Comments
 (0)