lockss-pybasic 0.1.0.dev18__tar.gz → 0.1.0.dev20__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lockss-pybasic
3
- Version: 0.1.0.dev18
3
+ Version: 0.1.0.dev20
4
4
  Summary: Basic Python utilities
5
5
  License: BSD-3-Clause
6
6
  Author: Thib Guicherd-Callin
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lockss-pybasic"
3
- version = "0.1.0-dev18"
3
+ version = "0.1.0-dev20"
4
4
  description = "Basic Python utilities"
5
5
  authors = [
6
6
  { name = "Thib Guicherd-Callin", email = "thib@cs.stanford.edu" }
@@ -36,4 +36,4 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
36
  POSSIBILITY OF SUCH DAMAGE.
37
37
  '''.strip()
38
38
 
39
- __version__ = '0.1.0-dev18'
39
+ __version__ = '0.1.0-dev20'
@@ -32,6 +32,7 @@
32
32
  Command line utilities.
33
33
  """
34
34
 
35
+ from argparse import _A
35
36
  from collections.abc import Callable
36
37
  import sys
37
38
  from typing import Any, Dict, Generic, Optional, TypeVar
@@ -134,7 +135,7 @@ class BaseCli(Generic[BaseModelT]):
134
135
  else:
135
136
  self._parser.error(f'unknown command; expected one of {', '.join(field_names)}')
136
137
 
137
- def _initialize_rich_argparse(self):
138
+ def _initialize_rich_argparse(self) -> None:
138
139
  for cls in [RichHelpFormatter]:
139
140
  cls.styles.update({
140
141
  'argparse.args': f'bold {cls.styles["argparse.args"]}',
@@ -142,7 +143,12 @@ class BaseCli(Generic[BaseModelT]):
142
143
  'argparse.metavar': f'bold {cls.styles["argparse.metavar"]}',
143
144
  'argparse.prog': f'bold {cls.styles["argparse.prog"]}',
144
145
  })
145
- self._parser.formatter_class = RichHelpFormatter
146
+ def __add_formatter_class(container):
147
+ container.formatter_class = RichHelpFormatter
148
+ if container._subparsers:
149
+ for x in container._subparsers:
150
+ __add_formatter_class(x)
151
+ __add_formatter_class(self._parser)
146
152
 
147
153
 
148
154
  def at_most_one_from_enum(model_cls, values: Dict[str, Any], enum_cls) -> Dict[str, Any]: