diff --git a/src/DIRAC/ConfigurationSystem/scripts/dirac_admin_check_config_options.py b/src/DIRAC/ConfigurationSystem/scripts/dirac_admin_check_config_options.py index 82635175fdc..4361da26578 100755 --- a/src/DIRAC/ConfigurationSystem/scripts/dirac_admin_check_config_options.py +++ b/src/DIRAC/ConfigurationSystem/scripts/dirac_admin_check_config_options.py @@ -174,6 +174,8 @@ def _printDiff(self, entry, level=""): diffType, entryName, _value, changes, _comment = entry elif len(entry) == 4: diffType, entryName, _value, changes = entry + else: + raise ValueError(f"Invalid entry {entry}") fullPath = os.path.join(level, entryName) diff --git a/src/DIRAC/Core/Base/AgentModule.py b/src/DIRAC/Core/Base/AgentModule.py index 1453390f446..24a1481bd4f 100644 --- a/src/DIRAC/Core/Base/AgentModule.py +++ b/src/DIRAC/Core/Base/AgentModule.py @@ -329,6 +329,7 @@ def _setShifterProxy(self): def am_go(self): # Set the shifter proxy if required + initialWallTime = initialCPUTime = cpuPercentage = -1 result = self._setShifterProxy() if not result["OK"]: return result diff --git a/src/DIRAC/Core/DISET/ServiceReactor.py b/src/DIRAC/Core/DISET/ServiceReactor.py index 03abc2635bd..eec216b6e40 100644 --- a/src/DIRAC/Core/DISET/ServiceReactor.py +++ b/src/DIRAC/Core/DISET/ServiceReactor.py @@ -14,6 +14,7 @@ must inherit from the base class RequestHandler """ + import time import datetime import selectors @@ -201,6 +202,7 @@ def __acceptIncomingConnection(self, svcName=False): """ sel = self.__getListeningSelector(svcName) while self.__alive: + clientTransport = None try: events = sel.select(timeout=10) if len(events) == 0: diff --git a/src/DIRAC/Core/Security/VOMS.py b/src/DIRAC/Core/Security/VOMS.py index b09716037df..c9a9171e530 100644 --- a/src/DIRAC/Core/Security/VOMS.py +++ b/src/DIRAC/Core/Security/VOMS.py @@ -1,5 +1,6 @@ """ Module for dealing with VOMS (Virtual Organization Membership Service) """ + from datetime import datetime import os import stat @@ -74,6 +75,7 @@ def getVOMSAttributes(self, proxy, switch="all"): if value and value not in attributes and value in validVOMSAttrs: attributes.append(value) + returnValue = None # Sorting and joining attributes if switch == "db": returnValue = ":".join(attributes) diff --git a/src/DIRAC/Core/Utilities/Graphs/Graph.py b/src/DIRAC/Core/Utilities/Graphs/Graph.py index b92ec9e4d3f..2162dd8d968 100644 --- a/src/DIRAC/Core/Utilities/Graphs/Graph.py +++ b/src/DIRAC/Core/Utilities/Graphs/Graph.py @@ -25,6 +25,7 @@ def __init__(self, *args, **kw): def layoutFigure(self, legend): prefs = self.prefs + nsublines = left = bottom = None # Get the main Figure object # self.figure = Figure() @@ -182,7 +183,7 @@ def makeTextGraph(self, text="Empty image"): def makeGraph(self, data, *args, **kw): start = time.time() - + plot_type = None # Evaluate all the preferences self.prefs = evalPrefs(*args, **kw) prefs = self.prefs diff --git a/src/DIRAC/Core/Utilities/Graphs/GraphUtilities.py b/src/DIRAC/Core/Utilities/Graphs/GraphUtilities.py index b8a43fdf79a..a93ef553e94 100644 --- a/src/DIRAC/Core/Utilities/Graphs/GraphUtilities.py +++ b/src/DIRAC/Core/Utilities/Graphs/GraphUtilities.py @@ -145,6 +145,7 @@ def add_time_to_title(begin, end, metadata={}): representing 168 Hours, but needed the format to show the date as well as the time. """ + format_str = None if "span" in metadata: interval = metadata["span"] else: diff --git a/src/DIRAC/Core/Utilities/Graphs/Legend.py b/src/DIRAC/Core/Utilities/Graphs/Legend.py index 1fe0db592c6..00aa5a8a662 100644 --- a/src/DIRAC/Core/Utilities/Graphs/Legend.py +++ b/src/DIRAC/Core/Utilities/Graphs/Legend.py @@ -3,6 +3,7 @@ The DIRAC Graphs package is derived from the GraphTool plotting package of the CMS/Phedex Project by ... """ + from matplotlib.patches import Rectangle from matplotlib.text import Text from matplotlib.figure import Figure @@ -63,6 +64,7 @@ def getLegendSize(self): legend_padding = float(self.prefs["legend_padding"]) legend_text_size = self.prefs.get("legend_text_size", self.prefs["text_size"]) legend_text_padding = self.prefs.get("legend_text_padding", self.prefs["text_padding"]) + legend_max_height = -1 if legend_position in ["right", "left"]: # One column in case of vertical legend legend_width = self.column_width + legend_padding diff --git a/src/DIRAC/Core/Utilities/Graphs/QualityMapGraph.py b/src/DIRAC/Core/Utilities/Graphs/QualityMapGraph.py index ea8d9fbec3d..2831883a235 100644 --- a/src/DIRAC/Core/Utilities/Graphs/QualityMapGraph.py +++ b/src/DIRAC/Core/Utilities/Graphs/QualityMapGraph.py @@ -3,6 +3,7 @@ The DIRAC Graphs package is derived from the GraphTool plotting package of the CMS/Phedex Project by ... """ + import datetime from pylab import setp from matplotlib.colors import Normalize @@ -39,7 +40,6 @@ class QualityMapGraph(PlotBase): - """ The BarGraph class is a straightforward bar graph; given a dictionary of values, it takes the keys as the independent variable and the values @@ -167,7 +167,7 @@ def draw(self): setp(self.ax.get_xticklines(), markersize=0.0) # pylint: disable=not-callable setp(self.ax.get_yticklines(), markersize=0.0) # pylint: disable=not-callable - cax, kw = make_axes(self.ax, orientation="vertical", fraction=0.07) + cax, _kw = make_axes(self.ax, orientation="vertical", fraction=0.07) # pylint: disable=unpacking-non-sequence ColorbarBase( cax, cmap=self.cmap, norm=self.norms, boundaries=self.cbBoundaries, values=self.cbValues, ticks=self.cbTicks ) diff --git a/src/DIRAC/Core/Utilities/Graphs/__init__.py b/src/DIRAC/Core/Utilities/Graphs/__init__.py index 0b721155c08..bef0dd671dd 100644 --- a/src/DIRAC/Core/Utilities/Graphs/__init__.py +++ b/src/DIRAC/Core/Utilities/Graphs/__init__.py @@ -115,7 +115,7 @@ def graph(data, fileName, *args, **kw): prefs = evalPrefs(*args, **kw) graph_size = prefs.get("graph_size", "normal") - + defaults = None if graph_size == "normal": defaults = graph_normal_prefs elif graph_size == "small": diff --git a/src/DIRAC/Core/Utilities/MySQL.py b/src/DIRAC/Core/Utilities/MySQL.py index 46f5428c27c..21efc261771 100755 --- a/src/DIRAC/Core/Utilities/MySQL.py +++ b/src/DIRAC/Core/Utilities/MySQL.py @@ -1231,7 +1231,7 @@ def buildCondition( """ condition = "" conjunction = "WHERE" - + attrName = None if condDict is not None: for aName, attrValue in condDict.items(): if isinstance(aName, str): diff --git a/src/DIRAC/DataManagementSystem/Client/DataManager.py b/src/DIRAC/DataManagementSystem/Client/DataManager.py index e604c00d729..f414501e0c0 100644 --- a/src/DIRAC/DataManagementSystem/Client/DataManager.py +++ b/src/DIRAC/DataManagementSystem/Client/DataManager.py @@ -8,6 +8,7 @@ This module consists of DataManager and related classes. """ + # # imports from datetime import datetime, timedelta import fnmatch @@ -988,6 +989,8 @@ def registerFile(self, fileTuple, catalog=""): fileTuples = fileTuple elif isinstance(fileTuple, tuple): fileTuples = [fileTuple] + else: + return S_ERROR(f"fileTuple is none of list,set,tuple: {type(fileTuple)}") for fileTuple in fileTuples: if not isinstance(fileTuple, tuple): errStr = "Supplied file info must be tuple or list of tuples." @@ -1041,6 +1044,8 @@ def registerReplica(self, replicaTuple, catalog=""): replicaTuples = replicaTuple elif isinstance(replicaTuple, tuple): replicaTuples = [replicaTuple] + else: + return S_ERROR(f"replicaTuple is not of type list,set or tuple: {type(replicaTuple)}") for replicaTuple in replicaTuples: if not isinstance(replicaTuple, tuple): errStr = "Supplied file info must be tuple or list of tuples." diff --git a/src/DIRAC/DataManagementSystem/Client/DirectoryListing.py b/src/DIRAC/DataManagementSystem/Client/DirectoryListing.py index 61f5d09d2de..b61dc802f68 100644 --- a/src/DIRAC/DataManagementSystem/Client/DirectoryListing.py +++ b/src/DIRAC/DataManagementSystem/Client/DirectoryListing.py @@ -60,6 +60,7 @@ def addDirectory(self, name, dirDict, numericid): date = dirDict["ModificationDate"] nlinks = 0 size = 0 + gname = None if "Owner" in dirDict: uname = dirDict["Owner"] elif "OwnerDN" in dirDict: diff --git a/src/DIRAC/DataManagementSystem/Client/FileCatalogClientCLI.py b/src/DIRAC/DataManagementSystem/Client/FileCatalogClientCLI.py index 8f84785d25b..65eb8317f05 100644 --- a/src/DIRAC/DataManagementSystem/Client/FileCatalogClientCLI.py +++ b/src/DIRAC/DataManagementSystem/Client/FileCatalogClientCLI.py @@ -671,9 +671,8 @@ def do_ancestorset(self, args): def complete_ancestorset(self, text, line, begidx, endidx): args = line.split() - if len(args) == 1: - cur_path = "" - elif len(args) > 1: + cur_path = "" + if len(args) > 1: # If the line ends with ' ' # this means a new parameter begin. if line.endswith(" "): diff --git a/src/DIRAC/DataManagementSystem/Service/StorageElementHandler.py b/src/DIRAC/DataManagementSystem/Service/StorageElementHandler.py index cdfba8a635a..d27d89d41af 100755 --- a/src/DIRAC/DataManagementSystem/Service/StorageElementHandler.py +++ b/src/DIRAC/DataManagementSystem/Service/StorageElementHandler.py @@ -286,10 +286,12 @@ def export_createDirectory(self, dir_path): def export_listDirectory(self, dir_path, mode): """Return the dir_path directory listing""" is_file = False + fname = None + dirList = None path = self.__resolveFileID(dir_path) if not os.path.exists(path): return S_ERROR(f"Directory {dir_path} does not exist") - elif os.path.isfile(path): + if os.path.isfile(path): fname = os.path.basename(path) is_file = True else: diff --git a/src/DIRAC/FrameworkSystem/Client/SystemAdministratorClientCLI.py b/src/DIRAC/FrameworkSystem/Client/SystemAdministratorClientCLI.py index d1df510df2e..be7246baf91 100644 --- a/src/DIRAC/FrameworkSystem/Client/SystemAdministratorClientCLI.py +++ b/src/DIRAC/FrameworkSystem/Client/SystemAdministratorClientCLI.py @@ -623,6 +623,7 @@ def do_install(self, args): install executor [-m ] [-p