Version
2026.6.0
How did you install UXarray?
Source
What happened?
uxarray type hints allow None for too many parameters. For example, in uxarray/core/api.py:
def open_grid(
grid_filename_or_obj: str | os.PathLike[Any] | dict | Dataset,
chunks=None,
use_dual: bool | None = False,
**kwargs: dict[str, Any],
):
"""Constructs and returns a ``Grid`` from a grid file.
...
use_dual : bool, optional
Specify whether to use the primal (use_dual=False) or dual (use_dual=True) mesh if the file type is MPAS
...
"""
...
The docstring and code both expect a bool, not None; there is no special meaning of use_dual=None. So, None should not be allowed in the type hinting here.
Related: #1590
What did you expect to happen?
I expected type hinting for each kwarg to either precisely represent all accepted types, or to be excluded entirely.
Can you provide a MCVE to repoduce the bug?
Version
2026.6.0
How did you install UXarray?
Source
What happened?
uxarray type hints allow None for too many parameters. For example, in
uxarray/core/api.py:The docstring and code both expect a bool, not None; there is no special meaning of use_dual=None. So, None should not be allowed in the type hinting here.
Related: #1590
What did you expect to happen?
I expected type hinting for each kwarg to either precisely represent all accepted types, or to be excluded entirely.
Can you provide a MCVE to repoduce the bug?