A couple new definitions, some more unicode for 2.7 (#185)

* Action.__init__(); ArgumentParser.__init__() & print_help()

* pprint() & pformat()

* added unicode support to url{parse,split,join,defrag}

* add unicode support to requests.api
This commit is contained in:
Michael R. Crusoe
2016-05-06 18:14:49 +02:00
committed by Guido van Rossum
parent eab591bb08
commit 0be5a11496
4 changed files with 51 additions and 25 deletions

View File

@@ -2,7 +2,7 @@
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.
from typing import Any, Sequence, Union
from typing import Any, Callable, Dict, List, IO, Iterable, Sequence, Union
SUPPRESS = ... # type: Any
OPTIONAL = ... # type: Any
@@ -52,8 +52,17 @@ class Action(_AttributeHolder):
required = ... # type: Any
help = ... # type: Any
metavar = ... # type: Any
def __init__(self, option_strings, dest, nargs=..., const=..., default=..., type=...,
choices=..., required=..., help=..., metavar=...): ...
def __init__(self,
option_strings: List[str],
dest = str,
nargs: Union[int, str] = ...,
const: Any = ...,
default: Any = ...,
type: Callable[[str], Any] = ...,
choices: Iterable[Any] = ...,
required: bool = ...,
help: str = ...,
metavar: str = ...) -> None: ...
def __call__(self, parser, namespace, values, option_string=...): ...
class _StoreAction(Action):
@@ -138,7 +147,7 @@ class _ActionsContainer:
version: str = ...
) -> None: ...
def add_argument_group(self, *args, **kwargs): ...
def add_mutually_exclusive_group(self, **kwargs): ...
def add_mutually_exclusive_group(self, **kwargs) -> _MutuallyExclusiveGroup: ...
class _ArgumentGroup(_ActionsContainer):
title = ... # type: Any
@@ -156,9 +165,19 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
formatter_class = ... # type: Any
fromfile_prefix_chars = ... # type: Any
add_help = ... # type: Any
def __init__(self, prog=..., usage=..., description=..., epilog=..., version=...,
parents=..., formatter_class=..., prefix_chars=..., fromfile_prefix_chars=...,
argument_default=..., conflict_handler=..., add_help=...): ...
def __init__(self,
prog: str = ...,
usage: str = ...,
description: str = ...,
epilog: str = ...,
version: None = ...,
parents: Iterable[ArgumentParser] = ...,
formatter_class: HelpFormatter = ...,
prefix_chars: str = ...,
fromfile_prefix_chars: str = ...,
argument_default: str = ...,
conflict_handler: str = ...,
add_help: bool = ...) -> None: ...
def add_subparsers(self, **kwargs): ...
def parse_args(self, args: Sequence[str] = ..., namespace=...): ...
def parse_known_args(self, args=..., namespace=...): ...
@@ -167,7 +186,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
def format_help(self): ...
def format_version(self): ...
def print_usage(self, file=...): ...
def print_help(self, file=...): ...
def print_help(self, file: IO[Any] = None) -> None: ...
def print_version(self, file=...): ...
def exit(self, status=..., message=...): ...
def error(self, message): ...

View File

@@ -6,15 +6,18 @@ from typing import IO, Any
def pprint(object: Any, stream: IO[str] = ..., indent: int = ..., width: int = ...,
depth: int = ...) -> None: ...
def pformat(object, indent=..., width=..., depth=...): ...
def pformat(object: Any, indent: int =..., width: int =..., depth: int =...) -> str: ...
def saferepr(object): ...
def isreadable(object): ...
def isrecursive(object): ...
class PrettyPrinter:
def __init__(self, indent: int = ..., width: int = ..., depth: int = ...,
stream: IO[str] = ...) -> None: ...
def pprint(self, object): ...
def __init__(self,
indent: int = ...,
width: int = ...,
depth: int = ...,
stream: IO[Any] = ...) -> None: ...
def pprint(self, object: Any) -> str: ...
def pformat(self, object): ...
def isrecursive(self, object): ...
def isreadable(self, object): ...

View File

@@ -1,6 +1,6 @@
# Stubs for urlparse (Python 2)
from typing import Dict, List, NamedTuple, Tuple, Sequence, overload
from typing import Dict, List, NamedTuple, Tuple, Sequence, Union, overload
uses_relative = [] # type: List[str]
uses_netloc = [] # type: List[str]
@@ -34,8 +34,10 @@ class ParseResult(NamedTuple('ParseResult', [
]), ResultMixin):
def geturl(self) -> str: ...
def urlparse(url: str, scheme: str = ..., allow_fragments: bool = ...) -> ParseResult: ...
def urlsplit(url: str, scheme: str = ..., allow_fragments: bool = ...) -> SplitResult: ...
def urlparse(url: Union[str, unicode], scheme: str = ...,
allow_fragments: bool = ...) -> ParseResult: ...
def urlsplit(url: Union[str, unicode], scheme: str = ...,
allow_fragments: bool = ...) -> SplitResult: ...
@overload
def urlunparse(data: Tuple[str, str, str, str, str, str]) -> str: ...
@overload
@@ -44,8 +46,9 @@ def urlunparse(data: Sequence[str]) -> str: ...
def urlunsplit(data: Tuple[str, str, str, str, str]) -> str: ...
@overload
def urlunsplit(data: Sequence[str]) -> str: ...
def urljoin(base: str, url: str, allow_fragments: bool = ...) -> str: ...
def urldefrag(url: str) -> str: ...
def urljoin(base: Union[str, unicode], url: Union[str, unicode],
allow_fragments: bool = ...) -> str: ...
def urldefrag(url: Union[str, unicode]) -> str: ...
def unquote(s: str) -> str: ...
def parse_qs(qs: str, keep_blank_values: bool = ...,
strict_parsing: bool = ...) -> Dict[str, List[str]]: ...

View File

@@ -1,14 +1,15 @@
# Stubs for requests.api (Python 3)
import typing
from typing import Union
from .models import Response
def request(method: str, url: str, **kwargs) -> Response: ...
def get(url: str, **kwargs) -> Response: ...
def options(url: str, **kwargs) -> Response: ...
def head(url: str, **kwargs) -> Response: ...
def post(url: str, data=..., json=..., **kwargs) -> Response: ...
def put(url: str, data=..., **kwargs) -> Response: ...
def patch(url: str, data=..., **kwargs) -> Response: ...
def delete(url: str, **kwargs) -> Response: ...
def get(url: Union[str, unicode], **kwargs) -> Response: ...
def options(url: Union[str, unicode], **kwargs) -> Response: ...
def head(url: Union[str, unicode], **kwargs) -> Response: ...
def post(url: Union[str, unicode], data=..., json=...,
**kwargs) -> Response: ...
def put(url: Union[str, unicode], data=..., **kwargs) -> Response: ...
def patch(url: Union[str, unicode], data=..., **kwargs) -> Response: ...
def delete(url: Union[str, unicode], **kwargs) -> Response: ...