Skip to content

Commit 57c289c

Browse files
authored
Get FR ready for Azure-Core poller typing PR (Azure#30211)
* Get FR ready for Azure-Core typing PR * Remove unecessary code * Pylint
1 parent 4832edd commit 57c289c

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_form_recognizer_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ def analyze_callback(raw_response, _, headers): # pylint: disable=unused-argume
752752
return prepare_form_result(analyze_result, model_id)
753753

754754
callback = kwargs.pop("cls", analyze_callback)
755-
polling = LROBasePolling(timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs)
755+
polling: LROBasePolling = LROBasePolling(timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs)
756756

757757
# FIXME: part of this code will be removed once autorest can handle diff mixin
758758
# signatures across API versions
@@ -810,7 +810,7 @@ def analyze_callback(raw_response, _, headers): # pylint: disable=unused-argume
810810
return prepare_form_result(analyze_result, model_id)
811811

812812
callback = kwargs.pop("cls", analyze_callback)
813-
polling = LROBasePolling(timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs)
813+
polling: LROBasePolling = LROBasePolling(timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs)
814814

815815
# FIXME: part of this code will be removed once autorest can handle diff mixin
816816
# signatures across API versions

sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_polling.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,10 @@
77

88
import datetime
99
import json
10-
from typing import Callable, Mapping, Union, TypeVar, Any, Optional
10+
from typing import Callable, Mapping, TypeVar, Any, Optional
1111
from typing_extensions import Protocol, runtime_checkable
1212
from azure.core.exceptions import HttpResponseError, ODataV4Format
1313
from azure.core.pipeline import PipelineResponse
14-
from azure.core.pipeline.transport import (
15-
HttpResponse,
16-
AsyncHttpResponse,
17-
HttpRequest,
18-
)
1914
from azure.core.polling import LROPoller, PollingMethod
2015
from azure.core.polling.base_polling import (
2116
LocationPolling,
@@ -28,10 +23,6 @@
2823
PollingReturnType = TypeVar("PollingReturnType")
2924

3025

31-
ResponseType = Union[HttpResponse, AsyncHttpResponse]
32-
PipelineResponseType = PipelineResponse[HttpRequest, ResponseType]
33-
34-
3526
def raise_error(response, errors, message):
3627
error_message = "({}) {}{}".format(errors[0]["code"], errors[0]["message"], message)
3728
error = HttpResponseError(message=error_message, response=response)
@@ -135,7 +126,7 @@ def from_continuation_token(
135126
class DocumentModelAdministrationPolling(OperationResourcePolling):
136127
"""Polling method overrides for training endpoints."""
137128

138-
def get_final_get_url(self, pipeline_response: PipelineResponseType) -> None:
129+
def get_final_get_url(self, pipeline_response: Any) -> None:
139130
"""If a final GET is needed, returns the URL.
140131
141132
:rtype: None

sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/aio/_form_recognizer_client_async.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,9 @@ def analyze_callback(raw_response, _, headers): # pylint: disable=unused-argume
766766
return prepare_form_result(analyze_result, model_id)
767767

768768
callback = kwargs.pop("cls", analyze_callback)
769-
polling = AsyncLROBasePolling(timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs)
769+
polling: AsyncLROBasePolling = AsyncLROBasePolling(
770+
timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs
771+
)
770772

771773
# FIXME: part of this code will be removed once autorest can handle diff mixin
772774
# signatures across API versions
@@ -824,7 +826,9 @@ def analyze_callback(raw_response, _, headers): # pylint: disable=unused-argume
824826
return prepare_form_result(analyze_result, model_id)
825827

826828
callback = kwargs.pop("cls", analyze_callback)
827-
polling = AsyncLROBasePolling(timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs)
829+
polling: AsyncLROBasePolling = AsyncLROBasePolling(
830+
timeout=polling_interval, lro_algorithms=[AnalyzePolling()], **kwargs
831+
)
828832

829833
# FIXME: part of this code will be removed once autorest can handle diff mixin
830834
# signatures across API versions

0 commit comments

Comments
 (0)