PR: Implement support for slugs to "colour.utilities.CaseInsensitiveMapping" class.#993
PR: Implement support for slugs to "colour.utilities.CaseInsensitiveMapping" class.#993
Conversation
f8475dc to
fbb0887
Compare
zachlewis
left a comment
There was a problem hiding this comment.
This is perfect. Excellent choice of slugifiers, it seems to behave well with everything I throw at it. Thanks Thomas.
Now, maybe this is too much magic, but what would you think about making sluggified lookups delimiter-insensitive?
For example, slugify produces the following for variations of "Sony S-Log3 S-Gamut3.Cine":
{
'Sony S-Log3 S-Gamut3.cine': 'sony-s-log3-s-gamut3cine',
'SONY_SLOG3-SGAMUT3.CINE': 'sony_slog3-sgamut3cine',
'sony_slog3_sgamut3cine': 'sony_slog3_sgamut3cine',
'Sony: SLog3 / SGamut3.Cine': 'sony-slog3-sgamut3cine',
'Sony: SLog3/SGamut3Cine': 'sony-slog3sgamut3cine',
'Sony: S-Log3/S-Gamut3.Cine': 'sony-s-log3s-gamut3cine',
'Sony/SLog3_SGamut3Cine': 'sonyslog3_sgamut3cine',
}
|
Not a bad idea, probably a bit dangerous but I guess we are reaching a point where Any idea for an alternative name? |
|
Here are few ideas after wandering on thesaurus.com:
|
|
With the exception of DCI-P3+, I think we’re probably okay in terms of name collisions, at least for As for the naming of the object… hmmm. Tricky. Off the top of my head… Maybe |
|
Quite like
|
620beb2 to
2bc02ac
Compare
|
@zachlewis : Changes are up! Note that we have the expected issue with >>> list(colour.RGB_COLOURSPACES.canonical_keys())
['aces20651', 'acescc', 'acescct', 'acescg', 'acesproxy', 'adobergb1998', 'adobewidegamutrgb', 'applergb', 'bestrgb', 'betargb', 'blackmagicwidegamut', 'ciergb', 'cinemagamut', 'colormatchrgb', 'dcdmxyz', 'dcip3', 'dcip3', 'djidgamut', 'dragoncolor', 'dragoncolor2', 'davinciwidegamut', 'displayp3', 'donrgb4', 'ecirgbv2', 'erimmrgb', 'ektaspaceps5', 'fgamut', 'filmlightegamut', 'iturbt2020', 'iturbt470525', 'iturbt470625', 'iturbt709', 'maxrgb', 'ngamut', 'ntsc1953', 'ntsc1987', 'p3d65', 'palsecam', 'prophotorgb', 'protunenative', 'redwidegamutrgb', 'redcolor', 'redcolor2', 'redcolor3', 'redcolor4', 'rimmrgb', 'rommrgb', 'russellrgb', 'sgamut', 'sgamut3', 'sgamut3cine', 'smpte240m', 'smptec', 'sharprgb', 'vgamut', 'venicesgamut3', 'venicesgamut3cine', 'xtremergb', 'srgb', 'aces', 'adobe1998', 'prophoto']
>>> colour.RGB_COLOURSPACES['dcip3']
RGB_Colourspace('DCI-P3+',
[[ 0.74, 0.27],
[ 0.22, 0.78],
[ 0.09, -0.09]],
[ 0.314, 0.351],
'DCI-P3',
[[ 0.55907356, 0.24893595, 0.08657739],
[ 0.2039863 , 0.88259109, -0.08657739],
[-0.00755505, 0. , 0.961971 ]],
[[ 1.99040349, -0.56139586, -0.22966194],
[-0.45849279, 1.262346 , 0.15487549],
[ 0.01563207, -0.00440904, 1.03772867]],
functools.partial(<function gamma_function at 0x156105550>, exponent=0.3846153846153846),
functools.partial(<function gamma_function at 0x156105550>, exponent=2.6),
False,
False)I suppose we could rename it... |
f9dbf64 to
7feae1b
Compare
0291528 to
4ac9596
Compare
…lities.CanonicalMapping" and "colour.utilities.LazyCaseInsensitiveMapping" class to "colour.utilities.LazyCanonicalMapping".
…onicalMapping" class.
4ac9596 to
4aa7de4
Compare
|
|
||
| RGB_COLOURSPACE_DCI_P3_P: RGB_Colourspace = RGB_Colourspace( | ||
| "DCI-P3+", | ||
| "DCI-P3-P", |
zachlewis
left a comment
There was a problem hiding this comment.
Thank you. This is lurvely.

Summary
This PR implements support for slugs to
colour.utilities.CaseInsensitiveMappingclass as suggested in #991.Two new methods have been added:
colour.utilities.CaseInsensitiveMapping.slugified_keyscolour.utilities.CaseInsensitiveMapping.slugified_itemsThey leverage the new
colour.utilities.slugifydefinition copied from Django.All the objects using the
colour.utilities.CaseInsensitiveMappingclass and itscolour.utilities.LazyCaseInsensitiveMappingsub-class should now have the same capabilities:Preflight
Code Style and Quality
colour,colour.models.Documentation