blocks.utils.reflection

Functions

  • try_import(): Try to import and return the specified class. If it fails return an empty class instead.

blocks.utils.reflection.try_import(class_fqn)[source]

Try to import and return the specified class. If it fails return an empty class instead.

example usage with hipipe dataset
import blocks as bl

class OdoCapDataset(bl.utils.try_import('my_module.Dataset'),
                    bl.datasets.RectangleRPNDataset,
                    metaclass=bl.utils.classmaker()):
Parameters

class_fqn (str) – class fully qualified name

Return type

type

Returns

specified class or an empty class