Format: application/octet-stream
⬇ Download File (3.5 KB)
   1  from typing import Any, AnyStr, Iterable, List, Mapping, Optional, Sequence, Text, Tuple, Union, overload
   2  
   3  ascii_letters: str
   4  ascii_lowercase: str
   5  ascii_uppercase: str
   6  digits: str
   7  hexdigits: str
   8  letters: str
   9  lowercase: str
  10  octdigits: str
  11  punctuation: str
  12  printable: str
  13  uppercase: str
  14  whitespace: str
  15  
  16  def capwords(s: AnyStr, sep: AnyStr = ...) -> AnyStr: ...
  17  
  18  # TODO: originally named 'from'
  19  def maketrans(_from: str, to: str) -> str: ...
  20  def atof(s: unicode) -> float: ...
  21  def atoi(s: unicode, base: int = ...) -> int: ...
  22  def atol(s: unicode, base: int = ...) -> int: ...
  23  def capitalize(word: AnyStr) -> AnyStr: ...
  24  def find(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ...
  25  def rfind(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ...
  26  def index(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ...
  27  def rindex(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ...
  28  def count(s: unicode, sub: unicode, start: int = ..., end: int = ...) -> int: ...
  29  def lower(s: AnyStr) -> AnyStr: ...
  30  def split(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ...
  31  def rsplit(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ...
  32  def splitfields(s: AnyStr, sep: AnyStr = ..., maxsplit: int = ...) -> List[AnyStr]: ...
  33  def join(words: Iterable[AnyStr], sep: AnyStr = ...) -> AnyStr: ...
  34  def joinfields(word: Iterable[AnyStr], sep: AnyStr = ...) -> AnyStr: ...
  35  def lstrip(s: AnyStr, chars: AnyStr = ...) -> AnyStr: ...
  36  def rstrip(s: AnyStr, chars: AnyStr = ...) -> AnyStr: ...
  37  def strip(s: AnyStr, chars: AnyStr = ...) -> AnyStr: ...
  38  def swapcase(s: AnyStr) -> AnyStr: ...
  39  def translate(s: str, table: str, deletechars: str = ...) -> str: ...
  40  def upper(s: AnyStr) -> AnyStr: ...
  41  def ljust(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ...
  42  def rjust(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ...
  43  def center(s: AnyStr, width: int, fillchar: AnyStr = ...) -> AnyStr: ...
  44  def zfill(s: AnyStr, width: int) -> AnyStr: ...
  45  def replace(s: AnyStr, old: AnyStr, new: AnyStr, maxreplace: int = ...) -> AnyStr: ...
  46  
  47  class Template:
  48      template: Text
  49      def __init__(self, template: Text) -> None: ...
  50      @overload
  51      def substitute(self, mapping: Union[Mapping[str, str], Mapping[unicode, str]] = ..., **kwds: str) -> str: ...
  52      @overload
  53      def substitute(self, mapping: Union[Mapping[str, Text], Mapping[unicode, Text]] = ..., **kwds: Text) -> Text: ...
  54      @overload
  55      def safe_substitute(self, mapping: Union[Mapping[str, str], Mapping[unicode, str]] = ..., **kwds: str) -> str: ...
  56      @overload
  57      def safe_substitute(self, mapping: Union[Mapping[str, Text], Mapping[unicode, Text]], **kwds: Text) -> Text: ...
  58  
  59  # TODO(MichalPokorny): This is probably badly and/or loosely typed.
  60  class Formatter(object):
  61      def format(self, format_string: str, *args, **kwargs) -> str: ...
  62      def vformat(self, format_string: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> str: ...
  63      def parse(self, format_string: str) -> Iterable[Tuple[str, str, str, str]]: ...
  64      def get_field(self, field_name: str, args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ...
  65      def get_value(self, key: Union[int, str], args: Sequence[Any], kwargs: Mapping[str, Any]) -> Any: ...
  66      def check_unused_args(self, used_args: Sequence[Union[int, str]], args: Sequence[Any], kwargs: Mapping[str, Any]) -> None: ...
  67      def format_field(self, value: Any, format_spec: str) -> Any: ...
  68      def convert_field(self, value: Any, conversion: str) -> Any: ...
  69