Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/DIRAC/AccountingSystem/private/Plotters/BaseReporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,12 @@ def __checkPlotMetadata(self, metadata):
if self._EA_WIDTH in self._extraArgs and self._extraArgs[self._EA_WIDTH]:
try:
metadata[self._EA_WIDTH] = min(1600, max(200, int(self._extraArgs[self._EA_WIDTH])))
except Exception:
except (TypeError, ValueError):
pass
if self._EA_HEIGHT in self._extraArgs and self._extraArgs[self._EA_HEIGHT]:
try:
metadata[self._EA_HEIGHT] = min(1600, max(200, int(self._extraArgs[self._EA_HEIGHT])))
except Exception:
except (TypeError, ValueError):
pass
if self._EA_TITLE in self._extraArgs and self._extraArgs[self._EA_TITLE]:
metadata["title"] = self._extraArgs[self._EA_TITLE]
Expand Down
8 changes: 4 additions & 4 deletions src/DIRAC/ConfigurationSystem/private/ConfigurationData.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def getCommentFromCFG(self, path, cfg=False):
cfg = cfg[section]
return self.dangerZoneEnd(cfg.getComment(levelList[-1]))
except Exception:
pass
pass # nosec B110
return self.dangerZoneEnd(None)

def getSectionsFromCFG(self, path, cfg=False, ordered=False):
Expand All @@ -136,7 +136,7 @@ def getSectionsFromCFG(self, path, cfg=False, ordered=False):
cfg = cfg[section]
return self.dangerZoneEnd(cfg.listSections(ordered))
except Exception:
pass
pass # nosec B110
return self.dangerZoneEnd(None)

def getOptionsFromCFG(self, path, cfg=False, ordered=False):
Expand All @@ -149,7 +149,7 @@ def getOptionsFromCFG(self, path, cfg=False, ordered=False):
cfg = cfg[section]
return self.dangerZoneEnd(cfg.listOptions(ordered))
except Exception:
pass
pass # nosec B110
return self.dangerZoneEnd(None)

def extractOptionFromCFG(self, path, cfg=False, disableDangerZones=False):
Expand All @@ -164,7 +164,7 @@ def extractOptionFromCFG(self, path, cfg=False, disableDangerZones=False):
if levelList[-1] in cfg.listOptions():
return self.dangerZoneEnd(cfg[levelList[-1]])
except Exception:
pass
pass # nosec B110
if not disableDangerZones:
self.dangerZoneEnd()

Expand Down
8 changes: 4 additions & 4 deletions src/DIRAC/Core/Base/AgentModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,14 @@ def am_createStopAgentFile(self):
try:
with open(self.am_getStopAgentFile(), "w") as fd:
fd.write(f"Dirac site agent Stopped at {str(datetime.datetime.utcnow())}")
except Exception:
pass
except Exception as err:
self.log.info(f"Failed to write stop file: {str(err)}")

def am_removeStopAgentFile(self):
try:
os.unlink(self.am_getStopAgentFile())
except Exception:
pass
except Exception as err:
self.log.info(f"Failed to remove stop file: {str(err)}")

def am_getWorkDirectory(self):
return os.path.join(self.__basePath, str(self.am_getOption("WorkDirectory")))
Expand Down
2 changes: 1 addition & 1 deletion src/DIRAC/Core/Base/CLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _initSignals(self):
for sigNum in (signal.SIGINT, signal.SIGQUIT, signal.SIGKILL, signal.SIGTERM):
try:
signal.signal(sigNum, self._handleSignal)
except Exception:
except (ValueError, TypeError, OSError):
pass

def _errMsg(self, errMsg):
Expand Down
2 changes: 1 addition & 1 deletion src/DIRAC/Core/DISET/MessageClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __cbDisconnect(self, trid):
try:
self.__transport.close()
except Exception:
pass
pass # nosec B110
for cb in self.__specialCallbacks["drop"]:
try:
cb(self)
Expand Down
2 changes: 1 addition & 1 deletion src/DIRAC/Core/DISET/ServiceReactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def closeListeningConnections(self):
try:
self.__listeningConnections[svcName]["transport"].close()
except Exception:
pass
pass # nosec B110
del self.__listeningConnections[svcName]["transport"]
gLogger.info("Connections closed")

Expand Down
6 changes: 3 additions & 3 deletions src/DIRAC/Core/DISET/private/BaseClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ def __findServiceURL(self):
failoverUrlsStr = getServiceFailoverURL(self._destinationSrv)
if failoverUrlsStr:
failoverUrls = failoverUrlsStr.split(",")
except Exception:
pass
except Exception as err:
gLogger.info(f"Failed to set any failover URLs: {str(err)}")

