Skip to content

Commit

Permalink
Update Pinned CI Packages (#11586)
Browse files Browse the repository at this point in the history
* update pinned CI deps

* fix custom checkers - rename msg_id -> msgid

* pylint updates for text analytics and form recognizer

* pylint updates for azure-identity and azure-keyvault-keys

* disable import-outside-toplevel

* Pylint for azure-core

* Mypy + pylint are friends

* Fix errors for pylint 2.5.2

* disable azure-identity warnings

* Refactor ReceivedMessageBase off such that the AIO version of ReceivedMessage does not violate pylint by overriding sync with async methods.  Now the sync-specific/async-specific versions imply implement their respective settlement methods, with the shared scaffolding in base.

* Temporarily disable pylint checks for AsyncServiceBusSharedKeyCredentialPolicy.
In the mid-term we need to deprecate the Async versions of this policy and credential to unify on a single model in the primary namespace, see issue here: Azure/azure-sdk-for-python#12533

* Fix deferred settlement tests by reverting the mgmt link settlement await.

* [Storage][Pylint]Fix Pylint

* resolve conflicts

Co-authored-by: Krista Pratico <[email protected]>
Co-authored-by: Charles Lowell <[email protected]>
Co-authored-by: Laurent Mazuel <[email protected]>
Co-authored-by: yijxie <[email protected]>
Co-authored-by: Kieran Brantner-Magee <[email protected]>
Co-authored-by: xiafu <[email protected]>
  • Loading branch information
7 people authored Jul 14, 2020
1 parent 6b87aff commit 23a1ed4
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion sdk/core/azure-core/azure/core/pipeline/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def prepare_requests(req):

with concurrent.futures.ThreadPoolExecutor() as executor:
# List comprehension to raise exceptions if happened
[ # pylint: disable=expression-not-assigned
[ # pylint: disable=expression-not-assigned, unnecessary-comprehension
_ for _ in executor.map(prepare_requests, requests)
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, credential, *scopes, **kwargs):
super().__init__(credential, *scopes, **kwargs)
self._lock = asyncio.Lock()

async def on_request(self, request: PipelineRequest):
async def on_request(self, request: PipelineRequest): # pylint:disable=invalid-overridden-method
"""Adds a bearer token Authorization header to request and sends request to next policy.
:param request: The pipeline request object to be modified.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AsyncRedirectPolicy(RedirectPolicy, AsyncHTTPPolicy):
:caption: Configuring an async redirect policy.
"""

async def send(self, request):
async def send(self, request): # pylint:disable=invalid-overridden-method
"""Sends the PipelineRequest object to the next policy.
Uses redirect settings to send the request to redirect endpoint if necessary.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class AsyncRetryPolicy(RetryPolicy, AsyncHTTPPolicy):
:caption: Configuring an async retry policy.
"""

async def _sleep_for_retry(self, response, transport):
async def _sleep_for_retry(self, response, transport): # pylint:disable=invalid-overridden-method
"""Sleep based on the Retry-After response header value.
:param response: The PipelineResponse object.
Expand All @@ -93,7 +93,7 @@ async def _sleep_for_retry(self, response, transport):
return True
return False

async def _sleep_backoff(self, settings, transport):
async def _sleep_backoff(self, settings, transport): # pylint:disable=invalid-overridden-method
"""Sleep using exponential backoff. Immediately returns if backoff is 0.
:param dict settings: The retry settings.
Expand All @@ -104,7 +104,7 @@ async def _sleep_backoff(self, settings, transport):
return
await transport.sleep(backoff)

async def sleep(self, settings, transport, response=None):
async def sleep(self, settings, transport, response=None): # pylint:disable=invalid-overridden-method
"""Sleep between retry attempts.
This method will respect a server's ``Retry-After`` response header
Expand All @@ -123,7 +123,7 @@ async def sleep(self, settings, transport, response=None):
return
await self._sleep_backoff(settings, transport)

async def send(self, request):
async def send(self, request): # pylint:disable=invalid-overridden-method
"""Uses the configured retry policy to send the request to the next policy in the pipeline.
:param request: The PipelineRequest object
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/azure-core/azure/core/pipeline/transport/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def parse_responses(response):

with concurrent.futures.ThreadPoolExecutor() as executor:
# List comprehension to raise exceptions if happened
[ # pylint: disable=expression-not-assigned
[ # pylint: disable=expression-not-assigned, unnecessary-comprehension
_ for _ in executor.map(parse_responses, responses)
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ async def __aenter__(self):
async def __aexit__(self, *exc_details): # pylint: disable=arguments-differ
return super(AsyncioRequestsTransport, self).__exit__()

async def sleep(self, duration):
async def sleep(self, duration): # pylint:disable=invalid-overridden-method
await asyncio.sleep(duration)

async def send(self, request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: # type: ignore
async def send(self, request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: # type: ignore # pylint:disable=invalid-overridden-method
"""Send the request using this HTTP sender.
:param request: The HttpRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ async def __aenter__(self):
async def __aexit__(self, *exc_details): # pylint: disable=arguments-differ
return super(TrioRequestsTransport, self).__exit__()

async def sleep(self, duration):
async def sleep(self, duration): # pylint:disable=invalid-overridden-method
await trio.sleep(duration)

async def send(self, request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: # type: ignore
async def send(self, request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: # type: ignore # pylint:disable=invalid-overridden-method
"""Send the request using this HTTP sender.
:param request: The HttpRequest
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/azure-core/azure/core/polling/_async_poller.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def from_continuation_token(cls, continuation_token: str, **kwargs) -> Tuple[Any
class AsyncNoPolling(_NoPolling):
"""An empty async poller that returns the deserialized initial response.
"""
async def run(self):
async def run(self): # pylint:disable=invalid-overridden-method
"""Empty run, no polling.
Just override initial run to add "async"
"""
Expand Down
12 changes: 6 additions & 6 deletions sdk/core/azure-core/azure/core/polling/async_base_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AsyncLROBasePolling(LROBasePolling):
"""A subclass or LROBasePolling that redefine "run" as async.
"""

async def run(self):
async def run(self): # pylint:disable=invalid-overridden-method
try:
await self._poll()
except BadStatus as err:
Expand All @@ -62,7 +62,7 @@ async def run(self):
response=self._pipeline_response.http_response, error=err
)

async def _poll(self):
async def _poll(self): # pylint:disable=invalid-overridden-method
"""Poll status of operation so long as operation is incomplete and
we have an endpoint to query.
Expand All @@ -85,17 +85,17 @@ async def _poll(self):
self._pipeline_response = await self.request_status(final_get_url)
_raise_if_bad_http_status_and_method(self._pipeline_response.http_response)

async def _sleep(self, delay):
async def _sleep(self, delay): # pylint:disable=invalid-overridden-method
await self._transport.sleep(delay)

async def _delay(self):
async def _delay(self): # pylint:disable=invalid-overridden-method
"""Check for a 'retry-after' header to set timeout,
otherwise use configured timeout.
"""
delay = self._extract_delay()
await self._sleep(delay)

async def update_status(self):
async def update_status(self): # pylint:disable=invalid-overridden-method
"""Update the current status of the LRO.
"""
self._pipeline_response = await self.request_status(
Expand All @@ -104,7 +104,7 @@ async def update_status(self):
_raise_if_bad_http_status_and_method(self._pipeline_response.http_response)
self._status = self._operation.get_status(self._pipeline_response)

async def request_status(self, status_link):
async def request_status(self, status_link): # pylint:disable=invalid-overridden-method
"""Do a simple GET to this status link.
This method re-inject 'x-ms-client-request-id'.
Expand Down

0 comments on commit 23a1ed4

Please sign in to comment.