Handle some pylint and bandit warnings

This commit is contained in:
Philipp Wolfer
2021-04-30 16:05:59 +02:00
parent ac3d449e07
commit 95cc8fde92
4 changed files with 10 additions and 11 deletions

View File

@@ -475,7 +475,7 @@ class ClusterDict(object):
index, count = self.words[word]
if index == -1:
token = self.tokenize(word)
if token == '':
if token == '': # nosec
return -1
index = self.id
self.ids[index] = (word, token)

View File

@@ -158,7 +158,7 @@ class CoverArt:
finally:
if ret != CoverArtProvider.WAIT:
self.next_in_queue()
return
return
except StopIteration:
# nothing more to do
self.album._finalize_loading(None)

View File

@@ -64,7 +64,7 @@ class DataHash:
self._filename = None
_datafile_mutex.lock()
try:
m = md5()
m = md5() # nosec
m.update(data)
self._hash = m.hexdigest()
if self._hash not in _datafiles:
@@ -337,7 +337,8 @@ class CoverArtImage:
except OSError as e:
raise CoverArtImageIOError(e)
def _next_filename(self, filename, counters):
@staticmethod
def _next_filename(filename, counters):
if counters[filename]:
new_filename = "%s (%d)" % (decode_filename(filename), counters[filename])
else:

View File

@@ -23,6 +23,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""Build a Qt resources file with all png images found under images/
It will update qrc file only if images newer than it are found
"""
from distutils import log
from distutils.dep_util import newer
@@ -31,20 +34,15 @@ import os
import re
"""Build a Qt resources file with all png images found under images/
It will update qrc file only if images newer than it are found
"""
def tryint(s):
try:
return int(s)
except:
except BaseException:
return s
def natsort_key(s):
return [ tryint(c) for c in re.split(r'(\d+)', s) ]
return [tryint(c) for c in re.split(r'(\d+)', s)]
def find_files(topdir, directory, patterns):