colour.utilities.CaseInsensitiveMapping

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

Bases: collections.abc.MutableMapping

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
copy()[source]

Returns a copy of the mapping.

Returns

Mapping copy.

Return type

CaseInsensitiveMapping

Notes

property data

Getter and setter property for the data.

Parameters

value (dict) – Value to set the data with.

Returns

Data.

Return type

dict

lower_items()[source]

Iterates over the lower items names.

Returns

Lower item names.

Return type

generator