Skip to content

Commit 922782b

Browse files
authored
Regenerate code (Azure#39852)
* Regenerate code * update * updates * Updates * update
1 parent 4d9bf58 commit 922782b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+415
-491
lines changed

sdk/search/azure-search-documents/azure/search/documents/_generated/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
3-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.26.1)
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.28.4)
44
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
55
# --------------------------------------------------------------------------
66
# pylint: disable=wrong-import-position

sdk/search/azure-search-documents/azure/search/documents/_generated/_configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
3-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.26.1)
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.28.4)
44
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
55
# --------------------------------------------------------------------------
66

sdk/search/azure-search-documents/azure/search/documents/_generated/_search_index_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
3-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.26.1)
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.28.4)
44
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
55
# --------------------------------------------------------------------------
66

sdk/search/azure-search-documents/azure/search/documents/_generated/_serialization.py

Lines changed: 20 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# pylint: disable=too-many-lines
1+
# pylint: disable=line-too-long,useless-suppression,too-many-lines
22
# --------------------------------------------------------------------------
33
#
44
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -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

@@ -185,73 +183,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]],
185183
except NameError:
186184
_long_type = int
187185

188-
189-
class UTC(datetime.tzinfo):
190-
"""Time Zone info for handling UTC"""
191-
192-
def utcoffset(self, dt):
193-
"""UTF offset for UTC is 0.
194-
195-
:param datetime.datetime dt: The datetime
196-
:returns: The offset
197-
:rtype: datetime.timedelta
198-
"""
199-
return datetime.timedelta(0)
200-
201-
def tzname(self, dt):
202-
"""Timestamp representation.
203-
204-
:param datetime.datetime dt: The datetime
205-
:returns: The timestamp representation
206-
:rtype: str
207-
"""
208-
return "Z"
209-
210-
def dst(self, dt):
211-
"""No daylight saving for UTC.
212-
213-
:param datetime.datetime dt: The datetime
214-
:returns: The daylight saving time
215-
:rtype: datetime.timedelta
216-
"""
217-
return datetime.timedelta(hours=1)
218-
219-
220-
try:
221-
from datetime import timezone as _FixedOffset # type: ignore
222-
except ImportError: # Python 2.7
223-
224-
class _FixedOffset(datetime.tzinfo): # type: ignore
225-
"""Fixed offset in minutes east from UTC.
226-
Copy/pasted from Python doc
227-
:param datetime.timedelta offset: offset in timedelta format
228-
"""
229-
230-
def __init__(self, offset) -> None:
231-
self.__offset = offset
232-
233-
def utcoffset(self, dt):
234-
return self.__offset
235-
236-
def tzname(self, dt):
237-
return str(self.__offset.total_seconds() / 3600)
238-
239-
def __repr__(self):
240-
return "<FixedOffset {}>".format(self.tzname(None))
241-
242-
def dst(self, dt):
243-
return datetime.timedelta(0)
244-
245-
def __getinitargs__(self):
246-
return (self.__offset,)
247-
248-
249-
try:
250-
from datetime import timezone
251-
252-
TZ_UTC = timezone.utc
253-
except ImportError:
254-
TZ_UTC = UTC() # type: ignore
186+
TZ_UTC = datetime.timezone.utc
255187

256188
_FLATTEN = re.compile(r"(?<!\\)\.")
257189

@@ -310,7 +242,7 @@ def _create_xml_node(tag, prefix=None, ns=None):
310242
return ET.Element(tag)
311243

312244

313-
class Model(object):
245+
class Model:
314246
"""Mixin for all client request body/response body models to support
315247
serialization and deserialization.
316248
"""
@@ -450,25 +382,25 @@ def _infer_class_models(cls):
450382
return client_models
451383

452384
@classmethod
453-
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:
454386
"""Parse a str using the RestAPI syntax and return a model.
455387
456388
:param str data: A str using RestAPI structure. JSON by default.
457389
:param str content_type: JSON by default, set application/xml if XML.
458390
:returns: An instance of this model
459391
:raises DeserializationError: if something went wrong
460-
:rtype: ModelType
392+
:rtype: Self
461393
"""
462394
deserializer = Deserializer(cls._infer_class_models())
463395
return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
464396

465397
@classmethod
466398
def from_dict(
467-
cls: Type[ModelType],
399+
cls,
468400
data: Any,
469401
key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None,
470402
content_type: Optional[str] = None,
471-
) -> ModelType:
403+
) -> Self:
472404
"""Parse a dict using given key extractor return a model.
473405
474406
By default consider key
@@ -480,7 +412,7 @@ def from_dict(
480412
:param str content_type: JSON by default, set application/xml if XML.
481413
:returns: An instance of this model
482414
:raises DeserializationError: if something went wrong
483-
:rtype: ModelType
415+
:rtype: Self
484416
"""
485417
deserializer = Deserializer(cls._infer_class_models())
486418
deserializer.key_extractors = ( # type: ignore
@@ -563,7 +495,7 @@ def _decode_attribute_map_key(key):
563495
return key.replace("\\.", ".")
564496

565497

566-
class Serializer(object): # pylint: disable=too-many-public-methods
498+
class Serializer: # pylint: disable=too-many-public-methods
567499
"""Request object model serializer."""
568500

569501
basic_types = {str: "str", int: "int", bool: "bool", float: "float"}
@@ -1429,7 +1361,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument
14291361
# Iter and wrapped, should have found one node only (the wrap one)
14301362
if len(children) != 1:
14311363
raise DeserializationError(
1432-
"Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long
1364+
"Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format(
14331365
xml_name
14341366
)
14351367
)
@@ -1441,7 +1373,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument
14411373
return children[0]
14421374

