Improved pytz support for timezone function (#911)

This commit is contained in:
Adam Marszałek
2017-02-03 19:54:59 +01:00
committed by Guido van Rossum
parent c760a4e949
commit ca36070d51
3 changed files with 37 additions and 24 deletions

View File

@@ -4,18 +4,18 @@ from typing import Union, Optional, Iterable, Mapping, Tuple
from .models import Response
ParamsMappingValueType = Union[str, unicode, int, float, Iterable[Union[str, unicode, int, float]]]
_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[Mapping[Union[str, unicode, int, float], ParamsMappingValueType],
Union[Mapping[Union[str, unicode, int, float], _ParamsMappingValueType],
Union[str, unicode],
Tuple[Union[str, unicode, int, float], ParamsMappingValueType],
Mapping[str, ParamsMappingValueType],
Mapping[unicode, ParamsMappingValueType],
Mapping[int, ParamsMappingValueType],
Mapping[float, ParamsMappingValueType]]] = 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: ...

View File

@@ -1,7 +1,7 @@
# Stubs for pytz (Python 3.5)
import datetime as dt
from typing import Optional, List, Set, Dict # NOQA
import datetime
from typing import Optional, List, Set, Dict, Union
all_timezones = ... # type: List
all_timezones_set = ... # type: Set
@@ -11,16 +11,29 @@ country_timezones = ... # type: Dict
country_names = ... # type: Dict
class _UTCclass(dt.tzinfo):
class _UTCclass(datetime.tzinfo):
zone = ... # type: str
def fromutc(self, dt: dt.datetime) -> dt.datetime: ...
def utcoffset(self, dt: Optional[dt.datetime]) -> dt.timedelta: ... # type: ignore
def tzname(self, dt: Optional[dt.datetime]) -> str: ...
def dst(self, dt: Optional[dt.datetime]) -> dt.timedelta: ... # type: ignore
def localize(self, dt: dt.datetime, is_dst: bool=...) -> dt.datetime: ...
def normalize(self, dt: dt.datetime, is_dst: bool=...) -> dt.datetime: ...
def fromutc(self, dt: datetime.datetime) -> datetime.datetime: ...
def utcoffset(self, dt: Optional[datetime.datetime]) -> datetime.timedelta: ... # type: ignore
def tzname(self, dt: Optional[datetime.datetime]) -> str: ...
def dst(self, dt: Optional[datetime.datetime]) -> datetime.timedelta: ... # type: ignore
def localize(self, dt: datetime.datetime, is_dst: bool = ...) -> datetime.datetime: ...
def normalize(self, dt: datetime.datetime, is_dst: bool = ...) -> datetime.datetime: ...
utc = ... # type: _UTCclass
UTC = ... # type: _UTCclass
def timezone(zone: str) -> dt.tzinfo: ...
class _BaseTzInfo(datetime.tzinfo):
zone = ... # type: str
def fromutc(self, dt: datetime.datetime) -> datetime.datetime: ...
def localize(self, dt: datetime.datetime, is_dst: Optional[bool] = ...) -> datetime.datetime: ...
def normalize(self, dt: datetime.datetime) -> datetime.datetime: ...
class _StaticTzInfo(_BaseTzInfo):
def normalize(self, dt: datetime.datetime, is_dst: Optional[bool] = ...) -> datetime.datetime: ...
def timezone(zone: str) -> _BaseTzInfo: ...

View File

@@ -4,19 +4,19 @@ 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]]]
_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[
Mapping[Union[str, bytes, int, float], ParamsMappingValueType],
Mapping[Union[str, bytes, int, float], _ParamsMappingValueType],
Union[str, bytes],
Tuple[Union[str, bytes, int, float], ParamsMappingValueType],
Mapping[str, ParamsMappingValueType],
Mapping[bytes, ParamsMappingValueType],
Mapping[int, ParamsMappingValueType],
Mapping[float, ParamsMappingValueType]]]=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: ...