Code Quality

This commit is contained in:
anand k 2024-02-23 23:50:04 +05:30
parent d545630ac7
commit b43c9c4a75
4 changed files with 11 additions and 12 deletions

View File

@ -1370,7 +1370,9 @@ class singleWorker(StoppableThread):
'bitmessagesettings', 'apinotifypath') 'bitmessagesettings', 'apinotifypath')
if apiNotifyPath: if apiNotifyPath:
call([apiNotifyPath, "newMessage"]) # There is no additional risk of remote exploitation or
# privilege escalation
call([apiNotifyPath, "newMessage"]) # nosec:B603
def requestPubKey(self, toAddress): def requestPubKey(self, toAddress):
"""Send a getpubkey object""" """Send a getpubkey object"""

View File

@ -22,11 +22,8 @@ class smtpDeliver(StoppableThread):
_instance = None _instance = None
def stopThread(self): def stopThread(self):
# pylint: disable=no-member """Relay shutdown instruction"""
try: queues.UISignalQueue.put(("stopThread", "data"))
queues.UISignallerQueue.put(("stopThread", "data"))
except: # noqa:E722
pass
super(smtpDeliver, self).stopThread() super(smtpDeliver, self).stopThread()
@classmethod @classmethod

View File

@ -287,7 +287,7 @@ def check_openssl():
path = ctypes.util.find_library('ssl') path = ctypes.util.find_library('ssl')
if path not in paths: if path not in paths:
paths.append(path) paths.append(path)
except: # noqa:E722 except: # nosec:B110 pylint:disable=bare-except
pass pass
openssl_version = None openssl_version = None

View File

@ -45,7 +45,7 @@ def sqlQuery(sql_statement, *args):
:param list args: SQL query parameters :param list args: SQL query parameters
:rtype: list :rtype: list
""" """
assert sql_available assert sql_available # nosec:B101
sql_lock.acquire() sql_lock.acquire()
sqlSubmitQueue.put(sql_statement) sqlSubmitQueue.put(sql_statement)
@ -65,7 +65,7 @@ def sqlExecuteChunked(sql_statement, idCount, *args):
"""Execute chunked SQL statement to avoid argument limit""" """Execute chunked SQL statement to avoid argument limit"""
# SQLITE_MAX_VARIABLE_NUMBER, # SQLITE_MAX_VARIABLE_NUMBER,
# unfortunately getting/setting isn't exposed to python # unfortunately getting/setting isn't exposed to python
assert sql_available assert sql_available # nosec:B101
sqlExecuteChunked.chunkSize = 999 sqlExecuteChunked.chunkSize = 999
if idCount == 0 or idCount > len(args): if idCount == 0 or idCount > len(args):
@ -95,7 +95,7 @@ def sqlExecuteChunked(sql_statement, idCount, *args):
def sqlExecute(sql_statement, *args): def sqlExecute(sql_statement, *args):
"""Execute SQL statement (optionally with arguments)""" """Execute SQL statement (optionally with arguments)"""
assert sql_available assert sql_available # nosec:B101
sql_lock.acquire() sql_lock.acquire()
sqlSubmitQueue.put(sql_statement) sqlSubmitQueue.put(sql_statement)
@ -120,7 +120,7 @@ def sqlExecuteScript(sql_statement):
def sqlStoredProcedure(procName): def sqlStoredProcedure(procName):
"""Schedule procName to be run""" """Schedule procName to be run"""
assert sql_available assert sql_available # nosec:B101
sql_lock.acquire() sql_lock.acquire()
sqlSubmitQueue.put(procName) sqlSubmitQueue.put(procName)
if procName == "exit": if procName == "exit":
@ -143,7 +143,7 @@ class SqlBulkExecute(object):
@staticmethod @staticmethod
def execute(sql_statement, *args): def execute(sql_statement, *args):
"""Used for statements that do not return results.""" """Used for statements that do not return results."""
assert sql_available assert sql_available # nosec:B101
sqlSubmitQueue.put(sql_statement) sqlSubmitQueue.put(sql_statement)
if args == (): if args == ():