@autorest/python 6.1.6 → 6.1.7

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.
@@ -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 %}
@@ -38,7 +38,7 @@
38
38
  _attribute_map = {
39
39
  {% if model.properties %}
40
40
  {% for p in model.properties %}
41
- {{ p.attribute_map }}
41
+ {{ serializer.declare_property(p) }}
42
42
  {% endfor %}
43
43
  {% endif %}
44
44
  }
@@ -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/package.json CHANGED
@@ -1,13 +1,7 @@
1
1
  {
2
2
  "name": "@autorest/python",
3
- "version": "6.1.6",
3
+ "version": "6.1.7",
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.7.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
+ }