diff --git a/proxy/common/utils.py b/proxy/common/utils.py index 61a3b9cc..062a567b 100644 --- a/proxy/common/utils.py +++ b/proxy/common/utils.py @@ -14,6 +14,7 @@ import socket from types import TracebackType from typing import Optional, Dict, Any, List, Tuple, Type, Callable +from typing_extensions import Literal from .constants import HTTP_1_1, COLON, WHITESPACE, CRLF @@ -185,7 +186,7 @@ class socket_connection(contextlib.ContextDecorator): self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], - exc_tb: Optional[TracebackType]) -> bool: + exc_tb: Optional[TracebackType]) -> Literal[False]: if self.conn: self.conn.close() return False diff --git a/proxy/http/parser.py b/proxy/http/parser.py index efcac32c..a56f1d37 100644 --- a/proxy/http/parser.py +++ b/proxy/http/parser.py @@ -117,7 +117,7 @@ class HttpParser: self.host, self.port = self.url.hostname, self.url.port \ if self.url.port else 80 else: - raise KeyError('Invalid request\n%s' % self.bytes) + raise KeyError(b'Invalid request\n%b' % self.bytes) self.path = self.build_url() def is_chunked_encoded(self) -> bool: diff --git a/requirements-testing.txt b/requirements-testing.txt index f1f0886d..a9c8c762 100644 --- a/requirements-testing.txt +++ b/requirements-testing.txt @@ -4,6 +4,6 @@ flake8==3.7.9 pytest==5.2.2 pytest-cov==2.8.1 autopep8==1.4.4 -mypy==0.730 +mypy==0.740 py-spy==0.3.0 codecov==2.0.15