Skip to content

Commit

Permalink
CodeGen from PR 3433 in test-repo-billy/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 4c27a59ebc5b8b82715dc2b6caae2181c5731604 into c9327ee12bede16737ba6881e54d1d72ccbaca5c
  • Loading branch information
SDKAuto committed Jul 31, 2024
1 parent 2bf9936 commit 569a35d
Show file tree
Hide file tree
Showing 55 changed files with 1,339 additions and 4,797 deletions.
6 changes: 3 additions & 3 deletions sdk/edgezones/azure-mgmt-edgezones/_meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"commit": "ab064e0047ec560a700d6b501097d99471ad817b",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"commit": "3b3d37a2e90deb526047d30f8dfb8014a329b07b",
"repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs",
"typespec_src": "specification/edgezones/EdgeZones.Management",
"@azure-tools/typespec-python": "0.25.0"
"@azure-tools/typespec-python": "0.27.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.
"""

result = {}
readonly_props = []
if exclude_readonly:
readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)]
for k, v in self.items():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
Expand Down Expand Up @@ -241,7 +243,10 @@ async def get(self, extended_zone_name: str, **kwargs: Any) -> _models.ExtendedZ

if response.status_code not in [200]:
if _stream:
await response.read() # Load the body in memory and close the socket
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = _deserialize(_models.ErrorResponse, response.json())
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
Expand Down Expand Up @@ -433,7 +438,10 @@ async def register(self, extended_zone_name: str, **kwargs: Any) -> _models.Exte

if response.status_code not in [200]:
if _stream:
await response.read() # Load the body in memory and close the socket
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = _deserialize(_models.ErrorResponse, response.json())
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
Expand Down Expand Up @@ -520,7 +528,10 @@ async def unregister(self, extended_zone_name: str, **kwargs: Any) -> _models.Ex

if response.status_code not in [200]:
if _stream:
await response.read() # Load the body in memory and close the socket
try:
await response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = _deserialize(_models.ErrorResponse, response.json())
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class Operation(_model_base.Model):
is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"])
"""Whether the operation applies to data-plane. This is \"true\" for data-plane operations and
\"false\" for Azure Resource Manager/control-plane operations."""
display: Optional["_models.OperationDisplay"] = rest_field()
display: Optional["_models.OperationDisplay"] = rest_field(visibility=["read"])
"""Localized display information for this particular operation."""
origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"])
"""The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit
Expand All @@ -294,7 +294,6 @@ class Operation(_model_base.Model):
def __init__(
self,
*,
display: Optional["_models.OperationDisplay"] = None,
action_type: Optional[Union[str, "_models.ActionType"]] = None,
): ...

Expand All @@ -312,6 +311,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles
class OperationDisplay(_model_base.Model):
"""Localized display information for and operation.
Readonly variables are only populated by the server, and will be ignored when sending a request.
:ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft
Monitoring Insights" or "Microsoft Compute".
:vartype provider: str
Expand All @@ -326,39 +327,19 @@ class OperationDisplay(_model_base.Model):
:vartype description: str
"""

provider: Optional[str] = rest_field()
provider: Optional[str] = rest_field(visibility=["read"])
"""The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring
Insights\" or \"Microsoft Compute\"."""
resource: Optional[str] = rest_field()
resource: Optional[str] = rest_field(visibility=["read"])
"""The localized friendly name of the resource type related to this operation. E.g. \"Virtual
Machines\" or \"Job Schedule Collections\"."""
operation: Optional[str] = rest_field()
operation: Optional[str] = rest_field(visibility=["read"])
"""The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create
or Update Virtual Machine\", \"Restart Virtual Machine\"."""
description: Optional[str] = rest_field()
description: Optional[str] = rest_field(visibility=["read"])
"""The short, localized friendly description of the operation; suitable for tool tips and detailed
views."""

@overload
def __init__(
self,
*,
provider: Optional[str] = None,
resource: Optional[str] = None,
operation: Optional[str] = None,
description: Optional[str] = None,
): ...

@overload
def __init__(self, mapping: Mapping[str, Any]):
"""
:param mapping: raw JSON to initialize the model.
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation
super().__init__(*args, **kwargs)


class SystemData(_model_base.Model):
"""Metadata pertaining to creation and last modification of the resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.paging import ItemPaged
Expand Down Expand Up @@ -359,7 +361,10 @@ def get(self, extended_zone_name: str, **kwargs: Any) -> _models.ExtendedZone:

if response.status_code not in [200]:
if _stream:
response.read() # Load the body in memory and close the socket
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = _deserialize(_models.ErrorResponse, response.json())
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
Expand Down Expand Up @@ -551,7 +556,10 @@ def register(self, extended_zone_name: str, **kwargs: Any) -> _models.ExtendedZo

if response.status_code not in [200]:
if _stream:
response.read() # Load the body in memory and close the socket
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = _deserialize(_models.ErrorResponse, response.json())
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
Expand Down Expand Up @@ -638,7 +646,10 @@ def unregister(self, extended_zone_name: str, **kwargs: Any) -> _models.Extended

if response.status_code not in [200]:
if _stream:
response.read() # Load the body in memory and close the socket
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = _deserialize(_models.ErrorResponse, response.json())
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
Expand Down
6 changes: 3 additions & 3 deletions sdk/edgezones/azure-mgmt-edgezones/tsp-location.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
directory: specification/edgezones/EdgeZones.Management
commit: ab064e0047ec560a700d6b501097d99471ad817b
repo: Azure/azure-rest-api-specs
additionalDirectories:
commit: 3b3d37a2e90deb526047d30f8dfb8014a329b07b
repo: test-repo-billy/azure-rest-api-specs
additionalDirectories:
7 changes: 3 additions & 4 deletions sdk/face/azure-ai-vision-face/_meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"commit": "37acfe2967e5e1be1169146ac461eb1875c9476e",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"commit": "3b3d37a2e90deb526047d30f8dfb8014a329b07b",
"repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs",
"typespec_src": "specification/ai/Face",
"@azure-tools/typespec-python": "0.23.8",
"@autorest/python": "6.13.15"
"@azure-tools/typespec-python": "0.27.0"
}
12 changes: 8 additions & 4 deletions sdk/face/azure-ai-vision-face/azure/ai/vision/face/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._patch import FaceClient
from ._patch import FaceSessionClient
from ._client import FaceClient
from ._client import FaceSessionClient
from ._version import VERSION

__version__ = VERSION


try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"FaceClient",
"FaceSessionClient",
]

__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
5 changes: 3 additions & 2 deletions sdk/face/azure-ai-vision-face/azure/ai/vision/face/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from copy import deepcopy
from typing import Any, TYPE_CHECKING, Union
from typing_extensions import Self

from azure.core import PipelineClient
from azure.core.credentials import AzureKeyCredential
Expand Down Expand Up @@ -94,7 +95,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
def close(self) -> None:
self._client.close()

def __enter__(self) -> "FaceClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

Expand Down Expand Up @@ -173,7 +174,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
def close(self) -> None:
self._client.close()

def __enter__(self) -> "FaceSessionClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.
"""

result = {}
readonly_props = []
if exclude_readonly:
readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)]
for k, v in self.items():
Expand Down Expand Up @@ -883,5 +884,6 @@ def rest_discriminator(
*,
name: typing.Optional[str] = None,
type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin
visibility: typing.Optional[typing.List[str]] = None,
) -> typing.Any:
return _RestField(name=name, type=type, is_discriminator=True)
return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility)
Loading

0 comments on commit 569a35d

Please sign in to comment.