Skip to content

Commit 819c561

Browse files
committed
refactor (lint): adapt to pylint 2.16.0
1 parent 6b9c258 commit 819c561

File tree

13 files changed

+41
-29
lines changed

13 files changed

+41
-29
lines changed

src/DIRAC/ConfigurationSystem/Agent/GOCDB2CSAgent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def execute(self):
5959
for option, functionCall in GOCDB2CSAgent._functionMap.items():
6060
optionValue = self.am_getOption(option, True)
6161
if optionValue:
62-
result = functionCall(self)
62+
result = functionCall(self) # pylint: disable=too-many-function-args
6363
if not result["OK"]:
6464
self.log.error("%s() failed with message: %s" % (functionCall.__name__, result["Message"]))
6565
else:

src/DIRAC/Core/Utilities/Graphs/PlotBase.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
The DIRAC Graphs package is derived from the GraphTool plotting package of the
44
CMS/Phedex Project by ... <to be added>
55
"""
6+
# matplotlib dynamicaly defines all the get_xticklabels and the like,
7+
# so we just ignore it
8+
# pylint: disable=not-callable
69

710
from __future__ import print_function
811
from __future__ import absolute_import

src/DIRAC/Core/Utilities/Graphs/QualityMapGraph.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ def draw(self):
172172
self.ax.set_xlim(xmin=start_plot, xmax=end_plot)
173173
else:
174174
self.ax.set_xlim(xmin=min(tmp_x), xmax=max(tmp_x))
175-
self.ax.set_yticks([i + 0.5 for i in range(nLabel)])
176-
self.ax.set_yticklabels(labelNames)
177-
setp(self.ax.get_xticklines(), markersize=0.0)
178-
setp(self.ax.get_yticklines(), markersize=0.0)
175+
self.ax.set_yticks([i + 0.5 for i in range(nLabel)]) # pylint: disable=not-callable
176+
self.ax.set_yticklabels(labelNames) # pylint: disable=not-callable
177+
setp(self.ax.get_xticklines(), markersize=0.0) # pylint: disable=not-callable
178+
setp(self.ax.get_yticklines(), markersize=0.0) # pylint: disable=not-callable
179179

180180
cax, kw = make_axes(self.ax, orientation="vertical", fraction=0.07)
181181
cb = ColorbarBase(

src/DIRAC/Core/Utilities/Pfn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def srm_pfnunparse(pfnDict):
5959
# host:port
6060
uri = "%s:%s" % (pfnDict["Host"], pfnDict["Port"])
6161
if pfnDict["WSUrl"]:
62-
if "?" in pfnDict["WSUrl"] and "=" in pfnDict["WSUrl"]:
62+
if "?" in pfnDict["WSUrl"] and "=" in pfnDict["WSUrl"]: # pylint: disable=unsupported-membership-test
6363
# host/wsurl
6464
# host:port/wsurl
6565
uri = "%s%s" % (uri, pfnDict["WSUrl"])

src/DIRAC/MonitoringSystem/DB/MonitoringDB.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def retrieveBucketedData(
214214
continue
215215
kwargs = {cond: condValue}
216216
if query:
217-
query = query | self._Q("term", **kwargs)
217+
query = query | self._Q("term", **kwargs) # pylint: disable=unsupported-binary-operation
218218
else:
219219
query = self._Q("term", **kwargs)
220220
if query:
@@ -349,7 +349,7 @@ def retrieveAggregatedData(
349349
continue
350350
kwargs = {cond: condValue}
351351
if query:
352-
query = query | self._Q("term", **kwargs)
352+
query = query | self._Q("term", **kwargs) # pylint: disable=unsupported-binary-operation
353353
else:
354354
query = self._Q("term", **kwargs)
355355
if query:

src/DIRAC/RequestManagementSystem/DB/RequestDB.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# pylint: disable=no-member
44
########################################################################
55

6+
# We disable pylint no-callable because of https://github.com/PyCQA/pylint/issues/8138
7+
68
""" Frontend for ReqDB
79
810
:mod: RequestDB
@@ -573,21 +575,31 @@ def getDBSummary(self):
573575
session = self.DBSession()
574576

