Skip to content

Commit 3885590

Browse files
committed
pylint and mypy
1 parent 4fd6637 commit 3885590

File tree

7 files changed

+32
-22
lines changed

7 files changed

+32
-22
lines changed

eng/test_tools.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Jinja2==2.11.2
2828
pylint==1.8.4; python_version < '3.4'
2929
pylint==2.5.2; python_version >= '3.4'
3030

31-
../../../tools/azure-devtools
3231

3332
# python-dotenv
3433
python-dotenv==0.15.0

sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_lro.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# Copyright (c) Microsoft Corporation.
44
# Licensed under the MIT License.
55
# ------------------------------------
6-
import json
76
from six.moves.urllib.parse import urlencode
87
from azure.core.polling import LROPoller
98
from azure.core.polling.base_polling import LROBasePolling, OperationResourcePolling, OperationFailed, BadStatus

sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_request_handlers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
TextDocumentInput,
1313
RecognizeEntitiesAction,
1414
RecognizePiiEntitiesAction,
15-
ExtractKeyPhrasesAction,
1615
AnalyzeBatchActionsType,
1716
)
1817

sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_response_handlers.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,16 @@ def _num_tasks_in_current_page(returned_tasks_object):
217217
len(returned_tasks_object.key_phrase_extraction_tasks or [])
218218
)
219219

