How to use the clu.naming.split_abbreviations 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 / colortype.py View on Github external
def test():
    assert split_abbreviations('RGB') == ('R', 'G', 'B')
    assert split_abbreviations('CMYK') == ('C', 'M', 'Y', 'K')
    assert split_abbreviations('YCbCr') == ('Y', 'Cb', 'Cr')
    assert split_abbreviations('sRGB') == ('R', 'G', 'B')
    assert split_abbreviations('XYZ') == ('X', 'Y', 'Z')
github fish2000 / instakit / instakit / utils / colortype.py View on Github external
def test():
    assert split_abbreviations('RGB') == ('R', 'G', 'B')
    assert split_abbreviations('CMYK') == ('C', 'M', 'Y', 'K')
    assert split_abbreviations('YCbCr') == ('Y', 'Cb', 'Cr')
    assert split_abbreviations('sRGB') == ('R', 'G', 'B')
    assert split_abbreviations('XYZ') == ('X', 'Y', 'Z')
github fish2000 / instakit / instakit / utils / colortype.py View on Github external
def test():
    assert split_abbreviations('RGB') == ('R', 'G', 'B')
    assert split_abbreviations('CMYK') == ('C', 'M', 'Y', 'K')
    assert split_abbreviations('YCbCr') == ('Y', 'Cb', 'Cr')
    assert split_abbreviations('sRGB') == ('R', 'G', 'B')
    assert split_abbreviations('XYZ') == ('X', 'Y', 'Z')
github fish2000 / instakit / instakit / utils / mode.py View on Github external
• I;16L (I16L)	 ∞    L/L : u2 » >u2
    
    """
    
    print("«TESTING: split_abbreviations()»")
    
    assert split_abbreviations('RGB') == ('R', 'G', 'B')
    assert split_abbreviations('CMYK') == ('C', 'M', 'Y', 'K')
    assert split_abbreviations('YCbCr') == ('Y', 'Cb', 'Cr')
    assert split_abbreviations('sRGB') == ('R', 'G', 'B')
    assert split_abbreviations('XYZZ') == ('X', 'Y', 'Z')
    assert split_abbreviations('I;16L') == ('I',)
    
    assert split_abbreviations('RGB') == Mode.RGB.bands
    assert split_abbreviations('CMYK') == Mode.CMYK.bands
    assert split_abbreviations('YCbCr') == Mode.YCbCr.bands
    assert split_abbreviations('I;16L') == Mode.I16L.bands
    assert split_abbreviations('sRGB') == Mode.RGB.bands
    # assert split_abbreviations('XYZ') == ('X', 'Y', 'Z')
    
    print("«SUCCESS»")
    print()
    
    # print(Mode.I16L.bands)
    # print(Mode.RGB.bands)
    
    pprint(list(Mode))
    print()
    
    assert Mode(10) == Mode.LAB
    # assert hasattr(Mode.RGB, '__slots__')
github fish2000 / instakit / instakit / utils / mode.py View on Github external
• I;16 (I16)	 ∞    L/L : u2 » >u2
    
    """
    
    print("«TESTING: split_abbreviations()»")
    
    assert split_abbreviations('RGB') == ('R', 'G', 'B')
    assert split_abbreviations('CMYK') == ('C', 'M', 'Y', 'K')
    assert split_abbreviations('YCbCr') == ('Y', 'Cb', 'Cr')
    assert split_abbreviations('sRGB') == ('R', 'G', 'B')
    assert split_abbreviations('XYZZ') == ('X', 'Y', 'Z')
    assert split_abbreviations('I;16L') == ('I',)
    
    assert split_abbreviations('RGB') == Mode.RGB.bands
    assert split_abbreviations('CMYK') == Mode.CMYK.bands
    assert split_abbreviations('YCbCr') == Mode.YCbCr.bands
    assert split_abbreviations('I;16L') == Mode.I16L.bands
    assert split_abbreviations('sRGB') == Mode.RGB.bands
    # assert split_abbreviations('XYZ') == ('X', 'Y', 'Z')
    
    print("«SUCCESS»")
    print()
    
    # print(Mode.I16L.bands)
    # print(Mode.RGB.bands)
    
    pprint(list(Mode))
    print()
    
    assert Mode(10) == Mode.LAB
