Skip to content

Commit

Permalink
pylint; clean request_status
Browse files Browse the repository at this point in the history
  • Loading branch information
mccoyp committed Jun 12, 2021
1 parent 0ee385f commit 894d7d0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ async def request_status(self, status_link):
:rtype: azure.core.pipeline.PipelineResponse
"""
if self._path_format_arguments:
status_link = self._client.format_url(status_link, **self._path_format_arguments)
request = self._client.get(status_link)
try:
if self._path_format_arguments:
status_link = self._client.format_url(status_link, **self._path_format_arguments)
# Re-inject 'x-ms-client-request-id' while polling
if "request_id" not in self._operation_config:
self._operation_config["request_id"] = self._get_request_id()
except AttributeError:
pass
request = self._client.get(status_link)
return await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **self._operation_config
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# ------------------------------------
import datetime
import email.utils
from requests.structures import CaseInsensitiveDict
from typing import TYPE_CHECKING
from requests.structures import CaseInsensitiveDict

from azure.core.polling.base_polling import BadStatus

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import base64
from typing import TYPE_CHECKING

import six

from azure.core.exceptions import HttpResponseError
from azure.core.polling.base_polling import (
BadResponse,
Expand All @@ -13,13 +15,12 @@
OperationFailed,
OperationResourcePolling,
)
import six

from .helpers import _failed, _get_retry_after, _raise_if_bad_http_status_and_method

if TYPE_CHECKING:
from typing import Union
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline import PipelineResponse # pylint: disable=ungrouped-imports
from azure.core.pipeline.transport import HttpResponse, AsyncHttpResponse, HttpRequest

ResponseType = Union[HttpResponse, AsyncHttpResponse]
Expand Down Expand Up @@ -143,15 +144,15 @@ def request_status(self, status_link):
:rtype: azure.core.pipeline.PipelineResponse
"""
if self._path_format_arguments:
status_link = self._client.format_url(status_link, **self._path_format_arguments)
request = self._client.get(status_link)
try:
if self._path_format_arguments:
status_link = self._client.format_url(status_link, **self._path_format_arguments)
# Re-inject 'x-ms-client-request-id' while polling
if "request_id" not in self._operation_config:
self._operation_config["request_id"] = self._get_request_id()
except AttributeError:
pass
request = self._client.get(status_link)
return self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **self._operation_config
)
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ def test_full_backup_and_restore(self, container_uri, sas_token):
backup_client = KeyVaultBackupClient(self.managed_hsm["url"], self.credential)
backup_poller = backup_client.begin_backup(container_uri, sas_token)

# check that pollers and polling methods behave as expected
assert backup_poller.status() == "InProgress"
assert not backup_poller.done() or backup_poller.polling_method().finished()

backup_operation = backup_poller.result()
assert backup_poller.status() == "Succeeded" and backup_poller.polling_method().status() == "Succeeded"
assert backup_operation.folder_url
Expand Down

0 comments on commit 894d7d0

Please sign in to comment.