From f1a659c9866f750911b9b75d21fd9aeaa3e4fa03 Mon Sep 17 00:00:00 2001 From: Jakub Stasiak Date: Thu, 29 Jun 2023 02:41:59 +0200 Subject: [PATCH] Make Mypy happy (#222) We're assigning to an attribute Mypy doesn't know about. The error it raised: injector/__init__.py:862: error: "FunctionType" has no attribute "__binding__" [attr-defined] Found 1 error in 1 file (checked 1 source file) --- injector/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/injector/__init__.py b/injector/__init__.py index dca43ea..90dc4bd 100644 --- a/injector/__init__.py +++ b/injector/__init__.py @@ -859,7 +859,7 @@ class Module: % (function.__name__, type(self), e) ) from e return_type = annotations['return'] - binding = function.__func__.__binding__ = Binding( + binding = cast(Any, function.__func__).__binding__ = Binding( interface=return_type, provider=binding.provider, scope=binding.scope ) bind_method = binder.multibind if binding.is_multibinding() else binder.bind