Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,34 @@ def details(self) -> Mapping[str, Any]:
:return: A mapping of details about the long-running operation.
:rtype: Mapping[str, Any]
"""
...

def continuation_token(self) -> str: # pylint: disable=no-self-use
"""Return a continuation token that allows to restart the poller later.

:returns: An opaque continuation token
:rtype: str
"""
...

def status(self) -> str: # pylint: disable=no-self-use
"""Returns the current status string.

:returns: The current status string
:rtype: str
"""
...

def result(self, timeout: Optional[int] = None) -> PollingReturnType: # pylint: disable=no-self-use, unused-argument
# pylint: disable=no-self-use, unused-argument
def result(self, timeout: Optional[int] = None) -> PollingReturnType_co:
"""Return the result of the long running operation, or
the result available after the specified timeout.

:returns: The deserialized resource of the long running operation,
if one is available.
:raises ~azure.core.exceptions.HttpResponseError: Server problem with the query.
"""
...

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

def done(self) -> bool: # pylint: disable=no-self-use
"""Check status of the long running operation.

:returns: 'True' if the process has completed, else 'False'.
:rtype: bool
"""
...

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

def remove_done_callback(self, func: Callable) -> None: # pylint: disable=no-self-use, unused-argument
"""Remove a callback from the long running operation.

:param callable func: The function to be removed from the callbacks.
:raises ValueError: if the long running operation has already completed.
"""
...

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


class TextAnalyticsOperationResourcePolling(OperationResourcePolling):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
_FAILED = frozenset(["failed"])
_SUCCEEDED = frozenset(["succeeded", "partiallycompleted", "partiallysucceeded"])

PollingReturnType = TypeVar("PollingReturnType", covariant=True)
PollingReturnType = TypeVar("PollingReturnType")
PollingReturnType_co = TypeVar("PollingReturnType_co", covariant=True)


@runtime_checkable
class AsyncTextAnalysisLROPoller(Protocol[PollingReturnType], Awaitable):
class AsyncTextAnalysisLROPoller(Protocol[PollingReturnType_co], Awaitable):
"""Implements a protocol which returned poller objects are consistent with.
"""

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

def continuation_token(self) -> str: # pylint: disable=no-self-use
"""Return a continuation token that allows to restart the poller later.

:returns: An opaque continuation token
:rtype: str
"""
...

def status(self) -> str: # pylint: disable=no-self-use
"""Returns the current status string.

:returns: The current status string
:rtype: str
"""
...

async def result(self) -> PollingReturnType:
async def result(self) -> PollingReturnType_co:
"""Return the result of the long running operation.

:returns: The deserialized resource of the long running operation, if one is available.
:raises ~azure.core.exceptions.HttpResponseError: Server problem with the query.
"""
...

async def wait(self) -> None:
"""Wait on the long running operation.

:raises ~azure.core.exceptions.HttpResponseError: Server problem with the query.
"""
...

def done(self) -> bool: # pylint: disable=no-self-use
"""Check status of the long running operation.

:returns: 'True' if the process has completed, else 'False'.
:rtype: bool
"""
...

def __await__(self) -> Generator[Any, None, PollingReturnType]:
def __await__(self) -> Generator[Any, None, PollingReturnType_co]:
...

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


class TextAnalyticsAsyncLROPollingMethod(AsyncLROBasePolling):
Expand Down