colour.WEIGHTS_YCBCR#
- colour.WEIGHTS_YCBCR = CanonicalMapping({'ITU-R BT.601': ..., 'ITU-R BT.709': ..., 'ITU-R BT.2020': ..., 'SMPTE-240M': ...})#
Implement a delimiter and case-insensitive
dict
-like object with support for slugs, i.e., SEO friendly and human-readable version of the keys but also canonical keys, i.e., slugified keys without delimiters.The item keys are expected to be
str
-like objects thus supporting thestr.lower()
method. Setting items is done by using the given keys. Retrieving or deleting an item and testing whether an item exist is done by transforming the item’s key in a sequence as follows:Original Key
Lowercase Key
Slugified Key
Canonical Key
For example, given the
McCamy 1992
key:Original Key :
McCamy 1992
Lowercase Key :
mccamy 1992
Slugified Key :
mccamy-1992
Canonical Key :
mccamy1992
- Parameters:
data – Data to store into the delimiter and case-insensitive
dict
-like object at initialisation.kwargs – Key / value pairs to store into the mapping at initialisation.
Attributes
Methods
Examples
>>> methods = CanonicalMapping({"McCamy 1992": 1, "Hernandez 1999": 2}) >>> methods["mccamy 1992"] 1 >>> methods["MCCAMY 1992"] 1 >>> methods["mccamy-1992"] 1 >>> methods["mccamy1992"] 1