colour.utilities.Lookup#
- class colour.utilities.Lookup[source]#
Bases:
dictRepresent a
dict-like object that provides lookup functionality by value(s).This class extends the built-in
dictto provide reverse lookup capabilities for dictionary values, enabling retrieval of keys based on their associated values. Support both single and multiple key retrieval for matching values.Methods
References
[Mana]
Examples
>>> person = Lookup(first_name="John", last_name="Doe", gender="male") >>> person.first_key_from_value("John") 'first_name' >>> persons = Lookup(John="Doe", Jane="Doe", Luke="Skywalker") >>> sorted(persons.keys_from_value("Doe")) ['Jane', 'John']
- first_key_from_value(value: Any) Any[source]#
Return the first key associated with the specified value.
- __weakref__#
list of weak references to the object