From 29827cb4118dac128331375328475504ceb2c64d Mon Sep 17 00:00:00 2001 From: Leonardus Chen Date: Fri, 10 Oct 2025 08:43:16 +0700 Subject: [PATCH] Add missing stub on providers.Resource for AbstractContextManager and AbstractAsyncContextManager --- src/dependency_injector/providers.pyi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/dependency_injector/providers.pyi b/src/dependency_injector/providers.pyi index e4d62506..8f9b525a 100644 --- a/src/dependency_injector/providers.pyi +++ b/src/dependency_injector/providers.pyi @@ -1,5 +1,6 @@ from __future__ import annotations +from contextlib import AbstractContextManager, AbstractAsyncContextManager from pathlib import Path from typing import ( Awaitable, @@ -465,6 +466,20 @@ class Resource(Provider[T]): **kwargs: Injection, ) -> None: ... @overload + def __init__( + self, + provides: Optional[_Callable[..., AbstractContextManager[T]]] = None, + *args: Injection, + **kwargs: Injection, + ) -> None: ... + @overload + def __init__( + self, + provides: Optional[_Callable[..., AbstractAsyncContextManager[T]]] = None, + *args: Injection, + **kwargs: Injection, + ) -> None: ... + @overload def __init__( self, provides: Optional[_Callable[..., _Iterator[T]]] = None,