-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
base: main
Are you sure you want to change the base?
[icalendar] Update to 6.1.* #13109
Conversation
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
Closes: #13071