Register Custom Resolvers
register_custom_resolvers(*args, **kwargs)
Registers multiple custom resolvers at once for OmegaConf.
This function allows you to register multiple custom resolvers either by passing them as positional arguments or as keyword arguments. If only a callable is provided, the name used to register the callable will be its function name. If there are any name collisions between the positional and keyword arguments, a ValueError will be raised.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args |
Callable[..., JsonType]
|
Variable length list of callables to register as resolvers. |
()
|
**kwargs |
Dict[str, Callable[..., JsonType]]
|
Arbitrary keyword arguments where the key is the name of the resolver and the value is the callable. |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
If there are any name collisions between the positional and keyword arguments. |
Example
def custom_resolver1():
return "value1"
def custom_resolver2():
return "value2"
register_custom_resolvers(custom_resolver1, custom_resolver2=my_custom_resolver2)
Source code in omegaconf_cloud_resolvers/__init__.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|