Author: DMRobertson Reviewer: twm Fixes: ticket:10269
Annotate readBody
as per the docstring
2288 | 2288 | self.deferred.errback(reason) |
|
2289 | 2289 | ||
2290 | 2290 | ||
2291 | - | def readBody(response): |
|
2291 | + | def readBody(response: IResponse) -> defer.Deferred[bytes]: |
|
2292 | 2292 | """ |
|
2293 | 2293 | Get the body of an L{IResponse} and return it as a byte string. |
|
2294 | 2294 |
2302 | 2302 | Cancelling it will close the connection to the server immediately. |
|
2303 | 2303 | """ |
|
2304 | 2304 | ||
2305 | - | def cancel(deferred): |
|
2305 | + | def cancel(deferred: defer.Deferred) -> None: |
|
2306 | 2306 | """ |
|
2307 | 2307 | Cancel a L{readBody} call, close the connection to the HTTP server |
|
2308 | 2308 | immediately, if it is still open. |
2313 | 2313 | if abort is not None: |
|
2314 | 2314 | abort() |
|
2315 | 2315 | ||
2316 | - | d = defer.Deferred(cancel) |
|
2316 | + | d: defer.Deferred[bytes] = defer.Deferred(cancel) |
|
2317 | 2317 | protocol = _ReadBodyProtocol(response.code, response.phrase, d) |
|
2318 | 2318 | ||
2319 | 2319 | def getAbort(): |
Files | Coverage |
---|---|
src/twisted | 89.56% |
Project Totals (830 files) | 89.56% |
1 |
#
|
2 |
# For documentation: https://docs.codecov.io/docs/codecovyml-reference
|
3 |
# Twisted settings: https://codecov.io/gh/twisted/twisted/settings/yaml
|
4 |
#
|
5 |
# We want 100% coverage for new patches to make sure we are always increasing
|
6 |
# the coverage.
|
7 |
#
|
8 |
codecov: |
9 |
require_ci_to_pass: yes |
10 |
notify: |
11 |
# We have at least 10 builds in GitHub Actions and 12 in Azure
|
12 |
# and lint + mypy + docs + ReadTheDocs
|
13 |
after_n_builds: 15 |
14 |
wait_for_ci: yes |
15 |
|
16 |
coverage: |
17 |
precision: 2 |
18 |
round: down |
19 |
status: |
20 |
patch: |
21 |
default: |
22 |
# New code should have 100% CI coverage as the minimum
|
23 |
# quality assurance measurement.
|
24 |
# If there is a good reason for new code not to have coverage,
|
25 |
# add inline pragma comments.
|
26 |
target: 100% |
27 |
project: |
28 |
default: |
29 |
# Temporary allow for a bit of slack in overall code coverage due to
|
30 |
# swinging coverage that is not triggered by changes in a PR.
|
31 |
# See: https://twistedmatrix.com/trac/ticket/10170
|
32 |
threshold: 0.02% |
33 |
|
34 |
|
35 |
# We don't want to receive general PR comments about coverage.
|
36 |
# We have the commit status checks and that should be enough.
|
37 |
# See https://docs.codecov.io/docs/pull-request-comments
|
38 |
comment: false |
39 |
|
40 |
# See https://docs.codecov.io/docs/github-checks
|
41 |
github_checks: |
42 |
# We want codecov to send inline PR comments for missing coverage.
|
43 |
annotations: true |