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]): if connection == Dandelion().objectChildStem(inv[1]):
# Fluff trigger by RNG # Fluff trigger by RNG
# auto-ignore if config set to 0, i.e. dandelion is off # 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]) fluffs.append(inv[1])
# send a dinv only if the stem node supports dandelion # send a dinv only if the stem node supports dandelion
elif connection.services & protocol.NODE_DANDELION > 0: elif connection.services & protocol.NODE_DANDELION > 0:

View File

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

View File

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

View File

@ -82,7 +82,7 @@ def _set_idle():
pid = win32api.GetCurrentProcessId() pid = win32api.GetCurrentProcessId()
handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid) handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
win32process.SetPriorityClass(handle, win32process.IDLE_PRIORITY_CLASS) win32process.SetPriorityClass(handle, win32process.IDLE_PRIORITY_CLASS)
except: # noqa:E722 except: # nosec:B110 noqa:E722 pylint:disable=bare-except
# Windows 64-bit # Windows 64-bit
pass pass
@ -296,14 +296,14 @@ def run(target, initialHash):
return _doGPUPoW(target, initialHash) return _doGPUPoW(target, initialHash)
except StopIteration: except StopIteration:
raise raise
except: # noqa:E722 except: # nosec:B110 noqa:E722 pylint:disable=bare-except
pass # fallback pass # fallback
if bmpow: if bmpow:
try: try:
return _doCPoW(target, initialHash) return _doCPoW(target, initialHash)
except StopIteration: except StopIteration:
raise raise
except: # noqa:E722 except: # nosec:B110 noqa:E722 pylint:disable=bare-except
pass # fallback pass # fallback
if paths.frozen == "macosx_app" or not paths.frozen: if paths.frozen == "macosx_app" or not paths.frozen:
# on my (Peter Surda) Windows 10, Windows Defender # on my (Peter Surda) Windows 10, Windows Defender
@ -315,13 +315,13 @@ def run(target, initialHash):
except StopIteration: except StopIteration:
logger.error("Fast PoW got StopIteration") logger.error("Fast PoW got StopIteration")
raise raise
except: # noqa:E722 except: # noqa:E722 pylint:disable=bare-except
logger.error("Fast PoW got exception:", exc_info=True) logger.error("Fast PoW got exception:", exc_info=True)
try: try:
return _doSafePoW(target, initialHash) return _doSafePoW(target, initialHash)
except StopIteration: except StopIteration:
raise raise
except: # noqa:E722 except: # nosec:B110 noqa:E722 pylint:disable=bare-except
pass # fallback pass # fallback

View File

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