github fish2000 / instakit / instakit / utils / mode.py View on Github external
"""
    
    print("«TESTING: split_abbreviations()»")
    
    assert split_abbreviations('RGB') == ('R', 'G', 'B')
    assert split_abbreviations('CMYK') == ('C', 'M', 'Y', 'K')
    assert split_abbreviations('YCbCr') == ('Y', 'Cb', 'Cr')
    assert split_abbreviations('sRGB') == ('R', 'G', 'B')
    assert split_abbreviations('XYZZ') == ('X', 'Y', 'Z')
    assert split_abbreviations('I;16L') == ('I',)
    
    assert split_abbreviations('RGB') == Mode.RGB.bands
    assert split_abbreviations('CMYK') == Mode.CMYK.bands
    assert split_abbreviations('YCbCr') == Mode.YCbCr.bands
    assert split_abbreviations('I;16L') == Mode.I16L.bands
    assert split_abbreviations('sRGB') == Mode.RGB.bands
    # assert split_abbreviations('XYZ') == ('X', 'Y', 'Z')
    
    print("«SUCCESS»")
    print()
    
    # print(Mode.I16L.bands)
    # print(Mode.RGB.bands)
    
    pprint(list(Mode))
    print()
    
    assert Mode(10) == Mode.LAB
    # assert hasattr(Mode.RGB, '__slots__')
    
    print()
github fish2000 / instakit / instakit / utils / colortype.py View on Github external
def ColorType(name, *args, **kwargs):
    global color_types
    dtype = numpy.dtype(kwargs.pop('dtype', numpy.uint8))
    if name not in color_types[dtype.name]:
        channels = split_abbreviations(name)
        
        class Color(namedtuple(name, channels)):
            
            def __repr__(self):
                return "%s(dtype=%s, %s)" % (
                    name, self.__class__.dtype.name,
                    ', '.join(['%s=%s' % (i[0], i[1]) \
                        for i in self._asdict().items()]))
            
            def __hex__(self):
                return '0x' + "%x" * len(self) % self
            
            def __int__(self):
                return int(self.__hex__(), 16)
            
            def __long__(self):
github fish2000 / instakit / instakit / utils / mode.py View on Github external
•         LA	 ∞    L/L : |u1 » uint8
    •         La	 ∞    L/L : |u1 » uint8
    •         PA	 ∞  RGB/L : |u1 » uint8
    • I;16 (I16)	 ∞    L/L : u2 » >u2
    
    """
    
    print("«TESTING: split_abbreviations()»")
    
    assert split_abbreviations('RGB') == ('R', 'G', 'B')
    assert split_abbreviations('CMYK') == ('C', 'M', 'Y', 'K')
    assert split_abbreviations('YCbCr') == ('Y', 'Cb', 'Cr')
    assert split_abbreviations('sRGB') == ('R', 'G', 'B')
    assert split_abbreviations('XYZZ') == ('X', 'Y', 'Z')
    assert split_abbreviations('I;16L') == ('I',)
    
    assert split_abbreviations('RGB') == Mode.RGB.bands
    assert split_abbreviations('CMYK') == Mode.CMYK.bands
    assert split_abbreviations('YCbCr') == Mode.YCbCr.bands
    assert split_abbreviations('I;16L') == Mode.I16L.bands
    assert split_abbreviations('sRGB') == Mode.RGB.bands
    # assert split_abbreviations('XYZ') == ('X', 'Y', 'Z')
    
    print("«SUCCESS»")
    print()
    
    # print(Mode.I16L.bands)
    # print(Mode.RGB.bands)
    
    pprint(list(Mode))