Repository navigation
Conversation
Carry over corrections identified while annotating the implementation, including parser overloads, recurrence return types and duck-typed inputs. Update the timezone and deprecated zoneinfo APIs for the released 3.0 implementation, and add regression cases for protocol inference and date subclass behavior.
Contributor
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update the stubs for dateutil 3.0 and carry over signature corrections from dateutil/dateutil#1647, using structural protocols to preserve duck-typed inputs and overloads to describe parser and recurrence results.
This supersedes the version bump in #16593. ISO-parser bytearray support remains covered by #16613.
Differences from the proposed inline annotations
The stubs retain datetime-subclass return types for
relativedeltaarithmetic, while date inputs have adatereturn type because adding a time component can promote them todatetime. A separate date/timedelta overload forutils.within_deltahandles a mypy inference limitation with the generic subtraction protocol.The stubs target the released 3.0 implementation, which still includes some compatibility aliases removed on dateutil's main branch. Stub-only protocols use
@type_check_onlyand existing typeshed protocols where available.Assisted by OpenAI Codex.