Skip to content

Commit f12869c

Browse files
committed
Fix type errors
1 parent 09270fb commit f12869c

File tree

1 file changed

+6
-4
lines changed
  • reportportal_client/_internal/aio

1 file changed

+6
-4
lines changed

reportportal_client/_internal/aio/http.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,23 @@ def __sleep(self, retry_num: int, retry_factor: int) -> Coroutine:
8787
else:
8888
return self.__nothing()
8989

90-
async def __request(self, method: Callable, url, **kwargs: Any) -> ClientResponse:
90+
async def __request(
91+
self, method: Callable[[Any, dict[str, Any]], Coroutine[Any, Any, ClientResponse]], url, **kwargs: Any
92+
) -> ClientResponse:
9193
"""Make a request and retry if necessary.
9294
9395
The method retries requests depending on error class and retry number. For no-retry errors, such as
9496
400 Bad Request it just returns result, for cases where it's reasonable to retry it does it in
9597
exponential manner.
9698
"""
97-
result = None
99+
result: Optional[ClientResponse] = None
98100
exceptions = []
99101

100102
for i in range(self.__retry_number + 1): # add one for the first attempt, which is not a retry
101103
retry_factor = None
102104
if result is not None:
103105
# Release previous result to return connection to pool
104-
await result.release()
106+
result.release()
105107
try:
106108
result = await method(url, **kwargs)
107109
except Exception as exc:
@@ -150,7 +152,7 @@ def put(self, url: str, *, data: Any = None, **kwargs: Any) -> Coroutine[Any, An
150152
"""Perform HTTP PUT request."""
151153
return self.__request(self._client.put, url, data=data, **kwargs)
152154

153-
def close(self) -> Coroutine:
155+
def close(self) -> Coroutine[None, None, None]:
154156
"""Gracefully close internal aiohttp.ClientSession class instance."""
155157
return self._client.close()
156158

0 commit comments

Comments
 (0)