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_\_
__getitem_\_
__delitem_\_
__contains_\_
__iter_\_
__len_\_
__eq_\_
__ne_\_
__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