mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 03:54:52 -04:00
Fix up type hints for Twisted 21.7 (#10490)
Mostly this involves decorating a few Deferred declarations with extra type hints. We wrap the types in quotes to avoid runtime errors when running against older versions of Twisted that don't have generics on Deferred.
This commit is contained in:
parent
9643dfde6a
commit
d9cb658c78
6 changed files with 25 additions and 15 deletions
|
@ -847,7 +847,7 @@ class _ReadBodyWithMaxSizeProtocol(protocol.Protocol):
|
|||
|
||||
def read_body_with_max_size(
|
||||
response: IResponse, stream: ByteWriteable, max_size: Optional[int]
|
||||
) -> defer.Deferred:
|
||||
) -> "defer.Deferred[int]":
|
||||
"""
|
||||
Read a HTTP response body to a file-object. Optionally enforcing a maximum file size.
|
||||
|
||||
|
@ -862,7 +862,7 @@ def read_body_with_max_size(
|
|||
Returns:
|
||||
A Deferred which resolves to the length of the read body.
|
||||
"""
|
||||
d = defer.Deferred()
|
||||
d: "defer.Deferred[int]" = defer.Deferred()
|
||||
|
||||
# If the Content-Length header gives a size larger than the maximum allowed
|
||||
# size, do not bother downloading the body.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue