yandexcloud 0.303.0__py3-none-any.whl → 0.305.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of yandexcloud might be problematic. Click here for more details.

@@ -10,11 +10,14 @@ from yandex.cloud.operation.operation_service_pb2 import GetOperationRequest
10
10
  from yandex.cloud.operation.operation_service_pb2_grpc import OperationServiceStub
11
11
  from yandexcloud._backoff import backoff_exponential_jittered_min_interval
12
12
  from yandexcloud._retry_interceptor import RetryInterceptor
13
- from yandexcloud.operations import OperationError, OperationResult
13
+ from yandexcloud.operations import (
14
+ MetaType,
15
+ OperationError,
16
+ OperationResult,
17
+ ResponseType,
18
+ )
14
19
 
15
20
  if TYPE_CHECKING:
16
- import google.protobuf.message
17
-
18
21
  from yandex.cloud.operation.operation_pb2 import Operation
19
22
  from yandexcloud._sdk import SDK
20
23
 
@@ -49,15 +52,15 @@ def wait_for_operation(sdk: "SDK", operation_id: str, timeout: Optional[float])
49
52
  def get_operation_result(
50
53
  sdk: "SDK",
51
54
  operation: "Operation",
52
- response_type: Optional[Type["google.protobuf.message.Message"]] = None,
53
- meta_type: Optional[Type["google.protobuf.message.Message"]] = None,
55
+ response_type: Optional[Type["ResponseType"]] = None,
56
+ meta_type: Optional[Type["MetaType"]] = None,
54
57
  timeout: Optional[float] = None,
55
58
  logger: Optional[logging.Logger] = None,
56
- ) -> Union["OperationResult", "OperationError"]:
59
+ ) -> Union["OperationResult[ResponseType, MetaType]", "OperationError"]:
57
60
  if not logger:
58
61
  logger = logging.getLogger()
59
62
  logger.addHandler(logging.NullHandler())
60
- operation_result = OperationResult(operation)
63
+ operation_result: OperationResult[ResponseType, MetaType] = OperationResult(operation)
61
64
  created_at = datetime.fromtimestamp(operation.created_at.seconds)
62
65
  message = (
63
66
  "Running Yandex.Cloud operation. ID: {id}. "
yandexcloud/_sdk.py CHANGED
@@ -11,11 +11,15 @@ from yandexcloud._wrappers import Wrappers
11
11
  if TYPE_CHECKING:
12
12
  import logging
13
13
 
14
- import google.protobuf.message
15
-
16
14
  from yandex.cloud.operation.operation_pb2 import Operation
17
15
  from yandexcloud._operation_waiter import OperationWaiter
18
- from yandexcloud.operations import OperationError, OperationResult
16
+ from yandexcloud.operations import (
17
+ MetaType,
18
+ OperationError,
19
+ OperationResult,
20
+ RequestType,
21
+ ResponseType,
22
+ )
19
23
 
20
24
 
21
25
  class SDK:
@@ -96,20 +100,20 @@ class SDK:
96
100
  def wait_operation_and_get_result(
97
101
  self,
98
102
  operation: "Operation",
99
- response_type: Optional[Type["google.protobuf.message.Message"]] = None,
100
- meta_type: Optional[Type["google.protobuf.message.Message"]] = None,
103
+ response_type: Optional[Type["ResponseType"]] = None,
104
+ meta_type: Optional[Type["MetaType"]] = None,
101
105
  timeout: Optional[float] = None,
102
106
  logger: Optional["logging.Logger"] = None,
103
- ) -> Union["OperationResult", "OperationError"]:
107
+ ) -> Union["OperationResult[ResponseType, MetaType]", "OperationError"]:
104
108
  return _operation_waiter.get_operation_result(self, operation, response_type, meta_type, timeout, logger)
105
109
 
106
110
  def create_operation_and_get_result(
107
111
  self,
108
- request: Type["google.protobuf.message.Message"],
112
+ request: Type["RequestType"],
109
113
  service: Any,
110
114
  method_name: str,
111
- response_type: Optional[Type["google.protobuf.message.Message"]] = None,
112
- meta_type: Optional[Type["google.protobuf.message.Message"]] = None,
115
+ response_type: Optional[Type["ResponseType"]] = None,
116
+ meta_type: Optional[Type["MetaType"]] = None,
113
117
  timeout: Optional[float] = None,
114
118
  logger: Optional["logging.Logger"] = None,
115
119
  ) -> Union["OperationResult", "OperationError"]:
yandexcloud/operations.py CHANGED
@@ -1,19 +1,22 @@
1
- from typing import TYPE_CHECKING, Optional
1
+ from typing import TYPE_CHECKING, Generic, Optional, TypeVar
2
2
 
3
3
  if TYPE_CHECKING:
4
4
  import google.protobuf.message
5
5
 
6
6
  from yandex.cloud.operation.operation_pb2 import Operation
7
7
 
8
- # from yandex.cloud.api.operation_pb2 import Operation
9
8
 
9
+ RequestType = TypeVar("RequestType", bound="google.protobuf.message.Message") # pylint: disable=C0103
10
+ ResponseType = TypeVar("ResponseType", bound="google.protobuf.message.Message") # pylint: disable=C0103
11
+ MetaType = TypeVar("MetaType", bound="google.protobuf.message.Message") # pylint: disable=C0103
10
12
 
