colour.utilities.Lookup

class colour.utilities.Lookup[source]

Bases: dict

Extends dict type to provide a lookup by value(s).

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']
keys_from_value(value)[source]

Gets the keys with given value.

Parameters

value (object) – Value.

Returns

Keys.

Return type

object

first_key_from_value(value)[source]

Gets the first key with given value.

Parameters

value (object) – Value.

Returns

Key.

Return type

object

__weakref__

list of weak references to the object (if defined)