@autorest/python 5.12.4 → 5.13.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/ChangeLog.md +173 -109
- package/autorest/black/__init__.py +7 -1
- package/autorest/codegen/__init__.py +12 -2
- package/autorest/codegen/models/__init__.py +2 -1
- package/autorest/codegen/models/client.py +22 -19
- package/autorest/codegen/models/constant_schema.py +0 -4
- package/autorest/codegen/models/credential_schema.py +3 -3
- package/autorest/codegen/models/dictionary_schema.py +1 -1
- package/autorest/codegen/models/enum_schema.py +2 -2
- package/autorest/codegen/models/imports.py +90 -50
- package/autorest/codegen/models/list_schema.py +1 -1
- package/autorest/codegen/models/lro_operation.py +15 -9
- package/autorest/codegen/models/object_schema.py +2 -2
- package/autorest/codegen/models/operation.py +39 -30
- package/autorest/codegen/models/operation_group.py +5 -14
- package/autorest/codegen/models/paging_operation.py +9 -9
- package/autorest/codegen/models/parameter.py +37 -11
- package/autorest/codegen/models/parameter_list.py +11 -4
- package/autorest/codegen/models/primitive_schemas.py +2 -2
- package/autorest/codegen/models/property.py +1 -1
- package/autorest/codegen/models/request_builder.py +7 -6
- package/autorest/codegen/models/request_builder_parameter.py +5 -0
- package/autorest/codegen/models/request_builder_parameter_list.py +1 -0
- package/autorest/codegen/models/schema_response.py +1 -1
- package/autorest/codegen/serializers/__init__.py +75 -71
- package/autorest/codegen/serializers/builder_serializer.py +68 -37
- package/autorest/codegen/serializers/client_serializer.py +14 -3
- package/autorest/codegen/serializers/general_serializer.py +7 -7
- package/autorest/codegen/serializers/import_serializer.py +44 -46
- package/autorest/codegen/serializers/metadata_serializer.py +12 -10
- package/autorest/codegen/serializers/utils.py +5 -1
- package/autorest/codegen/templates/config.py.jinja2 +2 -7
- package/autorest/codegen/templates/lro_operation.py.jinja2 +3 -1
- package/autorest/codegen/templates/lro_paging_operation.py.jinja2 +2 -0
- package/autorest/codegen/templates/operation.py.jinja2 +8 -2
- package/autorest/codegen/templates/operation_group.py.jinja2 +2 -1
- package/autorest/codegen/templates/operation_groups_container.py.jinja2 +1 -0
- package/autorest/codegen/templates/operation_tools.jinja2 +3 -2
- package/autorest/codegen/templates/paging_operation.py.jinja2 +3 -1
- package/autorest/codegen/templates/request_builder.py.jinja2 +2 -7
- package/autorest/codegen/templates/service_client.py.jinja2 +1 -1
- package/autorest/multiapi/models/imports.py +1 -1
- package/autorest/multiapi/serializers/import_serializer.py +1 -1
- package/autorest/namer/name_converter.py +1 -1
- package/package.json +2 -2
- package/run-python3.js +1 -7
- package/venvtools.py +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{% macro wrap_string(string, wrapstring) %}{{ string | wordwrap(width=
|
|
1
|
+
{% macro wrap_string(string, wrapstring, width=95) %}{{ string | wordwrap(width=width, break_long_words=False, break_on_hyphens=False, wrapstring=wrapstring)}}{% endmacro %}
|
|
2
2
|
|
|
3
3
|
{% macro description(builder, serializer) %}
|
|
4
4
|
{% for description in serializer.description_and_summary(builder) %}
|
|
@@ -22,7 +22,8 @@ Example:
|
|
|
22
22
|
.. code-block:: python
|
|
23
23
|
{% for template_line in serializer.get_example_template(builder) %}
|
|
24
24
|
{% if template_line %}
|
|
25
|
-
|
|
25
|
+
{% set wrap_amount = (template_line | length) - (template_line.lstrip() | length) + 10 %}
|
|
26
|
+
{{ wrap_string(template_line, wrapstring='\n' + " " * wrap_amount, width=(95 - wrap_amount)) }}
|
|
26
27
|
{% else %}
|
|
27
28
|
|
|
28
29
|
{% endif %}
|
|
@@ -17,4 +17,6 @@
|
|
|
17
17
|
return {{ operation.get_pager(async_mode) }}(
|
|
18
18
|
get_next, extract_data
|
|
19
19
|
)
|
|
20
|
-
{
|
|
20
|
+
{% if not code_model.options["version_tolerant"] %}
|
|
21
|
+
{{ operation_serializer.get_metadata_url(operation) -}}
|
|
22
|
+
{% endif %}
|
|
@@ -13,15 +13,10 @@
|
|
|
13
13
|
{% endfor %}
|
|
14
14
|
{% endif %}
|
|
15
15
|
# Construct URL
|
|
16
|
-
{
|
|
17
|
-
{% set url_value = keywords.escape_str(request_builder.url) %}
|
|
18
|
-
{% else %}
|
|
19
|
-
{% set url_value = 'kwargs.pop("template_url", ' + keywords.escape_str(request_builder.url) + ')' %}
|
|
20
|
-
{% endif %}
|
|
21
|
-
url = {{ url_value }}
|
|
16
|
+
{{ request_builder_serializer.construct_url(request_builder) }}
|
|
22
17
|
{% if request_builder.parameters.path %}
|
|
23
18
|
{{ op_tools.serialize(request_builder_serializer.serialize_path(request_builder)) | indent }}
|
|
24
|
-
|
|
19
|
+
_url = _format_url_section(_url, **path_format_arguments)
|
|
25
20
|
{% endif %}
|
|
26
21
|
|
|
27
22
|
{% if request_builder.parameters.query %}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
{{ imports }}
|
|
8
8
|
|
|
9
9
|
{{ serializer.class_definition(async_mode) }}
|
|
10
|
-
"""{{ code_model.description }}
|
|
10
|
+
"""{{ op_tools.wrap_string(code_model.description, "\n") | indent }}
|
|
11
11
|
|
|
12
12
|
{{ op_tools.serialize_with_wrap(serializer.property_descriptions(async_mode), "\n ") | indent }}
|
|
13
13
|
{{ serializer.init_signature_and_response_type_annotation(async_mode) | indent }}
|
|
@@ -62,7 +62,7 @@ class FileImportSerializer:
|
|
|
62
62
|
self._file_import.imports.get(TypingSection.TYPING) or
|
|
63
63
|
(not self.is_python3_file and self._file_import.imports.get(TypingSection.CONDITIONAL))
|
|
64
64
|
):
|
|
65
|
-
self._file_import.
|
|
65
|
+
self._file_import.add_submodule_import("typing", "TYPE_CHECKING", ImportType.STDLIB)
|
|
66
66
|
|
|
67
67
|
def __str__(self) -> str:
|
|
68
68
|
self._add_type_checking_import()
|
|
@@ -373,7 +373,7 @@ class NameConverter:
|
|
|
373
373
|
# check to see if name is reserved for the type of name we are converting
|
|
374
374
|
pad_string = cast(PadType, pad_string)
|
|
375
375
|
# there are some private variables, such as grouped parameters
|
|
376
|
-
# that are private. We still want to escape them for
|
|
376
|
+
# that are private. We still want to escape them for DPG
|
|
377
377
|
name_prefix = ""
|
|
378
378
|
if name[0] == "_":
|
|
379
379
|
# i am private
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorest/python",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.13.0",
|
|
4
4
|
"description": "The Python extension for generators in AutoRest.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "node run-python3.js prepare.py",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@azure-tools/extension": "~3.2.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@microsoft.azure/autorest.testserver": "^3.
|
|
30
|
+
"@microsoft.azure/autorest.testserver": "^3.3.20"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"autorest/**/*.py",
|
package/run-python3.js
CHANGED
|
@@ -18,12 +18,6 @@ async function runPython3(scriptName, debug = "") {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
runPython3(...process.argv.slice(2)).catch(err => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// Python script errors are already written out via stderr so don't
|
|
24
|
-
// write them twice. Write out all other errors to stderr.
|
|
25
|
-
if (!error.startsWith("Error: Command failed")) {
|
|
26
|
-
console.error(error);
|
|
27
|
-
}
|
|
21
|
+
console.error(err.toString());
|
|
28
22
|
process.exit(1);
|
|
29
23
|
});
|
package/venvtools.py
CHANGED
|
@@ -62,13 +62,13 @@ def python_run(venv_context, module, command=None, *, additional_dir=".", error_
|
|
|
62
62
|
venv_context.env_exe,
|
|
63
63
|
"-m", module
|
|
64
64
|
] + (command if command else [])
|
|
65
|
-
print("Executing: {}".format(" ".join(cmd_line))
|
|
65
|
+
print("Executing: {}".format(" ".join(cmd_line)))
|
|
66
66
|
subprocess.run(
|
|
67
67
|
cmd_line,
|
|
68
68
|
cwd=_ROOT_DIR / additional_dir,
|
|
69
69
|
check=True,
|
|
70
70
|
)
|
|
71
71
|
except subprocess.CalledProcessError as err:
|
|
72
|
-
print(err
|
|
72
|
+
print(err)
|
|
73
73
|
if not error_ok:
|
|
74
74
|
sys.exit(1)
|