optparse.HelpFormatter: format_heading and format_usage are abstract methods (#7194)

The [docstrings state](0ae4019179/Lib/optparse.py (L255-L259)) "Subclasses must implement", and the [docs for optparse](https://docs.python.org/3/library/optparse.html) explicitly state that `TitledHelpFormatter` and `IndentedHelpFormatter` are provided as "concrete implementations" of `optparse.HelpFormatter`.
This commit is contained in:
Alex Waygood
2022-02-14 01:41:00 +00:00
committed by GitHub
parent 68e2a74a79
commit cabfaabd76

View File

@@ -1,3 +1,4 @@
from abc import abstractmethod
from typing import IO, Any, AnyStr, Callable, Iterable, Mapping, Sequence, overload
NO_DEFAULT: tuple[str, ...]
@@ -47,9 +48,11 @@ class HelpFormatter:
def expand_default(self, option: Option) -> str: ...
def format_description(self, description: str) -> str: ...
def format_epilog(self, epilog: str) -> str: ...
@abstractmethod
def format_heading(self, heading: Any) -> str: ...
def format_option(self, option: Option) -> str: ...
def format_option_strings(self, option: Option) -> str: ...
@abstractmethod
def format_usage(self, usage: Any) -> str: ...
def indent(self) -> None: ...
def set_long_opt_delimiter(self, delim: str) -> None: ...