44
55import importlib .resources as imlr
66import typing
7- from inspect import isfunction
87from pathlib import Path
98from types import MappingProxyType
109
2625from .config import Config
2726
2827if typing .TYPE_CHECKING :
29- from typing import Any , Callable
28+ from typing import Callable
3029
3130
32- def _sub (cmd : Any , * sections : str ) -> Subcmd :
31+ def _sub (cmd : Callable [[ Config ], None ] , * sections : str ) -> Subcmd :
3332 """Build Subcmd instance."""
34- cmd_func = cmd if isfunction (cmd ) else cmd .cmd
35- return Subcmd (baredoc (cmd ), * sections , func = cmd_func )
33+ return Subcmd (baredoc (cmd ), * sections , func = cmd )
3634
3735
3836def _bare_cmd (conf : Config ) -> None :
@@ -59,11 +57,11 @@ def _load_mplstyle(conf: Config) -> None:
5957SUB_CMDS = MappingProxyType (
6058 {
6159 "common_" : Subcmd (doc_module , "common" , func = _bare_cmd ),
62- "field" : _sub (field , "core" , "plot" , "scaling" ),
63- "rprof" : _sub (rprof , "core" , "plot" , "scaling" ),
64- "time" : _sub (time_series , "core" , "plot" , "scaling" ),
65- "refstate" : _sub (refstate , "core" , "plot" ),
66- "plates" : _sub (plates , "core" , "plot" , "scaling" ),
60+ "field" : _sub (field . cmd , "core" , "plot" , "scaling" ),
61+ "rprof" : _sub (rprof . cmd , "core" , "plot" , "scaling" ),
62+ "time" : _sub (time_series . cmd , "core" , "plot" , "scaling" ),
63+ "refstate" : _sub (refstate . cmd , "core" , "plot" ),
64+ "plates" : _sub (plates . cmd , "core" , "plot" , "scaling" ),
6765 "info" : _sub (commands .info_cmd , "core" , "scaling" ),
6866 "var" : _sub (commands .var_cmd ),
6967 "version" : _sub (commands .version_cmd ),
0 commit comments