loaders
canari_ml.data.loaders
¶
canari_ml.data.loaders.CanariMLDataLoaderFactory()
¶
A factory class for managing a map of loader names and their corresponding implementation classes. Based on IceNet v0.4.0_dev
Attributes:
| Name | Type | Description |
|---|---|---|
_loader_map |
A dictionary holding loader names against their implementation classes. |
Source code in src/canari_ml/data/loaders/__init__.py
canari_ml.data.loaders.CanariMLDataLoaderFactory.loader_map
property
¶
The loader map dictionary.
canari_ml.data.loaders.CanariMLDataLoaderFactory.add_data_loader(loader_name, loader_impl)
¶
Adds a new loader to the loader map with the given name and implementation class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_name
|
str
|
The name of the loader. |
required |
loader_impl
|
object
|
The implementation class of the loader. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None. Updates |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If the loader name already exists or if the implementation class is not a descendant of CanariMLBaseDataLoader. |
Source code in src/canari_ml/data/loaders/__init__.py
canari_ml.data.loaders.CanariMLDataLoaderFactory.create_data_loader(loader_name, *args, **kwargs)
¶
Creates an instance of a loader based on specified name from the
_loader_map dict attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loader_name
|
str
|
The name of the loader. |
required |
*args
|
Unpack
|
Additional positional arguments, is passed to the loader constructor. |
()
|
**kwargs
|
Unpack
|
Additional keyword arguments, is passed to the loader constructor. |
{}
|
Returns:
| Type | Description |
|---|---|
object
|
An instance of the loader class. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the loader name does not exist in |