Expansion of unions inside params definition (#848)

Due to `Dict` / `Mapping` invariance it's necessary to include other variants of `Union[str, bytes], Union[str, bytes]`.
This commit is contained in:
Adam Marszałek
2017-01-20 18:09:23 +01:00
committed by Łukasz Langa
parent f2579e532f
commit 6178ed3201
2 changed files with 18 additions and 8 deletions

View File

@@ -1,18 +1,22 @@
# Stubs for requests.api (Python 2)
from typing import Union, Optional, Iterable, Dict, Tuple
from typing import Union, Optional, Iterable, Mapping, Tuple
from .models import Response
def request(method: str, url: str, **kwargs) -> Response: ...
ParamsMappingValueType = Union[str, unicode, int, float, Iterable[Union[str, unicode, int, float]]]
def request(method: str, url: str, **kwargs) -> Response: ...
def get(url: Union[str, unicode],
params: Optional[
Union[Dict[Union[str, unicode, int, float], Union[str, unicode, int, float, Iterable[Union[str, unicode, int, float]]]],
Union[Mapping[Union[str, unicode, int, float], ParamsMappingValueType],
Union[str, unicode],
Tuple[Union[str, unicode, int, float], Union[str, unicode, int, float, Iterable[Union[str, unicode, int, float]]]]]] = None,
Tuple[Union[str, unicode, int, float], ParamsMappingValueType],
Mapping[str, ParamsMappingValueType],
Mapping[unicode, ParamsMappingValueType],
Mapping[int, ParamsMappingValueType],
Mapping[float, ParamsMappingValueType]]] = None,
**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=...,

View File

@@ -1,16 +1,22 @@
# Stubs for requests.api (Python 3)
from typing import Optional, Union, Any, Iterable, Dict, Tuple
from typing import Optional, Union, Any, Iterable, Mapping, Tuple
from .models import Response
ParamsMappingValueType = Union[str, bytes, int, float, Iterable[Union[str, bytes, int, float]]]
def request(method: str, url: str, **kwargs) -> Response: ...
def get(url: Union[str, bytes],
params: Optional[
Union[
Dict[Union[str, bytes, int, float], Union[str, bytes, int, float, Iterable[Union[str, bytes, int, float]]]],
Mapping[Union[str, bytes, int, float], ParamsMappingValueType],
Union[str, bytes],
Tuple[Union[str, bytes, int, float], Union[str, bytes, int, float, Iterable[Union[str, bytes, int, float]]]]]] = None,
Tuple[Union[str, bytes, int, float], ParamsMappingValueType],
Mapping[str, ParamsMappingValueType],
Mapping[bytes, ParamsMappingValueType],
Mapping[int, ParamsMappingValueType],
Mapping[float, ParamsMappingValueType]]]=None,
**kwargs) -> Response: ...
def options(url: str, **kwargs) -> Response: ...
def head(url: str, **kwargs) -> Response: ...