-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove useless monkeypatch in
server/parsec/__main__.py
(already do…
…ne in `server/parsec/cli/__init__.py`)
- Loading branch information
1 parent
f5d3d17
commit 388b6ed
Showing
2 changed files
with
0 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,7 @@ | ||
# Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS | ||
from __future__ import annotations | ||
|
||
import os | ||
import sys | ||
from typing import Any, Sequence | ||
|
||
from parsec.cli import cli | ||
|
||
# Add support for PARSEC_CMD_ARGS env var | ||
|
||
vanilla_cli_main = cli.main | ||
|
||
|
||
def patched_cli_main(args: Sequence[str] | None = None, **kwargs: Any) -> Any: | ||
args_list = list(args) if args is not None else sys.argv[1:] | ||
|
||
raw_extra_args = os.environ.get("PARSEC_CMD_ARGS", "") | ||
args_list += [os.path.expandvars(x) for x in raw_extra_args.split()] | ||
|
||
return vanilla_cli_main(args=args_list[:], **kwargs) | ||
|
||
|
||
# [pyright] here we want to use the patched main instead of the one provided by `BaseCommand` | ||
# Note: We could use monkeypatch instead :thinking: | ||
cli.main = patched_cli_main # pyright: ignore[reportAttributeAccessIssue] | ||
|
||
|
||
if __name__ == "__main__": | ||
cli() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters