How to use the clldutils.misc.format_size 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 size(self, req):
        _path = self.abspath(req)
        if _path.exists():
            return format_size(_path.stat().st_size)
github clld / glottolog3 / glottolog3 / util.py View on Github external
def bitstream_link(oid, spec):
        url = cdstar.SERVICE_URL.path(
            '/bitstreams/{0}/{1}'.format(oid, spec['bitstreamid'])).as_string()
        return HTML.a(
            '{0} [{1}]'.format(spec['bitstreamid'], format_size(spec['filesize'])),
            href=url)