@autorest/python 6.2.8 → 6.2.9
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.
|
@@ -30,7 +30,11 @@ class ListType(BaseType):
|
|
|
30
30
|
return f"[{self.element_type.serialization_type}]"
|
|
31
31
|
|
|
32
32
|
def type_annotation(self, **kwargs: Any) -> str:
|
|
33
|
-
if
|
|
33
|
+
if (
|
|
34
|
+
self.code_model.options["version_tolerant"]
|
|
35
|
+
and self.element_type.is_xml
|
|
36
|
+
and not self.code_model.options["models_mode"]
|
|
37
|
+
):
|
|
34
38
|
# this means we're version tolerant XML, we just return the XML element
|
|
35
39
|
return self.element_type.type_annotation(**kwargs)
|
|
36
40
|
return f"List[{self.element_type.type_annotation(**kwargs)}]"
|
|
@@ -140,7 +144,9 @@ class ListType(BaseType):
|
|
|
140
144
|
def imports(self, **kwargs: Any) -> FileImport:
|
|
141
145
|
file_import = FileImport()
|
|
142
146
|
if not (
|
|
143
|
-
self.code_model.options["version_tolerant"]
|
|
147
|
+
self.code_model.options["version_tolerant"]
|
|
148
|
+
and self.element_type.is_xml
|
|
149
|
+
and not self.code_model.options["models_mode"]
|
|
144
150
|
):
|
|
145
151
|
file_import.add_submodule_import(
|
|
146
152
|
"typing", "List", ImportType.STDLIB, TypingSection.CONDITIONAL
|
|
@@ -257,7 +257,6 @@ def _get_model(module_name: str, model_name: str):
|
|
|
257
257
|
module = sys.modules[module_end]
|
|
258
258
|
models = {k: v for k, v in module.__dict__.items() if isinstance(v, type)}
|
|
259
259
|
if model_name not in models:
|
|
260
|
-
_LOGGER.warning("Can not find model name in models, will not deserialize")
|
|
261
260
|
return model_name
|
|
262
261
|
return models[model_name]
|
|
263
262
|
|
|
@@ -491,7 +490,7 @@ def _get_deserialize_callable_from_annotation(
|
|
|
491
490
|
pass
|
|
492
491
|
raise DeserializationError()
|
|
493
492
|
return functools.partial(_deserialize_with_union, annotation)
|
|
494
|
-
|
|
493
|
+
|
|
495
494
|
# is it optional?
|
|
496
495
|
try:
|
|
497
496
|
# right now, assuming we don't have unions, since we're getting rid of the only
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
{{ serializer.declare_model(model) }}
|
|
5
|
-
"""{{ model.description(is_operation_file=False) }}
|
|
5
|
+
"""{{ model.description(is_operation_file=False) | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}
|
|
6
6
|
{% if model.discriminated_subtypes %}
|
|
7
7
|
|
|
8
8
|
{{ serializer.discriminator_docstring(model) | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
{{ serializer.declare_model(model) }}
|
|
5
|
-
"""{{ model.description(is_operation_file=False) }}
|
|
5
|
+
"""{{ model.description(is_operation_file=False) | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}
|
|
6
6
|
{% if model.discriminated_subtypes %}
|
|
7
7
|
|
|
8
8
|
{{ serializer.discriminator_docstring(model) | wordwrap(width=95, break_long_words=False, break_on_hyphens=False, wrapstring='\n ') }}
|