Silence one mypy false positive

See https://github.com/python/mypy/issues/5354 for details.
This commit is contained in:
Jakub Stasiak 2018-09-19 12:38:12 +02:00
parent 69f1ab8743
commit 2c30c776e6
1 changed files with 4 additions and 1 deletions

View File

@ -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