Skip to content

Commit 071976d

Browse files
authored
Bump http-client-python 0.6.7 (#3025)
* Update dependencies (2025-01-21 21:01:10) * Regenerate for typespec-python (2025-01-21 21:05:24) * Regenerate for autorest.python (2025-01-21 21:19:15) * bump http-client-python 0.6.7 --------- Co-authored-by: AutoPrFromHttpClientPython <AutoPrFromHttpClientPython>
1 parent 6f6f132 commit 071976d

287 files changed

Lines changed: 10459 additions & 11007 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
changeKind: fix
3+
packages:
4+
- "@autorest/python"
5+
- "@azure-tools/typespec-python"
6+
---
7+
8+
Fix sphinx typing for raising documentation
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
changeKind: fix
3+
packages:
4+
- "@autorest/python"
5+
- "@azure-tools/typespec-python"
6+
---
7+
8+
fix typing for class methods in _serialization.py

packages/autorest.python/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
3131
"dependencies": {
32-
"@typespec/http-client-python": "~0.6.6",
32+
"@typespec/http-client-python": "~0.6.7",
3333
"@autorest/system-requirements": "~1.0.2",
3434
"fs-extra": "~11.2.0",
3535
"tsx": "~4.19.1"

packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_serialization.py

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@
4848
IO,
4949
Mapping,
5050
Callable,
51-
TypeVar,
5251
MutableMapping,
53-
Type,
5452
List,
5553
)
5654

@@ -61,13 +59,13 @@
6159
import xml.etree.ElementTree as ET
6260

6361
import isodate # type: ignore
62+
from typing_extensions import Self
6463

6564
from azure.core.exceptions import DeserializationError, SerializationError
6665
from azure.core.serialization import NULL as CoreNull
6766

6867
_BOM = codecs.BOM_UTF8.decode(encoding="utf-8")
6968

70-
ModelType = TypeVar("ModelType", bound="Model")
7169
JSON = MutableMapping[str, Any]
7270

7371

@@ -384,25 +382,25 @@ def _infer_class_models(cls):
384382
return client_models
385383

386384
@classmethod
387-
def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType:
385+
def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self:
388386
"""Parse a str using the RestAPI syntax and return a model.
389387
390388
:param str data: A str using RestAPI structure. JSON by default.
391389
:param str content_type: JSON by default, set application/xml if XML.
392390
:returns: An instance of this model
393-
:raises: DeserializationError if something went wrong
394-
:rtype: ModelType
391+
:raises DeserializationError: if something went wrong
392+
:rtype: Self
395393
"""
396394
deserializer = Deserializer(cls._infer_class_models())
397395
return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
398396

399397
@classmethod
400398
def from_dict(
401-
cls: Type[ModelType],
399+
cls,
402400
data: Any,
403401
key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None,
404402
content_type: Optional[str] = None,
405-
) -> ModelType:
403+
) -> Self:
406404
"""Parse a dict using given key extractor return a model.
407405
408406
By default consider key
@@ -414,7 +412,7 @@ def from_dict(
414412
:param str content_type: JSON by default, set application/xml if XML.
415413
:returns: An instance of this model
416414
:raises: DeserializationError if something went wrong
417-
:rtype: ModelType
415+
:rtype: Self
418416
"""
419417
deserializer = Deserializer(cls._infer_class_models())
420418
deserializer.key_extractors = ( # type: ignore
@@ -560,7 +558,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to
560558
:param object target_obj: The data to be serialized.
561559
:param str data_type: The type to be serialized from.
562560
:rtype: str, dict
563-
:raises: SerializationError if serialization fails.
561+
:raises SerializationError: if serialization fails.
564562
:returns: The serialized data.
565563
"""
566564
key_transformer = kwargs.get("key_transformer", self.key_transformer)
@@ -670,8 +668,8 @@ def body(self, data, data_type, **kwargs):
670668
:param object data: The data to be serialized.
671669
:param str data_type: The type to be serialized from.
672670
:rtype: dict
673-
:raises: SerializationError if serialization fails.
674-
:raises: ValueError if data is None
671+
:raises SerializationError: if serialization fails.
672+
:raises ValueError: if data is None
675673
:returns: The serialized request body
676674
"""
677675

@@ -715,8 +713,8 @@ def url(self, name, data, data_type, **kwargs):
715713
:param str data_type: The type to be serialized from.
716714
:rtype: str
717715
:returns: The serialized URL path
718-
:raises: TypeError if serialization fails.
719-
:raises: ValueError if data is None
716+
:raises TypeError: if serialization fails.
717+
:raises ValueError: if data is None
720718
"""
721719
try:
722720
output = self.serialize_data(data, data_type, **kwargs)
@@ -739,8 +737,8 @@ def query(self, name, data, data_type, **kwargs):
739737
:param object data: The data to be serialized.
740738
:param str data_type: The type to be serialized from.
741739
:rtype: str, list
742-
:raises: TypeError if serialization fails.
743-
:raises: ValueError if data is None
740+
:raises TypeError: if serialization fails.
741+
:raises ValueError: if data is None
744742
:returns: The serialized query parameter
745743
"""
746744
try:
@@ -769,8 +767,8 @@ def header(self, name, data, data_type, **kwargs):
769767
:param object data: The data to be serialized.
770768
:param str data_type: The type to be serialized from.
771769
:rtype: str
772-
:raises: TypeError if serialization fails.
773-
:raises: ValueError if data is None
770+
:raises TypeError: if serialization fails.
771+
:raises ValueError: if data is None
774772
:returns: The serialized header
775773
"""
776774
try:
@@ -789,9 +787,9 @@ def serialize_data(self, data, data_type, **kwargs):
789787
790788
:param object data: The data to be serialized.
791789
:param str data_type: The type to be serialized from.
792-
:raises: AttributeError if required data is None.
793-
:raises: ValueError if data is None
794-
:raises: SerializationError if serialization fails.
790+
:raises AttributeError: if required data is None.
791+
:raises ValueError: if data is None
792+
:raises SerializationError: if serialization fails.
795793
:returns: The serialized data.
796794
:rtype: str, int, float, bool, dict, list
797795
"""
@@ -1126,7 +1124,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument
11261124
11271125
:param Datetime attr: Object to be serialized.
11281126
:rtype: str
1129-
:raises: TypeError if format invalid.
1127+
:raises TypeError: if format invalid.
11301128
:return: serialized rfc
11311129
"""
11321130
try:
@@ -1152,7 +1150,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument
11521150
11531151
:param Datetime attr: Object to be serialized.
11541152
:rtype: str
1155-
:raises: SerializationError if format invalid.
1153+
:raises SerializationError: if format invalid.
11561154
:return: serialized iso
11571155
"""
11581156
if isinstance(attr, str):
@@ -1185,7 +1183,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument
11851183
11861184
:param Datetime attr: Object to be serialized.
11871185
:rtype: int
1188-
:raises: SerializationError if format invalid
1186+
:raises SerializationError: if format invalid
11891187
:return: serialied unix
11901188
"""
11911189
if isinstance(attr, int):
@@ -1422,7 +1420,7 @@ def __call__(self, target_obj, response_data, content_type=None):
14221420
:param str target_obj: Target data type to deserialize to.
14231421
:param requests.Response response_data: REST response object.
14241422
:param str content_type: Swagger "produces" if available.
1425-
:raises: DeserializationError if deserialization fails.
1423+
:raises DeserializationError: if deserialization fails.
14261424
:return: Deserialized object.
14271425
:rtype: object
14281426
"""
@@ -1436,7 +1434,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return
14361434
14371435
:param str target_obj: Target data type to deserialize to.
14381436
:param object data: Object to deserialize.
1439-
:raises: DeserializationError if deserialization fails.
1437+
:raises DeserializationError: if deserialization fails.
14401438
:return: Deserialized object.
14411439
:rtype: object
14421440
"""
@@ -1651,7 +1649,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-
16511649
16521650
:param str data: The response string to be deserialized.
16531651
:param str data_type: The type to deserialize to.
1654-
:raises: DeserializationError if deserialization fails.
1652+
:raises DeserializationError: if deserialization fails.
16551653
:return: Deserialized object.
16561654
:rtype: object
16571655
"""
@@ -1733,7 +1731,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return
17331731
:param dict attr: Dictionary to be deserialized.
17341732
:return: Deserialized object.
17351733
:rtype: dict
1736-
:raises: TypeError if non-builtin datatype encountered.
1734+
:raises TypeError: if non-builtin datatype encountered.
17371735
"""
17381736
if attr is None:
17391737
return None
@@ -1779,7 +1777,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return
17791777
:param str data_type: deserialization data type.
17801778
:return: Deserialized basic type.
17811779
:rtype: str, int, float or bool
1782-
:raises: TypeError if string format is not valid.
1780+
:raises TypeError: if string format is not valid.
17831781
"""
17841782
# If we're here, data is supposed to be a basic type.
17851783
# If it's still an XML node, take the text
@@ -1870,7 +1868,7 @@ def deserialize_bytearray(attr):
18701868
:param str attr: response string to be deserialized.
18711869
:return: Deserialized bytearray
18721870
:rtype: bytearray
1873-
:raises: TypeError if string format invalid.
1871+
:raises TypeError: if string format invalid.
18741872
"""
18751873
if isinstance(attr, ET.Element):
18761874
attr = attr.text
@@ -1883,7 +1881,7 @@ def deserialize_base64(attr):
18831881
:param str attr: response string to be deserialized.
18841882
:return: Deserialized base64 string
18851883
:rtype: bytearray
1886-
:raises: TypeError if string format invalid.
1884+
:raises TypeError: if string format invalid.
18871885
"""
18881886
if isinstance(attr, ET.Element):
18891887
attr = attr.text
@@ -1898,7 +1896,7 @@ def deserialize_decimal(attr):
18981896
18991897
:param str attr: response string to be deserialized.
19001898
:return: Deserialized decimal
1901-
:raises: DeserializationError if string format invalid.
1899+
:raises DeserializationError: if string format invalid.
19021900
:rtype: decimal
19031901
"""
19041902
if isinstance(attr, ET.Element):
@@ -1916,7 +1914,7 @@ def deserialize_long(attr):
19161914
:param str attr: response string to be deserialized.
19171915
:return: Deserialized int
19181916
:rtype: long or int
1919-
:raises: ValueError if string format invalid.
1917+
:raises ValueError: if string format invalid.
19201918
"""
19211919
if isinstance(attr, ET.Element):
19221920
attr = attr.text
@@ -1929,7 +1927,7 @@ def deserialize_duration(attr):
19291927
:param str attr: response string to be deserialized.
19301928
:return: Deserialized duration
19311929
:rtype: TimeDelta
1932-
:raises: DeserializationError if string format invalid.
1930+
:raises DeserializationError: if string format invalid.
19331931
"""
19341932
if isinstance(attr, ET.Element):
19351933
attr = attr.text
@@ -1947,7 +1945,7 @@ def deserialize_date(attr):
19471945
:param str attr: response string to be deserialized.
19481946
:return: Deserialized date
19491947
:rtype: Date
1950-
:raises: DeserializationError if string format invalid.
1948+
:raises DeserializationError: if string format invalid.
19511949
"""
19521950
if isinstance(attr, ET.Element):
19531951
attr = attr.text
@@ -1963,7 +1961,7 @@ def deserialize_time(attr):
19631961
:param str attr: response string to be deserialized.
19641962
:return: Deserialized time
19651963
:rtype: datetime.time
1966-
:raises: DeserializationError if string format invalid.
1964+
:raises DeserializationError: if string format invalid.
19671965
"""
19681966
if isinstance(attr, ET.Element):
19691967
attr = attr.text
@@ -1978,7 +1976,7 @@ def deserialize_rfc(attr):
19781976
:param str attr: response string to be deserialized.
19791977
:return: Deserialized RFC datetime
19801978
:rtype: Datetime
1981-
:raises: DeserializationError if string format invalid.
1979+
:raises DeserializationError: if string format invalid.
19821980
"""
19831981
if isinstance(attr, ET.Element):
19841982
attr = attr.text
@@ -2001,7 +1999,7 @@ def deserialize_iso(attr):
20011999
:param str attr: response string to be deserialized.
20022000
:return: Deserialized ISO datetime
20032001
:rtype: Datetime
2004-
:raises: DeserializationError if string format invalid.
2002+
:raises DeserializationError: if string format invalid.
20052003
"""
20062004
if isinstance(attr, ET.Element):
20072005
attr = attr.text
@@ -2039,7 +2037,7 @@ def deserialize_unix(attr):
20392037
:param int attr: Object to be serialized.
20402038
:return: Deserialized datetime
20412039
:rtype: Datetime
2042-
:raises: DeserializationError if format invalid
2040+
:raises DeserializationError: if format invalid
20432041
"""
20442042
if isinstance(attr, ET.Element):
20452043
attr = int(attr.text) # type: ignore

0 commit comments

Comments
 (0)