[PATCH] D68987: [LNT] Python 3 support: store color value as int

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 07:20:26 PDT 2019


thopre created this revision.
thopre added reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls.
thopre added a parent revision: D68986: [LNT] Python 3 support: adapt XML parsing with extra entities.

Page v4_graph.html sets the background color of some table entries from
float color values set in the v4_graph() method of lnt.server.ui.views
module using the %x specifier. However Python 3 gives an error in such a
case because it only accepts integer values. Under Python 2 an implicit
cast to int was performed. This commit adds an explicit cast to int when
storing the color value to satisfy the Python 3 requirement for %x
format specifier.


https://reviews.llvm.org/D68987

Files:
  lnt/server/ui/views.py


Index: lnt/server/ui/views.py
===================================================================
--- lnt/server/ui/views.py
+++ lnt/server/ui/views.py
@@ -930,8 +930,8 @@
         # Determine the base plot color.
         col = list(util.makeDarkColor(float(i) / num_plots))
         url = "/".join([str(machine.id), str(test.id), str(field_index)])
-        legend.append(LegendItem(machine, test.name, field.name, tuple(col),
-                                 url))
+        legend.append(LegendItem(machine, test.name, field.name,
+                                 tuple(map(int, col)), url))
 
         # Load all the field values for this test on the same machine.
         #
@@ -985,7 +985,7 @@
             # Make a color closer to the sample than its neighbour.
             color_offset = float(baseline_id) / num_baselines / 2
             my_color = (i + color_offset) / num_plots
-            dark_col = list(util.makeDarkerColor(my_color))
+            dark_col = list(map(int, util.makeDarkerColor(my_color)))
             str_dark_col = util.toColorString(dark_col)
             baseline_plots.append({
                 'color': str_dark_col,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68987.225030.patch
Type: text/x-patch
Size: 1159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191015/c3749b7a/attachment.bin>


More information about the llvm-commits mailing list