# We randomize the list, and add at the end the failover URLs (System/FailoverURLs/Component)
urlsList = List.fromChar(urls, ",") + failoverUrls
Expand Down Expand Up @@ -608,7 +608,7 @@ def __setKeepAliveLapse(self):
if self.KW_KEEP_ALIVE_LAPSE in self.kwargs:
try:
kaa = max(0, int(self.kwargs[self.KW_KEEP_ALIVE_LAPSE]))
except Exception:
except (ValueError, TypeError):
pass
if kaa:
kaa = max(150, kaa)
Expand Down
14 changes: 7 additions & 7 deletions src/DIRAC/Core/DISET/private/FileHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def networkToFD(self, iFD, maxFileSize=0):
try:
dataSink.close()
except Exception:
pass
pass # nosec B110

def networkToDataSink(self, dataSink, maxFileSize=0):
if "write" not in dir(dataSink):
Expand Down Expand Up @@ -208,7 +208,7 @@ def stringToNetwork(self, stringVal):
try:
stringIO.close()
except Exception:
pass
pass # nosec B110
return S_OK()

def FDToNetwork(self, iFD):
Expand Down Expand Up @@ -323,7 +323,7 @@ def __createTar(self, fileList, wPipe, compress, autoClose=True):
try:
filePipe.close()
except Exception:
pass
pass # nosec B110

def bulkToNetwork(self, fileList, compress=True, onthefly=True):
if not onthefly:
Expand All @@ -341,7 +341,7 @@ def bulkToNetwork(self, fileList, compress=True, onthefly=True):
fo.close()
os.unlink(filePath)
except Exception:
pass
pass # nosec B110
return result
else:
rPipe, wPipe = os.pipe()
Expand All @@ -351,7 +351,7 @@ def bulkToNetwork(self, fileList, compress=True, onthefly=True):
try:
os.close(rPipe)
except Exception:
pass
pass # nosec B110
return response

def __extractTar(self, destDir, rPipe, compress):
Expand All @@ -365,14 +365,14 @@ def __extractTar(self, destDir, rPipe, compress):
try:
filePipe.close()
except Exception:
pass
pass # nosec B110

def __receiveToPipe(self, wPipe, retList, maxFileSize):
retList.append(self.networkToFD(wPipe, maxFileSize=maxFileSize))
try:
os.close(wPipe)
except Exception:
pass
pass # nosec B110

def networkToBulk(self, destDir, compress=True, maxFileSize=0):
retList = []
Expand Down
2 changes: 1 addition & 1 deletion src/DIRAC/Core/DISET/private/Transports/BaseTransport.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, stServerAddress, bServerMode=False, **kwargs):
if "keepAliveLapse" in kwargs:
try:
self.__keepAliveLapse = max(150, int(kwargs["keepAliveLapse"]))
except Exception:
except (ValueError, TypeError):
pass
self.iListenQueueSize = max(self.iListenQueueSize, int(kwargs.get("SocketBacklog", 0)))
self.__lastActionTimestamp = time.time()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def close(self):
try:
self.oSocket.shutdown(socket.SHUT_RDWR)
except Exception:
pass
pass # nosec B110
self.oSocket.close()

def setClientSocket(self, oSocket):
Expand Down
4 changes: 2 additions & 2 deletions src/DIRAC/Core/Security/ProxyFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def writeChainToTemporaryFile(proxyChain):
if not retVal["OK"]:
try:
os.unlink(proxyLocation)
except Exception:
except OSError:
pass
return retVal
return S_OK(proxyLocation)
Expand All @@ -80,7 +80,7 @@ def deleteMultiProxy(multiProxyDict):
if multiProxyDict["tempFile"]:
try:
os.unlink(multiProxyDict["file"])
except Exception:
except OSError:
pass


Expand Down
2 changes: 1 addition & 1 deletion src/DIRAC/Core/Security/VOMS.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def _unlinkFiles(self, files):
else:
try:
os.unlink(files)
except Exception:
except OSError:
pass

def _generateTemporalFile(self):
Expand Down
4 changes: 2 additions & 2 deletions src/DIRAC/Core/Tornado/Server/TornadoService.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def export_ping(self):
iUptime = int(float(oFD.readline().split()[0].strip()))
dInfo["host uptime"] = iUptime
except Exception: # pylint: disable=broad-except
pass
pass # nosec B110
startTime = self._startTime
dInfo["service start time"] = self._startTime
serviceUptime = datetime.utcnow() - startTime
Expand All @@ -199,7 +199,7 @@ def export_ping(self):
with open("/proc/loadavg") as oFD:
dInfo["load"] = " ".join(oFD.read().split()[:3])
except Exception: # pylint: disable=broad-except
pass
pass # nosec B110
dInfo["name"] = self._serviceInfoDict["serviceName"]
dInfo["URL"] = self._serviceInfoDict["URL"]
stTimes = os.times()
Expand Down
2 changes: 1 addition & 1 deletion src/DIRAC/Core/Utilities/CGroups2.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def _setup_subproc(self, slot_name):
except Exception as err:
# We can't even really log here as we're in the set-up
# context of the new proces
pass
pass # nosec B110

