Get Unicode property.
340431
def get_unicode_property(self, i):
        """"""

        index = i.index
        prop = []
        value = []
        try:
            c = next(i)
            if c.upper() in _ASCII_LETTERS:
                prop.append(c)
            elif c != '{':
                raise SyntaxError("Unicode property missing '{' at %d!" % (i.index - 1))
            else:
                c = next(i)
                if c == '^':
                    prop.append(c)
                    c = next(i)
                while c not in (':', '=', '}'):
                    if c not in _PROPERTY:
                        raise SyntaxError('Invalid Unicode property character at %d!' % (i.index - 1))
                    if c not in _PROPERTY_STRIP:
                        prop.append(c)
                    c = next(i)
                if c in (':', '='):
                    c = next(i)
                    while c != '}':
                        if c not in _PROPERTY:
                            raise SyntaxError('Invalid Unicode property character at %d!' % (i.index - 1))
                        if c not in _PROPERTY_STRIP:
                            value.append(c)
                        c = next(i)
                    if not value:
                        raise SyntaxError('Invalid Unicode property!')
        except StopIteration:
            raise SyntaxError("Missing or unmatched '{' at %d!" % index)

        return ''.join(prop).lower(), ''.join(value).lower()
737269
def to_unicode(value):
    
    if isinstance(value, _TO_UNICODE_TYPES):
        return value
    if not isinstance(value, bytes):
        raise TypeError(
            "Expected bytes, unicode, or None; got %r" % type(value))
    return value.decode("utf-8")
385231
def unicode_char(ignored_chars=None):
        """"""
        return lambda e: e.unicode if e.type == pygame.KEYDOWN \
            and ((ignored_chars is None) 
                  or (e.unicode not in ignored_chars))\
            else EventConsumerInfo.DONT_CARE
213901
def unicode_obj(obj):
    
    if isinstance(obj, dict):
        return unicode_dict(obj)
    elif isinstance(obj, (list, tuple)):
        return unicode_list(obj)
    elif isinstance(obj, six.string_types):
        return unicode_string(obj)
    elif isinstance(obj, (int, float)):
        return obj
    elif obj is None:
        return obj
    else:
        try:
            return text(obj)
        except:
            return text(repr(obj))
1277162
def T(self):
    "'"
    name = self.timezone and self.timezone.tzname(self.data) or None
    if name is None:
      name = self.format('O')
    return unicode(name)
724435
def get_gc_property(value, is_bytes=False):
    """"""

    obj = unidata.ascii_properties if is_bytes else unidata.unicode_properties

    if value.startswith('^'):
        negate = True
        value = value[1:]
    else:
        negate = False

    value = unidata.unicode_alias['generalcategory'].get(value, value)

    assert 1 <= len(value) <= 2, 'Invalid property!'

    if not negate:
        p1, p2 = (value[0], value[1]) if len(value) > 1 else (value[0], None)
        value = ''.join(
            [v for k, v in obj.get(p1, {}).items() if not k.startswith('^')]
        ) if p2 is None else obj.get(p1, {}).get(p2, '')
    else:
        p1, p2 = (value[0], value[1]) if len(value) > 1 else (value[0], '')
        value = obj.get(p1, {}).get('^' + p2, '')
    assert value, 'Invalid property!'
    return value
169809
def get(cls, uni_char):
        """"""
        uni_char = unicod(uni_char)  # Force to Unicode
        code_point = ord(uni_char)
        if Block._RANGE_KEYS is None:
            Block._RANGE_KEYS = sorted(Block._RANGES.keys())
        idx = bisect.bisect_left(Block._RANGE_KEYS, code_point)
        if (idx > 0 and
            code_point >= Block._RANGES[Block._RANGE_KEYS[idx - 1]].start and
            code_point <= Block._RANGES[Block._RANGE_KEYS[idx - 1]].end):
            return Block._RANGES[Block._RANGE_KEYS[idx - 1]]
        elif (idx < len(Block._RANGES) and
              code_point >= Block._RANGES[Block._RANGE_KEYS[idx]].start and
              code_point <= Block._RANGES[Block._RANGE_KEYS[idx]].end):
            return Block._RANGES[Block._RANGE_KEYS[idx]]
        else:
            return Block.UNKNOWN
173210
def get_named_unicode(self, i):
        """"""

        index = i.index
        value = []
        try:
            if next(i) != '{':
                raise SyntaxError("Named Unicode missing '{'' at %d!" % (i.index - 1))
            c = next(i)
            while c != '}':
                value.append(c)
                c = next(i)
        except StopIteration:
            raise SyntaxError("Unmatched '}' at %d!" % index)

        return ''.join(value)
981497
def format_property(name, value):
    """"""
    result = b''
    utf8_name = utf8_bytes_string(name)

    result = b'property ' + utf8_name
    if value is not None:
        utf8_value = utf8_bytes_string(value)
        result += b' ' + ('%d' % len(utf8_value)).encode('ascii') + b' ' + utf8_value

    return result
278974
def convert_unicode(value):
    
    if isinstance(value, dict):
        return {convert_unicode(key): convert_unicode(value)
                for key, value in value.iteritems()}
    elif isinstance(value, list):
        return [convert_unicode(item) for item in value]
    elif isinstance(value, unicode):
        return value.encode('utf-8')
    else:
        return value
444136
def is_unicode(string):
    """"""
    str_type = str(type(string))

    if str_type.find('str') > 0 or str_type.find('unicode') > 0:
        return True

    return False
679048
def unicodestr(s, encoding='utf-8', fallback='iso-8859-1'):
    """"""

    if isinstance(s, unicode):
        return s

    try:
        return s.decode(encoding)
    except UnicodeError:
        return s.decode(fallback)
285689
def to_unicode(value):
    
    if isinstance(value, _TO_UNICODE_TYPES):
        return value
    if not isinstance(value, bytes_type):
        raise TypeError(
            "Expected bytes, unicode, or None; got %r" % type(value)
        )
    return value.decode("utf-8")
596106
function (unicode) {
                var unicodeNameIndex = unicodeName[unicode];
                if (undefined !== unicodeNameIndex) {
                    return postName[unicodeNameIndex];
                }

                return 'uni' + unicode.toString(16).toUpperCase();
            }
965373
def value_to_string(self, obj):
        """"""
        try:
            return force_unicode(self.__get__(obj))
        except TypeError:
            return str(self.__get__(obj))
400357
def get(cls, uni_char):
        """"""
        uni_char = unicod(uni_char)  # Force to Unicode
        return unicod(unicodedata.category(uni_char))
1361253
def ensure_unicode(text):
    """
    if isinstance(text, str):
        try:
            return text.decode(pyreadline_codepage, u"replace")
        except (LookupError, TypeError):
            return text.decode(u"ascii", u"replace")
    return text