hydra.util module
General-purpose utility types used across Hydra.
- class hydra.util.CaseConvention(*values)
Bases:
EnumA naming convention for symbols, such as camelCase or snake_case.
- CAMEL = Name(value='camel')
- LOWER_SNAKE = Name(value='lowerSnake')
- PASCAL = Name(value='pascal')
- TYPE_ = Name(value='hydra.util.CaseConvention')
- UPPER_SNAKE = Name(value='upperSnake')
- class hydra.util.Comparison(*values)
Bases:
EnumAn equality judgement: less than, equal to, or greater than.
- EQUAL_TO = Name(value='equalTo')
- GREATER_THAN = Name(value='greaterThan')
- LESS_THAN = Name(value='lessThan')
- TYPE_ = Name(value='hydra.util.Comparison')
- class hydra.util.ModuleNames(focus: Annotated[tuple[ModuleName, N], 'The module name in focus, together with its associated value'], mapping: Annotated[Mapping[ModuleName, N], 'A mapping of module names to values'])
Bases:
Generic[N]A mapping from module names to values of type n, with a focus on one module name.
- class Builder(_focus: 'tuple[hydra.packaging.ModuleName, N]' = None, _mapping: 'Mapping[hydra.packaging.ModuleName, N]' = None)
Bases:
Generic[N]- build()
- focus(focus)
- mapping(mapping)
- FOCUS = Name(value='focus')
- MAPPING = Name(value='mapping')
- TYPE_ = Name(value='hydra.util.ModuleNames')
- static builder()
- focus: Annotated[tuple[ModuleName, N], 'The module name in focus, together with its associated value']
- mapping: Annotated[Mapping[ModuleName, N], 'A mapping of module names to values']
- with_focus(focus)
- with_mapping(mapping)
- class hydra.util.Precision
Bases:
objectPrecisionArbitrary | PrecisionBits
- ARBITRARY = Name(value='arbitrary')
- BITS = Name(value='bits')
- TYPE_ = Name(value='hydra.util.Precision')
- class hydra.util.PrecisionArbitrary
Bases:
objectArbitrary precision
- class hydra.util.QualifiedName(module_name: Annotated[object, 'The optional module name'], local: Annotated[str, 'The local name'])
Bases:
objectA qualified name consisting of an optional module name together with a mandatory local name.
- class Builder(_module_name: 'Optional[hydra.packaging.ModuleName]' = None, _local: 'str' = None)
Bases:
object- build()
- local(local)
- module_name(module_name)
- LOCAL = Name(value='local')
- MODULE_NAME = Name(value='moduleName')
- TYPE_ = Name(value='hydra.util.QualifiedName')
- static builder()
- local: Annotated[str, 'The local name']
- with_local(local)
- with_module_name(module_name)