Add type-hints for _vformat in string.Formatter (#9228)

This commit is contained in:
chaojie
2022-11-21 10:22:36 +08:00
committed by GitHub
parent b58d0df349
commit 620e37fd02

View File

@@ -64,11 +64,20 @@ class Formatter:
) -> LiteralString: ...
@overload
def vformat(self, format_string: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> str: ...
def _vformat( # undocumented
self,
format_string: str,
args: Sequence[Any],
kwargs: Mapping[str, Any],
used_args: set[int | str],
recursion_depth: int,
auto_arg_index: int = ...,
) -> tuple[str, int]: ...
def parse(
self, format_string: StrOrLiteralStr
) -> Iterable[tuple[StrOrLiteralStr, StrOrLiteralStr | None, StrOrLiteralStr | None, StrOrLiteralStr | None]]: ...
def get_field(self, field_name: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ...
def get_value(self, key: int | str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ...
def check_unused_args(self, used_args: Sequence[int | str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> None: ...
def check_unused_args(self, used_args: set[int | str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> None: ...
def format_field(self, value: Any, format_spec: str) -> Any: ...
def convert_field(self, value: Any, conversion: str) -> Any: ...