220-
def get_iter_items(doc_id_order, task_order, obj, response_headers, analyze_job_state):
220+
def get_iter_items(doc_id_order, task_order, response_headers, analyze_job_state):
221221
iter_items = []
222222
returned_tasks_object = analyze_job_state.tasks
223223
for current_task_type in task_order:
224224
deserialization_callback = _get_deserialization_callback_from_task_type(current_task_type)
225225
property_name = _get_property_name_from_task_type(current_task_type)
226226
response_task_to_deserialize = getattr(returned_tasks_object, property_name).pop(0)
227-
document_results = deserialization_callback(doc_id_order, response_task_to_deserialize.results, response_headers, lro=True)
227+
document_results = deserialization_callback(
228+
doc_id_order, response_task_to_deserialize.results, response_headers, lro=True
229+
)
228230
iter_items.append(
229231
AnalyzeBatchActionsResult(
230232
document_results=document_results,
@@ -234,9 +236,9 @@ def get_iter_items(doc_id_order, task_order, obj, response_headers, analyze_job_
234236
)
235237
return iter_items
236238

237-
def analyze_extract_page_data(doc_id_order, task_order, obj, response_headers, analyze_job_state):
239+
def analyze_extract_page_data(doc_id_order, task_order, response_headers, analyze_job_state):
238240
# return next link, list of
239-
iter_items = get_iter_items(doc_id_order, task_order, obj, response_headers, analyze_job_state)
241+
iter_items = get_iter_items(doc_id_order, task_order, response_headers, analyze_job_state)
240242
return analyze_job_state.next_link, iter_items
241243

242244

@@ -269,7 +271,7 @@ def healthcare_paged_result(doc_id_order, health_status_callback, _, obj, respon
269271
def analyze_paged_result(doc_id_order, task_order, analyze_status_callback, _, obj, response_headers, show_stats=False): # pylint: disable=unused-argument
270272
return AnalyzeResult(
271273
functools.partial(lro_get_next_page, analyze_status_callback, obj, show_stats=show_stats),
272-
functools.partial(analyze_extract_page_data, doc_id_order, task_order, obj, response_headers),
274+
functools.partial(analyze_extract_page_data, doc_id_order, task_order, response_headers),
273275
statistics=TextDocumentBatchStatistics._from_generated(obj.statistics) \
274276
if show_stats and obj.statistics is not None else None # pylint: disable=protected-access
275277
)

sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_response_handlers_async.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,16 @@ def healthcare_paged_result(doc_id_order, health_status_callback, response, obj,
4545
statistics=RequestStatistics._from_generated(obj.results.statistics) if show_stats else None # pylint: disable=protected-access
4646
)
4747

48-
async def analyze_extract_page_data_async(doc_id_order, task_order, obj, response_headers, analyze_job_state):
49-
iter_items = get_iter_items(doc_id_order, task_order, obj, response_headers, analyze_job_state)
48+
async def analyze_extract_page_data_async(doc_id_order, task_order, response_headers, analyze_job_state):
49+
iter_items = get_iter_items(doc_id_order, task_order, response_headers, analyze_job_state)
5050
return analyze_job_state.next_link, AsyncList(iter_items)
5151

52-
def analyze_paged_result(doc_id_order, task_order, analyze_status_callback, response, obj, response_headers, show_stats=False): # pylint: disable=unused-argument
52+
def analyze_paged_result(
53+
doc_id_order, task_order, analyze_status_callback, response, obj, response_headers, show_stats=False # pylint: disable=unused-argument
54+
):
5355
return AnalyzeResultAsync(
5456
functools.partial(lro_get_next_page_async, analyze_status_callback, obj),
55-
functools.partial(analyze_extract_page_data_async, doc_id_order, task_order, obj, response_headers),
57+
functools.partial(analyze_extract_page_data_async, doc_id_order, task_order, response_headers),
5658
statistics=TextDocumentBatchStatistics._from_generated(obj.statistics) \
5759
if show_stats and obj.statistics is not None else None # pylint: disable=protected-access
5860
)

sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_text_analytics_client.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
TextAnalyticsOperationResourcePolling,
4040
TextAnalyticsLROPollingMethod,
4141
AnalyzeBatchActionsLROPollingMethod,
42-
AnalyzeBatchActionsLROPoller,
4342
)
4443

4544
if TYPE_CHECKING:
@@ -767,13 +766,16 @@ def begin_analyze_batch_actions( # type: ignore
767766
try:
768767
analyze_tasks = self._client.models(api_version='v3.1-preview.3').JobManifestTasks(
769768
entity_recognition_tasks=[
770-
t.to_generated() for t in [a for a in actions if _determine_action_type(a) == AnalyzeBatchActionsType.RECOGNIZE_ENTITIES]
769+
t.to_generated() for t in
770+
[a for a in actions if _determine_action_type(a) == AnalyzeBatchActionsType.RECOGNIZE_ENTITIES]
771771
],
772772
entity_recognition_pii_tasks=[
773-
t.to_generated() for t in [a for a in actions if _determine_action_type(a) == AnalyzeBatchActionsType.RECOGNIZE_PII_ENTITIES]
773+
t.to_generated() for t in
774+
[a for a in actions if _determine_action_type(a) == AnalyzeBatchActionsType.RECOGNIZE_PII_ENTITIES]
774775
],
775776
key_phrase_extraction_tasks=[
776-
t.to_generated() for t in [a for a in actions if _determine_action_type(a) == AnalyzeBatchActionsType.EXTRACT_KEY_PHRASES]
777+
t.to_generated() for t in
778+
[a for a in actions if _determine_action_type(a) == AnalyzeBatchActionsType.EXTRACT_KEY_PHRASES]
777779
]
778780
)
779781
analyze_body = self._client.models(api_version='v3.1-preview.3').AnalyzeBatchInput(
@@ -783,7 +785,9 @@ def begin_analyze_batch_actions( # type: ignore
783785
)
784786
return self._client.begin_analyze(
785787
body=analyze_body,
786-
cls=kwargs.pop("cls", partial(self._analyze_result_callback, doc_id_order, task_order, show_stats=show_stats)),
788+
cls=kwargs.pop("cls", partial(
789+
self._analyze_result_callback, doc_id_order, task_order, show_stats=show_stats
790+
)),
787791
polling=AnalyzeBatchActionsLROPollingMethod(
788792
timeout=polling_interval,
789793
lro_algorithms=[

sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/aio/_text_analytics_client_async.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ def _analyze_result_callback(self, doc_id_order, task_order, raw_response, _, he
694694
async def begin_analyze_batch_actions( # type: ignore
695695
self,
696696
documents, # type: Union[List[str], List[TextDocumentInput], List[Dict[str, str]]]
697-
actions, # type: Union[List[RecognizeEntitiesAction], List[RecognizePiiEntitiesAction], List[ExtractKeyPhrasesAction]]
697+
actions, # type: List[Union[RecognizeEntitiesAction, RecognizePiiEntitiesAction, ExtractKeyPhrasesAction]]
698698
**kwargs # type: Any
699699
): # type: (...) -> AsyncLROPoller[AsyncItemPaged[AnalyzeBatchActionsResult]]
700700
"""Start a long-running operation to perform a variety of text analysis tasks over a batch of documents.
@@ -762,13 +762,16 @@ async def begin_analyze_batch_actions( # type: ignore
762762
try:
763763
analyze_tasks = self._client.models(api_version='v3.1-preview.3').JobManifestTasks(
764764
entity_recognition_tasks=[
765-
t.to_generated() for t in [a for a in actions if _determine_action_type(a) == AnalyzeBatchActionsType.RECOGNIZE_ENTITIES]
765+
t.to_generated() for t in
766+
[a for a in actions if _determine_action_type(a) == AnalyzeBatchActionsType.RECOGNIZE_ENTITIES]
766767
],
767768
entity_recognition_pii_tasks=[
768-
t.to_generated() for t in [a for a in actions if _determine_action_type(a) == AnalyzeBatchActionsType.RECOGNIZE_PII_ENTITIES]
769+
t.to_generated() for t in
770+
[a for a in actions if _determine_action_type(a) == AnalyzeBatchActionsType.RECOGNIZE_PII_ENTITIES]
769771
],
770772
key_phrase_extraction_tasks=[
771-
t.to_generated() for t in [a for a in actions if _determine_action_type(a) == AnalyzeBatchActionsType.EXTRACT_KEY_PHRASES]
773+
t.to_generated() for t in
774+
[a for a in actions if _determine_action_type(a) == AnalyzeBatchActionsType.EXTRACT_KEY_PHRASES]
772775
]
773776
)
774777
analyze_body = self._client.models(api_version='v3.1-preview.3').AnalyzeBatchInput(
@@ -778,7 +781,9 @@ async def begin_analyze_batch_actions( # type: ignore
778781
)
779782
return await self._client.begin_analyze(
780783
body=analyze_body,
781-
cls=kwargs.pop("cls", partial(self._analyze_result_callback, doc_id_order, task_order, show_stats=show_stats)),
784+
cls=kwargs.pop("cls", partial(
785+
self._analyze_result_callback, doc_id_order, task_order, show_stats=show_stats
786+
)),
782787
polling=AsyncAnalyzeBatchActionsLROPollingMethod(
783788
timeout=polling_interval,
784789
lro_algorithms=[

0 commit comments

Comments
 (0)