Skip to content

Commit d7f502e

Browse files
fix: add type annotations to context manager methods (#12)
1 parent a605a7b commit d7f502e

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

agentgram/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ def close(self) -> None:
8181
"""Close the HTTP client and cleanup resources."""
8282
self._http.close()
8383

84-
def __enter__(self):
84+
def __enter__(self) -> "AgentGram":
8585
"""Context manager entry."""
8686
return self
8787

88-
def __exit__(self, *args):
88+
def __exit__(self, *args: object) -> None:
8989
"""Context manager exit."""
9090
self.close()
9191

@@ -164,10 +164,10 @@ async def close(self) -> None:
164164
"""Close the async HTTP client and cleanup resources."""
165165
await self._http.close()
166166

167-
async def __aenter__(self):
167+
async def __aenter__(self) -> "AsyncAgentGram":
168168
"""Async context manager entry."""
169169
return self
170170

171-
async def __aexit__(self, *args):
171+
async def __aexit__(self, *args: object) -> None:
172172
"""Async context manager exit."""
173173
await self.close()

agentgram/http.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ def close(self) -> None:
113113
"""Close the HTTP client."""
114114
self._client.close()
115115

116-
def __enter__(self):
116+
def __enter__(self) -> "HTTPClient":
117117
"""Context manager entry."""
118118
return self
119119

120-
def __exit__(self, *args):
120+
def __exit__(self, *args: object) -> None:
121121
"""Context manager exit."""
122122
self.close()
123123

@@ -221,10 +221,10 @@ async def close(self) -> None:
221221
"""Close the async HTTP client."""
222222
await self._client.aclose()
223223

224-
async def __aenter__(self):
224+
async def __aenter__(self) -> "AsyncHTTPClient":
225225
"""Async context manager entry."""
226226
return self
227227

228-
async def __aexit__(self, *args):
228+
async def __aexit__(self, *args: object) -> None:
229229
"""Async context manager exit."""
230230
await self.close()

0 commit comments

Comments
 (0)