示例#1
0
文件: value.py 项目: swarupsahoo/dart
    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
示例#2
0
文件: value.py 项目: bopopescu/Dart-1
    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
示例#3
0
    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
示例#4
0
 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