Skip to content

Commit ceff44c

Browse files
[textanalytics] fix type params in LROs and unnecessary lint ignores (Azure#25962)
* fix type params in LROs and unnecessary lint ignores * add back pylint ignores - not fixed in version we run in CI
1 parent d8f8f26 commit ceff44c

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,34 @@ def details(self) -> Mapping[str, Any]:
4141
:return: A mapping of details about the long-running operation.
4242
:rtype: Mapping[str, Any]
4343
"""
44+
...
4445

4546
def continuation_token(self) -> str: # pylint: disable=no-self-use
4647
"""Return a continuation token that allows to restart the poller later.
4748
4849
:returns: An opaque continuation token
4950
:rtype: str
5051
"""
52+
...
5153

5254
def status(self) -> str: # pylint: disable=no-self-use
5355
"""Returns the current status string.
5456
5557
:returns: The current status string
5658
:rtype: str
5759
"""
60+
...
5861

59-
def result(self, timeout: Optional[int] = None) -> PollingReturnType: # pylint: disable=no-self-use, unused-argument
62+
# pylint: disable=no-self-use, unused-argument
63+
def result(self, timeout: Optional[int] = None) -> PollingReturnType_co:
6064
"""Return the result of the long running operation, or
6165
the result available after the specified timeout.
6266
6367
:returns: The deserialized resource of the long running operation,
6468
if one is available.
6569
:raises ~azure.core.exceptions.HttpResponseError: Server problem with the query.
6670
"""
71+
...
6772

6873
def wait(self, timeout: Optional[float] = None) -> None: # pylint: disable=no-self-use, unused-argument
6974
"""Wait on the long running operation for a specified length
@@ -74,13 +79,15 @@ def wait(self, timeout: Optional[float] = None) -> None: # pylint: disable=no-s
7479
operation to complete (in seconds).
7580
:raises ~azure.core.exceptions.HttpResponseError: Server problem with the query.
7681
"""
82+
...
7783

7884
def done(self) -> bool: # pylint: disable=no-self-use
7985
"""Check status of the long running operation.
8086
8187
:returns: 'True' if the process has completed, else 'False'.
8288
:rtype: bool
8389
"""
90+
...
8491

8592
def add_done_callback(self, func: Callable) -> None: # pylint: disable=no-self-use, unused-argument
8693
"""Add callback function to be run once the long running operation
@@ -89,13 +96,15 @@ def add_done_callback(self, func: Callable) -> None: # pylint: disable=no-self-
8996
:param callable func: Callback function that takes at least one
9097
argument, a completed LongRunningOperation.
9198
"""
99+
...
92100

93101
def remove_done_callback(self, func: Callable) -> None: # pylint: disable=no-self-use, unused-argument
94102
"""Remove a callback from the long running operation.
95103
96104
:param callable func: The function to be removed from the callbacks.
97105
:raises ValueError: if the long running operation has already completed.
98106
"""
107+
...
99108

100109
def cancel(self) -> None: # pylint: disable=no-self-use
101110
"""Cancel the operation currently being polled.
@@ -104,6 +113,7 @@ def cancel(self) -> None: # pylint: disable=no-self-use
104113
:rtype: None
105114
:raises ~azure.core.exceptions.HttpResponseError: When the operation has already reached a terminal state.
106115
"""
116+
...
107117

108118

109119
class TextAnalyticsOperationResourcePolling(OperationResourcePolling):

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
_FAILED = frozenset(["failed"])
2222
_SUCCEEDED = frozenset(["succeeded", "partiallycompleted", "partiallysucceeded"])
2323

24-
PollingReturnType = TypeVar("PollingReturnType", covariant=True)
24+
PollingReturnType = TypeVar("PollingReturnType")
25+
PollingReturnType_co = TypeVar("PollingReturnType_co", covariant=True)
2526

2627

2728
@runtime_checkable
28-
class AsyncTextAnalysisLROPoller(Protocol[PollingReturnType], Awaitable):
29+
class AsyncTextAnalysisLROPoller(Protocol[PollingReturnType_co], Awaitable):
2930
"""Implements a protocol which returned poller objects are consistent with.
3031
"""
3132

@@ -36,42 +37,48 @@ def details(self) -> Mapping[str, Any]:
3637
:return: A mapping of details about the long-running operation.
3738
:rtype: Mapping[str, Any]
3839
"""
40+
...
3941

4042
def continuation_token(self) -> str: # pylint: disable=no-self-use
4143
"""Return a continuation token that allows to restart the poller later.
4244
4345
:returns: An opaque continuation token
4446
:rtype: str
4547
"""
48+
...
4649

4750
def status(self) -> str: # pylint: disable=no-self-use
4851
"""Returns the current status string.
4952
5053
:returns: The current status string
5154
:rtype: str
5255
"""
56+
...
5357

54-
async def result(self) -> PollingReturnType:
58+
async def result(self) -> PollingReturnType_co:
5559
"""Return the result of the long running operation.
5660
5761
:returns: The deserialized resource of the long running operation, if one is available.
5862
:raises ~azure.core.exceptions.HttpResponseError: Server problem with the query.
5963
"""
64+
...
6065

6166
async def wait(self) -> None:
6267
"""Wait on the long running operation.
6368
6469
:raises ~azure.core.exceptions.HttpResponseError: Server problem with the query.
6570
"""
71+
...
6672

6773
def done(self) -> bool: # pylint: disable=no-self-use
6874
"""Check status of the long running operation.
6975
7076
:returns: 'True' if the process has completed, else 'False'.
7177
:rtype: bool
7278
"""
79+
...
7380

74-
def __await__(self) -> Generator[Any, None, PollingReturnType]:
81+
def __await__(self) -> Generator[Any, None, PollingReturnType_co]:
7582
...
7683

7784
async def cancel(self) -> None: # pylint: disable=no-self-use
@@ -81,6 +88,7 @@ async def cancel(self) -> None: # pylint: disable=no-self-use
8188
:rtype: None
8289
:raises ~azure.core.exceptions.HttpResponseError: When the operation has already reached a terminal state.
8390
"""
91+
...
8492

8593

8694
class TextAnalyticsAsyncLROPollingMethod(AsyncLROBasePolling):

0 commit comments

Comments
 (0)