@autorest/python 6.37.0 → 6.37.1
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/generator/build/lib/pygen/codegen/models/client.py +1 -3
- package/generator/build/lib/pygen/codegen/serializers/general_serializer.py +3 -3
- package/generator/build/lib/pygen/codegen/serializers/operations_init_serializer.py +7 -2
- package/generator/build/lib/pygen/codegen/serializers/sample_serializer.py +3 -2
- package/generator/build/lib/pygen/codegen/templates/sample.py.jinja2 +1 -1
- package/generator/build/lib/pygen/preprocess/python_mappings.py +4 -2
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/codegen/models/client.py +1 -3
- package/generator/pygen/codegen/serializers/general_serializer.py +3 -3
- package/generator/pygen/codegen/serializers/operations_init_serializer.py +7 -2
- package/generator/pygen/codegen/serializers/sample_serializer.py +3 -2
- package/generator/pygen/codegen/templates/sample.py.jinja2 +1 -1
- package/generator/pygen/preprocess/python_mappings.py +4 -2
- package/package.json +2 -2
- package/scripts/__pycache__/venvtools.cpython-310.pyc +0 -0
- package/scripts/eng/regenerate.ts +1 -5
- package/setup.py +1 -0
|
@@ -322,13 +322,11 @@ class Client(_ClientConfigBase[ClientGlobalParameterList]): # pylint: disable=t
|
|
|
322
322
|
)
|
|
323
323
|
serialize_namespace = kwargs.get("serialize_namespace", self.code_model.namespace)
|
|
324
324
|
for og in self.operation_groups:
|
|
325
|
-
suffix = f".{og.filename}" if (not self.code_model.options["multiapi"]) and og.is_mixin else ""
|
|
326
325
|
file_import.add_submodule_import(
|
|
327
326
|
self.code_model.get_relative_import_path(
|
|
328
327
|
serialize_namespace,
|
|
329
328
|
self.code_model.get_imported_namespace_for_operation(og.client_namespace, async_mode),
|
|
330
|
-
)
|
|
331
|
-
+ suffix,
|
|
329
|
+
),
|
|
332
330
|
og.class_name,
|
|
333
331
|
ImportType.LOCAL,
|
|
334
332
|
)
|
|
@@ -19,14 +19,14 @@ from .base_serializer import BaseSerializer
|
|
|
19
19
|
VERSION_MAP = {
|
|
20
20
|
"msrest": "0.7.1",
|
|
21
21
|
"isodate": "0.6.1",
|
|
22
|
-
"azure-mgmt-core": "1.
|
|
23
|
-
"azure-core": "1.
|
|
22
|
+
"azure-mgmt-core": "1.6.0",
|
|
23
|
+
"azure-core": "1.35.0",
|
|
24
24
|
"typing-extensions": "4.6.0",
|
|
25
25
|
"corehttp": "1.0.0b6",
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
MIN_PYTHON_VERSION = "3.9"
|
|
29
|
-
MAX_PYTHON_VERSION = "3.
|
|
29
|
+
MAX_PYTHON_VERSION = "3.13"
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
class GeneralSerializer(BaseSerializer):
|
|
@@ -9,6 +9,12 @@ from jinja2 import Environment
|
|
|
9
9
|
from ..models import CodeModel, OperationGroup
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
def get_pylint_disable(code_model: CodeModel, og: OperationGroup) -> str:
|
|
13
|
+
if og.is_mixin and not code_model.options["multiapi"]:
|
|
14
|
+
return " # pylint: disable=unused-import"
|
|
15
|
+
return ""
|
|
16
|
+
|
|
17
|
+
|
|
12
18
|
class OperationsInitSerializer:
|
|
13
19
|
def __init__(
|
|
14
20
|
self,
|
|
@@ -27,9 +33,8 @@ class OperationsInitSerializer:
|
|
|
27
33
|
return "_operations" if self.code_model.options["combine-operation-files"] else operation_group.filename
|
|
28
34
|
|
|
29
35
|
return [
|
|
30
|
-
f"from .{_get_filename(og)} import {og.class_name}
|
|
36
|
+
f"from .{_get_filename(og)} import {og.class_name} # type: ignore{get_pylint_disable(self.code_model, og)}"
|
|
31
37
|
for og in self.operation_groups
|
|
32
|
-
if not og.is_mixin or self.code_model.options["multiapi"]
|
|
33
38
|
]
|
|
34
39
|
|
|
35
40
|
def serialize(self) -> str:
|
|
@@ -69,7 +69,7 @@ class SampleSerializer(BaseSerializer):
|
|
|
69
69
|
def _client_params(self) -> Dict[str, Any]:
|
|
70
70
|
# client params
|
|
71
71
|
special_param = {}
|
|
72
|
-
credential_type = getattr(self.
|
|
72
|
+
credential_type = getattr(self.operation_group.client.credential, "type", None)
|
|
73
73
|
if isinstance(credential_type, TokenCredentialType):
|
|
74
74
|
special_param.update({"credential": "DefaultAzureCredential()"})
|
|
75
75
|
elif isinstance(credential_type, KeyCredentialType):
|
|
@@ -78,7 +78,7 @@ class SampleSerializer(BaseSerializer):
|
|
|
78
78
|
params = [
|
|
79
79
|
p
|
|
80
80
|
for p in (
|
|
81
|
-
self.
|
|
81
|
+
self.operation_group.client.parameters.positional + self.operation_group.client.parameters.keyword_only
|
|
82
82
|
)
|
|
83
83
|
if not p.optional and p.client_default_value is None
|
|
84
84
|
]
|
|
@@ -153,6 +153,7 @@ class SampleSerializer(BaseSerializer):
|
|
|
153
153
|
operation_result, return_var = self._operation_result()
|
|
154
154
|
return self.env.get_template("sample.py.jinja2").render(
|
|
155
155
|
code_model=self.code_model,
|
|
156
|
+
client=self.operation_group.client,
|
|
156
157
|
file_name=self.file_name,
|
|
157
158
|
operation_result=operation_result,
|
|
158
159
|
operation_params=self._operation_params(),
|
|
@@ -97,7 +97,7 @@ _always_reserved = [
|
|
|
97
97
|
"int",
|
|
98
98
|
]
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
RESERVED_TSP_MODEL_PROPERTIES = [
|
|
101
101
|
"keys",
|
|
102
102
|
"items",
|
|
103
103
|
"values",
|
|
@@ -109,6 +109,8 @@ RESERVED_MODEL_PROPERTIES = [
|
|
|
109
109
|
"get",
|
|
110
110
|
"copy",
|
|
111
111
|
"as_dict",
|
|
112
|
+
# following are reserved special words for TSP models
|
|
113
|
+
"datetime",
|
|
112
114
|
]
|
|
113
115
|
|
|
114
116
|
RESERVED_WORDS = {
|
|
@@ -187,7 +189,7 @@ RESERVED_WORDS = {
|
|
|
187
189
|
|
|
188
190
|
TSP_RESERVED_WORDS = {
|
|
189
191
|
PadType.PARAMETER: ["stream"],
|
|
190
|
-
PadType.PROPERTY:
|
|
192
|
+
PadType.PROPERTY: RESERVED_TSP_MODEL_PROPERTIES,
|
|
191
193
|
}
|
|
192
194
|
|
|
193
195
|
REDEFINED_BUILTINS = [ # we don't pad, but we need to do lint ignores
|
|
Binary file
|
|
@@ -322,13 +322,11 @@ class Client(_ClientConfigBase[ClientGlobalParameterList]): # pylint: disable=t
|
|
|
322
322
|
)
|
|
323
323
|
serialize_namespace = kwargs.get("serialize_namespace", self.code_model.namespace)
|
|
324
324
|
for og in self.operation_groups:
|
|
325
|
-
suffix = f".{og.filename}" if (not self.code_model.options["multiapi"]) and og.is_mixin else ""
|
|
326
325
|
file_import.add_submodule_import(
|
|
327
326
|
self.code_model.get_relative_import_path(
|
|
328
327
|
serialize_namespace,
|
|
329
328
|
self.code_model.get_imported_namespace_for_operation(og.client_namespace, async_mode),
|
|
330
|
-
)
|
|
331
|
-
+ suffix,
|
|
329
|
+
),
|
|
332
330
|
og.class_name,
|
|
333
331
|
ImportType.LOCAL,
|
|
334
332
|
)
|
|
@@ -19,14 +19,14 @@ from .base_serializer import BaseSerializer
|
|
|
19
19
|
VERSION_MAP = {
|
|
20
20
|
"msrest": "0.7.1",
|
|
21
21
|
"isodate": "0.6.1",
|
|
22
|
-
"azure-mgmt-core": "1.
|
|
23
|
-
"azure-core": "1.
|
|
22
|
+
"azure-mgmt-core": "1.6.0",
|
|
23
|
+
"azure-core": "1.35.0",
|
|
24
24
|
"typing-extensions": "4.6.0",
|
|
25
25
|
"corehttp": "1.0.0b6",
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
MIN_PYTHON_VERSION = "3.9"
|
|
29
|
-
MAX_PYTHON_VERSION = "3.
|
|
29
|
+
MAX_PYTHON_VERSION = "3.13"
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
class GeneralSerializer(BaseSerializer):
|
|
@@ -9,6 +9,12 @@ from jinja2 import Environment
|
|
|
9
9
|
from ..models import CodeModel, OperationGroup
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
def get_pylint_disable(code_model: CodeModel, og: OperationGroup) -> str:
|
|
13
|
+
if og.is_mixin and not code_model.options["multiapi"]:
|
|
14
|
+
return " # pylint: disable=unused-import"
|
|
15
|
+
return ""
|
|
16
|
+
|
|
17
|
+
|
|
12
18
|
class OperationsInitSerializer:
|
|
13
19
|
def __init__(
|
|
14
20
|
self,
|
|
@@ -27,9 +33,8 @@ class OperationsInitSerializer:
|
|
|
27
33
|
return "_operations" if self.code_model.options["combine-operation-files"] else operation_group.filename
|
|
28
34
|
|
|
29
35
|
return [
|
|
30
|
-
f"from .{_get_filename(og)} import {og.class_name}
|
|
36
|
+
f"from .{_get_filename(og)} import {og.class_name} # type: ignore{get_pylint_disable(self.code_model, og)}"
|
|
31
37
|
for og in self.operation_groups
|
|
32
|
-
if not og.is_mixin or self.code_model.options["multiapi"]
|
|
33
38
|
]
|
|
34
39
|
|
|
35
40
|
def serialize(self) -> str:
|
|
@@ -69,7 +69,7 @@ class SampleSerializer(BaseSerializer):
|
|
|
69
69
|
def _client_params(self) -> Dict[str, Any]:
|
|
70
70
|
# client params
|
|
71
71
|
special_param = {}
|
|
72
|
-
credential_type = getattr(self.
|
|
72
|
+
credential_type = getattr(self.operation_group.client.credential, "type", None)
|
|
73
73
|
if isinstance(credential_type, TokenCredentialType):
|
|
74
74
|
special_param.update({"credential": "DefaultAzureCredential()"})
|
|
75
75
|
elif isinstance(credential_type, KeyCredentialType):
|
|
@@ -78,7 +78,7 @@ class SampleSerializer(BaseSerializer):
|
|
|
78
78
|
params = [
|
|
79
79
|
p
|
|
80
80
|
for p in (
|
|
81
|
-
self.
|
|
81
|
+
self.operation_group.client.parameters.positional + self.operation_group.client.parameters.keyword_only
|
|
82
82
|
)
|
|
83
83
|
if not p.optional and p.client_default_value is None
|
|
84
84
|
]
|
|
@@ -153,6 +153,7 @@ class SampleSerializer(BaseSerializer):
|
|
|
153
153
|
operation_result, return_var = self._operation_result()
|
|
154
154
|
return self.env.get_template("sample.py.jinja2").render(
|
|
155
155
|
code_model=self.code_model,
|
|
156
|
+
client=self.operation_group.client,
|
|
156
157
|
file_name=self.file_name,
|
|
157
158
|
operation_result=operation_result,
|
|
158
159
|
operation_params=self._operation_params(),
|
|
@@ -97,7 +97,7 @@ _always_reserved = [
|
|
|
97
97
|
"int",
|
|
98
98
|
]
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
RESERVED_TSP_MODEL_PROPERTIES = [
|
|
101
101
|
"keys",
|
|
102
102
|
"items",
|
|
103
103
|
"values",
|
|
@@ -109,6 +109,8 @@ RESERVED_MODEL_PROPERTIES = [
|
|
|
109
109
|
"get",
|
|
110
110
|
"copy",
|
|
111
111
|
"as_dict",
|
|
112
|
+
# following are reserved special words for TSP models
|
|
113
|
+
"datetime",
|
|
112
114
|
]
|
|
113
115
|
|
|
114
116
|
RESERVED_WORDS = {
|
|
@@ -187,7 +189,7 @@ RESERVED_WORDS = {
|
|
|
187
189
|
|
|
188
190
|
TSP_RESERVED_WORDS = {
|
|
189
191
|
PadType.PARAMETER: ["stream"],
|
|
190
|
-
PadType.PROPERTY:
|
|
192
|
+
PadType.PROPERTY: RESERVED_TSP_MODEL_PROPERTIES,
|
|
191
193
|
}
|
|
192
194
|
|
|
193
195
|
REDEFINED_BUILTINS = [ # we don't pad, but we need to do lint ignores
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorest/python",
|
|
3
|
-
"version": "6.37.
|
|
3
|
+
"version": "6.37.1",
|
|
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.14.
|
|
22
|
+
"@typespec/http-client-python": "~0.14.1",
|
|
23
23
|
"@autorest/system-requirements": "~1.0.2",
|
|
24
24
|
"fs-extra": "~11.2.0",
|
|
25
25
|
"tsx": "~4.19.1"
|
|
Binary file
|
|
@@ -119,11 +119,6 @@ function getEmitterOption(spec: string): Record<string, string>[] {
|
|
|
119
119
|
|
|
120
120
|
// Function to execute CLI commands asynchronously
|
|
121
121
|
async function executeCommand(tspCommand: TspCommand): Promise<void> {
|
|
122
|
-
try {
|
|
123
|
-
rmSync(tspCommand.outputDir, { recursive: true, force: true });
|
|
124
|
-
} catch (error) {
|
|
125
|
-
console.error(`rm error: ${error}`);
|
|
126
|
-
}
|
|
127
122
|
try {
|
|
128
123
|
console.log(`exec: ${tspCommand.command}`);
|
|
129
124
|
const { stdout, stderr } = await exec(tspCommand.command);
|
|
@@ -131,6 +126,7 @@ async function executeCommand(tspCommand: TspCommand): Promise<void> {
|
|
|
131
126
|
if (stderr) console.error(`stderr: ${stderr}`);
|
|
132
127
|
} catch (error) {
|
|
133
128
|
console.error(`exec error: ${error}`);
|
|
129
|
+
rmSync(tspCommand.outputDir, { recursive: true, force: true });
|
|
134
130
|
throw error;
|
|
135
131
|
}
|
|
136
132
|
}
|
package/setup.py
CHANGED
|
@@ -38,6 +38,7 @@ setup(
|
|
|
38
38
|
"Programming Language :: Python :: 3.10",
|
|
39
39
|
"Programming Language :: Python :: 3.11",
|
|
40
40
|
"Programming Language :: Python :: 3.12",
|
|
41
|
+
"Programming Language :: Python :: 3.13",
|
|
41
42
|
"License :: OSI Approved :: MIT License",
|
|
42
43
|
],
|
|
43
44
|
packages=find_packages(
|