<s> """<STR_LIT>""" <EOL> import bisect <EOL> import unicodedata <EOL> from . util import UnicodeMixin , unicod , u <EOL> class Category ( object ) : <EOL> """<STR_LIT>""" <EOL> LETTER = u ( "<STR_LIT:L>" ) <EOL> UPPERCASE_LETTER = u ( "<STR_LIT>" ) <EOL> LOWERCASE_LETTER = u ( "<STR_LIT>" ) <EOL> TITLECASE_LETTER = u ( "<STR_LIT>" ) <EOL> MODIFIER_LETTER = u ( "<STR_LIT>" ) <EOL> OTHER_LETTER = u ( "<STR_LIT>" ) <EOL> MARK = u ( "<STR_LIT:M>" ) <EOL> NON_SPACING_MARK = u ( "<STR_LIT>" ) <EOL> SPACING_COMBINING_MARK = u ( "<STR_LIT>" ) <EOL> ENCLOSING_MARK = u ( "<STR_LIT>" ) <EOL> NUMBER = u ( "<STR_LIT:N>" ) <EOL> DECIMAL_DIGIT_NUMBER = u ( "<STR_LIT>" ) <EOL> LETTER_NUMBER = u ( "<STR_LIT>" ) <EOL> OTHER_NUMBER = u ( "<STR_LIT>" ) <EOL> SYMBOL = u ( "<STR_LIT:S>" ) <EOL> MATH_SYMBOL = u ( "<STR_LIT>" ) <EOL> CURRENCY_SYMBOL = u ( "<STR_LIT>" ) <EOL> MODIFIER_SYMBOL = u ( "<STR_LIT>" ) <EOL> OTHER_SYMBOL = u ( "<STR_LIT>" ) <EOL> PUNCTUATION = u ( "<STR_LIT:P>" ) <EOL> CONNECTOR_PUNCTUATION = u ( "<STR_LIT>" ) <EOL> DASH_PUNCTUATION = u ( "<STR_LIT>" ) <EOL> OPEN_PUNCTUATION = u ( "<STR_LIT>" ) <EOL> CLOSE_PUNCTUATION = u ( "<STR_LIT>" ) <EOL> INITIAL_PUNCTUATION = u ( "<STR_LIT>" ) <EOL> FINAL_PUNCTUATION = u ( "<STR_LIT>" ) <EOL> OTHER_PUNCTUATION = u ( "<STR_LIT>" ) <EOL> SEPARATOR = u ( "<STR_LIT>" ) <EOL> SPACE_SEPARATOR = u ( "<STR_LIT>" ) <EOL> LINE_SEPARATOR = u ( "<STR_LIT>" ) <EOL> PARAGRAPH_SEPARATOR = u ( "<STR_LIT>" ) <EOL> OTHER = u ( "<STR_LIT:C>" ) <EOL> CONTROL = u ( "<STR_LIT>" ) <EOL> FORMAT = u ( "<STR_LIT>" ) <EOL> SURROGATE = u ( "<STR_LIT>" ) <EOL> PRIVATE_USE = u ( "<STR_LIT>" ) <EOL> NOT_ASSIGNED = u ( "<STR_LIT>" ) <EOL> @ classmethod <EOL> def get ( cls , uni_char ) : <EOL> """<STR_LIT>""" <EOL> uni_char = unicod ( uni_char ) <EOL> return unicod ( unicodedata . category ( uni_char ) ) <EOL> def is_letter ( uni_char ) : <EOL> """<STR_LIT>""" <EOL> category = Category . get ( uni_char ) <EOL> return ( category == Category . UPPERCASE_LETTER or <EOL> category == Category . LOWERCASE_LETTER or <EOL> category == Category . TITLECASE_LETTER or <EOL> category == Category . MODIFIER_LETTER or <EOL> category == Category . OTHER_LETTER ) <EOL> class _BlockRange ( UnicodeMixin ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , start , end , regdict = None ) : <EOL> self . start = start <EOL> self . end = end <EOL> if regdict is not None : <EOL> regdict [ start ] = self <EOL> def __eq__ ( self , other ) : <EOL> return ( self . start == other . start and self . end == other . end ) <EOL> def __ne__ ( self , other ) : <EOL> return not self == other <EOL> def __hash__ ( self ) : <EOL> return hash ( ( self . start , self . end ) ) <EOL> def __unicode__ ( self ) : <EOL> return unicod ( "<STR_LIT>" ) % ( self . start , self . end ) <EOL> class Block ( object ) : <EOL> """<STR_LIT>""" <EOL> _RANGES = { } <EOL> _RANGE_KEYS = None <EOL> BASIC_LATIN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LATIN_1_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LATIN_EXTENDED_A = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LATIN_EXTENDED_B = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> IPA_EXTENSIONS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SPACING_MODIFIER_LETTERS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> COMBINING_DIACRITICAL_MARKS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> GREEK_AND_COPTIC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CYRILLIC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CYRILLIC_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ARMENIAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> HEBREW = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ARABIC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SYRIAC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ARABIC_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> THAANA = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> NKO = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SAMARITAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MANDAIC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> DEVANAGARI = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BENGALI = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> GURMUKHI = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> GUJARATI = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ORIYA = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> TAMIL = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> TELUGU = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> KANNADA = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MALAYALAM = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SINHALA = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> THAI = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LAO = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> TIBETAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MYANMAR = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> GEORGIAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> HANGUL_JAMO = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ETHIOPIC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ETHIOPIC_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CHEROKEE = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> OGHAM = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> RUNIC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> TAGALOG = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> HANUNOO = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BUHID = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> TAGBANWA = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> KHMER = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MONGOLIAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS_EXTENDED = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LIMBU = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> TAI_LE = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> NEW_TAI_LUE = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> KHMER_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BUGINESE = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> TAI_THAM = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BALINESE = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SUNDANESE = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BATAK = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LEPCHA = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> OL_CHIKI = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> VEDIC_EXTENSIONS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> PHONETIC_EXTENSIONS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> PHONETIC_EXTENSIONS_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> COMBINING_DIACRITICAL_MARKS_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LATIN_EXTENDED_ADDITIONAL = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> GREEK_EXTENDED = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> GENERAL_PUNCTUATION = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SUPERSCRIPTS_AND_SUBSCRIPTS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CURRENCY_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LETTERLIKE_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> NUMBER_FORMS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ARROWS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MATHEMATICAL_OPERATORS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MISCELLANEOUS_TECHNICAL = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CONTROL_PICTURES = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> OPTICAL_CHARACTER_RECOGNITION = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ENCLOSED_ALPHANUMERICS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BOX_DRAWING = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BLOCK_ELEMENTS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> GEOMETRIC_SHAPES = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MISCELLANEOUS_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> DINGBATS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SUPPLEMENTAL_ARROWS_A = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BRAILLE_PATTERNS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SUPPLEMENTAL_ARROWS_B = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SUPPLEMENTAL_MATHEMATICAL_OPERATORS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MISCELLANEOUS_SYMBOLS_AND_ARROWS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> GLAGOLITIC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LATIN_EXTENDED_C = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> COPTIC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> GEORGIAN_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> TIFINAGH = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ETHIOPIC_EXTENDED = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CYRILLIC_EXTENDED_A = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SUPPLEMENTAL_PUNCTUATION = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CJK_RADICALS_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> KANGXI_RADICALS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> IDEOGRAPHIC_DESCRIPTION_CHARACTERS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CJK_SYMBOLS_AND_PUNCTUATION = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> HIRAGANA = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> KATAKANA = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BOPOMOFO = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> HANGUL_COMPATIBILITY_JAMO = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> KANBUN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BOPOMOFO_EXTENDED = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CJK_STROKES = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> KATAKANA_PHONETIC_EXTENSIONS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ENCLOSED_CJK_LETTERS_AND_MONTHS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CJK_COMPATIBILITY = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> YIJING_HEXAGRAM_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CJK_UNIFIED_IDEOGRAPHS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> YI_SYLLABLES = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> YI_RADICALS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LISU = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> VAI = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CYRILLIC_EXTENDED_B = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BAMUM = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MODIFIER_TONE_LETTERS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LATIN_EXTENDED_D = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SYLOTI_NAGRI = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> COMMON_INDIC_NUMBER_FORMS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> PHAGS_PA = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SAURASHTRA = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> DEVANAGARI_EXTENDED = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> KAYAH_LI = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> REJANG = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> HANGUL_JAMO_EXTENDED_A = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> JAVANESE = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CHAM = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MYANMAR_EXTENDED_A = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> TAI_VIET = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ETHIOPIC_EXTENDED_A = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MEETEI_MAYEK = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> HANGUL_SYLLABLES = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> HANGUL_JAMO_EXTENDED_B = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> HIGH_SURROGATES = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> HIGH_PRIVATE_USE_SURROGATES = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LOW_SURROGATES = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> PRIVATE_USE_AREA = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CJK_COMPATIBILITY_IDEOGRAPHS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ALPHABETIC_PRESENTATION_FORMS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ARABIC_PRESENTATION_FORMS_A = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> VARIATION_SELECTORS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> VERTICAL_FORMS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> COMBINING_HALF_MARKS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CJK_COMPATIBILITY_FORMS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SMALL_FORM_VARIANTS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ARABIC_PRESENTATION_FORMS_B = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> HALFWIDTH_AND_FULLWIDTH_FORMS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SPECIALS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LINEAR_B_SYLLABARY = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LINEAR_B_IDEOGRAMS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> AEGEAN_NUMBERS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ANCIENT_GREEK_NUMBERS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ANCIENT_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> PHAISTOS_DISC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LYCIAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CARIAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> OLD_ITALIC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> GOTHIC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> UGARITIC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> OLD_PERSIAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> DESERET = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SHAVIAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> OSMANYA = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CYPRIOT_SYLLABARY = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> IMPERIAL_ARAMAIC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> PHOENICIAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> LYDIAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> KHAROSHTHI = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> OLD_SOUTH_ARABIAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> AVESTAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> INSCRIPTIONAL_PARTHIAN = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> INSCRIPTIONAL_PAHLAVI = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> OLD_TURKIC = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> RUMI_NUMERAL_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BRAHMI = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> KAITHI = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CUNEIFORM = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CUNEIFORM_NUMBERS_AND_PUNCTUATION = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> EGYPTIAN_HIEROGLYPHS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BAMUM_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> KANA_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> BYZANTINE_MUSICAL_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MUSICAL_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ANCIENT_GREEK_MUSICAL_NOTATION = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> TAI_XUAN_JING_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> COUNTING_ROD_NUMERALS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MATHEMATICAL_ALPHANUMERIC_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MAHJONG_TILES = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> DOMINO_TILES = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> PLAYING_CARDS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ENCLOSED_ALPHANUMERIC_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ENCLOSED_IDEOGRAPHIC_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> MISCELLANEOUS_SYMBOLS_AND_PICTOGRAPHS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> EMOTICONS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> TRANSPORT_AND_MAP_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> ALCHEMICAL_SYMBOLS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> TAGS = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> VARIATION_SELECTORS_SUPPLEMENT = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SUPPLEMENTARY_PRIVATE_USE_AREA_A = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> SUPPLEMENTARY_PRIVATE_USE_AREA_B = _BlockRange ( <NUM_LIT> , <NUM_LIT> , _RANGES ) <EOL> UNKNOWN = _BlockRange ( - <NUM_LIT:1> , - <NUM_LIT:1> ) <EOL> @ classmethod <EOL> def get ( cls , uni_char ) : <EOL> """<STR_LIT>""" <EOL> uni_char = unicod ( uni_char ) <EOL> code_point = ord ( uni_char ) <EOL> if Block . _RANGE_KEYS is None : <EOL> Block . _RANGE_KEYS = sorted ( Block . _RANGES . keys ( ) ) <EOL> idx = bisect . bisect_left ( Block . _RANGE_KEYS , code_point ) <EOL> if ( idx > <NUM_LIT:0> and <EOL> code_point >= Block . _RANGES [ Block . _RANGE_KEYS [ idx - <NUM_LIT:1> ] ] . start and <EOL> code_point <= Block . _RANGES [ Block . _RANGE_KEYS [ idx - <NUM_LIT:1> ] ] . end ) : <EOL> return Block . _RANGES [ Block . _RANGE_KEYS [ idx - <NUM_LIT:1> ] ] <EOL> elif ( idx < len ( Block . _RANGES ) and <EOL> code_point >= Block . _RANGES [ Block . _RANGE_KEYS [ idx ] ] . start and <EOL> code_point <= Block . _RANGES [ Block . _RANGE_KEYS [ idx ] ] . end ) : <EOL> return Block . _RANGES [ Block . _RANGE_KEYS [ idx ] ] <EOL> else : <EOL> return Block . UNKNOWN <EOL> def digit ( uni_char , default_value = None ) : <EOL> """<STR_LIT>""" <EOL> uni_char = unicod ( uni_char ) <EOL> if default_value is not None : <EOL> return unicodedata . digit ( uni_char , default_value ) <EOL> else : <EOL> return unicodedata . digit ( uni_char ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> import doctest <EOL> doctest . testmod ( ) </s>
