Skip to content

Commit

Permalink
[p] Cover azul.es with mypy (#6821)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannes-ucsc committed Feb 3, 2025
1 parent 7340c90 commit 457492b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ modules =
azul.doctests,
azul.drs,
azul.dss,
azul.enums
azul.enums,
azul.es
packages =
azul.openapi

Expand All @@ -36,3 +37,6 @@ follow_untyped_imports = True
[mypy-docker.*]
; https://github.com/python/typeshed/issues/13439
follow_untyped_imports = True

[mypy-aws_requests_auth.boto_utils]
follow_untyped_imports = True
13 changes: 9 additions & 4 deletions src/azul/es.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Any,
Collection,
Mapping,
MutableMapping,
Tuple,
cast,
)
Expand Down Expand Up @@ -66,11 +67,11 @@ class AzulConnection(Connection):
def perform_request(self,
method: str,
url: str,
params: Mapping[str, Any] | None = None,
params: MutableMapping[str, Any] | None = None,
body: bytes | None = None,
timeout: int | float | None = None,
ignore: Collection[int] = (),
headers: Mapping[str, str] | None = None
headers: MutableMapping[str, str] | None = None
) -> Tuple[int, Mapping[str, str], str]:
self._log_request(method, self._full_url(url, params), headers, body)
return super().perform_request(method, url, params, body, timeout, ignore, headers)
Expand Down Expand Up @@ -159,7 +160,7 @@ def __init__(self,
self._inner = pool
self._http_auth = http_auth

def urlopen(self,
def urlopen(self, # type: ignore[override]
method: str,
url: str,
body: bytes | None = None,
Expand Down Expand Up @@ -201,7 +202,11 @@ def close(self):

class AzulUrllib3HttpConnection(AzulConnection, Urllib3HttpConnection):

def __init__(self, *args, http_auth: BotoAWSRequestsAuth = None, **kwargs):
def __init__(self,
*args,
http_auth: BotoAWSRequestsAuth | None = None,
**kwargs
) -> None:
super().__init__(*args, **kwargs)
if http_auth is not None:
# We can't extend the pool class because we don't control the
Expand Down

0 comments on commit 457492b

Please sign in to comment.