pydata / xarray

N-D labeled arrays and datasets in Python
https://xarray.dev
Apache License 2.0
3.6k stars 1.08k forks source link

Mypy 1.12 issues #9624

Open kmuehlbauer opened 2 weeks ago

kmuehlbauer commented 2 weeks ago

What is your issue?

Mypy 1.12 was released yesterday and broke our testing:

Found 3 errors in 2 files (checked 169 source files)
xarray/backends/common.py:114: error: Incompatible types in assignment (expression has type "list[Any | Sequence[str | PathLike[Any]] | Sequence[Sequence[str | PathLike[Any]]] | Sequence[Sequence[Sequence[str | PathLike[Any]]]]]", variable has type "str | PathLike[Any] | str | PathLike[Any] | Sequence[str | PathLike[Any]] | Sequence[Sequence[str | PathLike[Any]]] | Sequence[Sequence[Sequence[str | PathLike[Any]]]] | Sequence[Sequence[Sequence[Sequence[str | PathLike[Any]]]]]")  [assignment]
xarray/backends/common.py:116: error: Incompatible return value type (got "list[Any] | Sequence[str | PathLike[Any]] | Sequence[Sequence[str | PathLike[Any]]] | Sequence[Sequence[Sequence[str | PathLike[Any]]]] | Sequence[Sequence[Sequence[Sequence[str | PathLike[Any]]]]]", expected "list[str]")  [return-value]
Error: Process completed with exit code 1.

In #9621 I've pinned mypy to the last working version 1.11.2. Not sure, if this is a big issue and how much it takes to resolve, my typing-fu is mediocre :grimacing:.

headtr1ck commented 3 days ago

Actually a "homemade" problem. I was the one who added type hints to netCDF4 in the first place, haha!