Skip to content

Commit 7d5bc5a

Browse files
committed
chore: format files to satisfy CI (black)
1 parent 4372607 commit 7d5bc5a

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/mcp_shell_server/command_validator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ def _get_allowed_commands(self) -> set[str]:
2828
def _get_allowed_patterns(self) -> List[re.Pattern]:
2929
"""Get the list of allowed regex patterns from environment variables"""
3030
allow_patterns = os.environ.get("ALLOW_PATTERNS", "")
31-
patterns = [pattern.strip() for pattern in allow_patterns.split(",") if pattern.strip()]
31+
patterns = [
32+
pattern.strip() for pattern in allow_patterns.split(",") if pattern.strip()
33+
]
3234
return [re.compile(pattern) for pattern in patterns]
3335
"""Get the list of allowed commands from environment variables"""
3436
return list(self._get_allowed_commands())

src/mcp_shell_server/server.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ def get_allowed_commands(self) -> list[str]:
3232

3333
def get_allowed_patterns(self) -> list[str]:
3434
"""Get the allowed regex patterns"""
35-
return [pattern.pattern for pattern in self.executor.validator._get_allowed_patterns()]
35+
return [
36+
pattern.pattern
37+
for pattern in self.executor.validator._get_allowed_patterns()
38+
]
3639

3740
def get_tool_description(self) -> Tool:
3841
"""Get the tool description for the execute command"""
39-
allowed_commands = ', '.join(self.get_allowed_commands())
40-
allowed_patterns = ', '.join(self.get_allowed_patterns())
42+
allowed_commands = ", ".join(self.get_allowed_commands())
43+
allowed_patterns = ", ".join(self.get_allowed_patterns())
4144
description = (
4245
f"{self.description}\n"
4346
f"Allowed commands: {allowed_commands}\n"

tests/test_command_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_is_command_allowed_with_patterns(validator, monkeypatch):
2626
clear_env(monkeypatch)
2727
monkeypatch.setenv("ALLOW_COMMANDS", "allowed_cmd")
2828
monkeypatch.setenv("ALLOW_PATTERNS", "^cmd[0-9]+$")
29-
29+
3030
assert validator.is_command_allowed("allowed_cmd")
3131
assert validator.is_command_allowed("cmd123")
3232
assert not validator.is_command_allowed("disallowed_cmd")

0 commit comments

Comments
 (0)