Code Quality #2192

Merged
anand-skss merged 1 commits from code-quality into v0.6 2024-03-06 01:38:22 +01:00
11 changed files with 21 additions and 21 deletions

View File

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

View File

@ -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
@ -361,7 +361,7 @@ def check_curses():
return False
try:
subprocess.check_call(['which', 'dialog']) # nosec:B603, B607
subprocess.check_call(['which', 'dialog']) # nosec B603, B607
except subprocess.CalledProcessError:
logger.error(
'Curses requires the `dialog` command to be installed as well as'

View File

@ -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,

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: # nosec:B311
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: # 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

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: # 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)

View File

@ -11,14 +11,14 @@ try:
winsound.PlaySound(sound_file, winsound.SND_FILENAME)
except ImportError:
import os
import subprocess # nosec:B404
import subprocess # nosec B404
play_cmd = {}
def _subprocess(*args):
FNULL = open(os.devnull, 'wb')
subprocess.call(
args, stdout=FNULL, stderr=subprocess.STDOUT, close_fds=True) # nosec:B603
args, stdout=FNULL, stderr=subprocess.STDOUT, close_fds=True) # nosec B603
def connect_plugin(sound_file):
"""This function implements the entry point."""

View File

@ -10,7 +10,7 @@ import sys
import tempfile
import time
from struct import pack, unpack
from subprocess import call # nosec:B404
from subprocess import call # nosec B404
import openclpow
import paths
@ -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):
@ -298,14 +298,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
@ -323,7 +323,7 @@ def run(target, initialHash):
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

View File

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

View File

@ -11,7 +11,7 @@ from __future__ import division
import hashlib
import os
import stat
import subprocess # nosec:B404
import subprocess # nosec B404
import sys
from binascii import hexlify

View File

@ -11,7 +11,7 @@ import time
import urllib2
from random import randint
from urlparse import urlparse
from xml.dom.minidom import Document # nosec:B408
from xml.dom.minidom import Document # nosec B408
from defusedxml.minidom import parseString
import queues
@ -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: