Skip to content

Commit 71e7a47

Browse files
committed
style: apply ruff-format to vmm-cli.py
1 parent 0919e7a commit 71e7a47

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

vmm/src/vmm-cli.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@
3434
DEFAULT_CONFIG_PATH = os.path.expanduser("~/.dstack-vmm/config.json")
3535
DEFAULT_KMS_WHITELIST_PATH = os.path.expanduser("~/.dstack-vmm/kms-whitelist.json")
3636

37+
3738
# VMM discovery directories
3839
# Each user's instances are in $XDG_RUNTIME_DIR/dstack-vmm (typically /run/user/<uid>/dstack-vmm).
3940
# CLI scans all users' directories so operators can see every instance on the host.
4041
def _get_discovery_dirs() -> List[Tuple[str, Optional[str]]]:
4142
"""Return list of (discovery_dir, username) tuples."""
4243
import pwd
44+
4345
dirs = []
4446
run_user = "/run/user"
4547
if os.path.isdir(run_user):
@@ -180,7 +182,9 @@ def cmd_ls_vmm(args):
180182

181183
if not instances:
182184
print("No running VMM instances found.")
183-
print(f" (scanned: {', '.join(d for d, _ in _get_discovery_dirs()) or '/run/user/*/dstack-vmm'})")
185+
print(
186+
f" (scanned: {', '.join(d for d, _ in _get_discovery_dirs()) or '/run/user/*/dstack-vmm'})"
187+
)
184188
return
185189

186190
if getattr(args, "json", False):
@@ -1560,19 +1564,21 @@ def main():
15601564

15611565
# Register nested subcommands for top-level help display
15621566
_nested_commands = {
1563-
'vmm ls': 'List all running VMM instances on this host',
1564-
'vmm switch': 'Switch active VMM instance',
1567+
"vmm ls": "List all running VMM instances on this host",
1568+
"vmm switch": "Switch active VMM instance",
15651569
}
15661570

15671571
# Patch parser's format_help to show nested subcommands
15681572
_orig_format_help = parser.format_help
1573+
15691574
def _patched_format_help():
15701575
text = _orig_format_help()
15711576
# Append nested subcommands after the subparser listing
15721577
extra = "\nnested commands:\n"
15731578
for cmd, desc in _nested_commands.items():
15741579
extra += f" {cmd:<24s}{desc}\n"
15751580
return text + extra
1581+
15761582
parser.format_help = _patched_format_help
15771583

15781584
# List command

0 commit comments

Comments
 (0)