_patching.pyi 729 B

12345678910111213141516171819202122232425262728
  1. # Source code: https://github.com/hamdanal/rich-argparse
  2. # MIT license: Copyright (c) Ali Hamdan <ali.hamdan.dev@gmail.com>
  3. # for internal use only
  4. from argparse import _FormatterClass
  5. from collections.abc import Callable
  6. from typing import TypeVar, overload
  7. from rich_argparse._argparse import RichHelpFormatter
  8. _T = TypeVar("_T", bound=type)
  9. @overload
  10. def patch_default_formatter_class(
  11. cls: None = None,
  12. /,
  13. *,
  14. formatter_class: _FormatterClass = RichHelpFormatter,
  15. method_name: str = "__init__",
  16. ) -> Callable[[_T], _T]: ...
  17. @overload
  18. def patch_default_formatter_class(
  19. cls: _T,
  20. /,
  21. *,
  22. formatter_class: _FormatterClass = RichHelpFormatter,
  23. method_name: str = "__init__",
  24. ) -> _T: ...