def get_datetime(result): if key == 'runtime': datetime = result.runtime.datetime elif key == 'job': datetime = result.datetime else: raise ArgumentError('"key" argument must be "runtime" or "job"') return time.local_time(datetime)
def get_datetime(result): if key == 'build': datetime = result.runinfo.datetime elif key == 'job': datetime = result.datetime else: raise ValueError('"key" argument must be "build" or "job"') return time.local_time(datetime)
def titlestr(k, v): if k == 'name': return 'Runtime: ' + v if k == 'datetime': return 'Date/Time: ' + time.short_timestr(time.local_time(v)) elif k == 'compiler': return 'Compiler: ' + os.path.basename(v).upper() else: s = str(v).title() if len(s) > 20: s = s[:20] + '…' return k.title() + ': ' + s
def titlestr(k, v): if k == 'name': return 'Runtime: ' + v.title() if k == 'datetime': return 'Date/Time: ' + time.short_timestr(time.local_time(v)) elif k == 'compiler': m = re.match( '(?P<compiler>[^ ]+) (?P<version>[^ ]+)' '( \\((?P<compiler2>[^ ]+) (?P<version2>[^ ]+)\\))?', v) if m: d = m.groupdict() d['compiler'] = os.path.basename(d['compiler']) v = '{compiler} {version}'.format(**d) if d['compiler2']: d['compiler2'] = os.path.basename(d['compiler2']) v += ' ({compiler2} {version2})'.format(**d) return 'Compiler: ' + v else: s = str(v).title() if len(s) > 20: s = s[:20] + '…' return k.title() + ': ' + s