11
- class OperationResult:
13
+
14
+ class OperationResult(Generic[ResponseType, MetaType]):
12
15
  def __init__(
13
16
  self,
14
17
  operation: "Operation",
15
- response: Optional["google.protobuf.message.Message"] = None,
16
- meta: Optional["google.protobuf.message.Message"] = None,
18
+ response: Optional["ResponseType"] = None,
19
+ meta: Optional["MetaType"] = None,
17
20
  ):
18
21
  self.operation = operation
19
22
  self.response = response
@@ -21,7 +24,7 @@ class OperationResult:
21
24
 
22
25
 
23
26
  class OperationError(RuntimeError):
24
- def __init__(self, message: str, operation_result: OperationResult):
27
+ def __init__(self, message: str, operation_result: OperationResult[ResponseType, MetaType]):
25
28
  super(OperationError, self).__init__(message) # pylint: disable=super-with-arguments
26
29
  self.message = message
27
30
  self.operation_result = operation_result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: yandexcloud
3
- Version: 0.303.0
3
+ Version: 0.305.0
4
4
  Summary: The Yandex.Cloud official SDK
5
5
  Home-page: https://github.com/yandex-cloud/python-sdk
6
6
  Author: Yandex LLC
@@ -2418,17 +2418,17 @@ yandexcloud/_auth_plugin.py,sha256=ASc_uAcfoXKtC7w7JOEQeHSvNYB3h7YepVG2LbrZoyc,3
2418
2418
  yandexcloud/_backoff.py,sha256=dXoKZZOFJnEjc2VH35zfHjpJ3hwN2kecy9qzDF-QSso,1246
2419
2419
  yandexcloud/_channels.py,sha256=p-A6JRG5V_z0tBgsFJDxslYDGsofsOCBm1PCts_ihfI,5017
2420
2420
  yandexcloud/_helpers.py,sha256=EeTeR_m8FvpWMSrOW4mzVlCdsTaEvg4YOEOy_VnnFpk,3054
2421
- yandexcloud/_operation_waiter.py,sha256=5nqfltMmnb_KOvYrFSEvmJYvCnZTxRlV4s2uM37K_Vo,4882
2421
+ yandexcloud/_operation_waiter.py,sha256=RqfzO51WP6Ui6auwanJ8NZ_-97znWA1okZtBKZRjGcI,4914
2422
2422
  yandexcloud/_retry_interceptor.py,sha256=UdRxyLSfX6EZrvFNTfVkB_LprCSilWRtxIyRhLwpmXU,7642
2423
- yandexcloud/_sdk.py,sha256=GccAxhCobtk0RelX2jCbdRKLORtmFTUQmS0V-zEtmRU,7844
2423
+ yandexcloud/_sdk.py,sha256=eESvsOt-W4-fyRUWaHs8KTdm_ELFyRPHtI1Z6bnZLiU,7814
2424
2424
  yandexcloud/auth.py,sha256=SD_IVGUhN_Ny8f-qtnNWtZQ1VPYrGbKypFAbQcaSQ58,1008
2425
- yandexcloud/operations.py,sha256=ZSvEhe_JMBefkDLcFtSHnOAoY2g_MVVVM1qcDUtpvgs,831
2425
+ yandexcloud/operations.py,sha256=rOlhJT3Nx7u3hjRY4tnMc1_Z-yctcjcCkc_7GsDpSwY,1111
2426
2426
  yandexcloud/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2427
2427
  yandexcloud/_wrappers/__init__.py,sha256=z19vuf3vgVGWFc-0d1LFsyVXiM-SYlhvvWRQI8l1T_8,428
2428
2428
  yandexcloud/_wrappers/dataproc/__init__.py,sha256=QWM1jhd8dHwTEjhdiAalreNzac1g4jJ5djXoDdXRdfg,33016
2429
- yandexcloud-0.303.0.dist-info/AUTHORS,sha256=0o7IPkgdTswBveGhbt_73xRPpCrfeEGoZE11AiLvYSQ,231
2430
- yandexcloud-0.303.0.dist-info/LICENSE,sha256=AFcOYhNOyuBQP89lObqyipdScN2KUUS-OuWoUlVo6yE,1077
2431
- yandexcloud-0.303.0.dist-info/METADATA,sha256=RJpiT_MLyjeSgHQ63EOVr1xY2Ue_IY84KDp0nkp77oE,10419
2432
- yandexcloud-0.303.0.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
2433
- yandexcloud-0.303.0.dist-info/top_level.txt,sha256=p6aBMPGD526A1jM2WVnAneI2qO4kGDWeJi6uwYApDqg,19
2434
- yandexcloud-0.303.0.dist-info/RECORD,,
2429
+ yandexcloud-0.305.0.dist-info/AUTHORS,sha256=0o7IPkgdTswBveGhbt_73xRPpCrfeEGoZE11AiLvYSQ,231
2430
+ yandexcloud-0.305.0.dist-info/LICENSE,sha256=AFcOYhNOyuBQP89lObqyipdScN2KUUS-OuWoUlVo6yE,1077
2431
+ yandexcloud-0.305.0.dist-info/METADATA,sha256=HPC5rbSo3q4rzgOQfldiqHuzaszs3UTG72l3iPSDdN4,10419
2432
+ yandexcloud-0.305.0.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
2433
+ yandexcloud-0.305.0.dist-info/top_level.txt,sha256=p6aBMPGD526A1jM2WVnAneI2qO4kGDWeJi6uwYApDqg,19
2434
+ yandexcloud-0.305.0.dist-info/RECORD,,