Skip to content

Commit

Permalink
Use null object instead of string sentinel
Browse files Browse the repository at this point in the history
  • Loading branch information
nwatson22 committed May 7, 2024
1 parent 10d0dfd commit 4ade3ff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pyk/src/pyk/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

_LOGGER: Final = logging.getLogger(__name__)

NO_DEFAULT: Final = object()


class CLI:
_commands: list[Command]
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4ade3ff

Please sign in to comment.