@@ -34,6 +34,7 @@ from typing import (
3434 TYPE_CHECKING ,
3535 Any ,
3636 Callable ,
37+ final ,
3738 Final ,
3839 Generic ,
3940 Iterable ,
@@ -51,7 +52,7 @@ from typing import (
5152import cftime
5253import numpy as np
5354import numpy .typing as npt
54- from typing_extensions import Buffer , Self , TypeAlias
55+ from typing_extensions import Buffer , Self , TypeAlias , disjoint_base
5556
5657__all__ = [
5758 "Dataset" ,
@@ -217,6 +218,7 @@ class NetCDF4MissingFeatureException(Exception):
217218
218219def dtype_is_complex (dtype : str ) -> bool : ...
219220
221+ @disjoint_base
220222class Dataset :
221223 def __init__ (
222224 self ,
@@ -398,6 +400,7 @@ class Group(Dataset):
398400 def __init__ (self , parent : Dataset , name : str , ** kwargs : Any ) -> None : ...
399401 def close (self ) -> NoReturn : ...
400402
403+ @final
401404class Dimension :
402405 def __init__ (self , grp : Dataset , name : str , size : int | None = None , ** kwargs : Any ) -> None : ...
403406 @property
@@ -430,6 +433,7 @@ class _VarDtypeProperty:
430433 @overload
431434 def __get__ (self , instance : Variable , owner : Any ) -> Any : ... # actual return type np.dtype | Type[str]
432435
436+ @final
433437class Variable (Generic [VarT ]):
434438 # Overloads of __new__ are provided for some cases where the Variable's type may be statically inferred from the datatype arg
435439 @overload
@@ -590,6 +594,7 @@ class Variable(Generic[VarT]):
590594 def __len__ (self ) -> int : ...
591595 def __iter__ (self ) -> Iterator [Any ]: ... # faux method so mypy believes Variable is iterable
592596
597+ @final
593598class CompoundType :
594599 dtype : np .dtype
595600 dtype_view : np .dtype
@@ -600,13 +605,15 @@ class CompoundType:
600605 ) -> None : ...
601606 def __reduce__ (self ) -> NoReturn : ...
602607
608+ @final
603609class VLType :
604610 dtype : np .dtype
605611 name : str | None
606612
607613 def __init__ (self , grp : Dataset , dt : npt .DTypeLike , dtype_name : str , ** kwargs : Any ) -> None : ...
608614 def __reduce__ (self ) -> NoReturn : ...
609615
616+ @final
610617class EnumType :
611618 dtype : np .dtype [np .integer ]
612619 name : str
0 commit comments