How to use the clu.enums.alias function in clu

To help you get started, we’ve selected a few clu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fish2000 / instakit / instakit / utils / mode.py View on Github external
if DEBUG:
                mode = Mode.of(image)
                print(f"ModeContext.__exit__: converting {mode} to {original_mode}")
            final_image = original_mode.process(image)
            self.attr_set('final_image', final_image)
        return exc_type is None

@unique
class Field(AliasingEnum):
    
    RO          = auto()
    WO          = auto()
    RW          = auto()
    ReadOnly    = alias(RO)
    WriteOnly   = alias(WO)
    ReadWrite   = alias(RW)

class FieldIOError(IOError):
    pass

anno_for = lambda cls, name, default=None: getpyattr(cls, 'annotations', default={}).get(name, default)

class ModeField(object):
    
    """ Not *that* ModeDescriptor. THIS ModeDescriptor! """
    __slots__ = ('default', 'value', 'name', 'io')
    
    def __init__(self, default):
        self.default = default
    
    def __set_name__(self, cls, name):
        if name is not None:
github fish2000 / instakit / instakit / utils / pipeline.py View on Github external
def process(self, image):
        InkType = type(self)
        return ImageOps.colorize(Mode.L.process(image),
                                 InkType(0).rgb(),
                                 InkType(self.value).rgb())

@unique
class CMYKInk(Ink):
    
    WHITE       = 0
    CYAN        = 1
    MAGENTA     = 2
    YELLOW      = 3
    KEY         = 4
    BLACK       = alias(KEY)
    
    @classmethod
    def CMYK(cls):
        return (cls.CYAN, cls.MAGENTA, cls.YELLOW, cls.BLACK)
    
    @classmethod
    def CMY(cls):
        return (cls.CYAN, cls.MAGENTA, cls.YELLOW)

@unique
class RGBInk(Ink):
    
    WHITE       = 0
    RED         = 5
    GREEN       = 6
    BLUE        = 7
github fish2000 / instakit / instakit / utils / mode.py View on Github external
original_mode = self.attr_or_none('original_mode')
        if image is not None and original_mode is not None:
            if DEBUG:
                mode = Mode.of(image)
                print(f"ModeContext.__exit__: converting {mode} to {original_mode}")
            final_image = original_mode.process(image)
            self.attr_set('final_image', final_image)
        return exc_type is None

@unique
class Field(AliasingEnum):
    
    RO          = auto()
    WO          = auto()
    RW          = auto()
    ReadOnly    = alias(RO)
    WriteOnly   = alias(WO)
    ReadWrite   = alias(RW)

class FieldIOError(IOError):
    pass

anno_for = lambda cls, name, default=None: getpyattr(cls, 'annotations', default={}).get(name, default)

class ModeField(object):
    
    """ Not *that* ModeDescriptor. THIS ModeDescriptor! """
    __slots__ = ('default', 'value', 'name', 'io')
    
    def __init__(self, default):
        self.default = default
github fish2000 / instakit / instakit / utils / mode.py View on Github external
if image is not None and original_mode is not None:
            if DEBUG:
                mode = Mode.of(image)
                print(f"ModeContext.__exit__: converting {mode} to {original_mode}")
            final_image = original_mode.process(image)
            self.attr_set('final_image', final_image)
        return exc_type is None

@unique
class Field(AliasingEnum):
    
    RO          = auto()
    WO          = auto()
    RW          = auto()
    ReadOnly    = alias(RO)
    WriteOnly   = alias(WO)
    ReadWrite   = alias(RW)

class FieldIOError(IOError):
    pass

anno_for = lambda cls, name, default=None: getpyattr(cls, 'annotations', default={}).get(name, default)

class ModeField(object):
    
    """ Not *that* ModeDescriptor. THIS ModeDescriptor! """
    __slots__ = ('default', 'value', 'name', 'io')
    
    def __init__(self, default):
        self.default = default
    
    def __set_name__(self, cls, name):