Parameter Collection¶
- class avblocks.parameter_list.ParameterList¶
Bases:
MutableMapping[str,Any]A name-value collection used for passing parameters to different AVBlocks components.
This class implements a dictionary-like interface and supports immutability. An immutable object cannot be modified and all modifying methods will raise RuntimeError.
- clear()¶
Removes all items from the ParameterList.
- Raises:
RuntimeError: If the object is immutable.
- copy() ParameterList¶
Creates a shallow copy of the ParameterList. The copy is always mutable regardless of the source’s immutability.
- get(key: str, default: Any = None) Any¶
Gets the value associated with the specified key.
- Args:
key: The key whose value to get. default: The default value to return if key is not found.
- Returns:
The value associated with the specified key, or default if key is not found.
- property immutable: bool¶
Returns whether the object is immutable. An immutable object cannot be modified and all modifying methods fail to produce a result.
- Notes:
An immutable object can be modified by the AVBlocks library.
Object immutability spreads to all nested objects.
Therefore it is not possible to add/set an immutable object to a mutable object.
When cloned an immutable object becomes mutable.
- items() ItemsView[str, Any]¶
Gets a collection containing the key-value pairs in the ParameterList.
- keys() KeysView[str]¶
Gets a collection containing the keys of the ParameterList.
- pop(key: str, *args) Any¶
Removes the element with the specified key and returns its value.
- Args:
key: The key of the element to remove. default: The default value to return if key is not found.
- Returns:
The value that was removed, or default if key was not found.
- Raises:
RuntimeError: If the object is immutable. KeyError: If key is not found and no default is provided.
- popitem()¶
Removes and returns an arbitrary (key, value) pair from the ParameterList.
- Raises:
RuntimeError: If the object is immutable. KeyError: If the ParameterList is empty.
- setdefault(key: str, default: Any = None) Any¶
Returns the value of key if it exists, otherwise sets and returns default.
- Args:
key: The key to look up. default: The default value to set and return if key is not found.
- Returns:
The existing value or the default value that was set.
- Raises:
RuntimeError: If the object is immutable and key is not found.
- update(other=(), /, **kwargs)¶
Updates the ParameterList with the key-value pairs from other mappings.
- Args:
other: A mapping object or iterable of key-value pairs. **kwargs: Additional keyword arguments to add.
- Raises:
RuntimeError: If the object is immutable.
- values() ValuesView[Any]¶
Gets a collection containing the values in the ParameterList.