Skip to content

Commit

Permalink
sweep: #7227 test: update to pylint 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chaen authored and web-flow committed Oct 4, 2023
1 parent c3cea97 commit 0052ee8
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/DIRAC/ConfigurationSystem/Client/Helpers/Path.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def cfgPath(*args):
return os.path.normpath(os.path.join(*(str(k) for k in args)))


def cfgInstallPath(*args):
def cfgInstallPath(*args) -> str:
"""
Path to Installation/Configuration Options
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,8 @@ def getDirectoryMetaParameters(self, dpath, credDict, inherited=True):
return S_OK({})
metaDict = {}
for _dID, key, value in result["Value"]:
if key in metaDict:
if isinstance(metaDict[key], list):
metaDict[key].append(value)
else:
metaDict[key] = [metaDict[key]].append(value)
if isinstance(metaDict.get(key), list):
metaDict[key].append(value)
else:
metaDict[key] = value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,8 @@ def __getFileMetaParameters(self, fileID, credDict):
return S_OK({})
metaDict = {}
for fileID, key, value in result["Value"]:
if key in metaDict:
if isinstance(metaDict[key], list):
metaDict[key].append(value)
else:
metaDict[key] = [metaDict[key]].append(value)
if isinstance(metaDict.get(key), list):
metaDict[key].append(value)
else:
metaDict[key] = value

Expand Down
29 changes: 20 additions & 9 deletions src/DIRAC/FrameworkSystem/Client/ComponentInstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import MySQLdb
from diraccfg import CFG
from prompt_toolkit import prompt
from typing import cast

import DIRAC
from DIRAC import gConfig, gLogger, rootPath
Expand Down Expand Up @@ -162,7 +163,7 @@ def __init__(self):
gLogger.debug("DIRAC Root Path =", rootPath)

self.mysqlMode = ""
self.localCfg = None
self.localCfg: CFG = None
self.cfgFile = ""
self.setup = ""
self.instance = ""
Expand Down Expand Up @@ -1364,10 +1365,20 @@ def setupSite(self, scriptCfg, cfg=None):

# Now get the necessary info from self.localCfg
setupSystems = self.localCfg.getOption(cfgInstallPath("Systems"), ["Configuration", "Framework"])

setupDatabases = self.localCfg.getOption(cfgInstallPath("Databases"), [])
setupServices = [k.split("/") for k in self.localCfg.getOption(cfgInstallPath("Services"), [])]
setupAgents = [k.split("/") for k in self.localCfg.getOption(cfgInstallPath("Agents"), [])]
setupExecutors = [k.split("/") for k in self.localCfg.getOption(cfgInstallPath("Executors"), [])]
setupServices = [
k.split("/")
for k in self.localCfg.getOption(cfgInstallPath("Services"), []) # pylint: disable=not-an-iterable
]
setupAgents = [
k.split("/")
for k in self.localCfg.getOption(cfgInstallPath("Agents"), []) # pylint: disable=not-an-iterable
]
setupExecutors = [
k.split("/")
for k in self.localCfg.getOption(cfgInstallPath("Executors"), []) # pylint: disable=not-an-iterable
]
setupWeb = self.localCfg.getOption(cfgInstallPath("WebPortal"), False)
setupConfigurationMaster = self.localCfg.getOption(cfgInstallPath("ConfigurationMaster"), False)
setupPrivateConfiguration = self.localCfg.getOption(cfgInstallPath("PrivateConfiguration"), False)
Expand All @@ -1382,7 +1393,7 @@ def setupSite(self, scriptCfg, cfg=None):
DIRAC.exit(-1)
return S_ERROR(error)
serviceSysInstance = serviceTuple[0]
if serviceSysInstance not in setupSystems:
if serviceSysInstance not in setupSystems: # pylint: disable=unsupported-membership-test
setupSystems.append(serviceSysInstance)

for agentTuple in setupAgents:
Expand All @@ -1393,7 +1404,7 @@ def setupSite(self, scriptCfg, cfg=None):
DIRAC.exit(-1)
return S_ERROR(error)
agentSysInstance = agentTuple[0]
if agentSysInstance not in setupSystems:
if agentSysInstance not in setupSystems: # pylint: disable=unsupported-membership-test
setupSystems.append(agentSysInstance)

for executorTuple in setupExecutors:
Expand All @@ -1404,7 +1415,7 @@ def setupSite(self, scriptCfg, cfg=None):
DIRAC.exit(-1)
return S_ERROR(error)
executorSysInstance = executorTuple[0]
if executorSysInstance not in setupSystems:
if executorSysInstance not in setupSystems: # pylint: disable=unsupported-membership-test
setupSystems.append(executorSysInstance)

# And to find out the available extensions
Expand Down Expand Up @@ -1532,7 +1543,7 @@ def setupSite(self, scriptCfg, cfg=None):
# info to be propagated, this may cause the later self.setup to fail
if setupAddConfiguration:
gLogger.notice("Registering System instances")
for system in setupSystems:
for system in setupSystems: # pylint: disable=not-an-iterable
self.addSystemInstance(system, self.instance, self.setup, True)

for system, service in setupServices:
Expand Down Expand Up @@ -1593,7 +1604,7 @@ def setupSite(self, scriptCfg, cfg=None):
return result
dbDict = result["Value"]

for dbName in setupDatabases:
for dbName in setupDatabases: # pylint: disable=not-an-iterable
gLogger.verbose("Setting up database", dbName)
if dbName not in installedDatabases:
result = self.installDatabase(dbName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ def parseSwitches():
args = Script.getPositionalArgs()
if not args:
error("Missing mandatory 'query' argument")
DIRACExit(1)
elif not args[0].lower() in ("select", "add", "delete"):
error("Missing mandatory argument")
else:
query = args[0].lower()
DIRACExit(1)

query = args[0].lower()

switches = dict(Script.getUnprocessedSwitches())

Expand Down

0 comments on commit 0052ee8

Please sign in to comment.