@autorest/python 6.2.2 → 6.2.3

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.
@@ -248,10 +248,9 @@ class DpgModelSerializer(_ModelSerializer):
248
248
 
249
249
  @staticmethod
250
250
  def declare_property(prop: Property) -> List[str]:
251
- attribute_key = _ModelSerializer.escape_dot(prop.rest_api_name)
252
251
  args = []
253
- if prop.client_name != attribute_key or prop.is_discriminator:
254
- args.append(f'name="{attribute_key}"')
252
+ if prop.client_name != prop.rest_api_name or prop.is_discriminator:
253
+ args.append(f'name="{prop.rest_api_name}"')
255
254
  if prop.readonly:
256
255
  args.append("readonly=True")
257
256
  if prop.client_default_value is not None:
@@ -92,7 +92,7 @@ setup(
92
92
  "azure-core<2.0.0,>=1.24.0",
93
93
  {% endif %}
94
94
  {% if code_model.need_typing_extensions %}
95
- "typing_extensions>=4.3.0; python_version<'3.8.0'",
95
+ "typing-extensions>=4.3.0; python_version<'3.8.0'",
96
96
  {% endif %}
97
97
  ],
98
98
  {% if package_mode %}
@@ -4,6 +4,7 @@
4
4
  # license information.
5
5
  # --------------------------------------------------------------------------
6
6
  from typing import Any, Dict
7
+ import re
7
8
  from .python_mappings import PadType, RESERVED_WORDS, REDEFINED_BUILTINS
8
9
 
9
10
 
@@ -12,6 +13,7 @@ def pad_reserved_words(name: str, pad_type: PadType):
12
13
  if not name:
13
14
  # we'll pass in empty operation groups sometime etc.
14
15
  return name
16
+ name = pad_special_chars(name)
15
17
  name_prefix = "_" if name[0] == "_" else ""
16
18
  name = name[1:] if name[0] == "_" else name
17
19
  if name.lower() in RESERVED_WORDS[pad_type]:
@@ -22,3 +24,7 @@ def pad_reserved_words(name: str, pad_type: PadType):
22
24
  def add_redefined_builtin_info(name: str, yaml_data: Dict[str, Any]) -> None:
23
25
  if name in REDEFINED_BUILTINS:
24
26
  yaml_data["pylintDisable"] = "redefined-builtin"
27
+
28
+
29
+ def pad_special_chars(name: str) -> str:
30
+ return re.sub(r"[^A-z0-9_]", "_", name)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorest/python",
3
- "version": "6.2.2",
3
+ "version": "6.2.3",
4
4
  "description": "The Python extension for generators in AutoRest.",
5
5
  "repository": {
6
6
  "type": "git",