How to use the clldutils.misc.to_binary function in clldutils

To help you get started, we’ve selected a few clldutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github clld / clld / src / clld / web / adapters / download.py View on Github external
def dump_rendered(self, req, fp, item, index, rendered):
        body = rendered.split(to_binary('rdf:Description'))[1]
        fp.write(to_binary('\n'))
github clld / clld / src / clld / web / adapters / download.py View on Github external
def dump_rendered(self, req, fp, item, index, rendered):
        body = rendered.split(to_binary('rdf:Description'))[1]
        fp.write(to_binary('\n'))
github clld / glottolog3 / glottolog3 / adapters.py View on Github external
def dump_rendered(self, req, fp, item, index, rendered):
        header, body = rendered.split(to_binary('\n\n'), 1)
        if index == 0:
            fp.write(header)
            fp.write(to_binary('\n\n'))
        fp.write(body)
github clld / glottolog3 / glottolog3 / adapters.py View on Github external
def dump_rendered(self, req, fp, item, index, rendered):
        header, body = rendered.split(to_binary('\n\n'), 1)
        if index == 0:
            fp.write(header)
            fp.write(to_binary('\n\n'))
        fp.write(body)
github clld / clld / src / clld / lib / bibtex.py View on Github external
def _delatex(s):
        try:
            t = to_binary(s, encoding='latin1')
            result = t.decode('latex+latin1')
        except UnicodeEncodeError:
            result = string
        u_result = text_type(result)
        return u_result
github clld / clld / src / clld / lib / coins.py View on Github external
def __str__(self):
        pairs = [
            (to_binary('ctx_ver'), to_binary('Z39.88-2004')),
            (to_binary('rft_val_fmt'),
             to_binary('info:ofi/fmt:kev:mtx:') + _encoded(self.mtx)),
            (to_binary('rfr_id'), to_binary('info:sid/') + _encoded(self.sid))]
        for pair in self:
            pairs.append((_encoded(pair[0]), _encoded(pair[1])))
        try:
            return urlencode(pairs)
        except UnicodeDecodeError:  # pragma: no cover
            return to_binary('')
github clld / clld / src / clld / lib / coins.py View on Github external
def __str__(self):
        pairs = [
            (to_binary('ctx_ver'), to_binary('Z39.88-2004')),
            (to_binary('rft_val_fmt'),
             to_binary('info:ofi/fmt:kev:mtx:') + _encoded(self.mtx)),
            (to_binary('rfr_id'), to_binary('info:sid/') + _encoded(self.sid))]
        for pair in self:
            pairs.append((_encoded(pair[0]), _encoded(pair[1])))
        try:
            return urlencode(pairs)
        except UnicodeDecodeError:  # pragma: no cover
            return to_binary('')
github clld / clld / src / clld / lib / coins.py View on Github external
def __str__(self):
        pairs = [
            (to_binary('ctx_ver'), to_binary('Z39.88-2004')),
            (to_binary('rft_val_fmt'),
             to_binary('info:ofi/fmt:kev:mtx:') + _encoded(self.mtx)),
            (to_binary('rfr_id'), to_binary('info:sid/') + _encoded(self.sid))]
        for pair in self:
            pairs.append((_encoded(pair[0]), _encoded(pair[1])))
        try:
            return urlencode(pairs)
        except UnicodeDecodeError:  # pragma: no cover
            return to_binary('')