pylint cleanup, Python 3 cleanup/fixes (#897)

* pylint cleanup, Python 3 cleanup/fixes

* More python 3 fixes
This commit is contained in:
Ross Scroggs
2019-04-22 11:19:31 -07:00
committed by Jay Lee
parent dd7d4923be
commit 71c9d90b39
2 changed files with 93 additions and 155 deletions

View File

@@ -62,7 +62,7 @@ class _DeHTMLParser(HTMLParser):
def dehtml(text):
try:
parser = _DeHTMLParser()
parser.feed(text.encode('utf-8'))
parser.feed(str(text))
parser.close()
return parser.text()
except:
@@ -79,10 +79,10 @@ def formatFileSize(fileSize):
if fileSize < ONE_KILO_BYTES:
return '1kb'
if fileSize < ONE_MEGA_BYTES:
return '{0}kb'.format(fileSize/ONE_KILO_BYTES)
return '{0}kb'.format(fileSize//ONE_KILO_BYTES)
if fileSize < ONE_GIGA_BYTES:
return '{0}mb'.format(fileSize/ONE_MEGA_BYTES)
return '{0}gb'.format(fileSize/ONE_GIGA_BYTES)
return '{0}mb'.format(fileSize//ONE_MEGA_BYTES)
return '{0}gb'.format(fileSize//ONE_GIGA_BYTES)
def formatMilliSeconds(millis):
seconds, millis = divmod(millis, 1000)