def __call__(mcs, *args, **kwargs): test = mcs.__new__(mcs) test.__init__(*args, **kwargs) if test.value in ('true', 'false'): return BooleanValue(test.value) elif COLORS.has_key(test.value): return ColorValue(COLORS.get(test.value)) return test
def __call__(cls, *args, **kwargs): test = cls.__new__(cls) test.__init__(*args, **kwargs) if test.value in ('true', 'false'): return BooleanValue(test.value) elif test.value in COLORS: return ColorValue(COLORS.get(test.value)) return test
def prepare(value): while isinstance(value, Variable): value = value.value if isinstance(value, str): value = ColorValue(COLORS[value]) if COLORS.has_key(value) else StringValue(value) return value