mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 09:43:46 +01:00
Fix twisted trunk mypy errors (#14012)
This commit is contained in:
parent
7f4f2a3782
commit
a423f45294
3 changed files with 7 additions and 0 deletions
1
changelog.d/14012.misc
Normal file
1
changelog.d/14012.misc
Normal file
|
@ -0,0 +1 @@
|
|||
Fix type annotations to be compatible with new annotations in development versions of twisted.
|
|
@ -130,6 +130,9 @@ class CasHandler:
|
|||
except PartialDownloadError as pde:
|
||||
# Twisted raises this error if the connection is closed,
|
||||
# even if that's being used old-http style to signal end-of-data
|
||||
# Assertion is for mypy's benefit. Error.response is Optional[bytes],
|
||||
# but a PartialDownloadError should always have a non-None response.
|
||||
assert pde.response is not None
|
||||
body = pde.response
|
||||
except HttpResponseException as e:
|
||||
description = (
|
||||
|
|
|
@ -119,6 +119,9 @@ class RecaptchaAuthChecker(UserInteractiveAuthChecker):
|
|||
except PartialDownloadError as pde:
|
||||
# Twisted is silly
|
||||
data = pde.response
|
||||
# For mypy's benefit. A general Error.response is Optional[bytes], but
|
||||
# a PartialDownloadError.response should be bytes AFAICS.
|
||||
assert data is not None
|
||||
resp_body = json_decoder.decode(data.decode("utf-8"))
|
||||
|
||||
if "success" in resp_body:
|
||||
|
|
Loading…
Reference in a new issue