my_code_base¶
Submodules¶
Attributes¶
Functions¶
|
Save the given object including metadata. |
Package Contents¶
- my_code_base.save(obj, path, *args, **kwargs)[source]¶
Save the given object including metadata.
This is a dispatchable function. That is, there are several implementations for different types of objects (e.g.
matplotlib.figure.Figure,pandas.DataFrame,xarray.Dataset). In case there is no implementation, the function will throw aNotImplementedError.- Parameters:¶
- Raises:¶
NotImplementedError – If the according function is not dispatched.
Notes
This function raises a NotImplementedError because it is meant to be overridden by subclasses. To save objects of a specific type, please use the native method provided by that type.
Examples
>>> ds = xr.tutorial.load_dataset('air_temperature') >>> save(ds, '/tmp/mynetcdf.nc', add_hash=True) >>> !ncdump -h /tmp/mynetcdf_500e15f.nc | grep history :history = "2024-06-12 16:18:16: File saved by myscript.py#3 @git-commit:500e15f;" >>> save(my_object, '/tmp/myobj') NotImplementedError: Cannot save object of type <class 'type'> using `save` method. Please use the native method.
- my_code_base.BASE_DIR¶
- my_code_base.LOG_DIR¶
- my_code_base.dotenv_path¶
- my_code_base.jupyter_startup_script¶