Skip to content
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

Type hints for Request and subclasses #5171

Merged
merged 8 commits into from
Jun 11, 2021
Merged

Conversation

elacuesta
Copy link
Member

No description provided.

@codecov
Copy link

codecov bot commented Jun 1, 2021

Codecov Report

Merging #5171 (ce64477) into master (23cfdb0) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #5171      +/-   ##
==========================================
+ Coverage   88.16%   88.18%   +0.02%     
==========================================
  Files         162      162              
  Lines       10487    10490       +3     
  Branches     1517     1516       -1     
==========================================
+ Hits         9246     9251       +5     
+ Misses        966      965       -1     
+ Partials      275      274       -1     
Impacted Files Coverage Δ
scrapy/downloadermiddlewares/retry.py 100.00% <100.00%> (ø)
scrapy/http/request/__init__.py 97.77% <100.00%> (-0.03%) ⬇️
scrapy/http/request/form.py 95.48% <100.00%> (+0.13%) ⬆️
scrapy/http/request/json_request.py 94.87% <100.00%> (ø)
scrapy/http/request/rpc.py 100.00% <100.00%> (ø)
scrapy/utils/curl.py 100.00% <100.00%> (ø)
scrapy/core/downloader/__init__.py 92.48% <0.00%> (+1.50%) ⬆️

@Urahara
Copy link

Urahara commented Jun 2, 2021

@elacuesta Sorry for noobish why some times you just use Request and others you use this RequestTypeVar that references to Request?

@elacuesta
Copy link
Member Author

elacuesta commented Jun 7, 2021

That approach is based on https://stackoverflow.com/a/44644576 (#4243 (comment)), the idea being that cls argument for class methods is the same as the return type. Thanks for pointing that out, it made me realize about a couple of mistakes I had.

@wRAR wRAR merged commit 9f81de2 into scrapy:master Jun 11, 2021
@elacuesta elacuesta deleted the request-types branch June 11, 2021 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants