From b6cb460eb113f773860fe5df6fd4a243d025d184 Mon Sep 17 00:00:00 2001 From: Bouwe Andela Date: Thu, 16 Jul 2026 18:06:34 +0200 Subject: [PATCH 1/4] Fix type hints for cube --- lib/iris/cube.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/iris/cube.py b/lib/iris/cube.py index 6653018055..1b0938d82e 100644 --- a/lib/iris/cube.py +++ b/lib/iris/cube.py @@ -1213,11 +1213,14 @@ def __init__( attributes: Mapping | None = None, cell_methods: Iterable[CellMethod] | None = None, dim_coords_and_dims: Iterable[tuple[DimCoord, int]] | None = None, - aux_coords_and_dims: Iterable[tuple[AuxCoord, int | Iterable[int]]] + aux_coords_and_dims: Iterable[tuple[AuxCoord, int | Iterable[int] | None]] | None = None, aux_factories: Iterable[AuxCoordFactory] | None = None, - cell_measures_and_dims: Iterable[tuple[CellMeasure, int]] | None = None, - ancillary_variables_and_dims: Iterable[tuple[AncillaryVariable, int]] + cell_measures_and_dims: Iterable[tuple[CellMeasure, Iterable[int] | int | None]] + | None = None, + ancillary_variables_and_dims: Iterable[ + tuple[AncillaryVariable, Iterable[int] | int | None] + ] | None = None, shape: tuple | None = None, ): From 31ac6fe0028f98739694b6592b693cd9594d2aa7 Mon Sep 17 00:00:00 2001 From: Bouwe Andela Date: Thu, 16 Jul 2026 21:30:11 +0200 Subject: [PATCH 2/4] Add changelog and more readable formatting --- changelog/7202.doc.rst | 1 + lib/iris/cube.py | 27 +++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 changelog/7202.doc.rst diff --git a/changelog/7202.doc.rst b/changelog/7202.doc.rst new file mode 100644 index 0000000000..b042037fd8 --- /dev/null +++ b/changelog/7202.doc.rst @@ -0,0 +1 @@ +:user:`bouweandela` Fixed the type hints for the :method:`iris.cube.Cube.__init__`. diff --git a/lib/iris/cube.py b/lib/iris/cube.py index 1b0938d82e..51f41ed11d 100644 --- a/lib/iris/cube.py +++ b/lib/iris/cube.py @@ -1212,14 +1212,33 @@ def __init__( units: Unit | str | None = None, attributes: Mapping | None = None, cell_methods: Iterable[CellMethod] | None = None, - dim_coords_and_dims: Iterable[tuple[DimCoord, int]] | None = None, - aux_coords_and_dims: Iterable[tuple[AuxCoord, int | Iterable[int] | None]] + dim_coords_and_dims: Iterable[ + tuple[ + DimCoord, + int, + ], + ] + | None = None, + aux_coords_and_dims: Iterable[ + tuple[ + AuxCoord, + int | Iterable[int] | None, + ], + ] | None = None, aux_factories: Iterable[AuxCoordFactory] | None = None, - cell_measures_and_dims: Iterable[tuple[CellMeasure, Iterable[int] | int | None]] + cell_measures_and_dims: Iterable[ + tuple[ + CellMeasure, + Iterable[int] | int | None, + ], + ] | None = None, ancillary_variables_and_dims: Iterable[ - tuple[AncillaryVariable, Iterable[int] | int | None] + tuple[ + AncillaryVariable, + Iterable[int] | int | None, + ], ] | None = None, shape: tuple | None = None, From 0e2ecd418d2b37bc77e64868a35a13009cf1d452 Mon Sep 17 00:00:00 2001 From: Bouwe Andela Date: Thu, 16 Jul 2026 21:44:48 +0200 Subject: [PATCH 3/4] Correct sphinx role in changelog --- changelog/7202.doc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/7202.doc.rst b/changelog/7202.doc.rst index b042037fd8..2383592a4c 100644 --- a/changelog/7202.doc.rst +++ b/changelog/7202.doc.rst @@ -1 +1 @@ -:user:`bouweandela` Fixed the type hints for the :method:`iris.cube.Cube.__init__`. +:user:`bouweandela` Fixed the type hints for the :meth:`iris.cube.Cube.__init__`. From 4716a093e0bf6a379b2467732137727d3c769fa2 Mon Sep 17 00:00:00 2001 From: Bouwe Andela Date: Fri, 17 Jul 2026 11:11:11 +0200 Subject: [PATCH 4/4] DimCoords can also be added to Cube.aux_coords --- lib/iris/cube.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/iris/cube.py b/lib/iris/cube.py index 51f41ed11d..0bd3d3b018 100644 --- a/lib/iris/cube.py +++ b/lib/iris/cube.py @@ -1221,7 +1221,7 @@ def __init__( | None = None, aux_coords_and_dims: Iterable[ tuple[ - AuxCoord, + AuxCoord | DimCoord, int | Iterable[int] | None, ], ]