Code Quality
This commit is contained in:
parent
13e6116d8e
commit
d33959defc
|
@ -40,7 +40,7 @@ def generate_hash(string):
|
|||
try:
|
||||
# make input case insensitive
|
||||
string = str.lower(string)
|
||||
hash_object = hashlib.md5(str.encode(string)) # nosec B303, B324
|
||||
hash_object = hashlib.md5(str.encode(string)) # nosec B324, B303
|
||||
print(hash_object.hexdigest())
|
||||
# returned object is a hex string
|
||||
return hash_object.hexdigest()
|
||||
|
|
|
@ -686,8 +686,7 @@ class objectProcessor(threading.Thread):
|
|||
apiNotifyPath = config.safeGet(
|
||||
'bitmessagesettings', 'apinotifypath')
|
||||
if apiNotifyPath:
|
||||
subprocess.call( # nosec B603
|
||||
[apiNotifyPath, "newMessage"])
|
||||
subprocess.call([apiNotifyPath, "newMessage"]) # nosec B603
|
||||
|
||||
# Let us now check and see whether our receiving address is
|
||||
# behaving as a mailing list
|
||||
|
|
|
@ -287,7 +287,7 @@ def check_openssl():
|
|||
path = ctypes.util.find_library('ssl')
|
||||
if path not in paths:
|
||||
paths.append(path)
|
||||
except: # nosec:B110 pylint:disable=bare-except
|
||||
except: # nosec:B110 # pylint:disable=bare-except
|
||||
pass
|
||||
|
||||
openssl_version = None
|
||||
|
|
|
@ -610,7 +610,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
|||
'Closed connection to %s because we are already'
|
||||
' connected to that IP.', self.destination)
|
||||
return False
|
||||
except Exception: # nosec:B110 pylint:disable=broad-exception-caught
|
||||
except Exception: # nosec:B110 # pylint:disable=broad-exception-caught
|
||||
pass
|
||||
if not self.isOutbound:
|
||||
# incoming from a peer we're connected to as outbound,
|
||||
|
|
|
@ -25,17 +25,17 @@ class BMNetworkThread(StoppableThread):
|
|||
for i in BMConnectionPool().listeningSockets.values():
|
||||
try:
|
||||
i.close()
|
||||
except: # nosec:B110 pylint:disable=bare-except
|
||||
except: # nosec:B110 # pylint:disable=bare-except
|
||||
pass
|
||||
for i in BMConnectionPool().outboundConnections.values():
|
||||
try:
|
||||
i.close()
|
||||
except: # nosec:B110 pylint:disable=bare-except
|
||||
except: # nosec:B110 # pylint:disable=bare-except
|
||||
pass
|
||||
for i in BMConnectionPool().inboundConnections.values():
|
||||
try:
|
||||
i.close()
|
||||
except: # nosec:B110 pylint:disable=bare-except
|
||||
except: # nosec:B110 # pylint:disable=bare-except
|
||||
pass
|
||||
|
||||
# just in case
|
||||
|
|
|
@ -47,7 +47,7 @@ def initCL():
|
|||
device_type=cl.device_type.GPU))
|
||||
if platform.vendor not in vendors:
|
||||
vendors.append(platform.vendor)
|
||||
except: # nosec:B110 noqa:E722 pylint:disable=bare-except
|
||||
except: # nosec:B110 # noqa:E722 # pylint:disable=bare-except
|
||||
pass
|
||||
if enabledGpus:
|
||||
ctx = cl.Context(devices=enabledGpus)
|
||||
|
|
|
@ -82,7 +82,7 @@ def _set_idle():
|
|||
pid = win32api.GetCurrentProcessId()
|
||||
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
|
||||
win32process.SetPriorityClass(handle, win32process.IDLE_PRIORITY_CLASS)
|
||||
except: # nosec:B110 noqa:E722 pylint:disable=bare-except
|
||||
except: # nosec:B110 # noqa:E722 # pylint:disable=bare-except
|
||||
# Windows 64-bit
|
||||
pass
|
||||
|
||||
|
@ -135,7 +135,7 @@ def _doFastPoW(target, initialHash):
|
|||
try:
|
||||
pool.terminate()
|
||||
pool.join()
|
||||
except: # nosec:B110 noqa:E722 pylint:disable=bare-except
|
||||
except: # nosec:B110 # noqa:E722 # pylint:disable=bare-except
|
||||
pass
|
||||
raise StopIteration("Interrupted")
|
||||
for i in range(pool_size):
|
||||
|
@ -297,14 +297,14 @@ def run(target, initialHash):
|
|||
return _doGPUPoW(target, initialHash)
|
||||
except StopIteration:
|
||||
raise
|
||||
except: # nosec:B110 noqa:E722 pylint:disable=bare-except
|
||||
except: # nosec:B110 # noqa:E722 # pylint:disable=bare-except
|
||||
pass # fallback
|
||||
if bmpow:
|
||||
try:
|
||||
return _doCPoW(target, initialHash)
|
||||
except StopIteration:
|
||||
raise
|
||||
except: # nosec:B110 noqa:E722 pylint:disable=bare-except
|
||||
except: # nosec:B110 # noqa:E722 # pylint:disable=bare-except
|
||||
pass # fallback
|
||||
if paths.frozen == "macosx_app" or not paths.frozen:
|
||||
# on my (Peter Surda) Windows 10, Windows Defender
|
||||
|
@ -316,13 +316,13 @@ def run(target, initialHash):
|
|||
except StopIteration:
|
||||
logger.error("Fast PoW got StopIteration")
|
||||
raise
|
||||
except: # noqa:E722 pylint:disable=bare-except
|
||||
except: # noqa:E722 # pylint:disable=bare-except
|
||||
logger.error("Fast PoW got exception:", exc_info=True)
|
||||
try:
|
||||
return _doSafePoW(target, initialHash)
|
||||
except StopIteration:
|
||||
raise
|
||||
except: # nosec:B110 noqa:E722 pylint:disable=bare-except
|
||||
except: # nosec:B110 # noqa:E722 # pylint:disable=bare-except
|
||||
pass # fallback
|
||||
|
||||
|
||||
|
|
|
@ -212,10 +212,9 @@ def checkSensitiveFilePermissions(filename):
|
|||
# Skip known problems for non-Win32 filesystems
|
||||
# without POSIX permissions.
|
||||
fstype = subprocess.check_output(
|
||||
'stat -f -c "%%T" %s' % (filename),
|
||||
shell=True,
|
||||
['/usr/bin/stat', '-f', '-c', '%T', filename],
|
||||
stderr=subprocess.STDOUT
|
||||
)
|
||||
) # nosec B603
|
||||
if 'fuseblk' in fstype:
|
||||
logger.info(
|
||||
'Skipping file permissions check for %s.'
|
||||
|
|
|
@ -241,7 +241,7 @@ class uPnPThread(StoppableThread):
|
|||
if time.time() - lastSent > self.sendSleep and not self.routers:
|
||||
try:
|
||||
self.sendSearchRouter()
|
||||
except: # nosec:B110 noqa:E722 pylint:disable=bare-except
|
||||
except: # nosec:B110 # noqa:E722 # pylint:disable=bare-except
|
||||
pass
|
||||
lastSent = time.time()
|
||||
try:
|
||||
|
|
Reference in New Issue
Block a user