lookup_ndarray_adapter

lookup_ndarray_adapter#

treescope.type_registries.lookup_ndarray_adapter(possible_array: Any) ndarray_adapters.NDArrayAdapter[Any] | None[source]#

Looks up an NDArray adapter for the given type.

This function looks for an NDArray adapter by first checking for the __treescope_ndarray_adapter__ method on the type, and then by looking up the type in the global registry NDARRAY_ADAPTER_REGISTRY.

Parameters:

possible_array – The object to look up an adapter for.

Returns:

An NDArray adapter for the given type, or None if no adapter was found.