From b1f15b59f7056fec1b57a9eb8d1e3133d755f288 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 29 Aug 2022 14:16:57 -0400 Subject: [PATCH] Common: Ignore arg-type error in DIContainer.register() --- monkey/common/di_container.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/monkey/common/di_container.py b/monkey/common/di_container.py index b07367962..06df8e591 100644 --- a/monkey/common/di_container.py +++ b/monkey/common/di_container.py @@ -35,10 +35,15 @@ class DIContainer: :raises TypeError: If `concrete_type` is not a class, or not a subclass of `interface` """ if not inspect.isclass(concrete_type): + # Ignoring arg-type error because this if clause discovers that concrete_type is not the + # type that mypy expects. + formatted_type_name = DIContainer._format_type_name( + concrete_type.__class__ # type: ignore[arg-type] + ) raise TypeError( "Expected a class, but received an instance of type " - f'"{DIContainer._format_type_name(concrete_type.__class__)}"; Pass a class, not an ' - "instance, to register(), or use register_instance() instead" + f'"{formatted_type_name}"; Pass a class, not an instance, to register(), or use' + "register_instance() instead" ) if not issubclass(concrete_type, interface):