Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions stdlib/2/string.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Based on http://docs.python.org/3.2/library/string.html

from typing import Mapping, Sequence, Any, Optional, Union, List, Tuple, Iterable, AnyStr
from typing import Any, AnyStr, Iterable, List, Mapping, Optional, overload, Sequence, Text, Tuple, Union

ascii_letters = ... # type: str
ascii_lowercase = ... # type: str
Expand Down Expand Up @@ -47,14 +47,18 @@ def center(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ...
def zfill(s: AnyStr, width: int) -> AnyStr: ...
def replace(s: AnyStr, old: AnyStr, new: AnyStr, maxreplace: int = ...) -> AnyStr: ...

class Template(object):
# TODO: Unicode support?
template = ... # type: str
class Template:
template: Text

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: ...
def __init__(self, template: Text) -> None: ...
@overload
def substitute(self, mapping: Mapping[Text, str] = ..., **kwds: str) -> str: ...
@overload
def substitute(self, mapping: Mapping[Text, Text] = ..., **kwds: Text) -> Text: ...
@overload
def safe_substitute(self, mapping: Mapping[Text, str] = ..., **kwds: str) -> str: ...
@overload
def safe_substitute(self, mapping: Mapping[Text, Text] = ..., **kwds: Text) -> Text: ...

# TODO(MichalPokorny): This is probably badly and/or loosely typed.
class Formatter(object):
Expand Down