14431375

1444-
class Deserializer(object):
1376+
class Deserializer:
14451377
"""Response object model deserializer.
14461378
14471379
:param dict classes: Class type dictionary for deserializing complex types.
@@ -1683,17 +1615,21 @@ def _instantiate_model(self, response, attrs, additional_properties=None):
16831615
subtype = getattr(response, "_subtype_map", {})
16841616
try:
16851617
readonly = [
1686-
k for k, v in response._validation.items() if v.get("readonly") # pylint: disable=protected-access
1618+
k
1619+
for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore
1620+
if v.get("readonly")
16871621
]
16881622
const = [
1689-
k for k, v in response._validation.items() if v.get("constant") # pylint: disable=protected-access
1623+
k
1624+
for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore
1625+
if v.get("constant")
16901626
]
16911627
kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const}
16921628
response_obj = response(**kwargs)
16931629
for attr in readonly:
16941630
setattr(response_obj, attr, attrs.get(attr))
16951631
if additional_properties:
1696-
response_obj.additional_properties = additional_properties
1632+
response_obj.additional_properties = additional_properties # type: ignore
16971633
return response_obj
16981634
except TypeError as err:
16991635
msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore
@@ -2047,7 +1983,7 @@ def deserialize_rfc(attr):
20471983
try:
20481984
parsed_date = email.utils.parsedate_tz(attr) # type: ignore
20491985
date_obj = datetime.datetime(
2050-
*parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60))
1986+
*parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60))
20511987
)
20521988
if not date_obj.tzinfo:
20531989
date_obj = date_obj.astimezone(tz=TZ_UTC)

sdk/search/azure-search-documents/azure/search/documents/_generated/aio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
3-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.26.1)
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.28.4)
44
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
55
# --------------------------------------------------------------------------
66
# pylint: disable=wrong-import-position

sdk/search/azure-search-documents/azure/search/documents/_generated/aio/_configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
3-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.26.1)
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.28.4)
44
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
55
# --------------------------------------------------------------------------
66

sdk/search/azure-search-documents/azure/search/documents/_generated/aio/_search_index_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
3-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.26.1)
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.28.4)
44
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
55
# --------------------------------------------------------------------------
66

sdk/search/azure-search-documents/azure/search/documents/_generated/aio/operations/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
3-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.26.1)
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.28.4)
44
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
55
# --------------------------------------------------------------------------
66
# pylint: disable=wrong-import-position

sdk/search/azure-search-documents/azure/search/documents/_generated/aio/operations/_documents_operations.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# pylint: disable=too-many-lines
22
# coding=utf-8
33
# --------------------------------------------------------------------------
4-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.26.1)
4+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.28.4)
55
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
66
# --------------------------------------------------------------------------
77
from io import IOBase
88
import sys
99
from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload
1010

11+
from azure.core import AsyncPipelineClient
1112
from azure.core.exceptions import (
1213
ClientAuthenticationError,
1314
HttpResponseError,
@@ -22,6 +23,7 @@
2223
from azure.core.utils import case_insensitive_dict
2324

2425
from ... import models as _models
26+
from ..._serialization import Deserializer, Serializer
2527
from ...operations._documents_operations import (
2628
build_autocomplete_get_request,
2729
build_autocomplete_post_request,
@@ -33,6 +35,7 @@
3335
build_suggest_get_request,
3436
build_suggest_post_request,
3537
)
38+
from .._configuration import SearchIndexClientConfiguration
3639

3740
if sys.version_info >= (3, 9):
3841
from collections.abc import MutableMapping
@@ -56,10 +59,10 @@ class DocumentsOperations:
5659

5760
def __init__(self, *args, **kwargs) -> None:
5861
input_args = list(args)
59-
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
60-
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
61-
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
62-
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
62+
self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
63+
self._config: SearchIndexClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config")
64+
self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer")
65+
self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer")
6366

6467
@distributed_trace_async
6568
async def count(self, request_options: Optional[_models.RequestOptions] = None, **kwargs: Any) -> int:

sdk/search/azure-search-documents/azure/search/documents/_generated/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
3-
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.26.1)
3+
# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.9.5, generator: @autorest/python@6.28.4)
44
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
55
# --------------------------------------------------------------------------
66
# pylint: disable=wrong-import-position

0 commit comments

Comments
 (0)