colour.utilities.Structure#
- class colour.utilities.Structure(*args: Any, **kwargs: Any)[source]#
Bases:
dictRepresent a
dict-like structure that enables access to key values through dot notation syntax.This class extends the built-in
dictto provide attribute-style access to dictionary items, allowing both traditional dictionary access patterns and object-oriented dot notation for improved code readability and convenience.Methods
References
[Rak17]
Examples
>>> person = Structure(first_name="John", last_name="Doe", gender="male") >>> person.first_name 'John' >>> sorted(person.keys()) ['first_name', 'gender', 'last_name'] >>> person["gender"] 'male'
- __setattr__(name: str, value: Any) None[source]#
Assign the specified value to the attribute with the specified name.
- __delattr__(name: str) None[source]#
Delete the attribute with the specified name.
- Parameters:
name (str) – Name of the attribute to delete.
- Return type:
None
- __getattr__(name: str) Any[source]#
Return the value from the attribute with the specified name.
- Parameters:
name (str) – Name of the attribute to get the value from.
- Returns:
Value of the specified attribute.
- Return type:
- Raises:
AttributeError – If the attribute is not defined.
- __setstate__(state: Any) None[source]#
Set the object state when unpickling.
- Parameters:
state (Any)
- Return type:
None
- __weakref__#
list of weak references to the object