colour.utilities.Lookup

class colour.utilities.Lookup[source]

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

first_key_from_value()[source]
keys_from_value()[source]

References

Examples

>>> person = Lookup(first_name='Doe', last_name='John', gender='male')
>>> person.first_key_from_value('Doe')
'first_name'
>>> persons = Lookup(John='Doe', Jane='Doe', Luke='Skywalker')
>>> sorted(persons.keys_from_value('Doe'))
['Jane', 'John']
__init__()

x.__init__(…) initializes x; see help(type(x)) for signature

Methods

clear(() -> None.  Remove all items from D.)
copy(() -> a shallow copy of D)
first_key_from_value(value) Gets the first key with given value.
fromkeys(…) v defaults to None.
get((k[,d]) -> D[k] if k in D, …)
has_key((k) -> True if D has a key k, else False)
items(() -> list of D’s (key, value) pairs, …)
iteritems(() -> an iterator over the (key, …)
iterkeys(() -> an iterator over the keys of D)
itervalues(…)
keys(() -> list of D’s keys)
keys_from_value(value) Gets the keys with given value.
pop((k[,d]) -> v, …) If key is not found, d is returned if given, otherwise KeyError is raised
popitem(() -> (k, v), …) 2-tuple; but raise KeyError if D is empty.
setdefault((k[,d]) -> D.get(k,d), …)
update(([E, …) If E present and has a .keys() method, does: for k in E: D[k] = E[k]
values(() -> list of D’s values)
viewitems(…)
viewkeys(…)
viewvalues(…)