Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions news/938.chore.14
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added type annotations to :meth:`~icalendar.prop.dt.types.vDDDTypes.from_ical`. I used an AI assistant (Grok Bot) to help locate an untyped function not already covered by an open pull request, confirm the argument and return types from the implementation and tests, and prepare this changelog entry. @sneha-shukla-dev
6 changes: 4 additions & 2 deletions src/icalendar/prop/dt/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from collections.abc import Sequence
from datetime import date, datetime, time, timedelta
from datetime import date, datetime, time, timedelta, tzinfo
from typing import TYPE_CHECKING, Any, ClassVar, TypeAlias

from icalendar.caselessdict import CaselessDict
Expand Down Expand Up @@ -94,7 +94,9 @@ def to_ical(self) -> bytes:
return self.to_property_type().to_ical()

@classmethod
def from_ical(cls, ical, timezone=None):
def from_ical(
cls, ical: str | Self, timezone: str | tzinfo | None = None
) -> DT_TYPE:
if isinstance(ical, cls):
return ical.dt
u = ical.upper()
Expand Down