Skip to content

Commit 14a5a01

Browse files
author
SDKAuto
committed
CodeGen from PR 33562 in Azure/azure-rest-api-specs
Merge fe3b94f5e2537c53b5a7274ed15e6586b861be6c into dc4c1eaef16e0bc8b1e96c3d1e014deb96259b35
1 parent 8b96068 commit 14a5a01

31 files changed

+247
-3045
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commit": "3e2187c372ab0f1948d47ecdadd5fdb527c2a5aa",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"typespec_src": "specification/schemaregistry/SchemaRegistry",
5+
"@azure-tools/typespec-python": "0.42.2"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"CrossLanguagePackageId": "SchemaRegistry",
3+
"CrossLanguageDefinitionId": {
4+
"azure.schemaregistry.models.SchemaContentTypeValues": "SchemaRegistry.SchemaContentTypeValues"
5+
}
6+
}

sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_model_base.py

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
# coding=utf-8
33
# --------------------------------------------------------------------------
44
# Copyright (c) Microsoft Corporation. All rights reserved.
5-
# Licensed under the MIT License. See License.txt in the project root for
6-
# license information.
5+
# Licensed under the MIT License. See License.txt in the project root for license information.
6+
# Code generated by Microsoft (R) Python Code Generator.
7+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
78
# --------------------------------------------------------------------------
89
# pylint: disable=protected-access, broad-except
910

@@ -373,15 +374,34 @@ def __ne__(self, other: typing.Any) -> bool:
373374
return not self.__eq__(other)
374375

375376
def keys(self) -> typing.KeysView[str]:
377+
"""
378+
:returns: a set-like object providing a view on D's keys
379+
:rtype: ~typing.KeysView
380+
"""
376381
return self._data.keys()
377382

378383
def values(self) -> typing.ValuesView[typing.Any]:
384+
"""
385+
:returns: an object providing a view on D's values
386+
:rtype: ~typing.ValuesView
387+
"""
379388
return self._data.values()
380389

381390
def items(self) -> typing.ItemsView[str, typing.Any]:
391+
"""
392+
:returns: set-like object providing a view on D's items
393+
:rtype: ~typing.ItemsView
394+
"""
382395
return self._data.items()
383396

384397
def get(self, key: str, default: typing.Any = None) -> typing.Any:
398+
"""
399+
Get the value for key if key is in the dictionary, else default.
400+
:param str key: The key to look up.
401+
:param any default: The value to return if key is not in the dictionary. Defaults to None
402+
:returns: D[k] if k in D, else d.
403+
:rtype: any
404+
"""
385405
try:
386406
return self[key]
387407
except KeyError:
@@ -397,17 +417,38 @@ def pop(self, key: str, default: _T) -> _T: ...
397417
def pop(self, key: str, default: typing.Any) -> typing.Any: ...
398418

399419
def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
420+
"""
421+
Removes specified key and return the corresponding value.
422+
:param str key: The key to pop.
423+
:param any default: The value to return if key is not in the dictionary
424+
:returns: The value corresponding to the key.
425+
:rtype: any
426+
:raises KeyError: If key is not found and default is not given.
427+
"""
400428
if default is _UNSET:
401429
return self._data.pop(key)
402430
return self._data.pop(key, default)
403431

404432
def popitem(self) -> typing.Tuple[str, typing.Any]:
433+
"""
434+
Removes and returns some (key, value) pair
435+
:returns: The (key, value) pair.
436+
:rtype: tuple
437+
:raises KeyError: if D is empty.
438+
"""
405439
return self._data.popitem()
406440

407441
def clear(self) -> None:
442+
"""
443+
Remove all items from D.
444+
"""
408445
self._data.clear()
409446

410447
def update(self, *args: typing.Any, **kwargs: typing.Any) -> None:
448+
"""
449+
Updates D from mapping/iterable E and F.
450+
:param any args: Either a mapping object or an iterable of key-value pairs.
451+
"""
411452
self._data.update(*args, **kwargs)
412453

413454
@typing.overload
@@ -417,6 +458,13 @@ def setdefault(self, key: str, default: None = None) -> None: ...
417458
def setdefault(self, key: str, default: typing.Any) -> typing.Any: ...
418459

419460
def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
461+
"""
462+
Same as calling D.get(k, d), and setting D[k]=d if k not found
463+
:param str key: The key to look up.
464+
:param any default: The value to set if key is not in the dictionary
465+
:returns: D[k] if k in D, else d.
466+
:rtype: any
467+
"""
420468
if default is _UNSET:
421469
return self._data.setdefault(key)
422470
return self._data.setdefault(key, default)
@@ -910,6 +958,19 @@ def _failsafe_deserialize(
910958
return None
911959

912960

961+
def _failsafe_deserialize_xml(
962+
deserializer: typing.Any,
963+
value: typing.Any,
964+
) -> typing.Any:
965+
try:
966+
return _deserialize_xml(deserializer, value)
967+
except DeserializationError:
968+
_LOGGER.warning(
969+
"Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True
970+
)
971+
return None
972+
973+
913974
class _RestField:
914975
def __init__(
915976
self,

sdk/schemaregistry/azure-schemaregistry/azure/schemaregistry/_operations/_operations.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8-
import json # pylint: disable=unused-import
8+
import json
99
import sys
1010
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, TypeVar
1111
import urllib.parse
@@ -26,7 +26,7 @@
2626
from azure.core.tracing.decorator import distributed_trace
2727
from azure.core.utils import case_insensitive_dict
2828

29-
from .._model_base import SdkJSONEncoder, _deserialize # pylint: disable=unused-import
29+
from .._model_base import SdkJSONEncoder, _deserialize
3030
from .._serialization import Serializer
3131
from .._vendor import SchemaRegistryClientMixinABC
3232

@@ -271,7 +271,7 @@ def prepare_request(next_link=None):
271271

272272
def extract_data(pipeline_response):
273273
deserialized = pipeline_response.http_response.json()
274-
list_of_elem = _deserialize(List[str], deserialized["Value"])
274+
list_of_elem = _deserialize(List[str], deserialized.get("Value", []))
275275
if cls:
276276
list_of_elem = cls(list_of_elem) # type: ignore
277277
return deserialized.get("NextLink") or None, iter(list_of_elem)
@@ -367,7 +367,7 @@ def prepare_request(next_link=None):
367367

368368
def extract_data(pipeline_response):
369369
deserialized = pipeline_response.http_response.json()
370-
list_of_elem = _deserialize(List[int], deserialized["Value"])
370+
list_of_elem = _deserialize(List[int], deserialized.get("Value", []))
371371
if cls:
372372
list_of_elem = cls(list_of_elem) # type: ignore
373373
return deserialized.get("NextLink") or None, iter(list_of_elem)

0 commit comments

Comments
 (0)