MCPcopy
hub / github.com/ray-project/ray / load_class

Function load_class

python/ray/_common/utils.py:361–372  ·  view source on GitHub ↗

Load a class at runtime given a full path. Example of the path: mypkg.mysubpkg.myclass

(path)

Source from the content-addressed store, hash-verified

359
360
361def load_class(path):
362 """Load a class at runtime given a full path.
363
364 Example of the path: mypkg.mysubpkg.myclass
365 """
366 class_data = path.split(".")
367 if len(class_data) < 2:
368 raise ValueError("You need to pass a valid path like mymodule.provider_class")
369 module_path = ".".join(class_data[:-1])
370 class_str = class_data[-1]
371 module = importlib.import_module(module_path)
372 return getattr(module, class_str)
373
374
375def get_system_memory(

Calls 2

splitMethod · 0.45
joinMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…