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:
parent
4cf9e4f008
commit
3b1ca61104
|
@ -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)
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue