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

[icalendar] Update to 6.1.* #13109

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

srittau
Copy link
Collaborator

@srittau srittau commented Nov 25, 2024

Closes: #13071

Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉


class UIDGenerator:
chars: Final[list[str]]
@staticmethod
def rnd_string(length: int = 16) -> str: ...
@staticmethod
def uid(host_name: str = "example.com", unique: str = "") -> vText: ...

def is_date(dt: datetime.date) -> TypeIs[datetime.date]: ... # and not datetime.date
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def is_date(dt: datetime.date) -> TypeIs[datetime.date]: ... # and not datetime.date
def is_date(dt: datetime.date) -> TypeIs[datetime.date]: ... # and not datetime.datetime

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I think using TypeIs is inaccurate here. If it returns TypeIs[date], it should return True for all arguments that are instances of date, which this one doesn't. We could use TypeGuard, but given the parameter annotation, it can't really do useful narrowing anyway, so I'd just use bool as the return type.

def is_datetime(dt: datetime.date) -> TypeIs[datetime.datetime]: ...
def to_datetime(dt: datetime.date) -> datetime.datetime: ...
def is_pytz(tz: datetime.tzinfo) -> TypeIs[BaseTzInfo]: ...
def is_pytz_dt(dt: datetime.date) -> TypeIs[datetime.datetime]: ... # and dt.tzinfo is BaseTZInfo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably use TypeGuard here because of the extra condition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants