diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a781ab8c..321f6e47 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,8 +10,6 @@ repos: hooks: - id: "mypy" name: "Python: types" - additional_dependencies: - - "types-all" - repo: https://github.com/pycqa/isort rev: "5.13.2" diff --git a/setup.cfg b/setup.cfg index 372d84b0..c7cc318a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,6 +18,7 @@ disallow_untyped_defs = true ignore_missing_imports = true no_implicit_optional = true warn_unused_ignores = true +disable_error_code = import-untyped [mypy-tests.*,trino.client,trino.dbapi,trino.sqlalchemy.*] ignore_errors = true diff --git a/trino/auth.py b/trino/auth.py index 5b7b20ff..bf9b4b3b 100644 --- a/trino/auth.py +++ b/trino/auth.py @@ -388,7 +388,7 @@ def __call__(self, r: PreparedRequest) -> PreparedRequest: if token is not None: r.headers['Authorization'] = "Bearer " + token - r.register_hook('response', self._authenticate) # type: ignore + r.register_hook('response', self._authenticate) return r @@ -450,8 +450,8 @@ def _attempt_oauth(self, response: Response, **kwargs: Any) -> None: def _retry_request(self, response: Response, **kwargs: Any) -> Optional[Response]: request = response.request.copy() - extract_cookies_to_jar(request._cookies, response.request, response.raw) # type: ignore - request.prepare_cookies(request._cookies) # type: ignore + extract_cookies_to_jar(request._cookies, response.request, response.raw) + request.prepare_cookies(request._cookies) host = self._determine_host(response.request.url) user = self._determine_user(request.headers) @@ -459,7 +459,7 @@ def _retry_request(self, response: Response, **kwargs: Any) -> Optional[Response token = self._get_token_from_cache(key) if token is not None: request.headers['Authorization'] = "Bearer " + token - retry_response = response.connection.send(request, **kwargs) # type: ignore + retry_response = response.connection.send(request, **kwargs) retry_response.history.append(response) retry_response.request = request return retry_response @@ -468,7 +468,7 @@ def _get_token(self, token_server: str, response: Response, **kwargs: Any) -> st attempts = 0 while attempts < self.MAX_OAUTH_ATTEMPTS: attempts += 1 - with response.connection.send(Request( # type: ignore + with response.connection.send(Request( method='GET', url=token_server).prepare(), **kwargs) as response: if response.status_code == 200: token_response = json.loads(response.text)