@autorest/python 6.4.9 → 6.4.10

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.
@@ -133,7 +133,7 @@ TYPE_TO_OBJECT = {
133
133
  "time": TimeType,
134
134
  "duration": DurationType,
135
135
  "date": DateType,
136
- "byte-array": ByteArraySchema,
136
+ "bytes": ByteArraySchema,
137
137
  "boolean": BooleanType,
138
138
  "combined": CombinedType,
139
139
  "OAuth2": TokenCredentialType,
@@ -356,7 +356,7 @@ class StringType(PrimitiveType):
356
356
  class DatetimeType(PrimitiveType):
357
357
  def __init__(self, yaml_data: Dict[str, Any], code_model: "CodeModel") -> None:
358
358
  super().__init__(yaml_data=yaml_data, code_model=code_model)
359
- self.format = self.Formats(yaml_data["format"])
359
+ self.format = self.Formats(yaml_data.get("format", "date-time"))
360
360
 
361
361
  class Formats(str, Enum):
362
362
  datetime = "date-time"
@@ -588,7 +588,7 @@ class DurationType(PrimitiveType):
588
588
  class ByteArraySchema(PrimitiveType):
589
589
  def __init__(self, yaml_data: Dict[str, Any], code_model: "CodeModel") -> None:
590
590
  super().__init__(yaml_data=yaml_data, code_model=code_model)
591
- self.format = yaml_data["format"]
591
+ self.format = yaml_data.get("format", "bytes")
592
592
 
593
593
  @property
594
594
  def serialization_type(self) -> str:
@@ -20,7 +20,7 @@ import isodate
20
20
  from azure.core.exceptions import DeserializationError
21
21
  from azure.core import CaseInsensitiveEnumMeta
22
22
  from azure.core.pipeline import PipelineResponse
23
- from azure.core.serialization import NULL as AzureCoreNull
23
+ from azure.core.serialization import _Null # pylint: disable=protected-access
24
24
 
25
25
  if sys.version_info >= (3, 9):
26
26
  from collections.abc import MutableMapping
@@ -29,24 +29,9 @@ else:
29
29
 
30
30
  _LOGGER = logging.getLogger(__name__)
31
31
 
32
- __all__ = ["NULL", "AzureJSONEncoder", "Model", "rest_field", "rest_discriminator"]
32
+ __all__ = ["AzureJSONEncoder", "Model", "rest_field", "rest_discriminator"]
33
33
 
34
34
 
35
- class _Null(object):
36
- """To create a Falsy object"""
37
-
38
- def __bool__(self):
39
- return False
40
-
41
- __nonzero__ = __bool__ # Python2 compatibility
42
-
43
-
44
- NULL = _Null()
45
- """
46
- A falsy sentinel object which is supposed to be used to specify attributes
47
- with no data. This gets serialized to `null` on the wire.
48
- """
49
-
50
35
  TZ_UTC = timezone.utc
51
36
 
52
37
  def _timedelta_as_isostr(td: timedelta) -> str:
@@ -162,7 +147,7 @@ class AzureJSONEncoder(JSONEncoder):
162
147
  return {k: v for k, v in o.items() if k not in readonly_props}
163
148
  if isinstance(o, (bytes, bytearray)):
164
149
  return base64.b64encode(o).decode()
165
- if o is AzureCoreNull:
150
+ if isinstance(o, _Null):
166
151
  return None
167
152
  try:
168
153
  return super(AzureJSONEncoder, self).default(o)
@@ -234,7 +234,7 @@ def update_primitive( # pylint: disable=too-many-return-statements
234
234
  base["format"] = yaml_data["format"]
235
235
  return base
236
236
  if type_group == "byte-array":
237
- base = _update_type_base("byte-array", yaml_data)
237
+ base = _update_type_base("bytes", yaml_data)
238
238
  base["format"] = yaml_data["format"]
239
239
  return base
240
240
  return _update_type_base(type_group, yaml_data)
@@ -220,7 +220,7 @@ class PreProcessPlugin(YamlUpdatePlugin): # pylint: disable=abstract-method
220
220
  if type.get("name"):
221
221
  type["name"] = self.pad_reserved_words(type["name"], PadType.MODEL)
222
222
  type["description"] = update_description(
223
- type["description"], type["name"]
223
+ type.get("description", ""), type["name"]
224
224
  )
225
225
  type["snakeCaseName"] = to_snake_case(type["name"])
226
226
  if type.get("values") and not self.version_tolerant:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorest/python",
3
- "version": "6.4.9",
3
+ "version": "6.4.10",
4
4
  "description": "The Python extension for generators in AutoRest.",
5
5
  "main": "index.js",
6
6
  "repository": {