Skip to content

Commit

Permalink
Fix types-all installation failure in pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hovaesco committed Aug 6, 2024
1 parent dbe2b1e commit 2410e3b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions trino/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -450,16 +450,16 @@ 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)
key = self._construct_cache_key(host, user)
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
Expand All @@ -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)
Expand Down

0 comments on commit 2410e3b

Please sign in to comment.