[LNT] r273214 - [NFC] Fixup some style violations
Chris Matthews via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 20 16:04:23 PDT 2016
Author: cmatthews
Date: Mon Jun 20 18:04:23 2016
New Revision: 273214
URL: http://llvm.org/viewvc/llvm-project?rev=273214&view=rev
Log:
[NFC] Fixup some style violations
Modified:
lnt/trunk/lnt/server/ui/filters.py
lnt/trunk/lnt/server/ui/util.py
Modified: lnt/trunk/lnt/server/ui/filters.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/filters.py?rev=273214&r1=273213&r2=273214&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/filters.py (original)
+++ lnt/trunk/lnt/server/ui/filters.py Mon Jun 20 18:04:23 2016
@@ -6,10 +6,12 @@ import time
from lnt.server.ui import util
+
def filter_asutctime(time):
ts = datetime.datetime.utcfromtimestamp(time)
return ts.strftime('%Y-%m-%d %H:%M:%S UTC')
+
def filter_asisotime(time):
ts = datetime.datetime.utcfromtimestamp(time)
return ts.isoformat()
@@ -19,32 +21,39 @@ def filter_aspctcell(value, class_=None,
cell = util.PctCell(value, *args, **kwargs)
return cell.render(class_, style, attributes)
+
def filter_pprint(value):
stream = StringIO.StringIO()
pprint.pprint(value, stream)
return stream.getvalue()
+
def filter_format_or_default(fmt, input, default):
if input:
return fmt % input
else:
return default
+
def filter_urlencode(args):
return urllib.urlencode(args)
+
def filter_timedelta(start_time):
return "%.2fs" % (time.time() - start_time)
+
def filter_producerAsHTML(producer):
if not producer:
return ""
return util.renderProducerAsHTML(producer)
+
def filter_shortname(test_name):
return util.guess_test_short_name(test_name)
+
def register(env):
- for name,object in globals().items():
+ for name, object in globals().items():
if name.startswith('filter_'):
env.filters[name[7:]] = object
Modified: lnt/trunk/lnt/server/ui/util.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/util.py?rev=273214&r1=273213&r2=273214&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/util.py (original)
+++ lnt/trunk/lnt/server/ui/util.py Mon Jun 20 18:04:23 2016
@@ -265,11 +265,13 @@ class PctCell:
attr_string = ' '.join(attrs)
return '<td %s>%s</td>' % (attr_string, self.getValue())
+
def sorted(l, *args, **kwargs):
l = list(l)
l.sort(*args, **kwargs)
return l
+
def renderProducerAsHTML(producer):
# If the string looks like a buildbot link, render it prettily.
m = re.match(r'http://(.*)/builders/(.*)/builds/(\d+)', producer)
@@ -293,6 +295,7 @@ FLASH_INFO = "alert alert-info"
FLASH_SUCCESS = "alert alert-success"
FLASH_WARNING = "alert alert-warning"
+
def guess_test_short_name(test_name):
"""In some places the fully qualified test name is too long,
try to make a shorter one."""
More information about the llvm-commits
mailing list