@autorest/python 6.38.1 → 6.39.0
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.
- package/README.md +2 -27
- package/autorest/codegen.py +0 -1
- package/autorest/jsonrpc/server.py +0 -3
- package/generator/build/lib/pygen/__init__.py +14 -23
- package/generator/build/lib/pygen/codegen/__init__.py +4 -4
- package/generator/build/lib/pygen/codegen/models/__init__.py +2 -2
- package/generator/build/lib/pygen/codegen/models/base.py +9 -12
- package/generator/build/lib/pygen/codegen/models/base_builder.py +4 -6
- package/generator/build/lib/pygen/codegen/models/client.py +61 -102
- package/generator/build/lib/pygen/codegen/models/code_model.py +29 -29
- package/generator/build/lib/pygen/codegen/models/combined_type.py +7 -7
- package/generator/build/lib/pygen/codegen/models/constant_type.py +4 -11
- package/generator/build/lib/pygen/codegen/models/credential_types.py +9 -11
- package/generator/build/lib/pygen/codegen/models/dictionary_type.py +7 -8
- package/generator/build/lib/pygen/codegen/models/enum_type.py +7 -7
- package/generator/build/lib/pygen/codegen/models/imports.py +24 -29
- package/generator/build/lib/pygen/codegen/models/list_type.py +15 -14
- package/generator/build/lib/pygen/codegen/models/lro_operation.py +6 -6
- package/generator/build/lib/pygen/codegen/models/lro_paging_operation.py +2 -2
- package/generator/build/lib/pygen/codegen/models/model_type.py +11 -11
- package/generator/build/lib/pygen/codegen/models/operation.py +26 -56
- package/generator/build/lib/pygen/codegen/models/operation_group.py +11 -22
- package/generator/build/lib/pygen/codegen/models/paging_operation.py +15 -19
- package/generator/build/lib/pygen/codegen/models/parameter.py +12 -21
- package/generator/build/lib/pygen/codegen/models/parameter_list.py +37 -39
- package/generator/build/lib/pygen/codegen/models/primitive_types.py +24 -18
- package/generator/build/lib/pygen/codegen/models/property.py +10 -10
- package/generator/build/lib/pygen/codegen/models/request_builder.py +7 -8
- package/generator/build/lib/pygen/codegen/models/request_builder_parameter.py +3 -3
- package/generator/build/lib/pygen/codegen/models/response.py +15 -40
- package/generator/build/lib/pygen/codegen/models/utils.py +2 -2
- package/generator/build/lib/pygen/codegen/serializers/__init__.py +26 -42
- package/generator/build/lib/pygen/codegen/serializers/builder_serializer.py +103 -100
- package/generator/build/lib/pygen/codegen/serializers/client_serializer.py +22 -25
- package/generator/build/lib/pygen/codegen/serializers/enum_serializer.py +2 -2
- package/generator/build/lib/pygen/codegen/serializers/general_serializer.py +49 -61
- package/generator/build/lib/pygen/codegen/serializers/import_serializer.py +6 -7
- package/generator/build/lib/pygen/codegen/serializers/model_init_serializer.py +1 -2
- package/generator/build/lib/pygen/codegen/serializers/model_serializer.py +15 -17
- package/generator/build/lib/pygen/codegen/serializers/operation_groups_serializer.py +3 -3
- package/generator/build/lib/pygen/codegen/serializers/operations_init_serializer.py +5 -6
- package/generator/build/lib/pygen/codegen/serializers/parameter_serializer.py +28 -18
- package/generator/build/lib/pygen/codegen/serializers/patch_serializer.py +1 -2
- package/generator/build/lib/pygen/codegen/serializers/request_builders_serializer.py +1 -2
- package/generator/build/lib/pygen/codegen/serializers/sample_serializer.py +9 -14
- package/generator/build/lib/pygen/codegen/serializers/test_serializer.py +7 -7
- package/generator/build/lib/pygen/codegen/serializers/utils.py +2 -2
- package/generator/build/lib/pygen/codegen/templates/model_base.py.jinja2 +30 -24
- package/generator/build/lib/pygen/codegen/templates/model_dpg.py.jinja2 +1 -1
- package/generator/build/lib/pygen/codegen/templates/operation_group.py.jinja2 +1 -11
- package/generator/build/lib/pygen/codegen/templates/operations_folder_init.py.jinja2 +1 -1
- package/generator/build/lib/pygen/codegen/templates/packaging_templates/CHANGELOG.md.jinja2 +2 -1
- package/generator/build/lib/pygen/codegen/templates/packaging_templates/dev_requirements.txt.jinja2 +1 -1
- package/generator/build/lib/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +13 -2
- package/generator/build/lib/pygen/codegen/templates/patch.py.jinja2 +1 -1
- package/generator/build/lib/pygen/codegen/templates/serialization.py.jinja2 +11 -13
- package/generator/build/lib/pygen/codegen/templates/utils.py.jinja2 +6 -6
- package/generator/build/lib/pygen/preprocess/__init__.py +47 -30
- package/generator/build/lib/pygen/preprocess/helpers.py +2 -2
- package/generator/build/lib/pygen/utils.py +6 -6
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/__init__.py +14 -23
- package/generator/pygen/codegen/__init__.py +4 -4
- package/generator/pygen/codegen/models/__init__.py +2 -2
- package/generator/pygen/codegen/models/base.py +9 -12
- package/generator/pygen/codegen/models/base_builder.py +4 -6
- package/generator/pygen/codegen/models/client.py +61 -102
- package/generator/pygen/codegen/models/code_model.py +29 -29
- package/generator/pygen/codegen/models/combined_type.py +7 -7
- package/generator/pygen/codegen/models/constant_type.py +4 -11
- package/generator/pygen/codegen/models/credential_types.py +9 -11
- package/generator/pygen/codegen/models/dictionary_type.py +7 -8
- package/generator/pygen/codegen/models/enum_type.py +7 -7
- package/generator/pygen/codegen/models/imports.py +24 -29
- package/generator/pygen/codegen/models/list_type.py +15 -14
- package/generator/pygen/codegen/models/lro_operation.py +6 -6
- package/generator/pygen/codegen/models/lro_paging_operation.py +2 -2
- package/generator/pygen/codegen/models/model_type.py +11 -11
- package/generator/pygen/codegen/models/operation.py +26 -56
- package/generator/pygen/codegen/models/operation_group.py +11 -22
- package/generator/pygen/codegen/models/paging_operation.py +15 -19
- package/generator/pygen/codegen/models/parameter.py +12 -21
- package/generator/pygen/codegen/models/parameter_list.py +37 -39
- package/generator/pygen/codegen/models/primitive_types.py +24 -18
- package/generator/pygen/codegen/models/property.py +10 -10
- package/generator/pygen/codegen/models/request_builder.py +7 -8
- package/generator/pygen/codegen/models/request_builder_parameter.py +3 -3
- package/generator/pygen/codegen/models/response.py +15 -40
- package/generator/pygen/codegen/models/utils.py +2 -2
- package/generator/pygen/codegen/serializers/__init__.py +26 -42
- package/generator/pygen/codegen/serializers/builder_serializer.py +103 -100
- package/generator/pygen/codegen/serializers/client_serializer.py +22 -25
- package/generator/pygen/codegen/serializers/enum_serializer.py +2 -2
- package/generator/pygen/codegen/serializers/general_serializer.py +49 -61
- package/generator/pygen/codegen/serializers/import_serializer.py +6 -7
- package/generator/pygen/codegen/serializers/model_init_serializer.py +1 -2
- package/generator/pygen/codegen/serializers/model_serializer.py +15 -17
- package/generator/pygen/codegen/serializers/operation_groups_serializer.py +3 -3
- package/generator/pygen/codegen/serializers/operations_init_serializer.py +5 -6
- package/generator/pygen/codegen/serializers/parameter_serializer.py +28 -18
- package/generator/pygen/codegen/serializers/patch_serializer.py +1 -2
- package/generator/pygen/codegen/serializers/request_builders_serializer.py +1 -2
- package/generator/pygen/codegen/serializers/sample_serializer.py +9 -14
- package/generator/pygen/codegen/serializers/test_serializer.py +7 -7
- package/generator/pygen/codegen/serializers/utils.py +2 -2
- package/generator/pygen/codegen/templates/model_base.py.jinja2 +30 -24
- package/generator/pygen/codegen/templates/model_dpg.py.jinja2 +1 -1
- package/generator/pygen/codegen/templates/operation_group.py.jinja2 +1 -11
- package/generator/pygen/codegen/templates/operations_folder_init.py.jinja2 +1 -1
- package/generator/pygen/codegen/templates/packaging_templates/CHANGELOG.md.jinja2 +2 -1
- package/generator/pygen/codegen/templates/packaging_templates/dev_requirements.txt.jinja2 +1 -1
- package/generator/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +13 -2
- package/generator/pygen/codegen/templates/patch.py.jinja2 +1 -1
- package/generator/pygen/codegen/templates/serialization.py.jinja2 +11 -13
- package/generator/pygen/codegen/templates/utils.py.jinja2 +6 -6
- package/generator/pygen/preprocess/__init__.py +47 -30
- package/generator/pygen/preprocess/helpers.py +2 -2
- package/generator/pygen/utils.py +6 -6
- package/generator/pygen.egg-info/SOURCES.txt +0 -2
- package/package.json +2 -2
- package/scripts/__pycache__/venvtools.cpython-310.pyc +0 -0
- package/autorest/multiapi/__init__.py +0 -185
- package/autorest/multiapi/models/__init__.py +0 -16
- package/autorest/multiapi/models/client.py +0 -68
- package/autorest/multiapi/models/code_model.py +0 -142
- package/autorest/multiapi/models/config.py +0 -24
- package/autorest/multiapi/models/constant_global_parameter.py +0 -11
- package/autorest/multiapi/models/global_parameter.py +0 -34
- package/autorest/multiapi/models/global_parameters.py +0 -53
- package/autorest/multiapi/models/imports.py +0 -181
- package/autorest/multiapi/models/mixin_operation.py +0 -38
- package/autorest/multiapi/models/operation_group.py +0 -29
- package/autorest/multiapi/models/operation_mixin_group.py +0 -89
- package/autorest/multiapi/serializers/__init__.py +0 -145
- package/autorest/multiapi/serializers/import_serializer.py +0 -181
- package/autorest/multiapi/templates/multiapi_config.py.jinja2 +0 -89
- package/autorest/multiapi/templates/multiapi_init.py.jinja2 +0 -22
- package/autorest/multiapi/templates/multiapi_models.py.jinja2 +0 -9
- package/autorest/multiapi/templates/multiapi_operations_mixin.py.jinja2 +0 -39
- package/autorest/multiapi/templates/multiapi_service_client.py.jinja2 +0 -163
- package/autorest/multiapi/templates/multiapi_version.py.jinja2 +0 -8
- package/autorest/multiapi/utils.py +0 -51
- package/generator/build/lib/pygen/codegen/serializers/metadata_serializer.py +0 -216
- package/generator/build/lib/pygen/codegen/templates/metadata.json.jinja2 +0 -167
- package/generator/pygen/codegen/serializers/metadata_serializer.py +0 -216
- package/generator/pygen/codegen/templates/metadata.json.jinja2 +0 -167
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
# --------------------------------------------------------------------------
|
|
6
6
|
import logging
|
|
7
7
|
from typing import (
|
|
8
|
-
List,
|
|
9
|
-
Dict,
|
|
10
8
|
Any,
|
|
11
9
|
Generic,
|
|
12
10
|
TypeVar,
|
|
@@ -52,7 +50,7 @@ class BaseBuilder(
|
|
|
52
50
|
|
|
53
51
|
def __init__(
|
|
54
52
|
self,
|
|
55
|
-
yaml_data:
|
|
53
|
+
yaml_data: dict[str, Any],
|
|
56
54
|
code_model: "CodeModel",
|
|
57
55
|
client: "Client",
|
|
58
56
|
name: str,
|
|
@@ -70,9 +68,9 @@ class BaseBuilder(
|
|
|
70
68
|
self.want_tracing: bool = yaml_data.get("wantTracing", True)
|
|
71
69
|
self.group_name: str = yaml_data["groupName"] # either operationGroup or client I am on
|
|
72
70
|
self.is_overload: bool = yaml_data["isOverload"]
|
|
73
|
-
self.api_versions:
|
|
71
|
+
self.api_versions: list[str] = yaml_data["apiVersions"]
|
|
74
72
|
self.added_on: Optional[str] = yaml_data.get("addedOn")
|
|
75
|
-
self.external_docs: Optional[
|
|
73
|
+
self.external_docs: Optional[dict[str, Any]] = yaml_data.get("externalDocs")
|
|
76
74
|
self.client_namespace: str = yaml_data.get("clientNamespace", code_model.namespace)
|
|
77
75
|
|
|
78
76
|
if code_model.options["version-tolerant"] and yaml_data.get("abstract"):
|
|
@@ -114,7 +112,7 @@ class BaseBuilder(
|
|
|
114
112
|
)
|
|
115
113
|
return self._description or self.name
|
|
116
114
|
|
|
117
|
-
def method_signature(self, async_mode: bool, **kwargs: Any) ->
|
|
115
|
+
def method_signature(self, async_mode: bool, **kwargs: Any) -> list[str]:
|
|
118
116
|
if self.abstract:
|
|
119
117
|
return ["*args,", "**kwargs"]
|
|
120
118
|
return self.parameters.method_signature(async_mode, **kwargs)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for
|
|
4
4
|
# license information.
|
|
5
5
|
# --------------------------------------------------------------------------
|
|
6
|
-
from typing import Any,
|
|
6
|
+
from typing import Any, TYPE_CHECKING, TypeVar, Generic, Union, Optional
|
|
7
7
|
|
|
8
8
|
from .base import BaseModel
|
|
9
9
|
from .parameter_list import ClientGlobalParameterList, ConfigGlobalParameterList
|
|
@@ -35,7 +35,7 @@ class _ClientConfigBase(Generic[ParameterListType], BaseModel):
|
|
|
35
35
|
|
|
36
36
|
def __init__(
|
|
37
37
|
self,
|
|
38
|
-
yaml_data:
|
|
38
|
+
yaml_data: dict[str, Any],
|
|
39
39
|
code_model: "CodeModel",
|
|
40
40
|
parameters: ParameterListType,
|
|
41
41
|
):
|
|
@@ -54,19 +54,19 @@ class _ClientConfigBase(Generic[ParameterListType], BaseModel):
|
|
|
54
54
|
return self.yaml_data["name"]
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
class Client(_ClientConfigBase[ClientGlobalParameterList]):
|
|
57
|
+
class Client(_ClientConfigBase[ClientGlobalParameterList]):
|
|
58
58
|
"""Model representing our service client"""
|
|
59
59
|
|
|
60
60
|
def __init__(
|
|
61
61
|
self,
|
|
62
|
-
yaml_data:
|
|
62
|
+
yaml_data: dict[str, Any],
|
|
63
63
|
code_model: "CodeModel",
|
|
64
64
|
parameters: ClientGlobalParameterList,
|
|
65
65
|
*,
|
|
66
66
|
is_subclient: bool = False,
|
|
67
67
|
):
|
|
68
68
|
super().__init__(yaml_data, code_model, parameters)
|
|
69
|
-
self.operation_groups:
|
|
69
|
+
self.operation_groups: list[OperationGroup] = []
|
|
70
70
|
self.config = Config.from_yaml(yaml_data, self.code_model)
|
|
71
71
|
self.is_subclient = is_subclient
|
|
72
72
|
self.request_builders = self._build_request_builders()
|
|
@@ -81,12 +81,18 @@ class Client(_ClientConfigBase[ClientGlobalParameterList]): # pylint: disable=t
|
|
|
81
81
|
|
|
82
82
|
# update the host parameter value. In later logic, SDK will overwrite it
|
|
83
83
|
# with value from cloud_setting if users don't provide it.
|
|
84
|
-
if self.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
p.
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
if self.code_model.options.get("azure-arm"):
|
|
85
|
+
if self.need_cloud_setting:
|
|
86
|
+
for p in self.parameters.parameters:
|
|
87
|
+
if p.location == ParameterLocation.ENDPOINT_PATH:
|
|
88
|
+
p.client_default_value = None
|
|
89
|
+
p.optional = True
|
|
90
|
+
break
|
|
91
|
+
else:
|
|
92
|
+
for idx, p in enumerate(self.parameters.parameters):
|
|
93
|
+
if p.client_name == "cloud_setting":
|
|
94
|
+
self.parameters.parameters.pop(idx)
|
|
95
|
+
break
|
|
90
96
|
|
|
91
97
|
@property
|
|
92
98
|
def need_cloud_setting(self) -> bool:
|
|
@@ -102,10 +108,10 @@ class Client(_ClientConfigBase[ClientGlobalParameterList]): # pylint: disable=t
|
|
|
102
108
|
|
|
103
109
|
def _build_request_builders(
|
|
104
110
|
self,
|
|
105
|
-
) ->
|
|
106
|
-
request_builders:
|
|
111
|
+
) -> list[Union[RequestBuilder, OverloadedRequestBuilder]]:
|
|
112
|
+
request_builders: list[Union[RequestBuilder, OverloadedRequestBuilder]] = []
|
|
107
113
|
|
|
108
|
-
def add_og_request_builder(og:
|
|
114
|
+
def add_og_request_builder(og: dict[str, Any]):
|
|
109
115
|
for operation_yaml in og["operations"]:
|
|
110
116
|
request_builder = get_request_builder(
|
|
111
117
|
operation_yaml,
|
|
@@ -203,7 +209,43 @@ class Client(_ClientConfigBase[ClientGlobalParameterList]): # pylint: disable=t
|
|
|
203
209
|
except StopIteration as exc:
|
|
204
210
|
raise KeyError(f"No operation with id {operation_id} found.") from exc
|
|
205
211
|
|
|
206
|
-
|
|
212
|
+
@property
|
|
213
|
+
def has_mixin(self) -> bool:
|
|
214
|
+
"""Do we want a mixin ABC class for typing purposes?"""
|
|
215
|
+
return any(og for og in self.operation_groups if og.is_mixin)
|
|
216
|
+
|
|
217
|
+
@property
|
|
218
|
+
def lro_operations(self) -> list["OperationType"]:
|
|
219
|
+
"""all LRO operations in this SDK?"""
|
|
220
|
+
return [operation for operation_group in self.operation_groups for operation in operation_group.lro_operations]
|
|
221
|
+
|
|
222
|
+
@property
|
|
223
|
+
def has_public_lro_operations(self) -> bool:
|
|
224
|
+
"""Are there any public LRO operations in this SDK?"""
|
|
225
|
+
return any(not operation.internal for operation in self.lro_operations)
|
|
226
|
+
|
|
227
|
+
@property
|
|
228
|
+
def has_operations(self) -> bool:
|
|
229
|
+
return any(operation_group.has_operations for operation_group in self.operation_groups)
|
|
230
|
+
|
|
231
|
+
def link_lro_initial_operations(self) -> None:
|
|
232
|
+
"""Link each LRO operation to its initial operation"""
|
|
233
|
+
for operation_group in self.operation_groups:
|
|
234
|
+
for operation in operation_group.operations:
|
|
235
|
+
if isinstance(operation, (LROOperation, LROPagingOperation)):
|
|
236
|
+
operation.initial_operation = self.lookup_operation(id(operation.yaml_data["initialOperation"]))
|
|
237
|
+
|
|
238
|
+
@property
|
|
239
|
+
def has_abstract_operations(self) -> bool:
|
|
240
|
+
"""Whether there is abstract operation in any operation group."""
|
|
241
|
+
return any(og.has_abstract_operations for og in self.operation_groups)
|
|
242
|
+
|
|
243
|
+
@property
|
|
244
|
+
def has_non_abstract_operations(self) -> bool:
|
|
245
|
+
"""Whether there is non-abstract operation in any operation group."""
|
|
246
|
+
return any(og.has_non_abstract_operations for og in self.operation_groups)
|
|
247
|
+
|
|
248
|
+
def imports(self, async_mode: bool, **kwargs) -> FileImport:
|
|
207
249
|
file_import = FileImport(self.code_model)
|
|
208
250
|
file_import.add_submodule_import("typing", "Any", ImportType.STDLIB, TypingSection.CONDITIONAL)
|
|
209
251
|
if self.code_model.options["azure-arm"]:
|
|
@@ -259,46 +301,6 @@ class Client(_ClientConfigBase[ClientGlobalParameterList]): # pylint: disable=t
|
|
|
259
301
|
file_import.add_submodule_import("typing", "cast", ImportType.STDLIB)
|
|
260
302
|
file_import.add_submodule_import("azure.core.settings", "settings", ImportType.SDKCORE)
|
|
261
303
|
file_import.add_submodule_import("azure.mgmt.core.tools", "get_arm_endpoints", ImportType.SDKCORE)
|
|
262
|
-
return file_import
|
|
263
|
-
|
|
264
|
-
@property
|
|
265
|
-
def has_mixin(self) -> bool:
|
|
266
|
-
"""Do we want a mixin ABC class for typing purposes?"""
|
|
267
|
-
return any(og for og in self.operation_groups if og.is_mixin)
|
|
268
|
-
|
|
269
|
-
@property
|
|
270
|
-
def lro_operations(self) -> List["OperationType"]:
|
|
271
|
-
"""all LRO operations in this SDK?"""
|
|
272
|
-
return [operation for operation_group in self.operation_groups for operation in operation_group.lro_operations]
|
|
273
|
-
|
|
274
|
-
@property
|
|
275
|
-
def has_public_lro_operations(self) -> bool:
|
|
276
|
-
"""Are there any public LRO operations in this SDK?"""
|
|
277
|
-
return any(not operation.internal for operation in self.lro_operations)
|
|
278
|
-
|
|
279
|
-
@property
|
|
280
|
-
def has_operations(self) -> bool:
|
|
281
|
-
return any(operation_group.has_operations for operation_group in self.operation_groups)
|
|
282
|
-
|
|
283
|
-
def link_lro_initial_operations(self) -> None:
|
|
284
|
-
"""Link each LRO operation to its initial operation"""
|
|
285
|
-
for operation_group in self.operation_groups:
|
|
286
|
-
for operation in operation_group.operations:
|
|
287
|
-
if isinstance(operation, (LROOperation, LROPagingOperation)):
|
|
288
|
-
operation.initial_operation = self.lookup_operation(id(operation.yaml_data["initialOperation"]))
|
|
289
|
-
|
|
290
|
-
@property
|
|
291
|
-
def has_abstract_operations(self) -> bool:
|
|
292
|
-
"""Whether there is abstract operation in any operation group."""
|
|
293
|
-
return any(og.has_abstract_operations for og in self.operation_groups)
|
|
294
|
-
|
|
295
|
-
@property
|
|
296
|
-
def has_non_abstract_operations(self) -> bool:
|
|
297
|
-
"""Whether there is non-abstract operation in any operation group."""
|
|
298
|
-
return any(og.has_non_abstract_operations for og in self.operation_groups)
|
|
299
|
-
|
|
300
|
-
def imports(self, async_mode: bool, **kwargs) -> FileImport:
|
|
301
|
-
file_import = self._imports_shared(async_mode, **kwargs)
|
|
302
304
|
if async_mode:
|
|
303
305
|
file_import.add_submodule_import("typing", "Awaitable", ImportType.STDLIB)
|
|
304
306
|
file_import.add_submodule_import(
|
|
@@ -334,32 +336,11 @@ class Client(_ClientConfigBase[ClientGlobalParameterList]): # pylint: disable=t
|
|
|
334
336
|
if self.code_model.model_types and self.code_model.options["models-mode"] == "msrest":
|
|
335
337
|
path_to_models = ".." if async_mode else "."
|
|
336
338
|
file_import.add_submodule_import(path_to_models, "models", ImportType.LOCAL, alias="_models")
|
|
337
|
-
elif self.code_model.options["models-mode"] == "msrest":
|
|
338
|
-
# in this case, we have client_models = {} in the service client, which needs a type annotation
|
|
339
|
-
# this import will always be commented, so will always add it to the typing section
|
|
340
|
-
file_import.add_submodule_import("typing", "Dict", ImportType.STDLIB)
|
|
341
339
|
file_import.add_submodule_import("copy", "deepcopy", ImportType.STDLIB)
|
|
342
340
|
return file_import
|
|
343
341
|
|
|
344
|
-
def imports_for_multiapi(self, async_mode: bool, **kwargs) -> FileImport:
|
|
345
|
-
file_import = self._imports_shared(async_mode, **kwargs)
|
|
346
|
-
file_import.add_submodule_import("typing", "Optional", ImportType.STDLIB, TypingSection.CONDITIONAL)
|
|
347
|
-
try:
|
|
348
|
-
mixin_operation = next(og for og in self.operation_groups if og.is_mixin)
|
|
349
|
-
file_import.add_submodule_import("._operations_mixin", mixin_operation.class_name, ImportType.LOCAL)
|
|
350
|
-
except StopIteration:
|
|
351
|
-
pass
|
|
352
|
-
file_import.add_submodule_import("azure.profiles", "KnownProfiles", import_type=ImportType.SDKCORE)
|
|
353
|
-
file_import.add_submodule_import("azure.profiles", "ProfileDefinition", import_type=ImportType.SDKCORE)
|
|
354
|
-
file_import.add_submodule_import(
|
|
355
|
-
"azure.profiles.multiapiclient",
|
|
356
|
-
"MultiApiClientMixin",
|
|
357
|
-
import_type=ImportType.SDKCORE,
|
|
358
|
-
)
|
|
359
|
-
return file_import
|
|
360
|
-
|
|
361
342
|
@property
|
|
362
|
-
def credential_scopes(self) -> Optional[
|
|
343
|
+
def credential_scopes(self) -> Optional[list[str]]:
|
|
363
344
|
"""Credential scopes for this client"""
|
|
364
345
|
|
|
365
346
|
if self.credential:
|
|
@@ -373,7 +354,7 @@ class Client(_ClientConfigBase[ClientGlobalParameterList]): # pylint: disable=t
|
|
|
373
354
|
@classmethod
|
|
374
355
|
def from_yaml(
|
|
375
356
|
cls,
|
|
376
|
-
yaml_data:
|
|
357
|
+
yaml_data: dict[str, Any],
|
|
377
358
|
code_model: "CodeModel",
|
|
378
359
|
*,
|
|
379
360
|
is_subclient: bool = False,
|
|
@@ -413,7 +394,7 @@ class Config(_ClientConfigBase[ConfigGlobalParameterList]):
|
|
|
413
394
|
def name(self) -> str:
|
|
414
395
|
return f"{super().name}Configuration"
|
|
415
396
|
|
|
416
|
-
def
|
|
397
|
+
def imports(self, async_mode: bool, **kwargs) -> FileImport:
|
|
417
398
|
file_import = FileImport(self.code_model)
|
|
418
399
|
file_import.add_submodule_import(
|
|
419
400
|
"pipeline" if self.code_model.is_azure_flavor else "runtime",
|
|
@@ -432,11 +413,6 @@ class Config(_ClientConfigBase[ConfigGlobalParameterList]):
|
|
|
432
413
|
policy = "AsyncARMChallengeAuthenticationPolicy" if async_mode else "ARMChallengeAuthenticationPolicy"
|
|
433
414
|
file_import.add_submodule_import("azure.mgmt.core.policies", "ARMHttpLoggingPolicy", ImportType.SDKCORE)
|
|
434
415
|
file_import.add_submodule_import("azure.mgmt.core.policies", policy, ImportType.SDKCORE)
|
|
435
|
-
|
|
436
|
-
return file_import
|
|
437
|
-
|
|
438
|
-
def imports(self, async_mode: bool, **kwargs) -> FileImport:
|
|
439
|
-
file_import = self._imports_shared(async_mode, **kwargs)
|
|
440
416
|
for gp in self.parameters:
|
|
441
417
|
if gp.method_location == ParameterMethodLocation.KWARG and gp not in self.parameters.kwargs_to_pop:
|
|
442
418
|
continue
|
|
@@ -448,25 +424,8 @@ class Config(_ClientConfigBase[ConfigGlobalParameterList]):
|
|
|
448
424
|
)
|
|
449
425
|
return file_import
|
|
450
426
|
|
|
451
|
-
def imports_for_multiapi(self, async_mode: bool, **kwargs: Any) -> FileImport:
|
|
452
|
-
file_import = self._imports_shared(async_mode, **kwargs)
|
|
453
|
-
for gp in self.parameters:
|
|
454
|
-
if (
|
|
455
|
-
gp.method_location == ParameterMethodLocation.KWARG
|
|
456
|
-
and gp not in self.parameters.kwargs_to_pop
|
|
457
|
-
and gp.client_name == "api_version"
|
|
458
|
-
):
|
|
459
|
-
continue
|
|
460
|
-
file_import.merge(
|
|
461
|
-
gp.imports_for_multiapi(
|
|
462
|
-
async_mode=async_mode,
|
|
463
|
-
**kwargs,
|
|
464
|
-
)
|
|
465
|
-
)
|
|
466
|
-
return file_import
|
|
467
|
-
|
|
468
427
|
@classmethod
|
|
469
|
-
def from_yaml(cls, yaml_data:
|
|
428
|
+
def from_yaml(cls, yaml_data: dict[str, Any], code_model: "CodeModel") -> "Config":
|
|
470
429
|
return cls(
|
|
471
430
|
yaml_data=yaml_data,
|
|
472
431
|
code_model=code_model,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# license information.
|
|
5
5
|
# --------------------------------------------------------------------------
|
|
6
6
|
from pathlib import Path
|
|
7
|
-
from typing import
|
|
7
|
+
from typing import Any, Union, Literal, Optional, cast
|
|
8
8
|
|
|
9
9
|
from .base import BaseType
|
|
10
10
|
from .enum_type import EnumType
|
|
@@ -22,7 +22,7 @@ def _is_legacy(options) -> bool:
|
|
|
22
22
|
return not (options.get("version-tolerant") or options.get("low-level-client"))
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
def get_all_operation_groups_recursively(clients:
|
|
25
|
+
def get_all_operation_groups_recursively(clients: list[Client]) -> list[OperationGroup]:
|
|
26
26
|
operation_groups = []
|
|
27
27
|
queue = []
|
|
28
28
|
for client in clients:
|
|
@@ -37,10 +37,10 @@ def get_all_operation_groups_recursively(clients: List[Client]) -> List[Operatio
|
|
|
37
37
|
class ClientNamespaceType:
|
|
38
38
|
def __init__(
|
|
39
39
|
self,
|
|
40
|
-
clients: Optional[
|
|
41
|
-
models: Optional[
|
|
42
|
-
enums: Optional[
|
|
43
|
-
operation_groups: Optional[
|
|
40
|
+
clients: Optional[list[Client]] = None,
|
|
41
|
+
models: Optional[list[ModelType]] = None,
|
|
42
|
+
enums: Optional[list[EnumType]] = None,
|
|
43
|
+
operation_groups: Optional[list[OperationGroup]] = None,
|
|
44
44
|
):
|
|
45
45
|
self.clients = clients or []
|
|
46
46
|
self.models = models or []
|
|
@@ -73,34 +73,34 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
|
|
|
73
73
|
|
|
74
74
|
def __init__(
|
|
75
75
|
self,
|
|
76
|
-
yaml_data:
|
|
76
|
+
yaml_data: dict[str, Any],
|
|
77
77
|
options: OptionsDict,
|
|
78
78
|
) -> None:
|
|
79
79
|
self.yaml_data = yaml_data
|
|
80
80
|
self.options = options
|
|
81
81
|
self.namespace = self.yaml_data["namespace"]
|
|
82
|
-
self.types_map:
|
|
83
|
-
self._model_types:
|
|
82
|
+
self.types_map: dict[int, BaseType] = {} # map yaml id to schema
|
|
83
|
+
self._model_types: list[ModelType] = []
|
|
84
84
|
from . import build_type
|
|
85
85
|
|
|
86
86
|
for type_yaml in yaml_data.get("types", []):
|
|
87
87
|
build_type(yaml_data=type_yaml, code_model=self)
|
|
88
|
-
self.clients:
|
|
88
|
+
self.clients: list[Client] = [
|
|
89
89
|
Client.from_yaml(client_yaml_data, self) for client_yaml_data in yaml_data["clients"]
|
|
90
90
|
]
|
|
91
91
|
if self.options["models-mode"] and self.model_types:
|
|
92
92
|
self.sort_model_types()
|
|
93
|
-
self.named_unions:
|
|
93
|
+
self.named_unions: list[CombinedType] = [
|
|
94
94
|
t for t in self.types_map.values() if isinstance(t, CombinedType) and t.name
|
|
95
95
|
]
|
|
96
96
|
self.cross_language_package_id = self.yaml_data.get("crossLanguagePackageId")
|
|
97
97
|
self.for_test: bool = False
|
|
98
98
|
# key is typespec namespace, value is models/clients/opeartion_groups/enums cache in the namespace
|
|
99
|
-
self._client_namespace_types:
|
|
99
|
+
self._client_namespace_types: dict[str, ClientNamespaceType] = {}
|
|
100
100
|
self.has_subnamespace = False
|
|
101
|
-
self._operations_folder_name:
|
|
102
|
-
self._relative_import_path:
|
|
103
|
-
self.metadata:
|
|
101
|
+
self._operations_folder_name: dict[str, str] = {}
|
|
102
|
+
self._relative_import_path: dict[str, str] = {}
|
|
103
|
+
self.metadata: dict[str, Any] = yaml_data.get("metadata", {})
|
|
104
104
|
|
|
105
105
|
@staticmethod
|
|
106
106
|
def get_imported_namespace_for_client(imported_namespace: str, async_mode: bool = False) -> str:
|
|
@@ -160,7 +160,7 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
|
|
|
160
160
|
return "_".join(parts) + (str(dot_num) if dot_num > 0 else "")
|
|
161
161
|
|
|
162
162
|
@property
|
|
163
|
-
def client_namespace_types(self) ->
|
|
163
|
+
def client_namespace_types(self) -> dict[str, ClientNamespaceType]:
|
|
164
164
|
if not self._client_namespace_types:
|
|
165
165
|
# calculate client namespace types for each kind of client namespace
|
|
166
166
|
for client in self.clients:
|
|
@@ -202,7 +202,7 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
|
|
|
202
202
|
return any(client.has_etag for client in self.clients)
|
|
203
203
|
|
|
204
204
|
@staticmethod
|
|
205
|
-
def clients_has_operations(clients:
|
|
205
|
+
def clients_has_operations(clients: list[Client]) -> bool:
|
|
206
206
|
return any(c for c in clients if c.has_operations)
|
|
207
207
|
|
|
208
208
|
@property
|
|
@@ -235,7 +235,7 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
|
|
|
235
235
|
def client_filename(self) -> str:
|
|
236
236
|
return self.clients[0].filename
|
|
237
237
|
|
|
238
|
-
def get_clients(self, client_namespace: str) ->
|
|
238
|
+
def get_clients(self, client_namespace: str) -> list[Client]:
|
|
239
239
|
"""Get all clients in specific namespace"""
|
|
240
240
|
return self.client_namespace_types.get(client_namespace, ClientNamespaceType()).clients
|
|
241
241
|
|
|
@@ -332,7 +332,7 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
|
|
|
332
332
|
raise KeyError(f"Couldn't find schema with id {schema_id}") from exc
|
|
333
333
|
|
|
334
334
|
@property
|
|
335
|
-
def model_types(self) ->
|
|
335
|
+
def model_types(self) -> list[ModelType]:
|
|
336
336
|
"""All of the model types in this class"""
|
|
337
337
|
if not self._model_types:
|
|
338
338
|
self._model_types = [
|
|
@@ -341,19 +341,19 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
|
|
|
341
341
|
return self._model_types
|
|
342
342
|
|
|
343
343
|
@model_types.setter
|
|
344
|
-
def model_types(self, val:
|
|
344
|
+
def model_types(self, val: list[ModelType]) -> None:
|
|
345
345
|
self._model_types = val
|
|
346
346
|
|
|
347
347
|
@staticmethod
|
|
348
|
-
def get_public_model_types(models:
|
|
348
|
+
def get_public_model_types(models: list[ModelType]) -> list[ModelType]:
|
|
349
349
|
return [m for m in models if not m.internal and not m.base == "json"]
|
|
350
350
|
|
|
351
351
|
@property
|
|
352
|
-
def public_model_types(self) ->
|
|
352
|
+
def public_model_types(self) -> list[ModelType]:
|
|
353
353
|
return self.get_public_model_types(self.model_types)
|
|
354
354
|
|
|
355
355
|
@property
|
|
356
|
-
def enums(self) ->
|
|
356
|
+
def enums(self) -> list[EnumType]:
|
|
357
357
|
"""All of the enums"""
|
|
358
358
|
return [t for t in self.types_map.values() if isinstance(t, EnumType)]
|
|
359
359
|
|
|
@@ -364,8 +364,8 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
|
|
|
364
364
|
def _sort_model_types_helper(
|
|
365
365
|
self,
|
|
366
366
|
current: ModelType,
|
|
367
|
-
seen_schema_names:
|
|
368
|
-
seen_schema_yaml_ids:
|
|
367
|
+
seen_schema_names: set[str],
|
|
368
|
+
seen_schema_yaml_ids: set[int],
|
|
369
369
|
):
|
|
370
370
|
if current.id in seen_schema_yaml_ids:
|
|
371
371
|
return []
|
|
@@ -389,9 +389,9 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
|
|
|
389
389
|
:return: None
|
|
390
390
|
:rtype: None
|
|
391
391
|
"""
|
|
392
|
-
seen_schema_names:
|
|
393
|
-
seen_schema_yaml_ids:
|
|
394
|
-
sorted_object_schemas:
|
|
392
|
+
seen_schema_names: set[str] = set()
|
|
393
|
+
seen_schema_yaml_ids: set[int] = set()
|
|
394
|
+
sorted_object_schemas: list[ModelType] = []
|
|
395
395
|
for schema in sorted(self.model_types, key=lambda x: x.name.lower()):
|
|
396
396
|
sorted_object_schemas.extend(self._sort_model_types_helper(schema, seen_schema_names, seen_schema_yaml_ids))
|
|
397
397
|
self.model_types = sorted_object_schemas
|
|
@@ -415,7 +415,7 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
|
|
|
415
415
|
return _is_legacy(self.options)
|
|
416
416
|
|
|
417
417
|
@staticmethod
|
|
418
|
-
def has_non_json_models(models:
|
|
418
|
+
def has_non_json_models(models: list[ModelType]) -> bool:
|
|
419
419
|
return any(m for m in models if m.base != "json")
|
|
420
420
|
|
|
421
421
|
@property
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for
|
|
4
4
|
# license information.
|
|
5
5
|
# --------------------------------------------------------------------------
|
|
6
|
-
from typing import Any,
|
|
6
|
+
from typing import Any, Optional, TYPE_CHECKING, Type, Union
|
|
7
7
|
import re
|
|
8
8
|
from .imports import FileImport, ImportType, TypingSection
|
|
9
9
|
from .base import BaseType
|
|
@@ -23,9 +23,9 @@ class CombinedType(BaseType):
|
|
|
23
23
|
|
|
24
24
|
def __init__(
|
|
25
25
|
self,
|
|
26
|
-
yaml_data:
|
|
26
|
+
yaml_data: dict[str, Any],
|
|
27
27
|
code_model: "CodeModel",
|
|
28
|
-
types:
|
|
28
|
+
types: list[BaseType],
|
|
29
29
|
) -> None:
|
|
30
30
|
super().__init__(yaml_data, code_model)
|
|
31
31
|
self.types = types # the types that this type is combining
|
|
@@ -104,7 +104,7 @@ class CombinedType(BaseType):
|
|
|
104
104
|
client_default_value_declaration=client_default_value_declaration,
|
|
105
105
|
)
|
|
106
106
|
|
|
107
|
-
def get_polymorphic_subtypes(self, polymorphic_subtypes:
|
|
107
|
+
def get_polymorphic_subtypes(self, polymorphic_subtypes: list["ModelType"]) -> None:
|
|
108
108
|
raise ValueError("You shouldn't get polymorphic subtypes of multiple types")
|
|
109
109
|
|
|
110
110
|
@property
|
|
@@ -131,7 +131,7 @@ class CombinedType(BaseType):
|
|
|
131
131
|
return file_import
|
|
132
132
|
|
|
133
133
|
@classmethod
|
|
134
|
-
def from_yaml(cls, yaml_data:
|
|
134
|
+
def from_yaml(cls, yaml_data: dict[str, Any], code_model: "CodeModel") -> "BaseType":
|
|
135
135
|
from . import build_type
|
|
136
136
|
|
|
137
137
|
return cls(
|
|
@@ -143,8 +143,8 @@ class CombinedType(BaseType):
|
|
|
143
143
|
def target_model_subtype(
|
|
144
144
|
self,
|
|
145
145
|
target_types: Union[
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
tuple[Type[ModelType]],
|
|
147
|
+
tuple[Type[ModelType], Type[ModelType]],
|
|
148
148
|
],
|
|
149
149
|
) -> Optional[ModelType]:
|
|
150
150
|
for sub_t in self.types:
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# license information.
|
|
5
5
|
# --------------------------------------------------------------------------
|
|
6
6
|
import logging
|
|
7
|
-
from typing import
|
|
7
|
+
from typing import Any, Optional, TYPE_CHECKING, Union
|
|
8
8
|
from .base import BaseType
|
|
9
9
|
from .imports import FileImport, ImportType, TypingSection
|
|
10
10
|
from .primitive_types import IntegerType, BinaryType, StringType, BooleanType
|
|
@@ -28,7 +28,7 @@ class ConstantType(BaseType):
|
|
|
28
28
|
|
|
29
29
|
def __init__(
|
|
30
30
|
self,
|
|
31
|
-
yaml_data:
|
|
31
|
+
yaml_data: dict[str, Any],
|
|
32
32
|
code_model: "CodeModel",
|
|
33
33
|
value_type: BaseType,
|
|
34
34
|
value: Optional[Union[str, int, float]],
|
|
@@ -82,7 +82,7 @@ class ConstantType(BaseType):
|
|
|
82
82
|
return isinstance(self.value_type, (IntegerType, BinaryType, StringType, BooleanType))
|
|
83
83
|
|
|
84
84
|
@classmethod
|
|
85
|
-
def from_yaml(cls, yaml_data:
|
|
85
|
+
def from_yaml(cls, yaml_data: dict[str, Any], code_model: "CodeModel") -> "ConstantType":
|
|
86
86
|
"""Constructs a ConstantType from yaml data.
|
|
87
87
|
|
|
88
88
|
:param yaml_data: the yaml data from which we will construct this schema
|
|
@@ -109,16 +109,9 @@ class ConstantType(BaseType):
|
|
|
109
109
|
client_default_value_declaration=self.get_declaration(),
|
|
110
110
|
)
|
|
111
111
|
|
|
112
|
-
def
|
|
112
|
+
def imports(self, **kwargs: Any) -> FileImport:
|
|
113
113
|
file_import = super().imports(**kwargs)
|
|
114
114
|
file_import.merge(self.value_type.imports(**kwargs))
|
|
115
|
-
return file_import
|
|
116
|
-
|
|
117
|
-
def imports_for_multiapi(self, **kwargs: Any) -> FileImport:
|
|
118
|
-
return self._imports_shared(**kwargs)
|
|
119
|
-
|
|
120
|
-
def imports(self, **kwargs: Any) -> FileImport:
|
|
121
|
-
file_import = self._imports_shared(**kwargs)
|
|
122
115
|
if self._is_literal:
|
|
123
116
|
file_import.add_submodule_import("typing", "Literal", ImportType.STDLIB, TypingSection.REGULAR)
|
|
124
117
|
return file_import
|
|
@@ -7,9 +7,7 @@ from abc import abstractmethod
|
|
|
7
7
|
from typing import (
|
|
8
8
|
Optional,
|
|
9
9
|
Any,
|
|
10
|
-
Dict,
|
|
11
10
|
TYPE_CHECKING,
|
|
12
|
-
List,
|
|
13
11
|
Generic,
|
|
14
12
|
TypeVar,
|
|
15
13
|
Union,
|
|
@@ -29,7 +27,7 @@ class _CredentialPolicyBaseType:
|
|
|
29
27
|
Inherited by our BearerTokenCredentialPolicy and KeyCredentialPolicy types.
|
|
30
28
|
"""
|
|
31
29
|
|
|
32
|
-
def __init__(self, yaml_data:
|
|
30
|
+
def __init__(self, yaml_data: dict[str, Any], code_model: "CodeModel") -> None:
|
|
33
31
|
self.yaml_data = yaml_data
|
|
34
32
|
self.code_model = code_model
|
|
35
33
|
|
|
@@ -45,10 +43,10 @@ class BearerTokenCredentialPolicyType(_CredentialPolicyBaseType):
|
|
|
45
43
|
|
|
46
44
|
def __init__(
|
|
47
45
|
self,
|
|
48
|
-
yaml_data:
|
|
46
|
+
yaml_data: dict[str, Any],
|
|
49
47
|
code_model: "CodeModel",
|
|
50
|
-
credential_scopes:
|
|
51
|
-
flows: Optional[
|
|
48
|
+
credential_scopes: list[str],
|
|
49
|
+
flows: Optional[dict[str, Any]] = None,
|
|
52
50
|
) -> None:
|
|
53
51
|
super().__init__(yaml_data, code_model)
|
|
54
52
|
self.credential_scopes = credential_scopes
|
|
@@ -60,7 +58,7 @@ class BearerTokenCredentialPolicyType(_CredentialPolicyBaseType):
|
|
|
60
58
|
return f"policies.{policy_name}(self.credential, *self.credential_scopes, {auth_flows}**kwargs)"
|
|
61
59
|
|
|
62
60
|
@classmethod
|
|
63
|
-
def from_yaml(cls, yaml_data:
|
|
61
|
+
def from_yaml(cls, yaml_data: dict[str, Any], code_model: "CodeModel") -> "BearerTokenCredentialPolicyType":
|
|
64
62
|
return cls(yaml_data, code_model, yaml_data["credentialScopes"], yaml_data.get("flows"))
|
|
65
63
|
|
|
66
64
|
|
|
@@ -75,7 +73,7 @@ class ARMChallengeAuthenticationPolicyType(BearerTokenCredentialPolicyType):
|
|
|
75
73
|
class KeyCredentialPolicyType(_CredentialPolicyBaseType):
|
|
76
74
|
def __init__(
|
|
77
75
|
self,
|
|
78
|
-
yaml_data:
|
|
76
|
+
yaml_data: dict[str, Any],
|
|
79
77
|
code_model: "CodeModel",
|
|
80
78
|
key: str,
|
|
81
79
|
scheme: Optional[str] = None,
|
|
@@ -95,7 +93,7 @@ class KeyCredentialPolicyType(_CredentialPolicyBaseType):
|
|
|
95
93
|
return f"policies.{self.credential_name}Policy(self.credential, {params}**kwargs)"
|
|
96
94
|
|
|
97
95
|
@classmethod
|
|
98
|
-
def from_yaml(cls, yaml_data:
|
|
96
|
+
def from_yaml(cls, yaml_data: dict[str, Any], code_model: "CodeModel") -> "KeyCredentialPolicyType":
|
|
99
97
|
return cls(yaml_data, code_model, yaml_data["key"], yaml_data.get("scheme", None))
|
|
100
98
|
|
|
101
99
|
|
|
@@ -114,7 +112,7 @@ class CredentialType(Generic[CredentialPolicyType], BaseType):
|
|
|
114
112
|
|
|
115
113
|
def __init__(
|
|
116
114
|
self,
|
|
117
|
-
yaml_data:
|
|
115
|
+
yaml_data: dict[str, Any],
|
|
118
116
|
code_model: "CodeModel",
|
|
119
117
|
policy: CredentialPolicyType,
|
|
120
118
|
) -> None:
|
|
@@ -138,7 +136,7 @@ class CredentialType(Generic[CredentialPolicyType], BaseType):
|
|
|
138
136
|
return self.docstring_type()
|
|
139
137
|
|
|
140
138
|
@classmethod
|
|
141
|
-
def from_yaml(cls, yaml_data:
|
|
139
|
+
def from_yaml(cls, yaml_data: dict[str, Any], code_model: "CodeModel") -> "CredentialType":
|
|
142
140
|
from . import build_type
|
|
143
141
|
|
|
144
142
|
return cls(
|