@autorest/python 6.34.1 → 6.35.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/autorest/multiapi/models/client.py +1 -1
- package/autorest/multiapi/serializers/__init__.py +1 -5
- package/autorest/multiapi/templates/multiapi_operations_mixin.py.jinja2 +1 -1
- package/generator/build/lib/pygen/codegen/models/code_model.py +1 -0
- package/generator/build/lib/pygen/codegen/models/operation_group.py +13 -1
- package/generator/build/lib/pygen/codegen/models/paging_operation.py +14 -2
- package/generator/build/lib/pygen/codegen/models/response.py +1 -1
- package/generator/build/lib/pygen/codegen/serializers/__init__.py +8 -0
- package/generator/build/lib/pygen/codegen/serializers/builder_serializer.py +11 -0
- package/generator/build/lib/pygen/codegen/serializers/general_serializer.py +1 -1
- package/generator/build/lib/pygen/codegen/templates/operation_group.py.jinja2 +2 -2
- package/generator/build/lib/pygen/codegen/templates/operation_groups_container.py.jinja2 +0 -1
- package/generator/build/lib/pygen/codegen/templates/packaging_templates/README.md.jinja2 +1 -1
- package/generator/component-detection-pip-report.json +8 -7
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/codegen/models/code_model.py +1 -0
- package/generator/pygen/codegen/models/operation_group.py +13 -1
- package/generator/pygen/codegen/models/paging_operation.py +14 -2
- package/generator/pygen/codegen/models/response.py +1 -1
- package/generator/pygen/codegen/serializers/__init__.py +8 -0
- package/generator/pygen/codegen/serializers/builder_serializer.py +11 -0
- package/generator/pygen/codegen/serializers/general_serializer.py +1 -1
- package/generator/pygen/codegen/templates/operation_group.py.jinja2 +2 -2
- package/generator/pygen/codegen/templates/operation_groups_container.py.jinja2 +0 -1
- package/generator/pygen/codegen/templates/packaging_templates/README.md.jinja2 +1 -1
- package/package.json +2 -2
- package/scripts/__pycache__/venvtools.cpython-310.pyc +0 -0
- package/autorest/multiapi/templates/multiapi_utils_init.py.jinja2 +0 -10
|
@@ -43,7 +43,7 @@ class Client:
|
|
|
43
43
|
file_import = FileImport(json.loads(self.default_version_metadata["client"][imports_to_load]))
|
|
44
44
|
local_imports = file_import.imports.get(TypingSection.REGULAR, {}).get(ImportType.LOCAL, {})
|
|
45
45
|
for key in local_imports:
|
|
46
|
-
if re.search("^\\.*
|
|
46
|
+
if re.search("^\\.*_utils.serialization$", key):
|
|
47
47
|
relative_path = ".." if async_mode else "."
|
|
48
48
|
local_imports[f"{relative_path}_serialization"] = local_imports.pop(key)
|
|
49
49
|
break
|
|
@@ -133,11 +133,7 @@ class MultiAPISerializer(ReaderAndWriter): # pylint: disable=abstract-method
|
|
|
133
133
|
lstrip_blocks=True,
|
|
134
134
|
)
|
|
135
135
|
self.write_file(
|
|
136
|
-
Path("
|
|
137
|
-
self.env.get_template("multiapi_utils_init.py.jinja2").render(),
|
|
138
|
-
)
|
|
139
|
-
self.write_file(
|
|
140
|
-
Path("_utils/serialization.py"),
|
|
136
|
+
Path("_serialization.py"),
|
|
141
137
|
codegen_env.get_template("serialization.py.jinja2").render(
|
|
142
138
|
code_model=code_model,
|
|
143
139
|
),
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
# Changes may cause incorrect behavior and will be lost if the code is
|
|
9
9
|
# regenerated.
|
|
10
10
|
# --------------------------------------------------------------------------
|
|
11
|
-
from {{ ".." if async_mode else "." }}
|
|
11
|
+
from {{ ".." if async_mode else "." }}_serialization import Serializer, Deserializer
|
|
12
12
|
{% if imports %}
|
|
13
13
|
{{ imports }}
|
|
14
14
|
{% endif %}
|
|
@@ -98,6 +98,7 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
|
|
|
98
98
|
self.has_subnamespace = False
|
|
99
99
|
self._operations_folder_name: Dict[str, str] = {}
|
|
100
100
|
self._relative_import_path: Dict[str, str] = {}
|
|
101
|
+
self.metadata: Dict[str, Any] = yaml_data.get("metadata", {})
|
|
101
102
|
|
|
102
103
|
@staticmethod
|
|
103
104
|
def get_imported_namespace_for_client(imported_namespace: str, async_mode: bool = False) -> str:
|
|
@@ -64,7 +64,9 @@ class OperationGroup(BaseModel):
|
|
|
64
64
|
)
|
|
65
65
|
|
|
66
66
|
def base_class(self, async_mode: bool) -> str:
|
|
67
|
-
pipeline_client =
|
|
67
|
+
pipeline_client = (
|
|
68
|
+
f"{'Async' if async_mode else ''}PipelineClient[HttpRequest, {'Async' if async_mode else ''}HttpResponse]"
|
|
69
|
+
)
|
|
68
70
|
base_classes: List[str] = []
|
|
69
71
|
if self.is_mixin:
|
|
70
72
|
base_classes.append(f"ClientMixinABC[{pipeline_client}, {self.client.name}Configuration]")
|
|
@@ -166,6 +168,16 @@ class OperationGroup(BaseModel):
|
|
|
166
168
|
"ClientMixinABC",
|
|
167
169
|
ImportType.LOCAL,
|
|
168
170
|
)
|
|
171
|
+
file_import.add_submodule_import(
|
|
172
|
+
"rest",
|
|
173
|
+
"HttpRequest",
|
|
174
|
+
ImportType.SDKCORE,
|
|
175
|
+
)
|
|
176
|
+
file_import.add_submodule_import(
|
|
177
|
+
"rest",
|
|
178
|
+
f"{'Async' if async_mode else ''}HttpResponse",
|
|
179
|
+
ImportType.SDKCORE,
|
|
180
|
+
)
|
|
169
181
|
else:
|
|
170
182
|
file_import.add_msrest_import(
|
|
171
183
|
serialize_namespace=kwargs.get("serialize_namespace", self.code_model.namespace),
|
|
@@ -16,6 +16,7 @@ from .imports import ImportType, FileImport, TypingSection
|
|
|
16
16
|
from .parameter_list import ParameterList
|
|
17
17
|
from .model_type import ModelType
|
|
18
18
|
from .list_type import ListType
|
|
19
|
+
from .parameter import Parameter
|
|
19
20
|
|
|
20
21
|
if TYPE_CHECKING:
|
|
21
22
|
from .code_model import CodeModel
|
|
@@ -59,6 +60,9 @@ class PagingOperationBase(OperationBase[PagingResponseType]):
|
|
|
59
60
|
self.pager_sync: str = yaml_data.get("pagerSync") or f"{self.code_model.core_library}.paging.ItemPaged"
|
|
60
61
|
self.pager_async: str = yaml_data.get("pagerAsync") or f"{self.code_model.core_library}.paging.AsyncItemPaged"
|
|
61
62
|
self.continuation_token: Dict[str, Any] = yaml_data.get("continuationToken", {})
|
|
63
|
+
self.next_link_reinjected_parameters: List[Parameter] = [
|
|
64
|
+
Parameter.from_yaml(p, code_model) for p in yaml_data.get("nextLinkReInjectedParameters", [])
|
|
65
|
+
]
|
|
62
66
|
|
|
63
67
|
@property
|
|
64
68
|
def has_continuation_token(self) -> bool:
|
|
@@ -118,9 +122,17 @@ class PagingOperationBase(OperationBase[PagingResponseType]):
|
|
|
118
122
|
def _imports_shared(self, async_mode: bool, **kwargs: Any) -> FileImport:
|
|
119
123
|
file_import = super()._imports_shared(async_mode, **kwargs)
|
|
120
124
|
if async_mode:
|
|
121
|
-
|
|
125
|
+
default_paging_submodule = f"{'async_' if self.code_model.is_azure_flavor else ''}paging"
|
|
126
|
+
file_import.add_submodule_import(
|
|
127
|
+
f"{self.code_model.core_library}.{default_paging_submodule}",
|
|
128
|
+
"AsyncItemPaged",
|
|
129
|
+
ImportType.SDKCORE,
|
|
130
|
+
TypingSection.CONDITIONAL,
|
|
131
|
+
)
|
|
122
132
|
else:
|
|
123
|
-
file_import.add_submodule_import(
|
|
133
|
+
file_import.add_submodule_import(
|
|
134
|
+
f"{self.code_model.core_library}.paging", "ItemPaged", ImportType.SDKCORE, TypingSection.CONDITIONAL
|
|
135
|
+
)
|
|
124
136
|
if (
|
|
125
137
|
self.next_request_builder
|
|
126
138
|
and self.code_model.options["builders_visibility"] == "embedded"
|
|
@@ -186,7 +186,7 @@ class PagingResponse(Response):
|
|
|
186
186
|
return self.get_pager_path(async_mode).split(".")[-1]
|
|
187
187
|
|
|
188
188
|
def type_annotation(self, **kwargs: Any) -> str:
|
|
189
|
-
iterable = "
|
|
189
|
+
iterable = "AsyncItemPaged" if kwargs["async_mode"] else "ItemPaged"
|
|
190
190
|
return f"{iterable}[{self.item_type.type_annotation(**kwargs)}]"
|
|
191
191
|
|
|
192
192
|
def docstring_text(self, **kwargs: Any) -> str:
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
# license information.
|
|
5
5
|
# --------------------------------------------------------------------------
|
|
6
6
|
import logging
|
|
7
|
+
import json
|
|
7
8
|
from collections import namedtuple
|
|
8
9
|
import re
|
|
9
10
|
from typing import List, Any, Union
|
|
@@ -143,6 +144,13 @@ class JinjaSerializer(ReaderAndWriter):
|
|
|
143
144
|
self._serialize_and_write_sample(env, namespace=client_namespace)
|
|
144
145
|
if self.code_model.options["generate_test"]:
|
|
145
146
|
self._serialize_and_write_test(env, namespace=client_namespace)
|
|
147
|
+
|
|
148
|
+
# add _metadata.json
|
|
149
|
+
if self.code_model.metadata:
|
|
150
|
+
self.write_file(
|
|
151
|
+
exec_path / Path("_metadata.json"),
|
|
152
|
+
json.dumps(self.code_model.metadata, indent=2),
|
|
153
|
+
)
|
|
146
154
|
elif client_namespace_type.clients:
|
|
147
155
|
# add clients folder if there are clients in this namespace
|
|
148
156
|
self._serialize_client_and_config_files(client_namespace, client_namespace_type.clients, env)
|
|
@@ -1276,6 +1276,17 @@ class _PagingOperationSerializer(_OperationSerializer[PagingOperationType]):
|
|
|
1276
1276
|
else api_version_param.full_client_name
|
|
1277
1277
|
)
|
|
1278
1278
|
retval.append(f'_next_request_params["api-version"] = {api_version}')
|
|
1279
|
+
if builder.next_link_reinjected_parameters:
|
|
1280
|
+
for param in builder.next_link_reinjected_parameters:
|
|
1281
|
+
if param.location == ParameterLocation.QUERY:
|
|
1282
|
+
retval.extend(
|
|
1283
|
+
self.parameter_serializer.serialize_query_header(
|
|
1284
|
+
param,
|
|
1285
|
+
"next_request_params",
|
|
1286
|
+
self.serializer_name,
|
|
1287
|
+
self.code_model.is_legacy,
|
|
1288
|
+
)
|
|
1289
|
+
)
|
|
1279
1290
|
query_str = ", params=_next_request_params"
|
|
1280
1291
|
next_link_str = "urllib.parse.urljoin(next_link, _parsed_next_link.path)"
|
|
1281
1292
|
except StopIteration:
|
|
@@ -63,7 +63,7 @@ class GeneralSerializer(BaseSerializer):
|
|
|
63
63
|
"token_credential": token_credential,
|
|
64
64
|
"pkgutil_names": [".".join(package_parts[: i + 1]) for i in range(len(package_parts))],
|
|
65
65
|
"init_names": ["/".join(package_parts[: i + 1]) + "/__init__.py" for i in range(len(package_parts))],
|
|
66
|
-
"client_name": self.code_model.clients[0].name,
|
|
66
|
+
"client_name": self.code_model.clients[0].name if self.code_model.clients else "",
|
|
67
67
|
"VERSION_MAP": VERSION_MAP,
|
|
68
68
|
"MIN_PYTHON_VERSION": MIN_PYTHON_VERSION,
|
|
69
69
|
"MAX_PYTHON_VERSION": MAX_PYTHON_VERSION,
|
|
@@ -29,7 +29,7 @@ class {{ operation_group.class_name }}: {{ operation_group.pylint_disable() }}
|
|
|
29
29
|
models = _models
|
|
30
30
|
|
|
31
31
|
{% endif %}
|
|
32
|
-
def __init__(self, *args, **kwargs)
|
|
32
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
33
33
|
input_args = list(args)
|
|
34
34
|
self._client: {{ 'Async' if async_mode else ''}}PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
35
35
|
self._config: {{ operation_group.client.name }}Configuration = input_args.pop(0) if input_args else kwargs.pop("config")
|
|
@@ -48,7 +48,7 @@ class {{ operation_group.class_name }}: {{ operation_group.pylint_disable() }}
|
|
|
48
48
|
{{ check_abstract_methods() }}
|
|
49
49
|
{% elif operation_group.has_abstract_operations %}
|
|
50
50
|
|
|
51
|
-
def __init__(self)
|
|
51
|
+
def __init__(self) -> None:
|
|
52
52
|
{{ check_abstract_methods() }}
|
|
53
53
|
{% endif %}
|
|
54
54
|
{% if operation_group.is_mixin and code_model.options["multiapi"] %}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{% import 'operation_tools.jinja2' as op_tools %}
|
|
2
2
|
{% set operations_description = "async operations" if async_mode else "operations" %}
|
|
3
|
-
{% set return_none_type_annotation = " -> None" if async_mode else "" %}
|
|
4
3
|
# coding=utf-8
|
|
5
4
|
{% if code_model.license_header %}
|
|
6
5
|
{{ code_model.license_header }}
|
|
@@ -40,7 +40,7 @@ python -m pip install {{ package_name }}
|
|
|
40
40
|
- You need an [Azure subscription][azure_sub] to use this package.
|
|
41
41
|
- An existing {{ package_pprint_name }} instance.
|
|
42
42
|
|
|
43
|
-
{% if token_credential %}
|
|
43
|
+
{% if token_credential and client_name %}
|
|
44
44
|
#### Create with an Azure Active Directory Credential
|
|
45
45
|
To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
|
|
46
46
|
provide an instance of the desired credential type obtained from the
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "1",
|
|
3
|
-
"pip_version": "25.
|
|
3
|
+
"pip_version": "25.1.1",
|
|
4
4
|
"install": [
|
|
5
5
|
{
|
|
6
6
|
"download_info": {
|
|
7
|
-
"url": "https://files.pythonhosted.org/packages/
|
|
7
|
+
"url": "https://files.pythonhosted.org/packages/a1/18/0e835c3a557dc5faffc8f91092f62fc337c1dab1066715842e7a4b318ec4/setuptools-80.7.1-py3-none-any.whl",
|
|
8
8
|
"archive_info": {
|
|
9
|
-
"hash": "sha256=
|
|
9
|
+
"hash": "sha256=ca5cc1069b85dc23070a6628e6bcecb3292acac802399c7f8edc0100619f9009",
|
|
10
10
|
"hashes": {
|
|
11
|
-
"sha256": "
|
|
11
|
+
"sha256": "ca5cc1069b85dc23070a6628e6bcecb3292acac802399c7f8edc0100619f9009"
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
},
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"metadata": {
|
|
19
19
|
"metadata_version": "2.4",
|
|
20
20
|
"name": "setuptools",
|
|
21
|
-
"version": "
|
|
21
|
+
"version": "80.7.1",
|
|
22
22
|
"dynamic": [
|
|
23
23
|
"license-file"
|
|
24
24
|
],
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"management"
|
|
34
34
|
],
|
|
35
35
|
"author_email": "Python Packaging Authority <distutils-sig@python.org>",
|
|
36
|
+
"license_expression": "MIT",
|
|
36
37
|
"license_file": [
|
|
37
38
|
"LICENSE"
|
|
38
39
|
],
|
|
@@ -125,9 +126,9 @@
|
|
|
125
126
|
"implementation_version": "3.9.21",
|
|
126
127
|
"os_name": "posix",
|
|
127
128
|
"platform_machine": "x86_64",
|
|
128
|
-
"platform_release": "5.15.0-
|
|
129
|
+
"platform_release": "5.15.0-1088-azure",
|
|
129
130
|
"platform_system": "Linux",
|
|
130
|
-
"platform_version": "#
|
|
131
|
+
"platform_version": "#97~20.04.1-Ubuntu SMP Wed Apr 23 13:25:03 UTC 2025",
|
|
131
132
|
"python_full_version": "3.9.21",
|
|
132
133
|
"platform_python_implementation": "CPython",
|
|
133
134
|
"python_version": "3.9",
|
|
Binary file
|
|
@@ -98,6 +98,7 @@ class CodeModel: # pylint: disable=too-many-public-methods, disable=too-many-in
|
|
|
98
98
|
self.has_subnamespace = False
|
|
99
99
|
self._operations_folder_name: Dict[str, str] = {}
|
|
100
100
|
self._relative_import_path: Dict[str, str] = {}
|
|
101
|
+
self.metadata: Dict[str, Any] = yaml_data.get("metadata", {})
|
|
101
102
|
|
|
102
103
|
@staticmethod
|
|
103
104
|
def get_imported_namespace_for_client(imported_namespace: str, async_mode: bool = False) -> str:
|
|
@@ -64,7 +64,9 @@ class OperationGroup(BaseModel):
|
|
|
64
64
|
)
|
|
65
65
|
|
|
66
66
|
def base_class(self, async_mode: bool) -> str:
|
|
67
|
-
pipeline_client =
|
|
67
|
+
pipeline_client = (
|
|
68
|
+
f"{'Async' if async_mode else ''}PipelineClient[HttpRequest, {'Async' if async_mode else ''}HttpResponse]"
|
|
69
|
+
)
|
|
68
70
|
base_classes: List[str] = []
|
|
69
71
|
if self.is_mixin:
|
|
70
72
|
base_classes.append(f"ClientMixinABC[{pipeline_client}, {self.client.name}Configuration]")
|
|
@@ -166,6 +168,16 @@ class OperationGroup(BaseModel):
|
|
|
166
168
|
"ClientMixinABC",
|
|
167
169
|
ImportType.LOCAL,
|
|
168
170
|
)
|
|
171
|
+
file_import.add_submodule_import(
|
|
172
|
+
"rest",
|
|
173
|
+
"HttpRequest",
|
|
174
|
+
ImportType.SDKCORE,
|
|
175
|
+
)
|
|
176
|
+
file_import.add_submodule_import(
|
|
177
|
+
"rest",
|
|
178
|
+
f"{'Async' if async_mode else ''}HttpResponse",
|
|
179
|
+
ImportType.SDKCORE,
|
|
180
|
+
)
|
|
169
181
|
else:
|
|
170
182
|
file_import.add_msrest_import(
|
|
171
183
|
serialize_namespace=kwargs.get("serialize_namespace", self.code_model.namespace),
|
|
@@ -16,6 +16,7 @@ from .imports import ImportType, FileImport, TypingSection
|
|
|
16
16
|
from .parameter_list import ParameterList
|
|
17
17
|
from .model_type import ModelType
|
|
18
18
|
from .list_type import ListType
|
|
19
|
+
from .parameter import Parameter
|
|
19
20
|
|
|
20
21
|
if TYPE_CHECKING:
|
|
21
22
|
from .code_model import CodeModel
|
|
@@ -59,6 +60,9 @@ class PagingOperationBase(OperationBase[PagingResponseType]):
|
|
|
59
60
|
self.pager_sync: str = yaml_data.get("pagerSync") or f"{self.code_model.core_library}.paging.ItemPaged"
|
|
60
61
|
self.pager_async: str = yaml_data.get("pagerAsync") or f"{self.code_model.core_library}.paging.AsyncItemPaged"
|
|
61
62
|
self.continuation_token: Dict[str, Any] = yaml_data.get("continuationToken", {})
|
|
63
|
+
self.next_link_reinjected_parameters: List[Parameter] = [
|
|
64
|
+
Parameter.from_yaml(p, code_model) for p in yaml_data.get("nextLinkReInjectedParameters", [])
|
|
65
|
+
]
|
|
62
66
|
|
|
63
67
|
@property
|
|
64
68
|
def has_continuation_token(self) -> bool:
|
|
@@ -118,9 +122,17 @@ class PagingOperationBase(OperationBase[PagingResponseType]):
|
|
|
118
122
|
def _imports_shared(self, async_mode: bool, **kwargs: Any) -> FileImport:
|
|
119
123
|
file_import = super()._imports_shared(async_mode, **kwargs)
|
|
120
124
|
if async_mode:
|
|
121
|
-
|
|
125
|
+
default_paging_submodule = f"{'async_' if self.code_model.is_azure_flavor else ''}paging"
|
|
126
|
+
file_import.add_submodule_import(
|
|
127
|
+
f"{self.code_model.core_library}.{default_paging_submodule}",
|
|
128
|
+
"AsyncItemPaged",
|
|
129
|
+
ImportType.SDKCORE,
|
|
130
|
+
TypingSection.CONDITIONAL,
|
|
131
|
+
)
|
|
122
132
|
else:
|
|
123
|
-
file_import.add_submodule_import(
|
|
133
|
+
file_import.add_submodule_import(
|
|
134
|
+
f"{self.code_model.core_library}.paging", "ItemPaged", ImportType.SDKCORE, TypingSection.CONDITIONAL
|
|
135
|
+
)
|
|
124
136
|
if (
|
|
125
137
|
self.next_request_builder
|
|
126
138
|
and self.code_model.options["builders_visibility"] == "embedded"
|
|
@@ -186,7 +186,7 @@ class PagingResponse(Response):
|
|
|
186
186
|
return self.get_pager_path(async_mode).split(".")[-1]
|
|
187
187
|
|
|
188
188
|
def type_annotation(self, **kwargs: Any) -> str:
|
|
189
|
-
iterable = "
|
|
189
|
+
iterable = "AsyncItemPaged" if kwargs["async_mode"] else "ItemPaged"
|
|
190
190
|
return f"{iterable}[{self.item_type.type_annotation(**kwargs)}]"
|
|
191
191
|
|
|
192
192
|
def docstring_text(self, **kwargs: Any) -> str:
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
# license information.
|
|
5
5
|
# --------------------------------------------------------------------------
|
|
6
6
|
import logging
|
|
7
|
+
import json
|
|
7
8
|
from collections import namedtuple
|
|
8
9
|
import re
|
|
9
10
|
from typing import List, Any, Union
|
|
@@ -143,6 +144,13 @@ class JinjaSerializer(ReaderAndWriter):
|
|
|
143
144
|
self._serialize_and_write_sample(env, namespace=client_namespace)
|
|
144
145
|
if self.code_model.options["generate_test"]:
|
|
145
146
|
self._serialize_and_write_test(env, namespace=client_namespace)
|
|
147
|
+
|
|
148
|
+
# add _metadata.json
|
|
149
|
+
if self.code_model.metadata:
|
|
150
|
+
self.write_file(
|
|
151
|
+
exec_path / Path("_metadata.json"),
|
|
152
|
+
json.dumps(self.code_model.metadata, indent=2),
|
|
153
|
+
)
|
|
146
154
|
elif client_namespace_type.clients:
|
|
147
155
|
# add clients folder if there are clients in this namespace
|
|
148
156
|
self._serialize_client_and_config_files(client_namespace, client_namespace_type.clients, env)
|
|
@@ -1276,6 +1276,17 @@ class _PagingOperationSerializer(_OperationSerializer[PagingOperationType]):
|
|
|
1276
1276
|
else api_version_param.full_client_name
|
|
1277
1277
|
)
|
|
1278
1278
|
retval.append(f'_next_request_params["api-version"] = {api_version}')
|
|
1279
|
+
if builder.next_link_reinjected_parameters:
|
|
1280
|
+
for param in builder.next_link_reinjected_parameters:
|
|
1281
|
+
if param.location == ParameterLocation.QUERY:
|
|
1282
|
+
retval.extend(
|
|
1283
|
+
self.parameter_serializer.serialize_query_header(
|
|
1284
|
+
param,
|
|
1285
|
+
"next_request_params",
|
|
1286
|
+
self.serializer_name,
|
|
1287
|
+
self.code_model.is_legacy,
|
|
1288
|
+
)
|
|
1289
|
+
)
|
|
1279
1290
|
query_str = ", params=_next_request_params"
|
|
1280
1291
|
next_link_str = "urllib.parse.urljoin(next_link, _parsed_next_link.path)"
|
|
1281
1292
|
except StopIteration:
|
|
@@ -63,7 +63,7 @@ class GeneralSerializer(BaseSerializer):
|
|
|
63
63
|
"token_credential": token_credential,
|
|
64
64
|
"pkgutil_names": [".".join(package_parts[: i + 1]) for i in range(len(package_parts))],
|
|
65
65
|
"init_names": ["/".join(package_parts[: i + 1]) + "/__init__.py" for i in range(len(package_parts))],
|
|
66
|
-
"client_name": self.code_model.clients[0].name,
|
|
66
|
+
"client_name": self.code_model.clients[0].name if self.code_model.clients else "",
|
|
67
67
|
"VERSION_MAP": VERSION_MAP,
|
|
68
68
|
"MIN_PYTHON_VERSION": MIN_PYTHON_VERSION,
|
|
69
69
|
"MAX_PYTHON_VERSION": MAX_PYTHON_VERSION,
|
|
@@ -29,7 +29,7 @@ class {{ operation_group.class_name }}: {{ operation_group.pylint_disable() }}
|
|
|
29
29
|
models = _models
|
|
30
30
|
|
|
31
31
|
{% endif %}
|
|
32
|
-
def __init__(self, *args, **kwargs)
|
|
32
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
33
33
|
input_args = list(args)
|
|
34
34
|
self._client: {{ 'Async' if async_mode else ''}}PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
35
35
|
self._config: {{ operation_group.client.name }}Configuration = input_args.pop(0) if input_args else kwargs.pop("config")
|
|
@@ -48,7 +48,7 @@ class {{ operation_group.class_name }}: {{ operation_group.pylint_disable() }}
|
|
|
48
48
|
{{ check_abstract_methods() }}
|
|
49
49
|
{% elif operation_group.has_abstract_operations %}
|
|
50
50
|
|
|
51
|
-
def __init__(self)
|
|
51
|
+
def __init__(self) -> None:
|
|
52
52
|
{{ check_abstract_methods() }}
|
|
53
53
|
{% endif %}
|
|
54
54
|
{% if operation_group.is_mixin and code_model.options["multiapi"] %}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{% import 'operation_tools.jinja2' as op_tools %}
|
|
2
2
|
{% set operations_description = "async operations" if async_mode else "operations" %}
|
|
3
|
-
{% set return_none_type_annotation = " -> None" if async_mode else "" %}
|
|
4
3
|
# coding=utf-8
|
|
5
4
|
{% if code_model.license_header %}
|
|
6
5
|
{{ code_model.license_header }}
|
|
@@ -40,7 +40,7 @@ python -m pip install {{ package_name }}
|
|
|
40
40
|
- You need an [Azure subscription][azure_sub] to use this package.
|
|
41
41
|
- An existing {{ package_pprint_name }} instance.
|
|
42
42
|
|
|
43
|
-
{% if token_credential %}
|
|
43
|
+
{% if token_credential and client_name %}
|
|
44
44
|
#### Create with an Azure Active Directory Credential
|
|
45
45
|
To use an [Azure Active Directory (AAD) token credential][authenticate_with_token],
|
|
46
46
|
provide an instance of the desired credential type obtained from the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorest/python",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.35.0",
|
|
4
4
|
"description": "The Python extension for generators in AutoRest.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@typespec/http-client-python": "~0.
|
|
22
|
+
"@typespec/http-client-python": "~0.12.0",
|
|
23
23
|
"@autorest/system-requirements": "~1.0.2",
|
|
24
24
|
"fs-extra": "~11.2.0",
|
|
25
25
|
"tsx": "~4.19.1"
|
|
Binary file
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# --------------------------------------------------------------------------
|
|
3
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
# Licensed under the MIT License. See License.txt in the project root for
|
|
5
|
-
# license information.
|
|
6
|
-
#
|
|
7
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
8
|
-
# Changes may cause incorrect behavior and will be lost if the code is
|
|
9
|
-
# regenerated.
|
|
10
|
-
# --------------------------------------------------------------------------
|