From 4ade3ff8db2389f2fbc449ac2a648c16d4813e16 Mon Sep 17 00:00:00 2001 From: Noah Watson Date: Mon, 6 May 2024 21:04:53 -0500 Subject: [PATCH] Use null object instead of string sentinel --- pyk/src/pyk/cli/cli.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyk/src/pyk/cli/cli.py b/pyk/src/pyk/cli/cli.py index a35898f47a1..64245b527f9 100644 --- a/pyk/src/pyk/cli/cli.py +++ b/pyk/src/pyk/cli/cli.py @@ -17,6 +17,8 @@ _LOGGER: Final = logging.getLogger(__name__) +NO_DEFAULT: Final = object() + class CLI: _commands: list[Command] @@ -46,7 +48,7 @@ def get_command(self, args: dict[str, Any]) -> Command: def get_and_exec_command(self) -> None: parser = self.create_argument_parser() args = parser.parse_args() - stripped_args = {key: val for (key, val) in vars(args).items() if val != 'NoDefault'} + stripped_args = {key: val for (key, val) in vars(args).items() if val != NO_DEFAULT} cmd = self.get_command(stripped_args) cmd._options_group.extract(stripped_args, cmd.name) cmd.exec() @@ -77,7 +79,7 @@ def __init__( choices: list[str] | None = None, const: Any | None = None, aliases: Iterable[str] = (), - default: Any | str = 'NoDefault', + default: Any | str = NO_DEFAULT, metavar: str | None = None, nargs: int | str | None = None, required: bool = False,