Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More precise annotations of utils.timezone functions that return instances of tzinfo subclasses. #209

Merged
merged 5 commits into from
Nov 12, 2019
Merged
Changes from 2 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
8 changes: 5 additions & 3 deletions django-stubs/utils/timezone.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ from contextlib import ContextDecorator
from datetime import date, datetime as datetime, time, timedelta as timedelta, tzinfo as tzinfo
from typing import Optional, Union, Type

from pytz import BaseTzInfo

_AnyTime = Union[time, datetime]

class UTC(tzinfo):
Expand Down Expand Up @@ -30,10 +32,10 @@ class LocalTimezone(ReferenceLocalTimezone):

utc: UTC = ...

def get_fixed_timezone(offset: Union[timedelta, int]) -> tzinfo: ...
def get_default_timezone() -> tzinfo: ...
def get_fixed_timezone(offset: Union[timedelta, int]) -> FixedOffset: ...
filiplajszczak marked this conversation as resolved.
Show resolved Hide resolved
def get_default_timezone() -> BaseTzInfo: ...
filiplajszczak marked this conversation as resolved.
Show resolved Hide resolved
def get_default_timezone_name() -> str: ...
def get_current_timezone() -> tzinfo: ...
def get_current_timezone() -> BaseTzInfo: ...
filiplajszczak marked this conversation as resolved.
Show resolved Hide resolved
def get_current_timezone_name() -> str: ...
def activate(timezone: Union[tzinfo, str]) -> None: ...
def deactivate() -> None: ...
Expand Down