From 2c30c776e6c3ff267d94b510aad7bdf609ee64ba Mon Sep 17 00:00:00 2001 From: Jakub Stasiak Date: Wed, 19 Sep 2018 12:38:12 +0200 Subject: [PATCH] Silence one mypy false positive See https://github.com/python/mypy/issues/5354 for details. --- injector.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/injector.py b/injector.py index 924f207..64fb115 100644 --- a/injector.py +++ b/injector.py @@ -939,7 +939,10 @@ def _infer_injected_bindings(callable): union_members = v.__union_params__ new_members = tuple(set(union_members) - {type(None)}) new_union = Union[new_members] - bindings[k] = new_union + # mypy complains about this construct: + # error: The type alias is invalid in runtime context + # See: https://github.com/python/mypy/issues/5354 + bindings[k] = new_union # type: ignore return bindings