1# Stubs for string
2
3# Based on http://docs.python.org/3.2/library/string.html
4
5from typing import Mapping, Sequence, Any, Optional, Union, Tuple, Iterable
6
7ascii_letters: str
8ascii_lowercase: str
9ascii_uppercase: str
10digits: str
11hexdigits: str
12octdigits: str
13punctuation: str
14printable: str
15whitespace: str
16
17def capwords(s: str, sep: str = ...) -> str: ...
18
19class Template:
20    template: str
21
22    def __init__(self, template: str) -> None: ...
23    def substitute(self, mapping: Mapping[str, object] = ..., **kwds: object) -> str: ...
24    def safe_substitute(self, mapping: Mapping[str, object] = ...,
25                        **kwds: object) -> str: ...
26
27# TODO(MichalPokorny): This is probably badly and/or loosely typed.
28class Formatter:
29    def format(self, format_string: str, *args: Any, **kwargs: Any) -> str: ...
30    def vformat(self, format_string: str, args: Sequence[Any],
31                kwargs: Mapping[str, Any]) -> str: ...
32    def parse(self, format_string: str) -> Iterable[Tuple[str, Optional[str], Optional[str], Optional[str]]]: ...
33    def get_field(self, field_name: str, args: Sequence[Any],
34                  kwargs: Mapping[str, Any]) -> Any: ...
35    def get_value(self, key: Union[int, str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ...
36    def check_unused_args(self, used_args: Sequence[Union[int, str]], args: Sequence[Any],
37                          kwargs: Mapping[str, Any]) -> None: ...
38    def format_field(self, value: Any, format_spec: str) -> Any: ...
39    def convert_field(self, value: Any, conversion: str) -> Any: ...
40