mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
Copy string.Formatter to python 3 (#443)
This commit is contained in:
committed by
Matthias Kramm
parent
a98e9aa651
commit
d760d48f52
@@ -2,7 +2,7 @@
|
||||
|
||||
# Based on http://docs.python.org/3.2/library/string.html
|
||||
|
||||
from typing import Mapping
|
||||
from typing import Mapping, Sequence, Any, Optional, Union, List, Tuple, Iterable, AnyStr
|
||||
|
||||
ascii_letters = ... # type: str
|
||||
ascii_lowercase = ... # type: str
|
||||
@@ -24,4 +24,19 @@ class Template:
|
||||
def safe_substitute(self, mapping: Mapping[str, str],
|
||||
**kwds: str) -> str: ...
|
||||
|
||||
# TODO Formatter
|
||||
# TODO(MichalPokorny): This is probably badly and/or loosely typed.
|
||||
class Formatter(object):
|
||||
def format(self, format_string: str, *args, **kwargs) -> str: ...
|
||||
def vformat(self, format_string: str, args: Sequence[Any],
|
||||
kwargs: Mapping[str, Any]) -> str: ...
|
||||
def parse(self, format_string: str) -> Iterable[Tuple[str, Optional[str], Optional[str], Optional[str]]]: ...
|
||||
def get_field(self, field_name: str, args: Sequence[Any],
|
||||
kwargs: Mapping[str, Any]) -> Any: ...
|
||||
def get_value(self, key: Union[int, str], args: Sequence[Any],
|
||||
kwargs: Mapping[str, Any]) -> Any:
|
||||
raise IndexError()
|
||||
raise KeyError()
|
||||
def check_unused_args(self, used_args: Sequence[Union[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: ...
|
||||
|
||||
Reference in New Issue
Block a user