Merge pull request #1258 from danielzwlee/truthyconditional-varnamechange

Fixes to truthy conditional and variable names same as built-in

Fixes: ticket:3975
Fixes: ticket:3976
This commit is contained in:
Jean-Paul Calderone 2023-02-15 19:09:17 -05:00 committed by GitHub
commit 32dc2019dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 11 deletions

1
newsfragments/3975.minor Normal file
View File

@ -0,0 +1 @@
Fixes truthy conditional in status.py

1
newsfragments/3976.minor Normal file
View File

@ -0,0 +1 @@
Fixes variable name same as built-in type.

View File

@ -550,7 +550,7 @@ class DownloadStatusElement(Element):
length = r_ev["length"]
bytes_returned = r_ev["bytes_returned"]
decrypt_time = ""
if bytes:
if bytes_returned:
decrypt_time = self._rate_and_time(bytes_returned, r_ev["decrypt_time"])
speed, rtt = "",""
if r_ev["finish_time"] is not None:
@ -1616,30 +1616,30 @@ class StatisticsElement(Element):
@renderer
def uploads(self, req, tag):
files = self._stats["counters"].get("uploader.files_uploaded", 0)
bytes = self._stats["counters"].get("uploader.bytes_uploaded", 0)
bytes_uploaded = self._stats["counters"].get("uploader.bytes_uploaded", 0)
return tag(("%s files / %s bytes (%s)" %
(files, bytes, abbreviate_size(bytes))))
(files, bytes_uploaded, abbreviate_size(bytes_uploaded))))
@renderer
def downloads(self, req, tag):
files = self._stats["counters"].get("downloader.files_downloaded", 0)
bytes = self._stats["counters"].get("downloader.bytes_downloaded", 0)
bytes_uploaded = self._stats["counters"].get("downloader.bytes_downloaded", 0)
return tag("%s files / %s bytes (%s)" %
(files, bytes, abbreviate_size(bytes)))
(files, bytes_uploaded, abbreviate_size(bytes_uploaded)))
@renderer
def publishes(self, req, tag):
files = self._stats["counters"].get("mutable.files_published", 0)
bytes = self._stats["counters"].get("mutable.bytes_published", 0)
return tag("%s files / %s bytes (%s)" % (files, bytes,
abbreviate_size(bytes)))
bytes_uploaded = self._stats["counters"].get("mutable.bytes_published", 0)
return tag("%s files / %s bytes (%s)" % (files, bytes_uploaded,
abbreviate_size(bytes_uploaded)))
@renderer
def retrieves(self, req, tag):
files = self._stats["counters"].get("mutable.files_retrieved", 0)
bytes = self._stats["counters"].get("mutable.bytes_retrieved", 0)
return tag("%s files / %s bytes (%s)" % (files, bytes,
abbreviate_size(bytes)))
bytes_uploaded = self._stats["counters"].get("mutable.bytes_retrieved", 0)
return tag("%s files / %s bytes (%s)" % (files, bytes_uploaded,
abbreviate_size(bytes_uploaded)))
@renderer
def raw(self, req, tag):