When trying to check the following code using mypy:
import itertools
from typing import Sequence, Union, List
DigitsSequence = Union[str, Sequence[Union[str, int]]]
def normalize_input(digits: DigitsSequence) -> List[str]:
try:
new_digits = list(map(str, digits)) # <- Line 17
if not all(map(str.isdecimal, new_digits)):
raise TypeError
except TypeError:
print("Digits must be an iterable containing strings.")
return []
return new_digits
mypy throws the following errors:
calculate.py:17: error: Cannot infer type argument 1 of "map"
Why does this error occur? How can I fix it?
Thanks :)
Edit: It was actually a bug in mypy, and it's fixed now.