1
Fork 0
mirror of https://github.com/RGBCube/GitHubWrapper synced 2025-05-17 14:35:09 +00:00

Fixed walrus, for real

This commit is contained in:
sudosnok 2022-05-01 20:17:16 +01:00
parent 04bdadc995
commit efabb44b54

View file

@ -104,13 +104,10 @@ class GHClient:
async def __aexit__(self, *args: Any, **kwargs: Any) -> None: async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
try: try:
session = self.http.session session = self.http.session
await self.session.close() await session.close()
except Exception as exc: except Exception as exc:
raise Exception('HTTP Session doesn\'t exist') from exc raise Exception('HTTP Session doesn\'t exist') from exc
if session := getattr(self.http, 'session', None):
await session.close()
def __repr__(self) -> str: def __repr__(self) -> str:
return f'<{self.__class__.__name__} has_auth={bool(self._auth)}>' return f'<{self.__class__.__name__} has_auth={bool(self._auth)}>'