Files
typeshed/stdlib/3/string.pyi
Jelle Zijlstra 1d6e3f492e Fix incorrect usage of AnyStr (#1215)
* Fix incorrect usage of AnyStr

- sqlite3 was using Union[bytes, AnyStr], which doesn't make sense
- The urllib functions I changed accept either bytes or str for their "safe"
  argument
- Also added supports for PathLike to pstats
- Remove some unused imports of AnyStr

* pstats: python 2 accepts unicode
2017-04-27 08:47:59 -07:00

43 lines
1.7 KiB
Python

# Stubs for string
# Based on http://docs.python.org/3.2/library/string.html
from typing import Mapping, Sequence, Any, Optional, Union, List, Tuple, Iterable
ascii_letters = ... # type: str
ascii_lowercase = ... # type: str
ascii_uppercase = ... # type: str
digits = ... # type: str
hexdigits = ... # type: str
octdigits = ... # type: str
punctuation = ... # type: str
printable = ... # type: str
whitespace = ... # type: str
def capwords(s: str, sep: str = ...) -> str: ...
class Template:
template = ... # type: str
def __init__(self, template: str) -> None: ...
def substitute(self, mapping: Mapping[str, str] = ..., **kwds: str) -> str: ...
def safe_substitute(self, mapping: Mapping[str, str] = ...,
**kwds: str) -> str: ...
# TODO(MichalPokorny): This is probably badly and/or loosely typed.
class Formatter:
def format(self, format_string: str, *args: Any, **kwargs: Any) -> 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: ...