def setUp(self):
"""Creates the base cgroup tree if possible. Should be called once
Expand Down
4 changes: 2 additions & 2 deletions src/DIRAC/Core/Utilities/DEncode.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ def stripArgs(frame):
print("With arguments ", end=" ")
pprint(dencArgs)
break
except Exception:
pass
except Exception as err:
print(f"Failed to trace frames: {str(err)}")
print("=" * 100)
print()
print()
Expand Down
2 changes: 1 addition & 1 deletion src/DIRAC/Core/Utilities/EventDispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __realTrigger(self, eventName, params):
try:
gEventSync.unlock()
except Exception:
pass
pass # nosec B110
if not finalResult["OK"]:
return finalResult
return S_OK(len(eventFunctors))
Expand Down
8 changes: 4 additions & 4 deletions src/DIRAC/Core/Utilities/Graphs/GraphData.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,25 +332,25 @@ def getStatString(self, unit=None):
s = "Max: " + pretty_float(max_value) + " " + unitString
tmpList.append(s.strip())
except Exception:
pass
pass # nosec B110
if min_value:
try:
s = "Min: " + pretty_float(min_value) + " " + unitString
tmpList.append(s.strip())
except Exception:
pass
pass # nosec B110
if average:
try:
s = "Average: " + pretty_float(average) + " " + unitString
tmpList.append(s.strip())
except Exception:
pass
pass # nosec B110
if current:
try:
s = "Current: " + pretty_float(current) + " " + unitString
tmpList.append(s.strip())
except Exception:
pass
pass # nosec B110

resultString = ", ".join(tmpList)
return resultString
Expand Down
6 changes: 3 additions & 3 deletions src/DIRAC/Core/Utilities/Graphs/GraphUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def convert_to_datetime(dstring):
results = datetime.datetime.utcfromtimestamp(timestamp)
break
except Exception:
pass
pass # nosec B110
if t is None:
try:
dstring = dstring.split(".", 1)[0]
Expand All @@ -109,10 +109,10 @@ def convert_to_datetime(dstring):
def to_timestamp(val):
try:
v = float(val)
if v > 1000000000 and v < 1900000000:
if v > 1000000000 and v < 2540000000:
return v
except Exception:
pass
pass # nosec B110

val = convert_to_datetime(val)
return calendar.timegm(val.timetuple())
Expand Down
14 changes: 7 additions & 7 deletions src/DIRAC/Core/Utilities/MySQL.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def discardCurrentThreadConn(self):
try:
data[0].close()
except Exception:
pass
pass # nosec B110

def __pop(self, thid):
try:
Expand Down Expand Up @@ -545,7 +545,7 @@ def __del__(self):
try:
gInstancesCount -= 1
except Exception:
pass
pass # nosec B110

# MySQLdb error codes that mean the connection itself is dead and must be discarded.
__CONNECTION_LOST_ERRNOS = frozenset((2006, 2013, 2055, 4031))
Expand Down Expand Up @@ -769,7 +769,7 @@ def _query(self, cmd, *, args=None, conn=None, debug=True):
try:
cursor.close()
except Exception:
pass
pass # nosec B110

return retDict

Expand Down Expand Up @@ -809,7 +809,7 @@ def _update(self, cmd, *, args=None, conn=None, debug=True):
try:
cursor.close()
except Exception:
pass
pass # nosec B110

return retDict

Expand Down Expand Up @@ -844,7 +844,7 @@ def _updatemany(self, cmd, data, *, conn=None, debug=True):
try:
cursor.close()
except Exception:
pass
pass # nosec B110

return retDict

Expand Down Expand Up @@ -1716,7 +1716,7 @@ def executeStoredProcedure(self, packageName, parameters, outputIds, *, conn=Non
try:
cursor.close()
except Exception:
pass
pass # nosec B110
return retDict

# For the procedures that execute a select without storing the result
Expand Down Expand Up @@ -1747,6 +1747,6 @@ def executeStoredProcedureWithCursor(self, packageName, parameters, *, conn=None
try:
cursor.close()
except Exception:
pass
pass # nosec B110

return retDict
4 changes: 2 additions & 2 deletions src/DIRAC/Core/Utilities/Plotting/DataCache.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ def _deleteGraph(self, plotDict):
os.unlink(fPath)
else:
gLogger.info("Plot has already been deleted", value)
except Exception:
pass
except Exception as err:
gLogger.warn(f"Error while deleting plot! {str(err)}")
Loading
Loading