Skip to content

Commit

Permalink
Use TypeGuard
Browse files Browse the repository at this point in the history
  • Loading branch information
srittau authored Nov 27, 2024
1 parent 3cef1ce commit 89959bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stubs/icalendar/icalendar/tools.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datetime
from typing import Final
from typing_extensions import TypeIs
from typing_extensions import TypeGuard

from pytz.tzinfo import BaseTzInfo

Expand All @@ -19,5 +19,5 @@ def is_date(dt: datetime.date) -> bool: ... # and not datetime.date
def is_datetime(dt: datetime.date) -> TypeIs[datetime.datetime]: ...

Check failure on line 19 in stubs/icalendar/icalendar/tools.pyi

View workflow job for this annotation

GitHub Actions / Test typeshed with pyright (Linux, 3.12)

"TypeIs" is not defined (reportUndefinedVariable)
def to_datetime(dt: datetime.date) -> datetime.datetime: ...
def is_pytz(tz: datetime.tzinfo) -> TypeIs[BaseTzInfo]: ...

Check failure on line 21 in stubs/icalendar/icalendar/tools.pyi

View workflow job for this annotation

GitHub Actions / Test typeshed with pyright (Linux, 3.12)

"TypeIs" is not defined (reportUndefinedVariable)
def is_pytz_dt(dt: datetime.date) -> TypeIs[datetime.datetime]: ... # and dt.tzinfo is BaseTZInfo
def is_pytz_dt(dt: datetime.date) -> TypeGuard[datetime.datetime]: ... # and dt.tzinfo is BaseTZInfo
def normalize_pytz(dt: datetime.date) -> datetime.datetime: ...

0 comments on commit 89959bc

Please sign in to comment.