Shortcut around __init__ for internal use when we want to skip costly validation
(
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,
)
| 848 | |
| 849 | @classmethod |
| 850 | def _construct_direct( |
| 851 | cls, |
| 852 | variables: dict[Any, Variable], |
| 853 | coord_names: set[Hashable], |
| 854 | dims: dict[Any, int] | None = None, |
| 855 | attrs: dict | None = None, |
| 856 | indexes: dict[Any, Index] | None = None, |
| 857 | encoding: dict | None = None, |
| 858 | close: Callable[[], None] | None = None, |
| 859 | ) -> Self: |
| 860 | """Shortcut around __init__ for internal use when we want to skip |
| 861 | costly validation |
| 862 | """ |
| 863 | if dims is None: |
| 864 | dims = calculate_dimensions(variables) |
| 865 | if indexes is None: |
| 866 | indexes = {} |
| 867 | obj = object.__new__(cls) |
| 868 | obj._variables = variables |
| 869 | obj._coord_names = coord_names |
| 870 | obj._dims = dims |
| 871 | obj._indexes = indexes |
| 872 | obj._attrs = attrs |
| 873 | obj._close = close |
| 874 | obj._encoding = encoding |
| 875 | return obj |
| 876 | |
| 877 | def _replace( |
| 878 | self, |
no test coverage detected