fields.buffers.registry.BufferRegistry.resolve#
- BufferRegistry.resolve(array_like: Any, *args, **kwargs) BufferBase [source]#
Resolve and wrap an array-like object using an appropriate buffer class.
This method attempts to convert an input array-like object (such as a NumPy array, list, tuple, or unyt array) into a concrete instance of a buffer class registered in this registry.
If array_like is already an instance of a registered buffer class, it is returned unchanged.
If it is not a buffer, the method attempts to find a registered class whose can_handle() method returns True for the input, and calls that class’s from_array() constructor to wrap it.
- Parameters:
array_like (
Any
) – The object to resolve into a buffer. May be a raw array-like object or an existing buffer instance.*args – Positional arguments forwarded to the resolved class’s from_array() method.
**kwargs – Keyword arguments forwarded to the resolved class’s from_array() method.
- Returns:
An instance of a registered buffer class wrapping the input.
- Return type:
BufferBase
- Raises:
TypeError – If no registered buffer class can handle the input type.