From c3981b02fcb4f1d4112ecffca67e19c13792d076 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Sun, 13 Sep 2020 19:51:56 -0400 Subject: [PATCH] Return types module with deprecation warning --- src/dependency_injector/types.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/dependency_injector/types.py diff --git a/src/dependency_injector/types.py b/src/dependency_injector/types.py new file mode 100644 index 00000000..205b57a4 --- /dev/null +++ b/src/dependency_injector/types.py @@ -0,0 +1,18 @@ +from typing import TypeVar, Generic, Any +import warnings + + +warnings.warn( + message=( + 'Types module is deprecated since version 3.44.0. Use "Provider" class from the ' + '"providers" module: providers.Provider[SomeClass]' + ), + category=DeprecationWarning, +) + +Injection = Any +T = TypeVar('T') + + +class Provider(Generic[T]): + def __call__(self, *args: Injection, **kwargs: Injection) -> T: ...