Using Pycharm 2022.2.3 on Ubuntu 20.04. This is the code sample.
from typing import cast
samples: int = cast(typ=int, val=len(y_train))
The warning says
Expected type Sized, got Iterable[float]
Seems like PyCharm has some wrong assumption about the signature of the len function and does not count y_train as Sized.