convert text into typecode specific data.
349218
def text_to_data(self, text, elt, ps):
        '''
        '''
        if self.pyclass is not None:
            v = self.pyclass(text) 
        else:
            try:
                v = int(text)
            except:
                try:
                    v = long(text)
                except:
                    raise EvaluateException('Unparseable integer', 
                        ps.Backtrace(elt))
        return v
42846
def collate_fonts_data(fonts_data):
    """"""
    glyphs = {}

    for family in fonts_data:
        for glyph in family:
            if glyph['unicode'] not in glyphs:
                glyphs[glyph['unicode']] = glyph
            else:
                c = glyphs[glyph['unicode']]['contours']
                glyphs[glyph['unicode']]['contours'] = c | glyph['contours']
    return glyphs.values()
1176994
def FromTextFormat(cls, text):
    """"""
    tmp = cls.protobuf()  # pylint: disable=not-callable
    text_format.Merge(text, tmp)

    return cls.FromSerializedString(tmp.SerializeToString())
231943
def _convert_type(data_type):  # @NoSelf
        '''
        
        '''
        if data_type in (1, 41):
            dt_string = 'b'
        elif data_type == 2:
            dt_string = 'h'
        elif data_type == 4:
            dt_string = 'i'
        elif data_type in (8, 33):
            dt_string = 'q'
        elif data_type == 11:
            dt_string = 'B'
        elif data_type == 12:
            dt_string = 'H'
        elif data_type == 14:
            dt_string = 'I'
        elif data_type in (21, 44):
            dt_string = 'f'
        elif data_type in (22, 45, 31):
            dt_string = 'd'
        elif data_type == 32:
            dt_string = 'd'
        elif data_type in (51, 52):
            dt_string = 's'
        else:
            dt_string = ''

        return dt_string
1141267
def get_ctype_charset (text):
    
    for param in text.lower().split(';'):
        param = param.strip()
        if param.startswith('charset='):
            charset = param[8:].strip()
            try:
                codecs.lookup(charset)
                return charset
            except (LookupError, ValueError):
                pass
    return None
955589
def text_to_data(self, text, elt, ps):
        '''
        '''
        if self.strip: text = text.strip()
        if self.pyclass is not None:
            return self.pyclass(text.encode(UNICODE_ENCODING))
        return text.encode(UNICODE_ENCODING)
1088220
def encode(self, s):
    """"""
    s = tf.compat.as_text(s)
    tokens = self._tokenizer.tokenize(s)
    tokens = _prepare_tokens_for_encode(tokens)
    ids = []
    for token in tokens:
      ids.extend(self._token_to_ids(token))
    return text_encoder.pad_incr(ids)
863798
def parse_to_type(self,**kwargs):
        """"""
        indexes = self.selectedIndexes()
        if not indexes: return
        for index in indexes:
            self.model().parse_data_type(index, **kwargs)
79231
def to_python(self, value):
        """"""
        if value in self.empty_values:
            return ""
        value = force_text(value).strip()
        return value
244120
def _to_flags(self, text):
        """"""

        flags = 0
        for x in text.split('|'):
            value = x.strip().upper()
            if value:
                flags |= self.GLOB_FLAG_MAP.get(value, 0)
        return flags
312079
def encode (text):
    """"""
    if isinstance(text, unicode):
        return text.encode(i18n.default_encoding, 'ignore')
    return text
341998
def text_to_data(self, text, elt, ps):
        '''
        '''
        return String.text_to_data(self, urldecode(text), elt, ps)
642692
def _filter(self, text):
        """"""

        self.markdown.reset()
        return self.markdown.convert(text)
767579
def keys_to_typing(value):
    """"""
    typing = []
    for val in value:
        if isinstance(val, Keys):
            typing.append(val)
        elif isinstance(val, int):
            val = str(val)
            for i in range(len(val)):
                typing.append(val[i])
        else:
            for i in range(len(val)):
                typing.append(val[i])
    return typing
1122709
def ascii_text(text):
    """"""
    text = latinize_text(text, ascii=True)
    if isinstance(text, six.text_type):
        text = text.encode('ascii', 'ignore').decode('ascii')
    return text
218147
def is_type_text_string(obj):
    """"""
    if PY2:
        # Python 2
        return type(obj) in [str, unicode]
    else:
        # Python 3
        return type(obj) in [str, bytes]
832302
def bdecode(text):
    """"""
    text = text.decode('utf-8')

    def bdecode_next(start):
        """bdecode helper function"""
        if text[start] == 'i':
            end = text.find('e', start)
            return int(text[start+1:end], 10), end + 1

        if text[start] == 'l':
            res = []
            start += 1
            while text[start] != 'e':
                elem, start = bdecode_next(start)
                res.append(elem)
            return res, start + 1

        if text[start] == 'd':
            res = {}
            start += 1
            while text[start] != 'e':
                key, start = bdecode_next(start)
                value, start = bdecode_next(start)
                res[key] = value
            return res, start + 1

        lenend = text.find(':', start)
        length = int(text[start:lenend], 10)
        end = lenend + length + 1
        return text[lenend+1:end], end
    return bdecode_next(0)[0]