text --> typecode specific data.
341998
def text_to_data(self, text, elt, ps):
        '''
        '''
        return String.text_to_data(self, urldecode(text), elt, ps)
987714
def _code_cell(self, source):
        """"""
        input, output = self._prompt.to_cell(source)
        return {'cell_type': 'code',
                'input': input,
                'output': output}
1345887
def _match_type(self, i):
        """"""
        self.col_match = self.RE_TYPE.match(self._source[i])
        if self.col_match is not None:
            self.section = "types"
            self.el_type = CustomType
            self.el_name = self.col_match.group("name")
           
            return True
        else:
            return False
1147428
function(type, text) {
            var parser = parsers.get(type);

            return parser.parseInline(text)
                .get('content');
        }
557479
def _parse(self):
        """"""
        while self._cur_token['type'] in (TT.ws, TT.lbreak):
            self._skip_whitespace()
            self._skip_newlines()

        self._data = self._parse_value()

        return self._data
1242884
def typed_subtopic_data(fc, subid):
    ''''''
    # I don't think this code will change after we fix the data race bug. ---AG
    ty = subtopic_type(subid)
    data = get_unicode_feature(fc, subid)
    assert isinstance(data, unicode), \
        'data should be `unicode` but is %r' % type(data)
    if ty == 'image':
        img_data = get_unicode_feature(fc, subid + '|data')
        img = re.sub('^data:image/[a-zA-Z]+;base64,', '', img_data)
        img = base64.b64decode(img.encode('utf-8'))
        return data, img
    elif ty in ('text', 'manual'):
        return data
    raise ValueError('unrecognized subtopic type "%s"' % ty)
53275
def Binary(x):
    """"""
    if isinstance(x, text_type) and not (JYTHON or IRONPYTHON):
        return x.encode()
    return bytes(x)
25327
def from_text(text):
    """"""

    value = _by_text.get(text.upper())
    if value is None:
        match = _unknown_type_pattern.match(text)
        if match == None:
            raise UnknownRdatatype
        value = int(match.group(1))
        if value < 0 or value > 65535:
            raise ValueError("type must be between >= 0 and <= 65535")
    return value
548863
def ansi(color, text):
    """"""
    code = COLOR_CODES[color]
    return '\033[1;{0}m{1}{2}'.format(code, text, RESET_TERM)
540050
def ensure_text(s, encoding='utf-8', errors='strict'):
    
    if isinstance(s, binary_type):
        return s.decode(encoding, errors)
    elif isinstance(s, text_type):
        return s
    else:
        raise TypeError("not expecting type '%s'" % type(s))
335982
def oftype(self, typ):
        ''''''
        for key, val in self.items():
            if val.type == typ:
                yield key
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)
1092871
def python_type(textx_type_name):
    """"""
    return {
        'ID': text,
        'BOOL': bool,
        'INT': int,
        'FLOAT': float,
        'STRICTFLOAT': float,
        'STRING': text,
        'NUMBER': float,
        'BASETYPE': text,
    }.get(textx_type_name, textx_type_name)
1123786
def text_(s, encoding='latin-1', errors='strict'):
    '''
    
    '''
    return s.decode(encoding, errors) if isinstance(s, binary_type) else s
617266
function hasTextMimetype(types) {
      if (!types) return true;
      for (var i = 0; i < types.length; i++) {
        if (types[i] === 'Text' || types[i] === 'text/plain') return true;
      }
      return false;
    }
70344
def type(self, name: str):
        """'"""
        for f in self.body:
            if (hasattr(f, '_ctype')
                    and f._ctype._storage == Storages.TYPEDEF
                    and f._name == name):
                return f
274460
def _get_value_type(kind):
    """"""

    if kind == TEXT:
        return APETextValue
    elif kind == BINARY:
        return APEBinaryValue
    elif kind == EXTERNAL:
        return APEExtValue
    raise ValueError("unknown kind %r" % kind)