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.
This commit is contained in:
Jeremy Saklad 2021-08-14 14:40:15 -05:00
parent 4cf9e4f008
commit 3b1ca61104
Signed by: Jeremy Saklad
GPG Key ID: 9CA2149583EDBF84
2 changed files with 2 additions and 3 deletions

View File

@ -106,7 +106,6 @@ solver_options = parser.add_argument_group(
solver_options.add_argument( solver_options.add_argument(
"-v", "--verbose", "-v", "--verbose",
action=argparse.BooleanOptionalAction, action=argparse.BooleanOptionalAction,
default=False,
help="whether the solver should output search progress rather than showing intermediate solutions", help="whether the solver should output search progress rather than showing intermediate solutions",
dest='verbose' dest='verbose'
) )
@ -130,7 +129,7 @@ args = parser.parse_args()
arguments = vars(args) arguments = vars(args)
if not arguments.pop('verbose'): if not arguments.pop('verbose', False):
def WrappedSolve(stdscr, arguments): def WrappedSolve(stdscr, arguments):
# Prevents crash if window is too small to fit text # Prevents crash if window is too small to fit text
stdscr.scrollok(True) stdscr.scrollok(True)

View File

@ -29,7 +29,7 @@ class BlacklistAction(argparse.Action):
# Check whether this is a single value or a list of them # Check whether this is a single value or a list of them
if self._nargs is None or self._nargs == argparse.OPTIONAL: if self._nargs is None or self._nargs == argparse.OPTIONAL:
# Convert value back into an Enum # Convert value back into an Enum
enum = convert_to_enum(value) enum = convert_to_enum(values)
setattr(namespace, self.dest, enum) setattr(namespace, self.dest, enum)
else: else: