From 151d5a5bcc99ed8c931a6ebe0d23271b74d01e0a Mon Sep 17 00:00:00 2001 From: aldbr Date: Fri, 9 Oct 2026 08:42:11 +0200 Subject: [PATCH 1/3] fix: annotate DIRAC.exit as NoReturn astroid 4.3.4 makes pylint report possibly-used-before-assignment in dirac_admin_add_site.py, because a branch that ends in DIRACExit(-1) is not known to terminate. Annotating DIRAC.exit with NoReturn lets pylint treat every DIRACExit call as the end of its branch. Co-Authored-By: Claude Opus 5.5 --- src/DIRAC/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DIRAC/__init__.py b/src/DIRAC/__init__.py index f4dbd83a241..da398d8c8da 100755 --- a/src/DIRAC/__init__.py +++ b/src/DIRAC/__init__.py @@ -60,7 +60,7 @@ import sys import warnings from pkgutil import extend_path -from typing import Any, Optional, Union +from typing import Any, NoReturn, Optional, Union __path__ = extend_path(__path__, __name__) @@ -298,7 +298,7 @@ def siteName(): from DIRAC.Core.Utilities.Platform import getPlatformString, getPlatform, getPlatformTuple -def exit(exitCode=0): +def exit(exitCode=0) -> NoReturn: """ Finish execution using callbacks """ From 1953bb72ec323d9fd3e0e70ecacecd91dfbd278f Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Thu, 8 Oct 2026 11:41:05 +0200 Subject: [PATCH 2/3] fix: added few pylint disables (cherry picked from commit 183bc6086c41bc373cf2eb0c7280d6b443092a4b) --- src/DIRAC/Core/DISET/ThreadConfig.py | 2 +- src/DIRAC/Core/DISET/private/BaseClient.py | 11 +++++++---- .../Core/Tornado/Client/private/TornadoBaseClient.py | 2 +- .../DataManagementSystem/Service/S3GatewayHandler.py | 4 ++-- .../private/authorization/AuthServer.py | 2 +- .../Resources/Catalog/ConditionPlugins/ProxyPlugin.py | 4 ++-- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/DIRAC/Core/DISET/ThreadConfig.py b/src/DIRAC/Core/DISET/ThreadConfig.py index a42dac9bf3e..8961b508518 100644 --- a/src/DIRAC/Core/DISET/ThreadConfig.py +++ b/src/DIRAC/Core/DISET/ThreadConfig.py @@ -131,7 +131,7 @@ def wrapper(*args, **kwargs): :return: wrapped method """ - deco = tc.getDecorator() + deco = tc.getDecorator() # pylint: disable=no-member if not deco: return method(*args, **kwargs) # Deco is a decorator sooo.... diff --git a/src/DIRAC/Core/DISET/private/BaseClient.py b/src/DIRAC/Core/DISET/private/BaseClient.py index 2a4fc3aa956..756c489a5a7 100755 --- a/src/DIRAC/Core/DISET/private/BaseClient.py +++ b/src/DIRAC/Core/DISET/private/BaseClient.py @@ -1,6 +1,7 @@ -""" This module exposes the BaseClient class, - which serves as base for InnerRPCClient and TransferClient. +"""This module exposes the BaseClient class, +which serves as base for InnerRPCClient and TransferClient. """ + import time import _thread @@ -258,8 +259,10 @@ def __discoverExtraCredentials(self): self.__extraCredentials = self.kwargs[self.KW_EXTRA_CREDENTIALS] # Are we delegating something? - delegatedDN = self.kwargs.get(self.KW_DELEGATED_DN) or self.__threadConfig.getDN() - delegatedGroup = self.kwargs.get(self.KW_DELEGATED_GROUP) or self.__threadConfig.getGroup() + delegatedDN = self.kwargs.get(self.KW_DELEGATED_DN) or self.__threadConfig.getDN() # pylint: disable=no-member + delegatedGroup = ( + self.kwargs.get(self.KW_DELEGATED_GROUP) or self.__threadConfig.getGroup() # pylint: disable=no-member + ) if delegatedDN: self.kwargs[self.KW_DELEGATED_DN] = delegatedDN if not delegatedGroup: diff --git a/src/DIRAC/Core/Tornado/Client/private/TornadoBaseClient.py b/src/DIRAC/Core/Tornado/Client/private/TornadoBaseClient.py index ef4ea30fb2f..f559a333e0c 100644 --- a/src/DIRAC/Core/Tornado/Client/private/TornadoBaseClient.py +++ b/src/DIRAC/Core/Tornado/Client/private/TornadoBaseClient.py @@ -284,7 +284,7 @@ def __discoverExtraCredentials(self): if self.KW_EXTRA_CREDENTIALS in self.kwargs: self.__extraCredentials = self.kwargs[self.KW_EXTRA_CREDENTIALS] # Are we delegating something? - delegatedDN, delegatedGroup = self.__threadConfig.getID() + delegatedDN, delegatedGroup = self.__threadConfig.getID() # pylint: disable=no-member if self.KW_DELEGATED_DN in self.kwargs and self.kwargs[self.KW_DELEGATED_DN]: delegatedDN = self.kwargs[self.KW_DELEGATED_DN] elif delegatedDN: diff --git a/src/DIRAC/DataManagementSystem/Service/S3GatewayHandler.py b/src/DIRAC/DataManagementSystem/Service/S3GatewayHandler.py index bfbf7e28a7a..fde22548d77 100644 --- a/src/DIRAC/DataManagementSystem/Service/S3GatewayHandler.py +++ b/src/DIRAC/DataManagementSystem/Service/S3GatewayHandler.py @@ -116,8 +116,8 @@ def export_createPresignedUrl(self, storageName, s3_method, urls, expiration): # If we can't obtain remote credentials, consider it permission denied return S_ERROR(errno.EACCES, "Could not obtain remote credentials") - self._tc.setDN(credDict["DN"]) - self._tc.setGroup(credDict["group"]) + self._tc.setDN(credDict["DN"]) # pylint: disable=no-member + self._tc.setGroup(credDict["group"]) # pylint: disable=no-member successful = {} failed = {} diff --git a/src/DIRAC/FrameworkSystem/private/authorization/AuthServer.py b/src/DIRAC/FrameworkSystem/private/authorization/AuthServer.py index 02824ca377d..33145d62c48 100644 --- a/src/DIRAC/FrameworkSystem/private/authorization/AuthServer.py +++ b/src/DIRAC/FrameworkSystem/private/authorization/AuthServer.py @@ -397,7 +397,7 @@ def create_authorization_response(self, response, username): """ try: response = super().create_authorization_response(response, username) - response.clear_cookie("auth_session") + response.clear_cookie("auth_session") # pylint: disable=no-member return response except Exception as e: sLog.exception(e) diff --git a/src/DIRAC/Resources/Catalog/ConditionPlugins/ProxyPlugin.py b/src/DIRAC/Resources/Catalog/ConditionPlugins/ProxyPlugin.py index c320f47855a..967de9b61ba 100644 --- a/src/DIRAC/Resources/Catalog/ConditionPlugins/ProxyPlugin.py +++ b/src/DIRAC/Resources/Catalog/ConditionPlugins/ProxyPlugin.py @@ -60,8 +60,8 @@ def __init__(self, conditions): # We may not have a proxy, check the thread local if not self.proxyInfo: tc = ThreadConfig() - userDN = tc.getDN() - userGroup = tc.getGroup() + userDN = tc.getDN() # pylint: disable=no-member + userGroup = tc.getGroup() # pylint: disable=no-member if userDN and userGroup: userName = Registry.getUsernameForDN(userDN).get("Value") if userName: From 430d7a59613fa142c905f18a038754bb37be1924 Mon Sep 17 00:00:00 2001 From: aldbr Date: Fri, 9 Oct 2026 09:29:37 +0200 Subject: [PATCH 3/3] fix: add the pylint disables for the v8.0-only getSetup calls Co-Authored-By: Claude Opus 5.5 --- src/DIRAC/Core/DISET/private/BaseClient.py | 2 +- src/DIRAC/Core/Tornado/Client/private/TornadoBaseClient.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DIRAC/Core/DISET/private/BaseClient.py b/src/DIRAC/Core/DISET/private/BaseClient.py index 756c489a5a7..41c965517b7 100755 --- a/src/DIRAC/Core/DISET/private/BaseClient.py +++ b/src/DIRAC/Core/DISET/private/BaseClient.py @@ -131,7 +131,7 @@ def __discoverSetup(self): if self.KW_SETUP in self.kwargs and self.kwargs[self.KW_SETUP]: self.setup = str(self.kwargs[self.KW_SETUP]) else: - self.setup = self.__threadConfig.getSetup() + self.setup = self.__threadConfig.getSetup() # pylint: disable=no-member if not self.setup: self.setup = gConfig.getValue("/DIRAC/Setup", "Test") return S_OK() diff --git a/src/DIRAC/Core/Tornado/Client/private/TornadoBaseClient.py b/src/DIRAC/Core/Tornado/Client/private/TornadoBaseClient.py index f559a333e0c..5199509e717 100644 --- a/src/DIRAC/Core/Tornado/Client/private/TornadoBaseClient.py +++ b/src/DIRAC/Core/Tornado/Client/private/TornadoBaseClient.py @@ -142,7 +142,7 @@ def __discoverSetup(self): if self.KW_SETUP in self.kwargs and self.kwargs[self.KW_SETUP]: self.setup = str(self.kwargs[self.KW_SETUP]) else: - self.setup = self.__threadConfig.getSetup() + self.setup = self.__threadConfig.getSetup() # pylint: disable=no-member if not self.setup: self.setup = gConfig.getValue("/DIRAC/Setup", "Test") return S_OK()