DataSetAccessor#
- class DataSetAccessor(dataset: Any)[source]#
Structural protocol for third-party accessor classes.
An accessor class must accept the dataset instance as its single
__init__argument. Any public methods on the class become available asdataset.<namespace>.<method>(...)once the class is registered withregister_dataset_accessor().This Protocol exists primarily for static type analysis: plugin authors can annotate
accessor_cls: type[DataSetAccessor](or use it as a return annotation) to have mypy/pyright check that their accessor class conforms. The runtimeisinstancecheck is intentionally permissive (every class has__init__), so prefer the static-typing use.Added in version 0.48.0.
Examples
Declare an accessor that satisfies the protocol.
>>> from pyvista import DataSetAccessor >>> class MyAccessor: ... def __init__(self, dataset): ... self._dataset = dataset >>> isinstance(MyAccessor(None), DataSetAccessor) True