Use more descriptive variable names

This commit is contained in:
Sajith Sasidharan 2020-05-14 11:46:20 -04:00
parent 7e02502268
commit b02cfa5bbe

View File

@ -547,11 +547,11 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
srt = self._short_relative_time srt = self._short_relative_time
l = tags.div() evtag = tags.div()
t = tags.table(align="left", class_="status-download-events") dyhbtag = tags.table(align="left", class_="status-download-events")
t(tags.tr(tags.th("serverid"), dyhbtag(tags.tr(tags.th("serverid"),
tags.th("sent"), tags.th("sent"),
tags.th("received"), tags.th("received"),
tags.th("shnums"), tags.th("shnums"),
@ -568,7 +568,7 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
if not shnums: if not shnums:
shnums = ["-"] shnums = ["-"]
t(tags.tr(style="background: %s" % _color(server))( dyhbtag(tags.tr(style="background: %s" % _color(server))(
(tags.td(server.get_name()), (tags.td(server.get_name()),
tags.td(srt(sent)), tags.td(srt(sent)),
tags.td(srt(received)), tags.td(srt(received)),
@ -576,12 +576,12 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
tags.td(abbreviate_time(rtt)), tags.td(abbreviate_time(rtt)),
))) )))
l(tags.h2("DYHB Requests:"), t) evtag(tags.h2("DYHB Requests:"), dyhbtag)
l(tags.br(clear="all")) evtag(tags.br(clear="all"))
t = tags.table(align="left",class_="status-download-events") readtag = tags.table(align="left",class_="status-download-events")
t(tags.tr(( readtag(tags.tr((
tags.th("range"), tags.th("range"),
tags.th("start"), tags.th("start"),
tags.th("finish"), tags.th("finish"),
@ -605,7 +605,7 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
rtt = abbreviate_time(rtt) rtt = abbreviate_time(rtt)
paused = abbreviate_time(r_ev["paused_time"]) paused = abbreviate_time(r_ev["paused_time"])
t(tags.tr( readtag(tags.tr(
tags.td("[%d:+%d]" % (start, length)), tags.td("[%d:+%d]" % (start, length)),
tags.td(srt(r_ev["start_time"])), tags.td(srt(r_ev["start_time"])),
tags.td(srt(r_ev["finish_time"])), tags.td(srt(r_ev["finish_time"])),
@ -616,12 +616,12 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
tags.td(speed), tags.td(speed),
)) ))
l(tags.h2("Read Events:"), t) evtag(tags.h2("Read Events:"), readtag)
l(tags.br(clear="all")) evtag(tags.br(clear="all"))
t = tags.table(align="left",class_="status-download-events") segtag = tags.table(align="left",class_="status-download-events")
t(tags.tr( segtag(tags.tr(
tags.th("segnum"), tags.th("segnum"),
tags.th("start"), tags.th("start"),
tags.th("active"), tags.th("active"),
@ -651,7 +651,7 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
# not finished yet # not finished yet
pass pass
t(tags.tr( segtag(tags.tr(
tags.td("seg%d" % s_ev["segment_number"]), tags.td("seg%d" % s_ev["segment_number"]),
tags.td(srt(s_ev["start_time"])), tags.td(srt(s_ev["start_time"])),
tags.td(srt(s_ev["active_time"])), tags.td(srt(s_ev["active_time"])),
@ -661,13 +661,12 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
tags.td(segtime_s), tags.td(segtime_s),
tags.td(speed))) tags.td(speed)))
l(tags.h2("Segment Events:"), t) evtag(tags.h2("Segment Events:"), segtag)
evtag(tags.br(clear="all"))
l(tags.br(clear="all")) reqtab = tags.table(align="left",class_="status-download-events")
t = tags.table(align="left",class_="status-download-events") reqtab(tags.tr(
t(tags.tr(
tags.th("serverid"), tags.th("serverid"),
tags.th("shnum"), tags.th("shnum"),
tags.th("range"), tags.th("range"),
@ -682,7 +681,7 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
if r_ev["finish_time"] is not None: if r_ev["finish_time"] is not None:
rtt = r_ev["finish_time"] - r_ev["start_time"] rtt = r_ev["finish_time"] - r_ev["start_time"]
color = _color(server) color = _color(server)
t(tags.tr(style="background: %s" % color) reqtab(tags.tr(style="background: %s" % color)
( (
tags.td(server.get_name()), tags.td(server.get_name()),
tags.td(str(r_ev["shnum"])), tags.td(str(r_ev["shnum"])),
@ -693,10 +692,10 @@ class DownloadStatusElement(Element, DownloadResultsRendererMixin):
tags.td(abbreviate_time(rtt)), tags.td(abbreviate_time(rtt)),
)) ))
l(tags.h2("Requests:"), t) evtag(tags.h2("Requests:"), reqtab)
l(tags.br(clear="all")) evtag(tags.br(clear="all"))
return l return evtag
@renderer @renderer
def results(self, req, tag): def results(self, req, tag):