@autorest/python 6.32.3 → 6.34.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/m2r.py +1 -2
- package/autorest/m4reformatter/__init__.py +1 -2
- package/autorest/multiapi/models/imports.py +7 -2
- package/autorest/multiapi/serializers/__init__.py +5 -1
- package/autorest/multiapi/templates/multiapi_operations_mixin.py.jinja2 +1 -1
- package/autorest/multiapi/templates/multiapi_service_client.py.jinja2 +13 -2
- package/autorest/multiapi/templates/multiapi_utils_init.py.jinja2 +10 -0
- package/autorest/preprocess.py +1 -2
- package/generator/build/lib/pygen/codegen/models/client.py +39 -2
- package/generator/build/lib/pygen/codegen/models/code_model.py +22 -11
- package/generator/build/lib/pygen/codegen/models/enum_type.py +2 -2
- package/generator/build/lib/pygen/codegen/models/imports.py +13 -9
- package/generator/build/lib/pygen/codegen/models/lro_operation.py +1 -1
- package/generator/build/lib/pygen/codegen/models/model_type.py +4 -3
- package/generator/build/lib/pygen/codegen/models/operation.py +10 -3
- package/generator/build/lib/pygen/codegen/models/operation_group.py +27 -31
- package/generator/build/lib/pygen/codegen/models/paging_operation.py +3 -1
- package/generator/build/lib/pygen/codegen/models/parameter.py +4 -1
- package/generator/build/lib/pygen/codegen/models/primitive_types.py +2 -2
- package/generator/build/lib/pygen/codegen/models/property.py +1 -1
- package/generator/build/lib/pygen/codegen/serializers/__init__.py +31 -29
- package/generator/build/lib/pygen/codegen/serializers/builder_serializer.py +1 -1
- package/generator/build/lib/pygen/codegen/serializers/client_serializer.py +32 -6
- package/generator/build/lib/pygen/codegen/serializers/general_serializer.py +57 -35
- package/generator/build/lib/pygen/codegen/serializers/model_serializer.py +4 -3
- package/generator/build/lib/pygen/codegen/serializers/parameter_serializer.py +6 -1
- package/generator/build/lib/pygen/codegen/serializers/sample_serializer.py +2 -2
- package/generator/build/lib/pygen/codegen/templates/client.py.jinja2 +1 -1
- package/generator/build/lib/pygen/codegen/templates/config.py.jinja2 +2 -8
- package/generator/build/lib/pygen/codegen/templates/model_dpg.py.jinja2 +1 -1
- package/generator/build/lib/pygen/codegen/templates/operation_group.py.jinja2 +3 -3
- package/generator/build/lib/pygen/codegen/templates/packaging_templates/setup.py.jinja2 +12 -11
- package/generator/build/lib/pygen/codegen/templates/{vendor.py.jinja2 → utils.py.jinja2} +11 -12
- package/generator/component-detection-pip-report.json +4 -5
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/codegen/models/client.py +39 -2
- package/generator/pygen/codegen/models/code_model.py +22 -11
- package/generator/pygen/codegen/models/enum_type.py +2 -2
- package/generator/pygen/codegen/models/imports.py +13 -9
- package/generator/pygen/codegen/models/lro_operation.py +1 -1
- package/generator/pygen/codegen/models/model_type.py +4 -3
- package/generator/pygen/codegen/models/operation.py +10 -3
- package/generator/pygen/codegen/models/operation_group.py +27 -31
- package/generator/pygen/codegen/models/paging_operation.py +3 -1
- package/generator/pygen/codegen/models/parameter.py +4 -1
- package/generator/pygen/codegen/models/primitive_types.py +2 -2
- package/generator/pygen/codegen/models/property.py +1 -1
- package/generator/pygen/codegen/serializers/__init__.py +31 -29
- package/generator/pygen/codegen/serializers/builder_serializer.py +1 -1
- package/generator/pygen/codegen/serializers/client_serializer.py +32 -6
- package/generator/pygen/codegen/serializers/general_serializer.py +57 -35
- package/generator/pygen/codegen/serializers/model_serializer.py +4 -3
- package/generator/pygen/codegen/serializers/parameter_serializer.py +6 -1
- package/generator/pygen/codegen/serializers/sample_serializer.py +2 -2
- package/generator/pygen/codegen/templates/client.py.jinja2 +1 -1
- package/generator/pygen/codegen/templates/config.py.jinja2 +2 -8
- package/generator/pygen/codegen/templates/model_dpg.py.jinja2 +1 -1
- package/generator/pygen/codegen/templates/operation_group.py.jinja2 +3 -3
- package/generator/pygen/codegen/templates/packaging_templates/setup.py.jinja2 +12 -11
- package/generator/pygen/codegen/templates/{vendor.py.jinja2 → utils.py.jinja2} +11 -12
- package/generator/pygen.egg-info/SOURCES.txt +1 -1
- package/package.json +2 -2
- package/scripts/__pycache__/venvtools.cpython-310.pyc +0 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
{% if client.has_parameterized_host %}
|
|
10
10
|
{{ serializer.host_variable_name }} = {{ keywords.escape_str(client.url) }}
|
|
11
11
|
{% endif %}
|
|
12
|
-
{{ serializer.initialize_config() }}
|
|
12
|
+
{{ op_tools.serialize(serializer.initialize_config()) | indent(8) }}
|
|
13
13
|
{{ op_tools.serialize(serializer.initialize_pipeline_client(async_mode)) | indent(8) }}
|
|
14
14
|
|
|
15
15
|
{{ op_tools.serialize(serializer.serializers_and_operation_groups_properties()) | indent(8) }}
|
|
@@ -21,14 +21,8 @@ class {{ client.name }}Configuration: {{ client.config.pylint_disable() }}
|
|
|
21
21
|
{% if serializer.set_constants() %}
|
|
22
22
|
{{ op_tools.serialize(serializer.set_constants()) | indent(8) -}}
|
|
23
23
|
{% endif %}
|
|
24
|
-
{% if client.
|
|
25
|
-
|
|
26
|
-
{% if not cred_scopes %}
|
|
27
|
-
{% set cred_scopes = client.credential.type.types | selectattr("policy.credential_scopes") | first if client.credential.type.types is defined %}
|
|
28
|
-
{% endif %}
|
|
29
|
-
{% if cred_scopes %}
|
|
30
|
-
self.credential_scopes = kwargs.pop('credential_scopes', {{ cred_scopes.policy.credential_scopes }})
|
|
31
|
-
{% endif %}
|
|
24
|
+
{% if client.credential_scopes is not none %}
|
|
25
|
+
self.credential_scopes = kwargs.pop('credential_scopes', {{ client.credential_scopes }})
|
|
32
26
|
{% endif %}
|
|
33
27
|
kwargs.setdefault('sdk_moniker', '{{ client.config.sdk_moniker }}/{}'.format(VERSION))
|
|
34
28
|
self.polling_interval = kwargs.get("polling_interval", 30)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{% set base_class = ("(" + operation_group.base_class + ")") if operation_group.base_class else "" %}
|
|
1
|
+
{% set base_class = ("(" + operation_group.base_class(async_mode) + ")") if operation_group.base_class(async_mode) else "" %}
|
|
2
2
|
{% macro check_abstract_methods() %}
|
|
3
3
|
{% if operation_group.has_abstract_operations %}
|
|
4
4
|
raise_if_not_implemented(self.__class__, [
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
])
|
|
9
9
|
{% endif %}
|
|
10
10
|
{% endmacro %}
|
|
11
|
-
{% if operation_group.base_class %}
|
|
11
|
+
{% if operation_group.base_class(async_mode) %}
|
|
12
12
|
class {{ operation_group.class_name }}( {{ operation_group.pylint_disable() }}
|
|
13
|
-
{{ operation_group.base_class }}
|
|
13
|
+
{{ operation_group.base_class(async_mode) }}
|
|
14
14
|
):
|
|
15
15
|
{% else %}
|
|
16
16
|
class {{ operation_group.class_name }}: {{ operation_group.pylint_disable() }}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
|
+
{% set min_version = MIN_PYTHON_VERSION.split('.')[1] | int %}
|
|
3
|
+
{% set max_version = MAX_PYTHON_VERSION.split('.')[1] | int %}
|
|
2
4
|
{% if code_model.license_header %}
|
|
3
5
|
{{ code_model.license_header }}
|
|
4
6
|
{% endif %}
|
|
@@ -67,10 +69,9 @@ setup(
|
|
|
67
69
|
"Programming Language :: Python",
|
|
68
70
|
"Programming Language :: Python :: 3 :: Only",
|
|
69
71
|
"Programming Language :: Python :: 3",
|
|
70
|
-
|
|
71
|
-
"Programming Language :: Python :: 3.
|
|
72
|
-
|
|
73
|
-
"Programming Language :: Python :: 3.12",
|
|
72
|
+
{% for version in range(min_version, max_version + 1) %}
|
|
73
|
+
"Programming Language :: Python :: 3.{{ version }}",
|
|
74
|
+
{% endfor %}
|
|
74
75
|
"License :: OSI Approved :: MIT License",
|
|
75
76
|
],
|
|
76
77
|
zip_safe=False,
|
|
@@ -95,21 +96,21 @@ setup(
|
|
|
95
96
|
{% endif %}
|
|
96
97
|
install_requires=[
|
|
97
98
|
{% if code_model.is_legacy %}
|
|
98
|
-
"msrest>=
|
|
99
|
+
"msrest>={{ VERSION_MAP["msrest"] }}",
|
|
99
100
|
{% else %}
|
|
100
|
-
"isodate>=
|
|
101
|
+
"isodate>={{ VERSION_MAP["isodate"] }}",
|
|
101
102
|
{% endif %}
|
|
102
103
|
{% if azure_arm %}
|
|
103
|
-
"azure-mgmt-core>=
|
|
104
|
+
"azure-mgmt-core>={{ VERSION_MAP["azure-mgmt-core"] }}",
|
|
104
105
|
{% elif code_model.is_azure_flavor %}
|
|
105
|
-
"azure-core>=
|
|
106
|
+
"azure-core>={{ VERSION_MAP["azure-core"] }}",
|
|
106
107
|
{% else %}
|
|
107
|
-
"corehttp[requests]",
|
|
108
|
+
"corehttp[requests]>={{ VERSION_MAP["corehttp"] }}",
|
|
108
109
|
{% endif %}
|
|
109
|
-
"typing-extensions>=
|
|
110
|
+
"typing-extensions>={{ VERSION_MAP['typing-extensions'] }}",
|
|
110
111
|
],
|
|
111
112
|
{% if package_mode %}
|
|
112
|
-
python_requires=">=
|
|
113
|
+
python_requires=">={{ MIN_PYTHON_VERSION }}",
|
|
113
114
|
{% else %}
|
|
114
115
|
long_description="""\
|
|
115
116
|
{{ code_model.description }}
|
|
@@ -5,20 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
{{ imports }}
|
|
7
7
|
|
|
8
|
-
{% if code_model.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
):
|
|
8
|
+
{% if code_model.need_utils_mixin %}
|
|
9
|
+
|
|
10
|
+
TClient = TypeVar("TClient")
|
|
11
|
+
TConfig = TypeVar("TConfig")
|
|
12
|
+
|
|
13
|
+
class ClientMixinABC(ABC, Generic[TClient, TConfig]):
|
|
14
14
|
"""DO NOT use this class. It is for internal typing use only."""
|
|
15
|
-
_client:
|
|
16
|
-
_config:
|
|
15
|
+
_client: TClient
|
|
16
|
+
_config: TConfig
|
|
17
17
|
_serialize: "Serializer"
|
|
18
18
|
_deserialize: "Deserializer"
|
|
19
|
-
{% endfor %}
|
|
20
19
|
{% endif %}
|
|
21
|
-
{% if code_model.
|
|
20
|
+
{% if code_model.need_utils_abstract(client_namespace) %}
|
|
22
21
|
|
|
23
22
|
def raise_if_not_implemented(cls, abstract_methods):
|
|
24
23
|
not_implemented = [f for f in abstract_methods if not callable(getattr(cls, f, None))]
|
|
@@ -29,7 +28,7 @@ def raise_if_not_implemented(cls, abstract_methods):
|
|
|
29
28
|
)
|
|
30
29
|
{% endif %}
|
|
31
30
|
|
|
32
|
-
{% if code_model.
|
|
31
|
+
{% if code_model.need_utils_etag(client_namespace) %}
|
|
33
32
|
def quote_etag(etag: Optional[str]) -> Optional[str]:
|
|
34
33
|
if not etag or etag == "*":
|
|
35
34
|
return etag
|
|
@@ -59,7 +58,7 @@ def prep_if_none_match(etag: Optional[str], match_condition: Optional[MatchCondi
|
|
|
59
58
|
return "*"
|
|
60
59
|
return None
|
|
61
60
|
{% endif %}
|
|
62
|
-
{% if code_model.
|
|
61
|
+
{% if code_model.need_utils_form_data(async_mode, client_namespace) %}
|
|
63
62
|
# file-like tuple could be `(filename, IO (or bytes))` or `(filename, IO (or bytes), content_type)`
|
|
64
63
|
FileContent = Union[str, bytes, IO[str], IO[bytes]]
|
|
65
64
|
|
|
@@ -92,8 +92,8 @@ pygen/codegen/templates/serialization.py.jinja2
|
|
|
92
92
|
pygen/codegen/templates/test.py.jinja2
|
|
93
93
|
pygen/codegen/templates/testpreparer.py.jinja2
|
|
94
94
|
pygen/codegen/templates/types.py.jinja2
|
|
95
|
+
pygen/codegen/templates/utils.py.jinja2
|
|
95
96
|
pygen/codegen/templates/validation.py.jinja2
|
|
96
|
-
pygen/codegen/templates/vendor.py.jinja2
|
|
97
97
|
pygen/codegen/templates/version.py.jinja2
|
|
98
98
|
pygen/codegen/templates/packaging_templates/CHANGELOG.md.jinja2
|
|
99
99
|
pygen/codegen/templates/packaging_templates/LICENSE.jinja2
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorest/python",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.34.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.11.1",
|
|
23
23
|
"@autorest/system-requirements": "~1.0.2",
|
|
24
24
|
"fs-extra": "~11.2.0",
|
|
25
25
|
"tsx": "~4.19.1"
|
|
Binary file
|