Skip to content
Snippets Groups Projects
Unverified Commit a423f452 authored by David Robertson's avatar David Robertson Committed by GitHub
Browse files

Fix twisted trunk mypy errors (#14012)

parent 7f4f2a37
No related branches found
No related tags found
No related merge requests found
Fix type annotations to be compatible with new annotations in development versions of twisted.
...@@ -130,6 +130,9 @@ class CasHandler: ...@@ -130,6 +130,9 @@ class CasHandler:
except PartialDownloadError as pde: except PartialDownloadError as pde:
# Twisted raises this error if the connection is closed, # Twisted raises this error if the connection is closed,
# even if that's being used old-http style to signal end-of-data # 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 body = pde.response
except HttpResponseException as e: except HttpResponseException as e:
description = ( description = (
......
...@@ -119,6 +119,9 @@ class RecaptchaAuthChecker(UserInteractiveAuthChecker): ...@@ -119,6 +119,9 @@ class RecaptchaAuthChecker(UserInteractiveAuthChecker):
except PartialDownloadError as pde: except PartialDownloadError as pde:
# Twisted is silly # Twisted is silly
data = pde.response 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")) resp_body = json_decoder.decode(data.decode("utf-8"))
if "success" in resp_body: if "success" in resp_body:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment