Skip to content

Commit

Permalink
Stub methods for abstract tzinfo to allow usage with mypy 1.0.0
Browse files Browse the repository at this point in the history
Fixes #125.  Ported from:

python/typeshed@de0b366

Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk committed Mar 8, 2023
1 parent b6ce01a commit abb4903
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/backports/zoneinfo/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import typing
from datetime import datetime, tzinfo
from datetime import datetime, timedelta, tzinfo
from typing import (
Any,
Iterable,
Expand Down Expand Up @@ -30,6 +30,9 @@ class ZoneInfo(tzinfo):
) -> _T: ...
@classmethod
def clear_cache(cls, *, only_keys: Iterable[str] = ...) -> None: ...
def tzname(self, __dt: datetime | None) -> str | None: ...
def utcoffset(self, __dt: datetime | None) -> timedelta | None: ...
def dst(self, __dt: datetime | None) -> timedelta | None: ...

# Note: Both here and in clear_cache, the types allow the use of `str` where
# a sequence of strings is required. This should be remedied if a solution
Expand Down

0 comments on commit abb4903

Please sign in to comment.