From e78bffb414c8438c2d43a0106253d5812ce2fdab Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 26 Apr 2022 01:27:17 -0400 Subject: [PATCH] Common: Add note about varargs and kwargs to resolve() docstring --- monkey/common/di_container.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monkey/common/di_container.py b/monkey/common/di_container.py index 8ee7fcb1f..4ad246ec7 100644 --- a/monkey/common/di_container.py +++ b/monkey/common/di_container.py @@ -37,7 +37,8 @@ class DIContainer: def resolve(self, type_: Type[T]) -> T: """ Resolves all dependencies and returns a new instance of `type_` using constructor dependency - injection. + injection. Note that only positional arguments are resolved. Varargs, keyword-only args, and + default values are ignored. :param type_: A type (class) to construct. :return: An instance of `type_` @@ -49,7 +50,6 @@ class DIContainer: args = [] - # TODO: Need to handle keyword-only arguments, defaults, varargs, etc. for arg_type in inspect.getfullargspec(type_).annotations.values(): instance = self._resolve_type(arg_type) args.append(instance)