Skip to content

Commit

Permalink
use strtobool
Browse files Browse the repository at this point in the history
  • Loading branch information
ric-evans committed Oct 4, 2023
1 parent c0ce189 commit be89723
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions rest_tools/server/arghandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,19 @@ def __init__(self, source: dict[str, Any] | bytes) -> None:
super().__init__(exit_on_error=False)
self.source = source

def add_argument(self, name: str, *args: Any, **kwargs: Any) -> None: # type: ignore[override]
"""explain."""
def add_argument( # type: ignore[override]
self,
name: str,
*args: Any,
type: type | Callable[[Any], Any] | None = None,
**kwargs: Any,
) -> None:
"""Add an argument -- like argparse.add_argument with additions.
See https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.add_argument
"""
if type == bool: # type is a bad argument name, but it's what argparse uses
type = strtobool

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable type is not used.
super().add_argument(f"--{name}", *args, **kwargs)

def parse_args(self) -> argparse.Namespace: # type: ignore[override]
Expand Down

0 comments on commit be89723

Please sign in to comment.