@autorest/python 6.9.6 → 6.9.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.
Files changed (42) hide show
  1. package/autorest/codegen/__init__.py +2 -4
  2. package/autorest/codegen/models/base.py +2 -5
  3. package/autorest/codegen/models/client.py +12 -8
  4. package/autorest/codegen/models/code_model.py +5 -1
  5. package/autorest/codegen/models/combined_type.py +1 -1
  6. package/autorest/codegen/models/constant_type.py +1 -1
  7. package/autorest/codegen/models/credential_types.py +21 -11
  8. package/autorest/codegen/models/dictionary_type.py +1 -1
  9. package/autorest/codegen/models/enum_type.py +2 -2
  10. package/autorest/codegen/models/imports.py +18 -69
  11. package/autorest/codegen/models/list_type.py +1 -1
  12. package/autorest/codegen/models/model_type.py +1 -1
  13. package/autorest/codegen/models/operation.py +11 -15
  14. package/autorest/codegen/models/operation_group.py +2 -2
  15. package/autorest/codegen/models/paging_operation.py +4 -4
  16. package/autorest/codegen/models/parameter.py +1 -1
  17. package/autorest/codegen/models/primitive_types.py +12 -16
  18. package/autorest/codegen/models/property.py +1 -1
  19. package/autorest/codegen/models/request_builder.py +4 -4
  20. package/autorest/codegen/models/response.py +32 -10
  21. package/autorest/codegen/serializers/builder_serializer.py +15 -11
  22. package/autorest/codegen/serializers/client_serializer.py +4 -7
  23. package/autorest/codegen/serializers/enum_serializer.py +2 -1
  24. package/autorest/codegen/serializers/general_serializer.py +9 -10
  25. package/autorest/codegen/serializers/model_serializer.py +2 -2
  26. package/autorest/codegen/serializers/operation_groups_serializer.py +2 -1
  27. package/autorest/codegen/serializers/patch_serializer.py +2 -2
  28. package/autorest/codegen/serializers/request_builders_serializer.py +1 -1
  29. package/autorest/codegen/serializers/sample_serializer.py +17 -13
  30. package/autorest/codegen/serializers/types_serializer.py +1 -1
  31. package/autorest/codegen/templates/enum_container.py.jinja2 +1 -1
  32. package/autorest/codegen/templates/model_base.py.jinja2 +12 -9
  33. package/autorest/codegen/templates/model_dpg.py.jinja2 +1 -1
  34. package/autorest/codegen/templates/model_msrest.py.jinja2 +1 -1
  35. package/autorest/codegen/templates/packaging_templates/LICENSE.jinja2 +1 -1
  36. package/autorest/codegen/templates/packaging_templates/README.md.jinja2 +1 -1
  37. package/autorest/codegen/templates/packaging_templates/setup.py.jinja2 +3 -3
  38. package/autorest/codegen/templates/patch.py.jinja2 +1 -1
  39. package/autorest/codegen/templates/serialization.py.jinja2 +4 -7
  40. package/autorest/multiapi/models/code_model.py +2 -0
  41. package/autorest/multiapi/serializers/__init__.py +1 -2
  42. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  # --------------------------------------------------------------------------
2
2
  #
3
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Copyright (c) {{ code_model.options["company_name"] }} Corporation. All rights reserved.
4
4
  #
5
5
  # The MIT License (MIT)
6
6
  #
@@ -63,8 +63,8 @@ import xml.etree.ElementTree as ET
63
63
 
64
64
  import isodate # type: ignore
65
65
 
66
- from {{ import_core_exceptions }} import DeserializationError, SerializationError
67
- from {{ import_core_serialization }} import NULL as AzureCoreNull
66
+ from {{ code_model.core_library }}.exceptions import DeserializationError, SerializationError
67
+ from {{ code_model.core_library }}.serialization import NULL as CoreNull
68
68
 
69
69
  _BOM = codecs.BOM_UTF8.decode(encoding="utf-8")
70
70
 
@@ -732,7 +732,6 @@ class Serializer(object):
732
732
 
733
733
  if kwargs.get("skip_quote") is True:
734
734
  output = str(output)
735
- # https://github.com/Azure/autorest.python/issues/2063
736
735
  output = output.replace("{", quote("{")).replace("}", quote("}"))
737
736
  else:
738
737
  output = quote(str(output), safe="")
@@ -808,7 +807,7 @@ class Serializer(object):
808
807
  raise ValueError("No value for given attribute")
809
808
 
810
809
  try:
811
- if data is AzureCoreNull:
810
+ if data is CoreNull:
812
811
  return None
813
812
  if data_type in self.basic_types.values():
814
813
  return self.serialize_basic(data, data_type, **kwargs)
@@ -1217,7 +1216,6 @@ def rest_key_extractor(attr, attr_desc, data):
1217
1216
  if working_data is None:
1218
1217
  # If at any point while following flatten JSON path see None, it means
1219
1218
  # that all properties under are None as well
1220
- # https://github.com/Azure/msrest-for-python/issues/197
1221
1219
  return None
1222
1220
  key = ".".join(dict_keys[1:])
1223
1221
 
@@ -1238,7 +1236,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data):
1238
1236
  if working_data is None:
1239
1237
  # If at any point while following flatten JSON path see None, it means
1240
1238
  # that all properties under are None as well
1241
- # https://github.com/Azure/msrest-for-python/issues/197
1242
1239
  return None
1243
1240
  key = ".".join(dict_keys[1:])
1244
1241
 
@@ -45,6 +45,8 @@ class CodeModel: # pylint: disable=too-many-instance-attributes
45
45
  default_version_metadata["global_parameters"]
46
46
  )
47
47
  self.user_specified_default_api = user_specified_default_api
48
+ self.options: Dict[str, Any] = {"unbranded": False, "company_name": "Microsoft"}
49
+ self.core_library = "azure.core"
48
50
 
49
51
  @property
50
52
  def operation_groups(self) -> List[OperationGroup]:
@@ -150,8 +150,7 @@ class MultiAPISerializer(ReaderAndWriter): # pylint: disable=abstract-method
150
150
  self.write_file(
151
151
  Path("_serialization.py"),
152
152
  codegen_env.get_template("serialization.py.jinja2").render(
153
- import_core_exceptions="azure.core.exceptions",
154
- import_core_serialization="azure.core.serialization",
153
+ code_model=code_model,
155
154
  ),
156
155
  )
157
156
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorest/python",
3
- "version": "6.9.6",
3
+ "version": "6.9.7",
4
4
  "description": "The Python extension for generators in AutoRest.",
5
5
  "main": "index.js",
6
6
  "repository": {