예제 #1
0
def is_multi_byte( chars ):
    for char in chars:
        try:
            char = unicode( char )
        except UnicodeDecodeError:
            # Probably binary
            return False
        if ( wchartype.is_asian( char ) or wchartype.is_full_width( char ) or
                wchartype.is_kanji( char ) or wchartype.is_hiragana( char ) or
                wchartype.is_katakana( char ) or wchartype.is_half_katakana( char ) or
                wchartype.is_hangul( char ) or wchartype.is_full_digit( char ) or
                wchartype.is_full_letter( char )):
            return True
    return False
예제 #2
0
def is_multi_byte( chars ):
    for char in chars:
        try:
            char = unicode( char )
        except UnicodeDecodeError:
            # Probably binary
            return False
        if ( wchartype.is_asian( char ) or wchartype.is_full_width( char ) or
             wchartype.is_kanji( char ) or wchartype.is_hiragana( char ) or
             wchartype.is_katakana( char ) or wchartype.is_half_katakana( char )
             or wchartype.is_hangul( char ) or wchartype.is_full_digit( char )
             or wchartype.is_full_letter( char )):
            return True
    return False
예제 #3
0
파일: multi_byte.py 프로젝트: bwlang/galaxy
def is_multi_byte(chars):
    if wchartype is None:
        message = "Attempted to use galaxy.util.multi_byte but dependency wchartype is unavailable."
        raise Exception(message)
    for char in chars:
        try:
            char = text_type(char)
        except UnicodeDecodeError:
            # Probably binary
            return False
        if (wchartype.is_asian(char) or wchartype.is_full_width(char) or
                wchartype.is_kanji(char) or wchartype.is_hiragana(char) or
                wchartype.is_katakana(char) or wchartype.is_half_katakana(char) or
                wchartype.is_hangul(char) or wchartype.is_full_digit(char) or
                wchartype.is_full_letter(char)):
            return True
    return False
예제 #4
0
def is_multi_byte( chars ):
    if wchartype is None:
        message = "Attempted to use galaxy.util.multi_byte but dependency wchartype is unavailable."
        raise Exception(message)
    for char in chars:
        try:
            char = text_type( char )
        except UnicodeDecodeError:
            # Probably binary
            return False
        if ( wchartype.is_asian( char ) or wchartype.is_full_width( char ) or
                wchartype.is_kanji( char ) or wchartype.is_hiragana( char ) or
                wchartype.is_katakana( char ) or wchartype.is_half_katakana( char ) or
                wchartype.is_hangul( char ) or wchartype.is_full_digit( char ) or
                wchartype.is_full_letter( char )):
            return True
    return False