def _get_colour_variant(self, key): global m2 m = m2 m.parse(key) xforms = m.get_colour_transforms() for xform in xforms: tstate = m.transformed_state(xform) try: value = Index.__getitem__(self, tstate) return xform.invert(value) except (KeyError): pass return None
def __getitem__(self, key): try: value = Index.__getitem__(self, key) return value except (KeyError): pass value = self._get_colour_variant(key) if value is not None: return value value = self._get_transformed_variant(key) if value is not None: return value raise KeyError('No matching entry %s' % key)