acvl-utils

raw JSON →
0.2.6 verified Fri May 01 auth: no python

A collection of utility functions and classes for various tasks in deep learning and data processing. Version 0.2.6 is current. Release cadence is irregular.

pip install acvl-utils
error ModuleNotFoundError: No module named 'acvl-utils'
cause Using hyphen instead of underscore in Python import.
fix
Use import acvl_utils (underscore) in Python code.
error ImportError: cannot import name 'maybe' from 'acvl_utils'
cause Incorrect submodule or function name; check available functions.
fix
Verify the exact function name by running dir(acvl_utils) or reading the source.
gotcha Import uses underscores in package names: `acvl_utils` not `acvl-utils`.
fix Use `import acvl_utils` with underscores.
gotcha Documentation is sparse; rely on source code or docstrings for function usage.
fix Inspect the source code or use `help()` in Python.

Basic usage of the `maybe` utility to safely access dictionary keys with a default fallback.

from acvl_utils import maybe

# Example: safely get a value from a dict
result = maybe({'key': 'value'}, 'key')
print(result)  # 'value'

result = maybe({'other': 'stuff'}, 'key', default='not found')
print(result)  # 'not found'