From 3b1ca61104886b5751e5f2589f9ca90571ba070c Mon Sep 17 00:00:00 2001 From: Jeremy Saklad Date: Sat, 14 Aug 2021 14:40:15 -0500 Subject: [PATCH] Fix BlacklistAction bug This bug would have caused an error if BlacklistAction were used with a different nargs. The "verbose" argument no longer has a default specified. Instead, the code that checks it supplies a default for itself. --- bonemarketsolver/__main__.py | 3 +-- bonemarketsolver/objects/blacklistaction.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bonemarketsolver/__main__.py b/bonemarketsolver/__main__.py index d3438ca..1eb8024 100644 --- a/bonemarketsolver/__main__.py +++ b/bonemarketsolver/__main__.py @@ -106,7 +106,6 @@ solver_options = parser.add_argument_group( solver_options.add_argument( "-v", "--verbose", action=argparse.BooleanOptionalAction, - default=False, help="whether the solver should output search progress rather than showing intermediate solutions", dest='verbose' ) @@ -130,7 +129,7 @@ args = parser.parse_args() arguments = vars(args) -if not arguments.pop('verbose'): +if not arguments.pop('verbose', False): def WrappedSolve(stdscr, arguments): # Prevents crash if window is too small to fit text stdscr.scrollok(True) diff --git a/bonemarketsolver/objects/blacklistaction.py b/bonemarketsolver/objects/blacklistaction.py index 0c848ca..1ddf842 100644 --- a/bonemarketsolver/objects/blacklistaction.py +++ b/bonemarketsolver/objects/blacklistaction.py @@ -29,7 +29,7 @@ class BlacklistAction(argparse.Action): # Check whether this is a single value or a list of them if self._nargs is None or self._nargs == argparse.OPTIONAL: # Convert value back into an Enum - enum = convert_to_enum(value) + enum = convert_to_enum(values) setattr(namespace, self.dest, enum) else: