Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sdk/schemaregistry/azure-schemaregistry/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"commit": "0452565bc97d1f2d55954d99d170a38529ba7e4b",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"typespec_src": "specification/schemaregistry/SchemaRegistry",
"@azure-tools/typespec-python": "0.42.2"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"CrossLanguagePackageId": "SchemaRegistry",
"CrossLanguageDefinitionId": {
"azure.schemaregistry.models.SchemaContentTypeValues": "SchemaRegistry.SchemaContentTypeValues"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=protected-access, broad-except

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

def keys(self) -> typing.KeysView[str]:
"""
:returns: a set-like object providing a view on D's keys
:rtype: ~typing.KeysView
"""
return self._data.keys()

def values(self) -> typing.ValuesView[typing.Any]:
"""
:returns: an object providing a view on D's values
:rtype: ~typing.ValuesView
"""
return self._data.values()

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

def get(self, key: str, default: typing.Any = None) -> typing.Any:
"""
Get the value for key if key is in the dictionary, else default.
:param str key: The key to look up.
:param any default: The value to return if key is not in the dictionary. Defaults to None
:returns: D[k] if k in D, else d.
:rtype: any
"""
try:
return self[key]
except KeyError:
Expand All @@ -397,17 +417,38 @@ def pop(self, key: str, default: _T) -> _T: ...
def pop(self, key: str, default: typing.Any) -> typing.Any: ...

def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
"""
Removes specified key and return the corresponding value.
:param str key: The key to pop.
:param any default: The value to return if key is not in the dictionary
:returns: The value corresponding to the key.
:rtype: any
:raises KeyError: If key is not found and default is not given.
"""
if default is _UNSET:
return self._data.pop(key)
return self._data.pop(key, default)

def popitem(self) -> typing.Tuple[str, typing.Any]:
"""
Removes and returns some (key, value) pair
:returns: The (key, value) pair.
:rtype: tuple
:raises KeyError: if D is empty.
"""
return self._data.popitem()

def clear(self) -> None:
"""
Remove all items from D.
"""
self._data.clear()

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

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

def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
"""
Same as calling D.get(k, d), and setting D[k]=d if k not found
:param str key: The key to look up.
:param any default: The value to set if key is not in the dictionary
:returns: D[k] if k in D, else d.
:rtype: any
"""
if default is _UNSET:
return self._data.setdefault(key)
return self._data.setdefault(key, default)
Expand Down Expand Up @@ -910,6 +958,19 @@ def _failsafe_deserialize(
return None


def _failsafe_deserialize_xml(
deserializer: typing.Any,
value: typing.Any,
) -> typing.Any:
try:
return _deserialize_xml(deserializer, value)
except DeserializationError:
_LOGGER.warning(
"Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True
)
return None


class _RestField:
def __init__(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import json # pylint: disable=unused-import
import json
import sys
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, TypeVar
import urllib.parse
Expand All @@ -26,7 +26,7 @@
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict

from .._model_base import SdkJSONEncoder, _deserialize # pylint: disable=unused-import
from .._model_base import SdkJSONEncoder, _deserialize
from .._serialization import Serializer
from .._vendor import SchemaRegistryClientMixinABC

Expand Down Expand Up @@ -271,7 +271,7 @@ def prepare_request(next_link=None):

def extract_data(pipeline_response):
deserialized = pipeline_response.http_response.json()
list_of_elem = _deserialize(List[str], deserialized["Value"])
list_of_elem = _deserialize(List[str], deserialized.get("Value", []))
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.get("NextLink") or None, iter(list_of_elem)
Expand Down Expand Up @@ -367,7 +367,7 @@ def prepare_request(next_link=None):

def extract_data(pipeline_response):
deserialized = pipeline_response.http_response.json()
list_of_elem = _deserialize(List[int], deserialized["Value"])
list_of_elem = _deserialize(List[int], deserialized.get("Value", []))
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.get("NextLink") or None, iter(list_of_elem)
Expand Down
Loading