Skip to content

Commit 9e93ea8

Browse files
got686-yandexPeppaTheC
authored andcommitted
Fix typing for airflow provider
1 parent 9bbc4da commit 9e93ea8

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

yandexcloud/_operation_waiter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ def get_operation_result(
5656
meta_type: Optional[Type["MetaType"]] = None,
5757
timeout: Optional[float] = None,
5858
logger: Optional[logging.Logger] = None,
59-
) -> Union["OperationResult", "OperationError"]:
59+
) -> Union["OperationResult[ResponseType, MetaType]", "OperationError"]:
6060
if not logger:
6161
logger = logging.getLogger()
6262
logger.addHandler(logging.NullHandler())
63-
operation_result = OperationResult(operation)
63+
operation_result: OperationResult[ResponseType, MetaType] = OperationResult(operation)
6464
created_at = datetime.fromtimestamp(operation.created_at.seconds)
6565
message = (
6666
"Running Yandex.Cloud operation. ID: {id}. "

yandexcloud/_sdk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def wait_operation_and_get_result(
104104
meta_type: Optional[Type["MetaType"]] = None,
105105
timeout: Optional[float] = None,
106106
logger: Optional["logging.Logger"] = None,
107-
) -> Union["OperationResult", "OperationError"]:
107+
) -> Union["OperationResult[ResponseType, MetaType]", "OperationError"]:
108108
return _operation_waiter.get_operation_result(self, operation, response_type, meta_type, timeout, logger)
109109

110110
def create_operation_and_get_result(

yandexcloud/operations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import TYPE_CHECKING, Optional, TypeVar
1+
from typing import TYPE_CHECKING, Generic, Optional, TypeVar
22

33
if TYPE_CHECKING:
44
import google.protobuf.message
@@ -11,7 +11,7 @@
1111
MetaType = TypeVar("MetaType", bound="google.protobuf.message.Message") # pylint: disable=C0103
1212

1313

14-
class OperationResult:
14+
class OperationResult(Generic[ResponseType, MetaType]):
1515
def __init__(
1616
self,
1717
operation: "Operation",
@@ -24,7 +24,7 @@ def __init__(
2424

2525

2626
class OperationError(RuntimeError):
27-
def __init__(self, message: str, operation_result: OperationResult):
27+
def __init__(self, message: str, operation_result: OperationResult[ResponseType, MetaType]):
2828
super(OperationError, self).__init__(message) # pylint: disable=super-with-arguments
2929
self.message = message
3030
self.operation_result = operation_result

0 commit comments

Comments
 (0)