-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Typing for scrapy/utils, second pass #6003
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6003 +/- ##
==========================================
- Coverage 89.24% 89.08% -0.16%
==========================================
Files 162 162
Lines 11325 11425 +100
Branches 1835 1856 +21
==========================================
+ Hits 10107 10178 +71
- Misses 927 949 +22
- Partials 291 298 +7
|
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.
I love it when adding type hints includes bug fixes :)
iterable = etree.iterparse(reader, tag=tag, encoding=reader.encoding) | ||
# technically, etree.iterparse only needs .read() AFAICS, but this is how it's typed | ||
iterable = etree.iterparse( | ||
cast("SupportsReadClose[bytes]", reader), tag=tag, encoding=reader.encoding |
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.
💄 Would it work to move the type hint to line 60/86 above instead of casting here?
PS: I’m not sure we need the comment.
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.
Casting hides reader.encoding
.
No description provided.