-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Typing for scrapy/utils #5925
Typing for scrapy/utils #5925
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5925 +/- ##
==========================================
+ Coverage 88.89% 89.19% +0.29%
==========================================
Files 162 162
Lines 11254 11287 +33
Branches 1827 1833 +6
==========================================
+ Hits 10004 10067 +63
+ Misses 965 928 -37
- Partials 285 292 +7
|
|
Another batch of improved typing, mostly covering scrapy.utils.* (not everything there was processed yet but I think it's already quite large).
I have one question for @elacuesta: #3869 added
scrapy.utils.datatypes.LocalWeakReferencedCache
which returns None if "key is not weak-referenceable", and because of howscrapy.utils.misc.is_generator_with_return_value()
uses it, that function can return None in addition to an expected bool. It even uses a pattern of putting a value into a dict and getting it back. So I wonder if None there has the same value as False (as the result ofis_generator_with_return_value()
is only checked with a simpleif
) and if it's fine to cast it to bool like I do in this PR.