colour.utilities.CaseInsensitiveMapping

class colour.utilities.CaseInsensitiveMapping(data=None, **kwargs)[source]

Implements a case-insensitive mutable mapping / dict object.

Allows values retrieving from keys while ignoring the key case. The keys are expected to be unicode or string-like objects supporting the str.lower() method.

Parameters:data (dict) – dict of data to store into the mapping at initialisation.
Other Parameters:
 **kwargs (dict, optional) – Key / Value pairs to store into the mapping at initialisation.
__setitem__()[source]
__getitem__()[source]
__delitem__()[source]
__contains__()[source]
__iter__()[source]
__len__()[source]
__eq__()[source]
__ne__()[source]
__repr__()
copy()[source]
lower_items()[source]

Warning

The keys are expected to be unicode or string-like objects.

References

[Rei]

Examples

>>> methods = CaseInsensitiveMapping({'McCamy': 1, 'Hernandez': 2})
>>> methods['mccamy']
1
__init__(data=None, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([data]) Initialize self.
clear()
copy() Returns a copy of the mapping.
get(k[,d])
items()
keys()
lower_items() Iterates over the lower items names.
pop(k[,d]) If key is not found, d is returned if given, otherwise KeyError is raised.
popitem() as a 2-tuple; but raise KeyError if D is empty.
setdefault(k[,d])
update([E, ]**F) If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
values()

Attributes

data Getter and setter property for the data.