From 59830169624c6877bb798585a935b1f868f95201 Mon Sep 17 00:00:00 2001 From: Stefan Tatschner Date: Wed, 18 Dec 2024 10:16:17 +0100 Subject: [PATCH] chore: Remove closure factory This is not needed to do, since there is `staticmethod`. --- src/gallia/cli/gallia.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/gallia/cli/gallia.py b/src/gallia/cli/gallia.py index d78852101..0e736539e 100644 --- a/src/gallia/cli/gallia.py +++ b/src/gallia/cli/gallia.py @@ -145,17 +145,11 @@ def parse_and_run( parser = create_parser(commands) - def make_f(c: Callable[[], None]) -> Callable[[Any], None]: - def f(_: Any) -> None: - c() - - return f - if top_level_options is not None: for name, (func, help_) in top_level_options.items(): class Action(argparse.Action): - f = make_f(func) + cmd = staticmethod(func) def __call__( self, @@ -164,7 +158,7 @@ def __call__( values: str | Sequence[Any] | None, option_string: str | None = None, ) -> None: - self.f() + self.cmd() sys.exit(exitcodes.OK) parser.add_argument(