Skip to content

Commit 90da0a6

Browse files
authored
useless-disable (#39064)
1 parent a04b30b commit 90da0a6

18 files changed

+24
-25
lines changed

sdk/identity/azure-identity/azure/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
# Copyright (c) Microsoft Corporation.
33
# Licensed under the MIT License.
44
# ------------------------------------
5-
# pylint:disable=missing-docstring
65
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore

sdk/identity/azure-identity/azure/identity/_credentials/authorization_code.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def get_token(
8585
attribute gives a reason. Any error response from Microsoft Entra ID is available as the error's
8686
``response`` attribute.
8787
"""
88-
# pylint:disable=useless-super-delegation
88+
8989
return super(AuthorizationCodeCredential, self).get_token(
9090
*scopes, claims=claims, tenant_id=tenant_id, client_secret=self._client_secret, **kwargs
9191
)

sdk/identity/azure-identity/azure/identity/_credentials/azd_cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def _run_command(command: str, timeout: int) -> str:
278278
# failed to execute 'cmd' or '/bin/sh'
279279
error = CredentialUnavailableError(message="Failed to execute '{}'".format(args[0]))
280280
raise error from ex
281-
except Exception as ex: # pylint:disable=broad-except
281+
except Exception as ex:
282282
# could be a timeout, for example
283283
error = CredentialUnavailableError(message="Failed to invoke the Azure Developer CLI")
284284
raise error from ex

sdk/identity/azure-identity/azure/identity/_credentials/azure_arc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _get_secret_key(response: PipelineResponse) -> str:
5454
with open(key_file, "r", encoding="utf-8") as file:
5555
try:
5656
return file.read()
57-
except Exception as error: # pylint:disable=broad-except
57+
except Exception as error:
5858
# user is expected to have obtained read permission prior to this being called
5959
raise ClientAuthenticationError(
6060
message="Could not read file {} contents: {}".format(key_file, error)

sdk/identity/azure-identity/azure/identity/_credentials/azure_cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def _run_command(command: str, timeout: int) -> str:
269269
# failed to execute 'cmd' or '/bin/sh'
270270
error = CredentialUnavailableError(message="Failed to execute '{}'".format(args[0]))
271271
raise error from ex
272-
except Exception as ex: # pylint:disable=broad-except
272+
except Exception as ex:
273273
# could be a timeout, for example
274274
error = CredentialUnavailableError(message="Failed to invoke the Azure CLI")
275275
raise error from ex

sdk/identity/azure-identity/azure/identity/_credentials/azure_powershell.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def run_command_line(command_line: List[str], timeout: int) -> str:
192192
proc = start_process(command_line)
193193
stdout, stderr = proc.communicate(**kwargs)
194194

195-
except Exception as ex: # pylint:disable=broad-except
195+
except Exception as ex:
196196
# failed to execute "cmd" or "/bin/sh", or timed out; PowerShell and Az.Account may or may not be installed
197197
# (handling Exception here because subprocess.SubprocessError and .TimeoutExpired were added in 3.3)
198198
if proc and not proc.returncode:

sdk/identity/azure-identity/azure/identity/_credentials/imds.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def _request_token(self, *scopes: str, **kwargs: Any) -> AccessTokenInfo:
8989
# IMDS responded
9090
_check_forbidden_response(ex)
9191
self._endpoint_available = True
92-
except Exception as ex: # pylint:disable=broad-except
92+
except Exception as ex:
9393
error_message = (
9494
"ManagedIdentityCredential authentication unavailable, no response from the IMDS endpoint."
9595
)
@@ -119,7 +119,7 @@ def _request_token(self, *scopes: str, **kwargs: Any) -> AccessTokenInfo:
119119
raise ClientAuthenticationError(message=ex.message, response=ex.response) from ex
120120
except json.decoder.JSONDecodeError as ex:
121121
raise CredentialUnavailableError(message="ManagedIdentityCredential authentication unavailable.") from ex
122-
except Exception as ex: # pylint:disable=broad-except
122+
except Exception as ex:
123123
# if anything else was raised, assume the endpoint is unavailable
124124
error_message = "ManagedIdentityCredential authentication unavailable, no response from the IMDS endpoint."
125125
raise CredentialUnavailableError(error_message) from ex

sdk/identity/azure-identity/azure/identity/_internal/auth_code_redirect_handler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def do_GET(self):
2828

2929
self.wfile.write(b"Authentication complete. You can close this window.")
3030

31-
def log_message(self, format, *args): # pylint: disable=redefined-builtin,unused-argument
31+
def log_message(self, format, *args): # pylint: disable=redefined-builtin
3232
pass # this prevents server dumping messages to stdout
3333

3434

sdk/identity/azure-identity/azure/identity/_internal/decorators.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def wrapper(*args, **kwargs):
4242
except Exception as ex: # pylint: disable=broad-except
4343
_LOGGER.debug("Failed to log the account information: %s", ex, exc_info=True)
4444
return token
45-
except Exception as ex: # pylint: disable=broad-except
45+
except Exception as ex:
4646
_LOGGER.log(
4747
logging.DEBUG if within_credential_chain.get() else logging.WARNING,
4848
"%s failed: %s",
@@ -70,7 +70,7 @@ def wrapper(*args, **kwargs):
7070
return fn(*args, **kwargs)
7171
except ClientAuthenticationError:
7272
raise
73-
except Exception as ex: # pylint:disable=broad-except
73+
except Exception as ex:
7474
auth_error = ClientAuthenticationError(message="Authentication failed: {}".format(ex))
7575
raise auth_error from ex
7676

sdk/identity/azure-identity/azure/identity/_internal/interactive.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def _get_token_base(
224224

225225
# this may be the first authentication, or the user may have authenticated a different identity
226226
self._auth_record = _build_auth_record(result)
227-
except Exception as ex: # pylint:disable=broad-except
227+
except Exception as ex:
228228
_LOGGER.warning(
229229
"%s.%s failed: %s",
230230
self.__class__.__name__,

sdk/identity/azure-identity/azure/identity/_internal/managed_identity_client.py

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020

2121
class ManagedIdentityClientBase(abc.ABC):
22-
# pylint:disable=missing-client-constructor-parameter-credential
2322
def __init__(
2423
self,
2524
request_factory: Callable[[str, dict], HttpRequest],

sdk/identity/azure-identity/azure/identity/_internal/msal_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from azure.core.exceptions import ClientAuthenticationError
99
from azure.core.pipeline.policies import ContentDecodePolicy
10-
from azure.core.pipeline.transport import ( # pylint:disable=unknown-option-value,no-legacy-azure-core-http-response-import
10+
from azure.core.pipeline.transport import ( # pylint:disable=no-legacy-azure-core-http-response-import
1111
HttpRequest,
1212
HttpResponse,
1313
)

sdk/identity/azure-identity/azure/identity/_internal/msal_managed_identity_client.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def _request_token(self, *scopes: str, **kwargs: Any) -> AccessTokenInfo: # pyl
5959
token_type=result.get("token_type", "Bearer"),
6060
refresh_on=refresh_on,
6161
)
62+
error_desc = ""
6263
if result and "error" in result:
6364
error_desc = cast(str, result["error"])
6465
error_message = self.get_unavailable_message(error_desc)
@@ -186,7 +187,7 @@ def _get_token_base(
186187
exc_info=_LOGGER.isEnabledFor(logging.DEBUG),
187188
)
188189
raise ClientAuthenticationError(self.get_unavailable_message(str(ex))) from ex
189-
except Exception as ex: # pylint:disable=broad-except
190+
except Exception as ex:
190191
_LOGGER.log(
191192
logging.DEBUG if within_credential_chain.get() else logging.WARNING,
192193
"%s.%s failed: %s",

sdk/identity/azure-identity/azure/identity/_internal/shared_token_cache.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def __init__(
8888
authority: Optional[str] = None,
8989
tenant_id: Optional[str] = None,
9090
**kwargs: Any
91-
) -> None: # pylint:disable=unused-argument
91+
) -> None:
9292
self._authority = normalize_authority(authority) if authority else get_default_authority()
9393
environment = urlparse(self._authority).netloc
9494
self._environment_aliases = KNOWN_ALIASES.get(environment) or frozenset((environment,))
@@ -246,7 +246,7 @@ def _get_cached_access_token(
246246
return AccessTokenInfo(
247247
token["secret"], expires_on, token_type=token.get("token_type", "Bearer"), refresh_on=refresh_on
248248
)
249-
except Exception as ex: # pylint:disable=broad-except
249+
except Exception as ex:
250250
message = "Error accessing cached data: {}".format(ex)
251251
raise CredentialUnavailableError(message=message) from ex
252252

@@ -262,7 +262,7 @@ def _get_refresh_tokens(self, account, is_cae: bool = False) -> List[str]:
262262
msal.TokenCache.CredentialType.REFRESH_TOKEN, query={"home_account_id": account["home_account_id"]}
263263
)
264264
return [token["secret"] for token in cache_entries if "secret" in token]
265-
except Exception as ex: # pylint:disable=broad-except
265+
except Exception as ex:
266266
message = "Error accessing cached data: {}".format(ex)
267267
raise CredentialUnavailableError(message=message) from ex
268268

sdk/identity/azure-identity/azure/identity/aio/_credentials/default.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class DefaultAzureCredential(ChainedTokenCredential):
8989
:caption: Create a DefaultAzureCredential.
9090
"""
9191

92-
def __init__(self, **kwargs: Any) -> None: # pylint: disable=too-many-statements, too-many-locals
92+
def __init__(self, **kwargs: Any) -> None: # pylint: disable=too-many-statements
9393
if "tenant_id" in kwargs:
9494
raise TypeError("'tenant_id' is not supported in DefaultAzureCredential.")
9595

sdk/identity/azure-identity/azure/identity/aio/_credentials/imds.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async def close(self) -> None:
3737
async def _acquire_token_silently(self, *scopes: str, **kwargs: Any) -> Optional[AccessTokenInfo]:
3838
return self._client.get_cached_token(*scopes)
3939

40-
async def _request_token(self, *scopes: str, **kwargs: Any) -> AccessTokenInfo: # pylint:disable=unused-argument
40+
async def _request_token(self, *scopes: str, **kwargs: Any) -> AccessTokenInfo:
4141

4242
if within_credential_chain.get() and not self._endpoint_available:
4343
# If within a chain (e.g. DefaultAzureCredential), we do a quick check to see if the IMDS endpoint
@@ -49,7 +49,7 @@ async def _request_token(self, *scopes: str, **kwargs: Any) -> AccessTokenInfo:
4949
# IMDS responded
5050
_check_forbidden_response(ex)
5151
self._endpoint_available = True
52-
except Exception as ex: # pylint:disable=broad-except
52+
except Exception as ex:
5353
error_message = (
5454
"ManagedIdentityCredential authentication unavailable, no response from the IMDS endpoint."
5555
)
@@ -78,7 +78,7 @@ async def _request_token(self, *scopes: str, **kwargs: Any) -> AccessTokenInfo:
7878
_check_forbidden_response(ex)
7979
# any other error is unexpected
8080
raise ClientAuthenticationError(message=ex.message, response=ex.response) from ex
81-
except Exception as ex: # pylint:disable=broad-except
81+
except Exception as ex:
8282
# if anything else was raised, assume the endpoint is unavailable
8383
error_message = "ManagedIdentityCredential authentication unavailable, no response from the IMDS endpoint."
8484
raise CredentialUnavailableError(error_message) from ex

sdk/identity/azure-identity/azure/identity/aio/_internal/decorators.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async def wrapper(*args, **kwargs):
4141
except Exception as ex: # pylint: disable=broad-except
4242
_LOGGER.debug("Failed to log the account information: %s", ex, exc_info=True)
4343
return token
44-
except Exception as ex: # pylint: disable=broad-except
44+
except Exception as ex:
4545
_LOGGER.log(
4646
logging.DEBUG if within_credential_chain.get() else logging.WARNING,
4747
"%s failed: %s",
@@ -70,7 +70,7 @@ async def wrapper(*args, **kwargs):
7070
return result
7171
except ClientAuthenticationError:
7272
raise
73-
except Exception as ex: # pylint:disable=broad-except
73+
except Exception as ex:
7474
auth_error = ClientAuthenticationError(message="Authentication failed: {}".format(ex))
7575
raise auth_error from ex
7676

sdk/identity/azure-identity/azure/identity/aio/_internal/managed_identity_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
T = TypeVar("T", bound="AsyncManagedIdentityClient")
1616

1717

18-
# pylint:disable=async-client-bad-name,missing-client-constructor-parameter-credential
18+
# pylint:disable=async-client-bad-name
1919
class AsyncManagedIdentityClient(AsyncContextManager, ManagedIdentityClientBase):
2020
async def __aenter__(self: T) -> T:
2121
await self._pipeline.__aenter__()

0 commit comments

Comments
 (0)