Skip to content

Commit 1a8d3a1

Browse files
committed
style: apply ruff formatting
1 parent 54db7f7 commit 1a8d3a1

4 files changed

Lines changed: 27 additions & 8 deletions

File tree

src/wireshark_mcp/installer.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,11 @@ def _print_rows(rows: list[dict[str, str]]) -> None:
586586

587587
def _summarize_status_rows(rows: list[dict[str, str]], statuses: tuple[str, ...]) -> dict[str, int]:
588588
"""Summarize row counts for the requested statuses."""
589-
return {status: sum(row["status"] == status for row in rows) for status in statuses if any(row["status"] == status for row in rows)}
589+
return {
590+
status: sum(row["status"] == status for row in rows)
591+
for status in statuses
592+
if any(row["status"] == status for row in rows)
593+
}
590594

591595

592596
def _collect_client_rows(selected_clients: list[str] | None = None) -> list[dict[str, str]]:
@@ -794,7 +798,12 @@ def install_mcp_servers(*, uninstall: bool = False, selected_clients: list[str]
794798

795799
if not os.path.exists(config_dir):
796800
result_rows.append(
797-
{"marker": "[SKIP]", "name": name, "detail": f"{action_word} skipped (config dir not found)", "path": config_path}
801+
{
802+
"marker": "[SKIP]",
803+
"name": name,
804+
"detail": f"{action_word} skipped (config dir not found)",
805+
"path": config_path,
806+
}
798807
)
799808
skipped += 1
800809
continue
@@ -808,7 +817,9 @@ def install_mcp_servers(*, uninstall: bool = False, selected_clients: list[str]
808817
continue
809818

810819
done_word = "uninstalled" if uninstall else "installed"
811-
result_rows.append({"marker": "[OK]", "name": name, "detail": f"{done_word} (restart required)", "path": config_path})
820+
result_rows.append(
821+
{"marker": "[OK]", "name": name, "detail": f"{done_word} (restart required)", "path": config_path}
822+
)
812823
installed += 1
813824
continue
814825

@@ -827,7 +838,9 @@ def install_mcp_servers(*, uninstall: bool = False, selected_clients: list[str]
827838
_write_json_config(config_path, config)
828839

829840
done_word = "uninstalled" if uninstall else "installed"
830-
result_rows.append({"marker": "[OK]", "name": name, "detail": f"{done_word} (restart required)", "path": config_path})
841+
result_rows.append(
842+
{"marker": "[OK]", "name": name, "detail": f"{done_word} (restart required)", "path": config_path}
843+
)
831844
installed += 1
832845

833846
_print_rows(result_rows)

src/wireshark_mcp/tools/registry.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ def recommended_tools_for_protocols(self, detected_protocols: set[str]) -> list[
159159

160160
recommended = sorted(tool_name for tool_name in tools_to_recommend if tool_name in self._contextual_catalog)
161161

162-
missing_tools = sorted(tool_name for tool_name in tools_to_recommend if tool_name not in self._contextual_catalog)
162+
missing_tools = sorted(
163+
tool_name for tool_name in tools_to_recommend if tool_name not in self._contextual_catalog
164+
)
163165
for tool_name in missing_tools:
164166
logger.warning("Tool %s is in PROTOCOL_TOOL_MAP but not in catalog", tool_name)
165167

@@ -271,7 +273,9 @@ async def wireshark_open_file(pcap_file: str) -> str:
271273
output_parts.append(f" • {tool_name}: {doc}")
272274
else:
273275
output_parts.append("\n--- No protocol-specific recommendations ---")
274-
output_parts.append("The core tools should be enough to start, and all contextual tools remain available if needed.")
276+
output_parts.append(
277+
"The core tools should be enough to start, and all contextual tools remain available if needed."
278+
)
275279

276280
output_parts.append(
277281
"\n💡 Tip: Start broad with wireshark_quick_analysis or wireshark_get_packet_list, then narrow using the recommended tools above."

tests/test_registry.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ def test_open_file_recommends_tools_without_mutating_tool_surface(self, mock_cli
188188
from mcp.server.fastmcp import FastMCP
189189

190190
async def fake_get_protocol_stats(_pcap_file: str) -> str:
191-
return success_response("eth frames:10 bytes:100\n ip frames:10 bytes:90\n tcp frames:5 bytes:50\n http frames:5 bytes:50\n")
191+
return success_response(
192+
"eth frames:10 bytes:100\n ip frames:10 bytes:90\n tcp frames:5 bytes:50\n http frames:5 bytes:50\n"
193+
)
192194

193195
async def fake_get_file_info(_pcap_file: str) -> str:
194196
return success_response("file name: test.pcap\n")

tests/test_security.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async def extract_fields(
2929

3030
if fields == ["http.request.full_uri", "http.host", "http.request.uri"] and display_filter == "http.request":
3131
return success_response(
32-
'http.request.full_uri\thttp.host\thttp.request.uri\n'
32+
"http.request.full_uri\thttp.host\thttp.request.uri\n"
3333
'"http://bad.example/evil"\t"bad.example"\t"/evil"\n'
3434
'""\t"only-host.example"\t"/download"\n'
3535
)

0 commit comments

Comments
 (0)