Browse code

simplify _table_row in notebook_integration.py

Bas Nijholt authored on 19/12/2019 09:39:59
Showing 1 changed files
... ...
@@ -233,11 +233,10 @@ def live_info(runner, *, update_interval=0.5):
233 233
 
234 234
 def _table_row(i, key, value):
235 235
     """Style the rows of a table. Based on the default Jupyterlab table style."""
236
-    style_odd = "text-align: right; padding: 0.5em 0.5em; line-height: 1.0;"
237
-    style_even = style_odd + "background: var(--md-grey-100);"
238
-    template = '<tr><th style="{style}">{key}</th><th style="{style}">{value}</th></tr>'
239
-    style = style_odd if i % 2 == 1 else style_even
240
-    return template.format(style=style, key=key, value=value)
236
+    style = "text-align: right; padding: 0.5em 0.5em; line-height: 1.0;"
237
+    if i % 2 == 1:
238
+        style += " background: var(--md-grey-100);"
239
+    return f'<tr><th style="{style}">{key}</th><th style="{style}">{value}</th></tr>'
241 240
 
242 241
 
243 242
 def _info_html(runner):