Code Quality

This commit is contained in:
anand k 2024-02-26 13:18:02 +05:30
parent c2e407ef5a
commit e5e0f43b42
No known key found for this signature in database
GPG Key ID: 515AC24FA525DDE0
5 changed files with 11 additions and 11 deletions

View File

@ -78,7 +78,7 @@ class InvThread(StoppableThread):
if connection == Dandelion().objectChildStem(inv[1]):
# Fluff trigger by RNG
# auto-ignore if config set to 0, i.e. dandelion is off
if random.randint(1, 100) >= state.dandelion:
if random.randint(1, 100) >= state.dandelion: # nosec:B311
fluffs.append(inv[1])
# send a dinv only if the stem node supports dandelion
elif connection.services & protocol.NODE_DANDELION > 0:

View File

@ -25,17 +25,17 @@ class BMNetworkThread(StoppableThread):
for i in BMConnectionPool().listeningSockets.values():
try:
i.close()
except:
except: # nosec:B110 pylint:disable=bare-except
pass
for i in BMConnectionPool().outboundConnections.values():
try:
i.close()
except:
except: # nosec:B110 pylint:disable=bare-except
pass
for i in BMConnectionPool().inboundConnections.values():
try:
i.close()
except:
except: # nosec:B110 pylint:disable=bare-except
pass
# just in case

View File

@ -47,7 +47,7 @@ def initCL():
device_type=cl.device_type.GPU))
if platform.vendor not in vendors:
vendors.append(platform.vendor)
except: # noqa:E722
except: # nosec:B110 noqa:E722 pylint:disable=bare-except
pass
if enabledGpus:
ctx = cl.Context(devices=enabledGpus)

View File

@ -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: # noqa:E722
except: # nosec:B110 noqa:E722 pylint:disable=bare-except
# Windows 64-bit
pass
@ -296,14 +296,14 @@ def run(target, initialHash):
return _doGPUPoW(target, initialHash)
except StopIteration:
raise
except: # noqa:E722
except: # nosec:B110 noqa:E722 pylint:disable=bare-except
pass # fallback
if bmpow:
try:
return _doCPoW(target, initialHash)
except StopIteration:
raise
except: # noqa:E722
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
@ -315,13 +315,13 @@ def run(target, initialHash):
except StopIteration:
logger.error("Fast PoW got StopIteration")
raise
except: # noqa:E722
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: # noqa:E722
except: # nosec:B110 noqa:E722 pylint:disable=bare-except
pass # fallback

View File

@ -819,7 +819,7 @@ def loadOpenSSL():
try:
OpenSSL = _OpenSSL(library)
return
except Exception:
except Exception: # nosec:B110
pass
raise Exception(
"Couldn't find and load the OpenSSL library. You must install it.")