Overriding this method (along with ._replace) and modifying it to return a Dataset object should hopefully ensure that the return type of any method on this object is a Dataset.
( # type: ignore[override]
cls,
variables: dict[Any, Variable],
coord_names: set[Hashable],
dims: dict[Any, int] | None = None,
attrs: dict | None = None,
indexes: dict[Any, Index] | None = None,
encoding: dict | None = None,
close: Callable[[], None] | None = None,
)
| 324 | |
| 325 | @classmethod |
| 326 | def _construct_direct( # type: ignore[override] |
| 327 | cls, |
| 328 | variables: dict[Any, Variable], |
| 329 | coord_names: set[Hashable], |
| 330 | dims: dict[Any, int] | None = None, |
| 331 | attrs: dict | None = None, |
| 332 | indexes: dict[Any, Index] | None = None, |
| 333 | encoding: dict | None = None, |
| 334 | close: Callable[[], None] | None = None, |
| 335 | ) -> Dataset: |
| 336 | """ |
| 337 | Overriding this method (along with ._replace) and modifying it to return a Dataset object |
| 338 | should hopefully ensure that the return type of any method on this object is a Dataset. |
| 339 | """ |
| 340 | if dims is None: |
| 341 | dims = calculate_dimensions(variables) |
| 342 | if indexes is None: |
| 343 | indexes = {} |
| 344 | obj = object.__new__(Dataset) |
| 345 | obj._variables = variables |
| 346 | obj._coord_names = coord_names |
| 347 | obj._dims = dims |
| 348 | obj._indexes = indexes |
| 349 | obj._attrs = attrs |
| 350 | obj._close = close |
| 351 | obj._encoding = encoding |
| 352 | return obj |
| 353 | |
| 354 | def _replace( # type: ignore[override] |
| 355 | self, |
no test coverage detected