Skip to content

Commit 79f436b

Browse files
authored
[Core] useless-supression fix for next-pylint (#37263)
* script * core * Revert "script" This reverts commit f1506d3. * remove * update core * black * fix pylint * black * pylint * ran black * fix useless-disables * no-member * Revert "no-member" This reverts commit 635013e1a3a023ff081c4af26ae09b78cff0f533.
1 parent a9233f4 commit 79f436b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+384
-172
lines changed

sdk/core/azure-core-tracing-opentelemetry/azure/core/tracing/ext/opentelemetry_span/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def __enter__(self) -> "OpenTelemetrySpan":
238238

239239
self._current_ctxt_manager = trace.use_span(self._span_instance, end_on_exit=True)
240240
if self._current_ctxt_manager:
241-
self._current_ctxt_manager.__enter__() # pylint: disable=no-member
241+
self._current_ctxt_manager.__enter__()
242242
return self
243243

244244
def __exit__(self, exception_type, exception_value, traceback) -> None:
@@ -248,7 +248,7 @@ def __exit__(self, exception_type, exception_value, traceback) -> None:
248248
error_type = f"{module}.{exception_type.__qualname__}" if module else exception_type.__qualname__
249249
self.add_attribute(_ERROR_SPAN_ATTRIBUTE, error_type)
250250
if self._current_ctxt_manager:
251-
self._current_ctxt_manager.__exit__(exception_type, exception_value, traceback) # pylint: disable=no-member
251+
self._current_ctxt_manager.__exit__(exception_type, exception_value, traceback)
252252
self._current_ctxt_manager = None
253253
for token in self._context_tokens:
254254
context.detach(token)

sdk/core/azure-core/azure/core/_enum_meta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class MyCustomEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
4545

4646
def __getitem__(cls, name: str) -> Any:
4747
# disabling pylint bc of pylint bug https://github.com/PyCQA/astroid/issues/713
48-
return super(CaseInsensitiveEnumMeta, cls).__getitem__(name.upper()) # pylint: disable=no-value-for-parameter
48+
return super(CaseInsensitiveEnumMeta, cls).__getitem__(name.upper())
4949

5050
def __getattr__(cls, name: str) -> Enum:
5151
"""Return the enum member matching `name`.

sdk/core/azure-core/azure/core/_pipeline_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def _build_pipeline(
140140
[
141141
config.logging_policy,
142142
DistributedTracingPolicy(**kwargs),
143-
SensitiveHeaderCleanupPolicy(**kwargs) if config.redirect_policy else None,
143+
(SensitiveHeaderCleanupPolicy(**kwargs) if config.redirect_policy else None),
144144
config.http_logging_policy or HttpLoggingPolicy(**kwargs),
145145
]
146146
)
@@ -195,7 +195,7 @@ def send_request(self, request: HTTPRequestType, *, stream: bool = False, **kwar
195195
:rtype: ~azure.core.rest.HttpResponse
196196
"""
197197
return_pipeline_response = kwargs.pop("_return_pipeline_response", False)
198-
pipeline_response = self._pipeline.run(request, stream=stream, **kwargs) # pylint: disable=protected-access
198+
pipeline_response = self._pipeline.run(request, stream=stream, **kwargs)
199199
if return_pipeline_response:
200200
return pipeline_response # type: ignore # This is a private API we don't want to type in signature
201201
return pipeline_response.http_response

sdk/core/azure-core/azure/core/_pipeline_client_async.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ def __init__(
165165
self._base_url = base_url
166166
self._pipeline = pipeline or self._build_pipeline(self._config, **kwargs)
167167

168-
async def __aenter__(self) -> AsyncPipelineClient[HTTPRequestType, AsyncHTTPResponseType]:
168+
async def __aenter__(
169+
self,
170+
) -> AsyncPipelineClient[HTTPRequestType, AsyncHTTPResponseType]:
169171
await self._pipeline.__aenter__()
170172
return self
171173

@@ -223,7 +225,7 @@ def _build_pipeline(
223225
[
224226
config.logging_policy,
225227
DistributedTracingPolicy(**kwargs),
226-
SensitiveHeaderCleanupPolicy(**kwargs) if config.redirect_policy else None,
228+
(SensitiveHeaderCleanupPolicy(**kwargs) if config.redirect_policy else None),
227229
config.http_logging_policy or HttpLoggingPolicy(**kwargs),
228230
]
229231
)
@@ -263,7 +265,7 @@ def _build_pipeline(
263265

264266
async def _make_pipeline_call(self, request: HTTPRequestType, **kwargs) -> AsyncHTTPResponseType:
265267
return_pipeline_response = kwargs.pop("_return_pipeline_response", False)
266-
pipeline_response = await self._pipeline.run(request, **kwargs) # pylint: disable=protected-access
268+
pipeline_response = await self._pipeline.run(request, **kwargs)
267269
if return_pipeline_response:
268270
return pipeline_response # type: ignore # This is a private API we don't want to type in signature
269271
return pipeline_response.http_response

sdk/core/azure-core/azure/core/credentials.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@ class AccessTokenInfo:
3838
"""Specifies the time, in Unix time, when the cached token should be proactively refreshed. Optional."""
3939

4040
def __init__(
41-
self, token: str, expires_on: int, *, token_type: str = "Bearer", refresh_on: Optional[int] = None
41+
self,
42+
token: str,
43+
expires_on: int,
44+
*,
45+
token_type: str = "Bearer",
46+
refresh_on: Optional[int] = None,
4247
) -> None:
4348
self.token = token
4449
self.expires_on = expires_on

sdk/core/azure-core/azure/core/exceptions.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def raise_with_traceback(exception: Callable, *args: Any, message: str = "", **k
9797
exc_msg = "{}, {}: {}".format(message, exc_type.__name__, exc_value)
9898
error = exception(exc_msg, *args, **kwargs)
9999
try:
100-
raise error.with_traceback(exc_traceback) # pylint: disable=raise-missing-from
100+
raise error.with_traceback(exc_traceback)
101101
except AttributeError: # Python 2
102102
error.__traceback__ = exc_traceback
103103
raise error # pylint: disable=raise-missing-from
@@ -150,7 +150,9 @@ def get(self, key: KeyType) -> Optional[ValueType]:
150150

151151

152152
def map_error(
153-
status_code: int, response: _HttpResponseCommonAPI, error_map: Mapping[int, Type[HttpResponseError]]
153+
status_code: int,
154+
response: _HttpResponseCommonAPI,
155+
error_map: Mapping[int, Type[HttpResponseError]],
154156
) -> None:
155157
if not error_map:
156158
return
@@ -309,7 +311,7 @@ def raise_with_traceback(self) -> None:
309311
This method is deprecated as we don't support Python 2 anymore. Use raise/from instead.
310312
"""
311313
try:
312-
raise super(AzureError, self).with_traceback(self.exc_traceback) # pylint: disable=raise-missing-from
314+
raise super(AzureError, self).with_traceback(self.exc_traceback)
313315
except AttributeError:
314316
self.__traceback__: Optional[TracebackType] = self.exc_traceback
315317
raise self # pylint: disable=raise-missing-from
@@ -355,7 +357,10 @@ class HttpResponseError(AzureError):
355357
"""
356358

357359
def __init__(
358-
self, message: Optional[object] = None, response: Optional[_HttpResponseCommonAPI] = None, **kwargs: Any
360+
self,
361+
message: Optional[object] = None,
362+
response: Optional[_HttpResponseCommonAPI] = None,
363+
**kwargs: Any,
359364
) -> None:
360365
# Don't want to document this one yet.
361366
error_format = kwargs.get("error_format", ODataV4Format)
@@ -453,7 +458,10 @@ class TooManyRedirectsError(HttpResponseError, Generic[HTTPRequestType, HTTPResp
453458
"""
454459

455460
def __init__(
456-
self, history: "List[RequestHistory[HTTPRequestType, HTTPResponseType]]", *args: Any, **kwargs: Any
461+
self,
462+
history: "List[RequestHistory[HTTPRequestType, HTTPResponseType]]",
463+
*args: Any,
464+
**kwargs: Any,
457465
) -> None:
458466
self.history = history
459467
message = "Reached maximum redirect attempts."

sdk/core/azure-core/azure/core/messaging.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
DataType = TypeVar("DataType")
2323

2424

25-
class CloudEvent(Generic[DataType]): # pylint:disable=too-many-instance-attributes
25+
class CloudEvent(Generic[DataType]):
2626
"""Properties of the CloudEvent 1.0 Schema.
2727
All required parameters must be populated in order to send to Azure.
2828
@@ -57,13 +57,13 @@ class CloudEvent(Generic[DataType]): # pylint:disable=too-many-instance-attribu
5757
"""Identifies the context in which an event happened. The combination of id and source must
5858
be unique for each distinct event. If publishing to a domain topic, source must be the domain topic name."""
5959

60-
type: str # pylint: disable=redefined-builtin
60+
type: str
6161
"""Type of event related to the originating occurrence."""
6262

6363
specversion: str = "1.0"
6464
"""The version of the CloudEvent spec. Defaults to "1.0" """
6565

66-
id: str # pylint: disable=redefined-builtin
66+
id: str
6767
"""An identifier for the event. The combination of id and source must be
6868
unique for each distinct event. If not provided, a random UUID will be generated and used."""
6969

sdk/core/azure-core/azure/core/paging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#
2525
# --------------------------------------------------------------------------
2626
import itertools
27-
from typing import ( # pylint: disable=unused-import
27+
from typing import (
2828
Callable,
2929
Optional,
3030
TypeVar,

sdk/core/azure-core/azure/core/pipeline/__init__.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,18 @@
2424
#
2525
# --------------------------------------------------------------------------
2626

27-
from typing import TypeVar, Generic, Dict, Any, Tuple, List, Optional, overload, TYPE_CHECKING, Union
27+
from typing import (
28+
TypeVar,
29+
Generic,
30+
Dict,
31+
Any,
32+
Tuple,
33+
List,
34+
Optional,
35+
overload,
36+
TYPE_CHECKING,
37+
Union,
38+
)
2839

2940
HTTPResponseType = TypeVar("HTTPResponseType", covariant=True) # pylint: disable=typevar-name-incorrect-variance
3041
HTTPRequestType = TypeVar("HTTPRequestType", covariant=True) # pylint: disable=typevar-name-incorrect-variance
@@ -50,9 +61,7 @@ class PipelineContext(Dict[str, Any]):
5061

5162
_PICKLE_CONTEXT = {"deserialized_data"}
5263

53-
def __init__(
54-
self, transport: Optional["TransportType"], **kwargs: Any
55-
) -> None: # pylint: disable=super-init-not-called
64+
def __init__(self, transport: Optional["TransportType"], **kwargs: Any) -> None:
5665
self.transport: Optional["TransportType"] = transport
5766
self.options = kwargs
5867
self._protected = ["transport", "options"]
@@ -95,7 +104,9 @@ def __delitem__(self, key: str) -> None:
95104
raise ValueError("Context value {} cannot be deleted.".format(key))
96105
return super(PipelineContext, self).__delitem__(key)
97106

98-
def clear(self) -> None: # pylint: disable=docstring-missing-return, docstring-missing-rtype
107+
def clear( # pylint: disable=docstring-missing-return, docstring-missing-rtype
108+
self,
109+
) -> None:
99110
"""Context objects cannot be cleared.
100111
101112
:raises: TypeError

sdk/core/azure-core/azure/core/pipeline/_base.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,17 @@
2525
# --------------------------------------------------------------------------
2626
from __future__ import annotations
2727
import logging
28-
from typing import Generic, TypeVar, Union, Any, List, Dict, Optional, Iterable, ContextManager
28+
from typing import (
29+
Generic,
30+
TypeVar,
31+
Union,
32+
Any,
33+
List,
34+
Dict,
35+
Optional,
36+
Iterable,
37+
ContextManager,
38+
)
2939
from azure.core.pipeline import (
3040
PipelineRequest,
3141
PipelineResponse,
@@ -84,7 +94,7 @@ def send(self, request: PipelineRequest[HTTPRequestType]) -> PipelineResponse[HT
8494
_await_result(self._policy.on_request, request)
8595
try:
8696
response = self.next.send(request)
87-
except Exception: # pylint: disable=broad-except
97+
except Exception:
8898
_await_result(self._policy.on_exception, request)
8999
raise
90100
_await_result(self._policy.on_response, request, response)
@@ -146,7 +156,8 @@ def __init__(
146156
policies: Optional[
147157
Iterable[
148158
Union[
149-
HTTPPolicy[HTTPRequestType, HTTPResponseType], SansIOHTTPPolicy[HTTPRequestType, HTTPResponseType]
159+
HTTPPolicy[HTTPRequestType, HTTPResponseType],
160+
SansIOHTTPPolicy[HTTPRequestType, HTTPResponseType],
150161
]
151162
]
152163
] = None,
@@ -168,7 +179,7 @@ def __enter__(self) -> Pipeline[HTTPRequestType, HTTPResponseType]:
168179
self._transport.__enter__()
169180
return self
170181

171-
def __exit__(self, *exc_details: Any) -> None: # pylint: disable=arguments-differ
182+
def __exit__(self, *exc_details: Any) -> None:
172183
self._transport.__exit__(*exc_details)
173184

174185
@staticmethod

0 commit comments

Comments
 (0)