575577
try:
576-
requestQuery = session.query(Request._Status, func.count(Request.RequestID)).group_by(Request._Status).all()
578+
requestQuery = (
579+
session.query(Request._Status, func.count(Request.RequestID)) # pylint: disable=not-callable
580+
.group_by(Request._Status)
581+
.all()
582+
)
577583

578584
for status, count in requestQuery:
579585
retDict["Request"][status] = count
580586

581587
operationQuery = (
582-
session.query(Operation.Type, Operation._Status, func.count(Operation.OperationID))
588+
session.query(
589+
Operation.Type, Operation._Status, func.count(Operation.OperationID) # pylint: disable=not-callable
590+
)
583591
.group_by(Operation.Type, Operation._Status)
584592
.all()
585593
)
586594

587595
for oType, status, count in operationQuery:
588596
retDict["Operation"].setdefault(oType, {})[status] = count
589597

590-
fileQuery = session.query(File._Status, func.count(File.FileID)).group_by(File._Status).all()
598+
fileQuery = (
599+
session.query(File._Status, func.count(File.FileID)) # pylint: disable=not-callable
600+
.group_by(File._Status)
601+
.all()
602+
)
591603

592604
for status, count in fileQuery:
593605
retDict["File"][status] = count
@@ -735,7 +747,9 @@ def getRequestCountersWeb(self, groupingAttribute, selectDict):
735747
groupingAttribute = "Request.%s" % groupingAttribute
736748

737749
try:
738-
summaryQuery = session.query(eval(groupingAttribute), func.count(Request.RequestID))
750+
summaryQuery = session.query(
751+
eval(groupingAttribute), func.count(Request.RequestID) # pylint: disable=not-callable
752+
)
739753

740754
for key, value in selectDict.items():
741755
if key == "ToDate":

src/DIRAC/ResourceStatusSystem/Command/test/Test_RSS_Command_VOBOXAvailabilityCommand.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
try:
1717
# Python 2: "reload" is built-in
18-
reload
18+
reload # pylint: disable=used-before-assignment
1919
except NameError:
2020
from importlib import reload # pylint: disable=no-name-in-module
2121

src/DIRAC/Resources/Computing/SSHComputingElement.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,12 @@ def __init__(self, host=None, parameters=None):
142142

143143
def __ssh_call(self, command, timeout):
144144

145-
try:
146-
import pexpect
147-
148-
expectFlag = True
149-
except BaseException:
150-
from DIRAC.Core.Utilities.Subprocess import shellCall
151-
152-
expectFlag = False
153-
154145
if not timeout:
155146
timeout = 999
156147

157-
if expectFlag:
148+
try:
149+
import pexpect
150+
158151
ssh_newkey = "Are you sure you want to continue connecting"
159152
try:
160153
child = pexpect.spawn(command, timeout=timeout, encoding="utf-8")
@@ -183,7 +176,9 @@ def __ssh_call(self, command, timeout):
183176
except Exception as x:
184177
res = (-1, "Encountered exception %s: %s" % (Exception, str(x)))
185178
return S_ERROR(res)
186-
else:
179+
except BaseException:
180+
from DIRAC.Core.Utilities.Subprocess import shellCall
181+
187182
# Try passwordless login
188183
result = shellCall(timeout, command)
189184
# print ( "!!! SSH command: %s returned %s\n" % (command, result) )

src/DIRAC/Resources/Storage/StorageElement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ def __executeMethod(self, lfn, *args, **kwargs):
11681168

11691169
# args should normaly be empty to avoid problem...
11701170
if args:
1171-
log.debug("args should be empty!%s" % args)
1171+
log.debug("args should be empty! %s" % (args,))
11721172
# because there is normally only one kw argument, I can move it from args to kwargs
11731173
methDefaultArgs = list(StorageElementItem.__defaultsArguments.get(self.methodName, {}))
11741174
if methDefaultArgs:

src/DIRAC/TransformationSystem/Agent/TransformationAgent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ def _execute(self, transDict):
215215
# Each thread will have its own clients
216216
clients = self._getClients()
217217

218+
startTime = time.time()
218219
try:
219220
transID = int(transDict["TransformationID"])
220221
self._logInfo("Processing transformation %s." % transID, transID=transID)
221-
startTime = time.time()
222222
res = self.processTransformation(transDict, clients)
223223
if not res["OK"]:
224224
self._logInfo("Failed to process transformation:", res["Message"], transID=transID)

0 commit comments

Comments
 (0)