From e5e0f43b42eae3f4f1223e7ab7e0f9a553214d8d Mon Sep 17 00:00:00 2001
From: anand k <anand.theskss@gmail.com>
Date: Mon, 26 Feb 2024 13:18:02 +0530
Subject: [PATCH] Code Quality

---
 src/network/invthread.py     |  2 +-
 src/network/networkthread.py |  6 +++---
 src/openclpow.py             |  2 +-
 src/proofofwork.py           | 10 +++++-----
 src/pyelliptic/openssl.py    |  2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/network/invthread.py b/src/network/invthread.py
index e68b7692..e7d11f86 100644
--- a/src/network/invthread.py
+++ b/src/network/invthread.py
@@ -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:
diff --git a/src/network/networkthread.py b/src/network/networkthread.py
index 61ff6c09..659b16d9 100644
--- a/src/network/networkthread.py
+++ b/src/network/networkthread.py
@@ -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
diff --git a/src/openclpow.py b/src/openclpow.py
index 938ffc81..4a349af1 100644
--- a/src/openclpow.py
+++ b/src/openclpow.py
@@ -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)
diff --git a/src/proofofwork.py b/src/proofofwork.py
index 5c9448f1..73a15e0a 100644
--- a/src/proofofwork.py
+++ b/src/proofofwork.py
@@ -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
 
 
diff --git a/src/pyelliptic/openssl.py b/src/pyelliptic/openssl.py
index ff6ff028..fda1b13e 100644
--- a/src/pyelliptic/openssl.py
+++ b/src/pyelliptic/openssl.py
@@ -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.")