MCPcopy Create free account
hub / github.com/pydata/xarray / _resolve_class_from_string

Method _resolve_class_from_string

xarray/tests/test_backends.py:4293–4297  ·  view source on GitHub ↗

Resolve a string class path like 'zarr.AsyncArray' to the actual class.

(class_path: str)

Source from the content-addressed store, hash-verified

4291 # Each type of indexing ends up calling a different zarr indexing method
4292 # They all use a method named .getitem, but on a different internal zarr class
4293 def _resolve_class_from_string(class_path: str) -> type[Any]:
4294 """Resolve a string class path like 'zarr.AsyncArray' to the actual class."""
4295 module_path, class_name = class_path.rsplit(".", 1)
4296 module = import_module(module_path)
4297 return getattr(module, class_name)
4298
4299 target_class = _resolve_class_from_string(target_zarr_class)
4300 method_name = "getitem"

Callers

nothing calls this directly

Calls 1

rsplitMethod · 0.80

Tested by

no test coverage detected