unregister_dataset_accessor

unregister_dataset_accessor#

unregister_dataset_accessor(name: str, target_cls: type) None[source]#

Remove an accessor previously attached to a target class.

The inverse of register_dataset_accessor(). Restores any built-in attribute that was shadowed via override=True when the accessor was registered.

Added in version 0.48.0.

Parameters:
namestr

Namespace of the accessor to remove.

target_clstype

Target class the accessor was registered against. Only accessors attached directly on target_cls can be unregistered; an accessor inherited from a parent class must be unregistered on that parent.

Raises:
ValueError

If no accessor named name is attached directly to target_cls.

TypeError

If target_cls is not a class, or name is not a string.

Examples

>>> import pyvista as pv
>>> @pv.register_dataset_accessor('tmp', pv.PolyData)
... class TmpAccessor:
...     def __init__(self, mesh):
...         self._mesh = mesh
>>> pv.unregister_dataset_accessor('tmp', pv.PolyData)