@autorest/python 6.46.1 → 6.47.0

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.
@@ -848,6 +848,14 @@ def _deserialize_multiple_sequence(
848
848
  return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers))
849
849
 
850
850
 
851
+ def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool:
852
+ return (
853
+ isinstance(deserializer, functools.partial)
854
+ and isinstance(deserializer.args[0], functools.partial)
855
+ and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable
856
+ )
857
+
858
+
851
859
  def _deserialize_sequence(
852
860
  deserializer: typing.Optional[typing.Callable],
853
861
  module: typing.Optional[str],
@@ -857,17 +865,19 @@ def _deserialize_sequence(
857
865
  return obj
858
866
  if isinstance(obj, ET.Element):
859
867
  obj = list(obj)
860
- try:
861
- if (
862
- isinstance(obj, str)
863
- and isinstance(deserializer, functools.partial)
864
- and isinstance(deserializer.args[0], functools.partial)
865
- and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable
866
- ):
867
- # encoded string may be deserialized to sequence
868
+
869
+ # encoded string may be deserialized to sequence
870
+ if isinstance(obj, str) and isinstance(deserializer, functools.partial):
871
+ # for list[str]
872
+ if _is_array_encoded_deserializer(deserializer):
868
873
  return deserializer(obj)
869
- except: # pylint: disable=bare-except
870
- pass
874
+
875
+ # for list[Union[...]]
876
+ if isinstance(deserializer.args[0], list):
877
+ for sub_deserializer in deserializer.args[0]:
878
+ if _is_array_encoded_deserializer(sub_deserializer):
879
+ return sub_deserializer(obj)
880
+
871
881
  return type(obj)(_deserialize(deserializer, entry, module) for entry in obj)
872
882
 
873
883
 
@@ -4,11 +4,11 @@
4
4
  "install": [
5
5
  {
6
6
  "download_info": {
7
- "url": "https://files.pythonhosted.org/packages/a3/dc/17031897dae0efacfea57dfd3a82fdd2a2aeb58e0ff71b77b87e44edc772/setuptools-80.9.0-py3-none-any.whl",
7
+ "url": "https://files.pythonhosted.org/packages/e0/76/f963c61683a39084aa575f98089253e1e852a4417cb8a3a8a422923a5246/setuptools-80.10.1-py3-none-any.whl",
8
8
  "archive_info": {
9
- "hash": "sha256=062d34222ad13e0cc312a4c02d73f059e86a4acbfbdea8f8f76b28c99f306922",
9
+ "hash": "sha256=fc30c51cbcb8199a219c12cc9c281b5925a4978d212f84229c909636d9f6984e",
10
10
  "hashes": {
11
- "sha256": "062d34222ad13e0cc312a4c02d73f059e86a4acbfbdea8f8f76b28c99f306922"
11
+ "sha256": "fc30c51cbcb8199a219c12cc9c281b5925a4978d212f84229c909636d9f6984e"
12
12
  }
13
13
  }
14
14
  },
@@ -18,7 +18,7 @@
18
18
  "metadata": {
19
19
  "metadata_version": "2.4",
20
20
  "name": "setuptools",
21
- "version": "80.9.0",
21
+ "version": "80.10.1",
22
22
  "dynamic": [
23
23
  "license-file"
24
24
  ],
@@ -63,6 +63,7 @@
63
63
  "tomli-w>=1.0.0; extra == \"test\"",
64
64
  "pytest-timeout; extra == \"test\"",
65
65
  "pytest-perf; sys_platform != \"cygwin\" and extra == \"test\"",
66
+ "pyobjc<12; (sys_platform == \"darwin\" and python_version <= \"3.9\") and extra == \"test\"",
66
67
  "jaraco.develop>=7.21; (python_version >= \"3.9\" and sys_platform != \"cygwin\") and extra == \"test\"",
67
68
  "pytest-home>=0.5; extra == \"test\"",
68
69
  "pytest-subprocess; extra == \"test\"",
@@ -848,6 +848,14 @@ def _deserialize_multiple_sequence(
848
848
  return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers))
849
849
 
850
850
 
851
+ def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool:
852
+ return (
853
+ isinstance(deserializer, functools.partial)
854
+ and isinstance(deserializer.args[0], functools.partial)
855
+ and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable
856
+ )
857
+
858
+
851
859
  def _deserialize_sequence(
852
860
  deserializer: typing.Optional[typing.Callable],
853
861
  module: typing.Optional[str],
@@ -857,17 +865,19 @@ def _deserialize_sequence(
857
865
  return obj
858
866
  if isinstance(obj, ET.Element):
859
867
  obj = list(obj)
860
- try:
861
- if (
862
- isinstance(obj, str)
863
- and isinstance(deserializer, functools.partial)
864
- and isinstance(deserializer.args[0], functools.partial)
865
- and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable
866
- ):
867
- # encoded string may be deserialized to sequence
868
+
869
+ # encoded string may be deserialized to sequence
870
+ if isinstance(obj, str) and isinstance(deserializer, functools.partial):
871
+ # for list[str]
872
+ if _is_array_encoded_deserializer(deserializer):
868
873
  return deserializer(obj)
869
- except: # pylint: disable=bare-except
870
- pass
874
+
875
+ # for list[Union[...]]
876
+ if isinstance(deserializer.args[0], list):
877
+ for sub_deserializer in deserializer.args[0]:
878
+ if _is_array_encoded_deserializer(sub_deserializer):
879
+ return sub_deserializer(obj)
880
+
871
881
  return type(obj)(_deserialize(deserializer, entry, module) for entry in obj)
872
882
 
873
883
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorest/python",
3
- "version": "6.46.1",
3
+ "version": "6.47.0",
4
4
  "description": "The Python extension for generators in AutoRest.",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
21
21
  "dependencies": {
22
- "@typespec/http-client-python": "~0.24.1",
22
+ "@typespec/http-client-python": "~0.25.0",
23
23
  "@autorest/system-requirements": "~1.0.2",
24
24
  "fs-extra": "~11.2.0",
25
25
  "tsx": "~4.19.1"