-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Use Iterable hint instead of Sequence #4125
Use Iterable hint instead of Sequence #4125
Conversation
Given that the `FrozenList` type hint is `Union[List[_T], Iterable[_T]]` the Application middleware type should not restrict to `Sequence` and support all `Iterable` types.
Codecov Report
@@ Coverage Diff @@
## master #4125 +/- ##
=======================================
Coverage 97.33% 97.33%
=======================================
Files 43 43
Lines 8849 8849
Branches 1381 1381
=======================================
Hits 8613 8613
Misses 114 114
Partials 122 122
Continue to review full report at Codecov.
|
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.
Makes sense.
Thank you
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.
Please add ./CHANGES/4125.feature
file.
72e3142
to
cd50afa
Compare
Done. |
Thanks! |
Given that the `FrozenList` type hint is `Union[List[_T], Iterable[_T]]` the Application middleware type should not restrict to `Sequence` and support all `Iterable` types.. (cherry picked from commit 8475395) Co-authored-by: Stefan T <[email protected]>
Given that the `FrozenList` type hint is `Union[List[_T], Iterable[_T]]` the Application middleware type should not restrict to `Sequence` and support all `Iterable` types.. (cherry picked from commit 8475395) Co-authored-by: Stefan T <[email protected]>
Given that the
FrozenList
type hint isUnion[List[_T], Iterable[_T]]
the Application middleware type should not restrict to
Sequence
andsupport all
Iterable
types.What do these changes do?
In my application I pass a generator type as the middleware argument to create a web.Application. mypy complains that it is not a
Sequence
type as hinted in the class. I feel the Sequence hint isto restrictive and an Iterable is the better choice.
Are there changes in behavior for the user?
No.
Related issue number
None
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bugfix)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.