Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/actions/setup-py…
Browse files Browse the repository at this point in the history
…thon-5
  • Loading branch information
tleonhardt authored Dec 11, 2023
2 parents fc382b7 + d4c02a8 commit 3bdb428
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cmd2/cmd2.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,14 +684,19 @@ def _build_parser(
self,
parent: CommandParent,
parser_builder: Optional[
Union[argparse.ArgumentParser, Callable[[], argparse.ArgumentParser], StaticArgParseBuilder, ClassArgParseBuilder]
Union[
argparse.ArgumentParser,
Callable[[], argparse.ArgumentParser],
StaticArgParseBuilder,
ClassArgParseBuilder,
]
],
) -> Optional[argparse.ArgumentParser]:
parser: Optional[argparse.ArgumentParser] = None
if isinstance(parser_builder, staticmethod):
parser = parser_builder.__func__()
elif isinstance(parser_builder, classmethod):
parser = parser_builder.__func__(parent if not None else self)
parser = parser_builder.__func__(parent if not None else self) # type: ignore[arg-type]
elif callable(parser_builder):
parser = parser_builder()
elif isinstance(parser_builder, argparse.ArgumentParser):
Expand Down

0 comments on commit 3bdb428

Please sign in to comment.