From 5c3f01831121106973bcb2d9c13d27997dd8393f Mon Sep 17 00:00:00 2001 From: Nicolas Thumann Date: Mon, 6 Nov 2023 10:27:33 +0100 Subject: [PATCH] Fix: Runtime context methods to fix return type --- pontos/nvd/cve_change_history/api.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pontos/nvd/cve_change_history/api.py b/pontos/nvd/cve_change_history/api.py index 1c40f5d6..b317b4e1 100644 --- a/pontos/nvd/cve_change_history/api.py +++ b/pontos/nvd/cve_change_history/api.py @@ -16,7 +16,8 @@ # along with this program. If not, see . from datetime import datetime -from typing import Any, AsyncIterator, Dict, Iterable, Optional, Union +from types import TracebackType +from typing import Any, AsyncIterator, Dict, Iterable, Optional, Type, Union from httpx import Timeout @@ -150,3 +151,17 @@ async def cve_changes( if results_per_page is not None: start_index += results_per_page + + async def __aenter__(self) -> "CVEChangeHistoryApi": + await super().__aenter__() + return self + + async def __aexit__( + self, + exc_type: Optional[Type[BaseException]], + exc_value: Optional[BaseException], + traceback: Optional[TracebackType], + ) -> Optional[bool]: + return await super().__aexit__( # type: ignore + exc_type, exc_value, traceback + )