@autorest/python 6.1.6 → 6.1.8
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/_utils.py +22 -3
- package/autorest/black/__init__.py +2 -2
- package/autorest/cadlflags/__init__.py +4 -2
- package/autorest/codegen/__init__.py +8 -4
- package/autorest/codegen/models/__init__.py +1 -1
- package/autorest/codegen/models/client.py +5 -3
- package/autorest/codegen/models/combined_type.py +6 -4
- package/autorest/codegen/models/enum_type.py +6 -4
- package/autorest/codegen/models/model_type.py +30 -9
- package/autorest/codegen/models/operation.py +21 -0
- package/autorest/codegen/models/operation_group.py +6 -7
- package/autorest/codegen/models/parameter.py +37 -0
- package/autorest/codegen/models/property.py +8 -15
- package/autorest/codegen/models/request_builder_parameter.py +4 -2
- package/autorest/codegen/serializers/__init__.py +12 -2
- package/autorest/codegen/serializers/builder_serializer.py +42 -20
- package/autorest/codegen/serializers/client_serializer.py +3 -4
- package/autorest/codegen/serializers/general_serializer.py +4 -0
- package/autorest/codegen/serializers/model_serializer.py +159 -61
- package/autorest/codegen/templates/model_base.py.jinja2 +636 -0
- package/autorest/codegen/templates/model_container.py.jinja2 +6 -2
- package/autorest/codegen/templates/model_dpg.py.jinja2 +62 -0
- package/autorest/codegen/templates/model_init.py.jinja2 +0 -5
- package/autorest/codegen/templates/{model.py.jinja2 → model_msrest.py.jinja2} +1 -1
- package/autorest/codegen/templates/operation_group.py.jinja2 +1 -1
- package/autorest/m2r/__init__.py +4 -2
- package/autorest/preprocess/__init__.py +2 -2
- package/package.json +9 -10
- package/ChangeLog.md +0 -1299
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{# actual template starts here #}
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
{{ serializer.declare_model(model) }}
|
|
5
|
+
"""{{ model.description(is_operation_file=False) }}
|
|
6
|
+
{% if model.discriminated_subtypes %}
|
|
7
|
+
|
|
8
|
+
{{ serializer.discriminator_docstring(model) | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}
|
|
9
|
+
{% endif %}
|
|
10
|
+
{% if model.has_readonly_or_constant_property %}
|
|
11
|
+
|
|
12
|
+
Variables are only populated by the server, and will be ignored when sending a request.
|
|
13
|
+
{% endif %}
|
|
14
|
+
{% if (model.properties | selectattr('optional', "equalto", false) | first) is defined %}
|
|
15
|
+
|
|
16
|
+
All required parameters must be populated in order to send to Azure.
|
|
17
|
+
{% endif %}
|
|
18
|
+
|
|
19
|
+
{% if model.properties != None %}
|
|
20
|
+
{% for p in model.properties %}
|
|
21
|
+
{% for line in serializer.variable_documentation_string(p) %}
|
|
22
|
+
{% for doc_string in line.replace('\n', '\n ').split('\n') %}
|
|
23
|
+
{{ doc_string | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}
|
|
24
|
+
{% endfor %}
|
|
25
|
+
{% endfor %}
|
|
26
|
+
{% endfor %}
|
|
27
|
+
{% endif %}
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
{% if model.is_polymorphic %}
|
|
31
|
+
__mapping__ = {}
|
|
32
|
+
{% endif %}
|
|
33
|
+
{% for p in serializer.get_properties_to_initialize(model)%}
|
|
34
|
+
{% for line in serializer.declare_property(p) %}
|
|
35
|
+
{{ line }}
|
|
36
|
+
{% endfor %}
|
|
37
|
+
{% endfor %}
|
|
38
|
+
|
|
39
|
+
{% if model.is_public and serializer.init_line(model) %}
|
|
40
|
+
@overload
|
|
41
|
+
def __init__(
|
|
42
|
+
self,
|
|
43
|
+
{% for param_signature in serializer.init_line(model) %}
|
|
44
|
+
{{ param_signature }}
|
|
45
|
+
{% endfor %}
|
|
46
|
+
):
|
|
47
|
+
...
|
|
48
|
+
|
|
49
|
+
@overload
|
|
50
|
+
def __init__(self, mapping: Mapping[str, Any]):
|
|
51
|
+
"""
|
|
52
|
+
:param mapping: raw JSON to initialize the model.
|
|
53
|
+
:type mapping: Mapping[str, Any]
|
|
54
|
+
"""
|
|
55
|
+
...
|
|
56
|
+
|
|
57
|
+
{% endif %}
|
|
58
|
+
def __init__(self, *args, **kwargs):
|
|
59
|
+
super().__init__(*args, **kwargs)
|
|
60
|
+
{% if model.discriminator_value %}
|
|
61
|
+
{{ serializer.initialize_discriminator_property(model, model.discriminator_property) }}
|
|
62
|
+
{% endif %}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
{% import 'keywords.jinja2' as keywords %}
|
|
2
2
|
# coding=utf-8
|
|
3
3
|
{{ code_model.options['license_header'] }}
|
|
4
|
-
{% macro iterate_models_py3() %}
|
|
5
|
-
{% for schema in schemas %}
|
|
6
|
-
from .{{ code_model.models_filename }} import {{ schema }}
|
|
7
|
-
{% endfor %}
|
|
8
|
-
{% endmacro %}
|
|
9
4
|
{% if schemas %}
|
|
10
5
|
|
|
11
6
|
{% for schema in schemas %}
|
|
@@ -20,7 +20,7 @@ class {{ operation_group.class_name }}{{ base_class }}:{{ disable }}
|
|
|
20
20
|
:attr:`{{ operation_group.property_name }}` attribute.
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
|
-
{% if code_model.public_model_types and code_model.options["models_mode"]%}
|
|
23
|
+
{% if code_model.public_model_types and code_model.options["models_mode"] == "msrest" %}
|
|
24
24
|
models = _models
|
|
25
25
|
|
|
26
26
|
{% endif %}
|
package/autorest/m2r/__init__.py
CHANGED
|
@@ -68,5 +68,7 @@ class M2RAutorest(YamlUpdatePluginAutorest, M2R):
|
|
|
68
68
|
|
|
69
69
|
if __name__ == "__main__":
|
|
70
70
|
# CADL pipeline will call this
|
|
71
|
-
args = parse_args()
|
|
72
|
-
M2R(
|
|
71
|
+
args, unknown_args = parse_args()
|
|
72
|
+
M2R(
|
|
73
|
+
output_folder=args.output_folder, cadl_file=args.cadl_file, **unknown_args
|
|
74
|
+
).process()
|
|
@@ -363,7 +363,7 @@ class PreProcessPluginAutorest(YamlUpdatePluginAutorest, PreProcessPlugin):
|
|
|
363
363
|
|
|
364
364
|
if __name__ == "__main__":
|
|
365
365
|
# CADL pipeline will call this
|
|
366
|
-
args = parse_args()
|
|
366
|
+
args, unknown_args = parse_args()
|
|
367
367
|
PreProcessPlugin(
|
|
368
|
-
output_folder=args.output_folder, cadl_file=args.cadl_file
|
|
368
|
+
output_folder=args.output_folder, cadl_file=args.cadl_file, **unknown_args
|
|
369
369
|
).process()
|
package/package.json
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorest/python",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.8",
|
|
4
4
|
"description": "The Python extension for generators in AutoRest.",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"prepare": "node run-python3.js prepare.py",
|
|
7
|
-
"start": "node run-python3.js start.py",
|
|
8
|
-
"install": "node run-python3.js install.py",
|
|
9
|
-
"debug": "node run-python3.js start.py --debug"
|
|
10
|
-
},
|
|
11
5
|
"repository": {
|
|
12
6
|
"type": "git",
|
|
13
7
|
"url": "https://github.com/Azure/autorest.python/tree/autorestv3"
|
|
@@ -28,7 +22,7 @@
|
|
|
28
22
|
},
|
|
29
23
|
"devDependencies": {
|
|
30
24
|
"@microsoft.azure/autorest.testserver": "^3.3.38",
|
|
31
|
-
"typescript": "^4.
|
|
25
|
+
"typescript": "^4.8.3"
|
|
32
26
|
},
|
|
33
27
|
"files": [
|
|
34
28
|
"autorest/**/*.py",
|
|
@@ -41,5 +35,10 @@
|
|
|
41
35
|
"run-python3.js",
|
|
42
36
|
"requirements.txt",
|
|
43
37
|
"run_cadl.py"
|
|
44
|
-
]
|
|
45
|
-
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"start": "node run-python3.js start.py",
|
|
41
|
+
"install": "node run-python3.js install.py",
|
|
42
|
+
"debug": "node run-python3.js start.py --debug"
|
|
43
|
+
}
|
|
44
|
+
}
|