示例#1
0
 def write_li(k, filename, element='li'):
     desc = ",  ".join('%s = %s' % (a, b) for a, b in k.items())
     href = os.path.relpath(filename, os.path.dirname(index))
     
     if os.path.exists(filename):
         when = duration_human(time.time() - mtime(filename))
         span_when = '<span class="when">%s ago</span>' % when
         style = style_order(order(filename))
         a = '<a href="%s">%s</a>' % (href, desc)
     else:
         # print('File %s does not exist yet' % filename)
         style = ""
         span_when = '<span class="when">missing</span>'
         a = '<a href="%s">%s</a>' % (href, desc)
     f.write('<%s style="%s">%s %s</%s>' % (element, style, a, span_when,
                                            element))
示例#2
0
def timestring(sec):
    if sec < 1:
        return "%.3f sec" % sec
    else:
        return duration_human(sec)
示例#3
0
def timestring(sec):
    if sec < 1:
        return '%.3f sec' % sec
    else:
        return duration_human(sec)