Skip to content

Commit

Permalink
Bump cadl ranch (#2546)
Browse files Browse the repository at this point in the history
  • Loading branch information
iscai-msft authored Apr 26, 2024
1 parent fc6febb commit 4d3d30c
Show file tree
Hide file tree
Showing 116 changed files with 4,732 additions and 188 deletions.
2 changes: 1 addition & 1 deletion packages/typespec-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@azure-tools/typespec-azure-resource-manager": "~0.41.0",
"@azure-tools/typespec-autorest": "~0.41.0",
"@azure-tools/cadl-ranch-expect": "~0.13.3",
"@azure-tools/cadl-ranch-specs": "~0.32.0",
"@azure-tools/cadl-ranch-specs": "~0.33.0",
"@types/js-yaml": "~4.0.5",
"@types/mocha": "~10.0.1",
"@types/node": "^18.16.3",
Expand Down
3 changes: 3 additions & 0 deletions packages/typespec-python/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
"type/model/empty": {
"package-name": "typetest-model-empty",
},
"type/model/flatten": {
"package-name": "typetest-model-flatten",
},
"type/model/inheritance/enum-discriminator": {
"package-name": "typetest-model-enumdiscriminator",
},
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include *.md
include LICENSE
include azure/specialheaders/xmsclientrequestid/py.typed
recursive-include tests *.py
recursive-include samples *.py *.md
include azure/__init__.py
include azure/specialheaders/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@


# Specialheaders Clientrequestid client library for Python
# Azure Specialheaders Xmsclientrequestid client library for Python
<!-- write necessary description of service -->

## Getting started

### Install the package

```bash
python -m pip install specialheaders-clientrequestid
python -m pip install azure-specialheaders-xmsclientrequestid
```

#### Prequisites

- Python 3.8 or later is required to use this package.
- You need an [Azure subscription][azure_sub] to use this package.
- An existing Specialheaders Clientrequestid instance.
- An existing Azure Specialheaders Xmsclientrequestid instance.

## Contributing

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"CrossLanguagePackageId": "Azure.SpecialHeaders.XmsClientRequestId",
"CrossLanguageDefinitionId": {
"azure.specialheaders.xmsclientrequestid.XmsClientRequestIdClient.get": "get"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._client import ClientRequestIdClient
from ._client import XmsClientRequestIdClient
from ._version import VERSION

__version__ = VERSION
Expand All @@ -19,7 +19,7 @@
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"ClientRequestIdClient",
"XmsClientRequestIdClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse

from ._configuration import ClientRequestIdClientConfiguration
from ._operations import ClientRequestIdClientOperationsMixin
from ._configuration import XmsClientRequestIdClientConfiguration
from ._operations import XmsClientRequestIdClientOperationsMixin
from ._serialization import Deserializer, Serializer


class ClientRequestIdClient(ClientRequestIdClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
class XmsClientRequestIdClient(
XmsClientRequestIdClientOperationsMixin
): # pylint: disable=client-accepts-api-version-keyword
"""Azure client request id header configurations.
:keyword endpoint: Service host. Default value is "http://localhost:3000".
Expand All @@ -28,8 +30,7 @@ class ClientRequestIdClient(ClientRequestIdClientOperationsMixin): # pylint: di
def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self, *, endpoint: str = "http://localhost:3000", **kwargs: Any
) -> None:
self._config = ClientRequestIdClientConfiguration(**kwargs)
kwargs["request_id_header_name"] = "client-request-id"
self._config = XmsClientRequestIdClientConfiguration(**kwargs)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
Expand Down Expand Up @@ -78,7 +79,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
def close(self) -> None:
self._client.close()

def __enter__(self) -> "ClientRequestIdClient":
def __enter__(self) -> "XmsClientRequestIdClient":
self._client.__enter__()
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
from ._version import VERSION


class ClientRequestIdClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for ClientRequestIdClient.
class XmsClientRequestIdClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for XmsClientRequestIdClient.
Note that all parameters used to create this instance are saved as instance
attributes.
"""

def __init__(self, **kwargs: Any) -> None:

kwargs.setdefault("sdk_moniker", "specialheaders-clientrequestid/{}".format(VERSION))
kwargs.setdefault("sdk_moniker", "specialheaders-xmsclientrequestid/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._operations import ClientRequestIdClientOperationsMixin
from ._operations import XmsClientRequestIdClientOperationsMixin

from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"ClientRequestIdClientOperationsMixin",
"XmsClientRequestIdClientOperationsMixin",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from azure.core.utils import case_insensitive_dict

from .._serialization import Serializer
from .._vendor import ClientRequestIdClientMixinABC
from .._vendor import XmsClientRequestIdClientMixinABC

if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
Expand All @@ -36,22 +36,22 @@
_SERIALIZER.client_side_validation = False


def build_client_request_id_get_request(**kwargs: Any) -> HttpRequest:
def build_xms_client_request_id_get_request(**kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})

# Construct URL
_url = "/special-headers/client-request-id"
_url = "/azure/special-headers/x-ms-client-request-id"

# Construct headers

return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)


class ClientRequestIdClientOperationsMixin(ClientRequestIdClientMixinABC):
class XmsClientRequestIdClientOperationsMixin(XmsClientRequestIdClientMixinABC):

@distributed_trace
def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
"""Get operation with azure client request id header.
"""Get operation with azure ``x-ms-client-request-id`` header.
:return: None
:rtype: None
Expand All @@ -70,7 +70,7 @@ def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-sta

cls: ClsType[None] = kwargs.pop("cls", None)

_request = build_client_request_id_get_request(
_request = build_xms_client_request_id_get_request(
headers=_headers,
params=_params,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from abc import ABC
from typing import TYPE_CHECKING

from ._configuration import ClientRequestIdClientConfiguration
from ._configuration import XmsClientRequestIdClientConfiguration

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
Expand All @@ -17,10 +17,10 @@
from ._serialization import Deserializer, Serializer


class ClientRequestIdClientMixinABC(ABC):
class XmsClientRequestIdClientMixinABC(ABC):
"""DO NOT use this class. It is for internal typing use only."""

_client: "PipelineClient"
_config: ClientRequestIdClientConfiguration
_config: XmsClientRequestIdClientConfiguration
_serialize: "Serializer"
_deserialize: "Deserializer"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._client import ClientRequestIdClient
from ._client import XmsClientRequestIdClient

try:
from ._patch import __all__ as _patch_all
Expand All @@ -16,7 +16,7 @@
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"ClientRequestIdClient",
"XmsClientRequestIdClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
from azure.core.rest import AsyncHttpResponse, HttpRequest

from .._serialization import Deserializer, Serializer
from ._configuration import ClientRequestIdClientConfiguration
from ._operations import ClientRequestIdClientOperationsMixin
from ._configuration import XmsClientRequestIdClientConfiguration
from ._operations import XmsClientRequestIdClientOperationsMixin


class ClientRequestIdClient(ClientRequestIdClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
class XmsClientRequestIdClient(
XmsClientRequestIdClientOperationsMixin
): # pylint: disable=client-accepts-api-version-keyword
"""Azure client request id header configurations.
:keyword endpoint: Service host. Default value is "http://localhost:3000".
Expand All @@ -28,8 +30,7 @@ class ClientRequestIdClient(ClientRequestIdClientOperationsMixin): # pylint: di
def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self, *, endpoint: str = "http://localhost:3000", **kwargs: Any
) -> None:
self._config = ClientRequestIdClientConfiguration(**kwargs)
kwargs["request_id_header_name"] = "client-request-id"
self._config = XmsClientRequestIdClientConfiguration(**kwargs)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
Expand Down Expand Up @@ -80,7 +81,7 @@ def send_request(
async def close(self) -> None:
await self._client.close()

async def __aenter__(self) -> "ClientRequestIdClient":
async def __aenter__(self) -> "XmsClientRequestIdClient":
await self._client.__aenter__()
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
from .._version import VERSION


class ClientRequestIdClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for ClientRequestIdClient.
class XmsClientRequestIdClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for XmsClientRequestIdClient.
Note that all parameters used to create this instance are saved as instance
attributes.
"""

def __init__(self, **kwargs: Any) -> None:

kwargs.setdefault("sdk_moniker", "specialheaders-clientrequestid/{}".format(VERSION))
kwargs.setdefault("sdk_moniker", "specialheaders-xmsclientrequestid/{}".format(VERSION))
self.polling_interval = kwargs.get("polling_interval", 30)
self._configure(**kwargs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._operations import ClientRequestIdClientOperationsMixin
from ._operations import XmsClientRequestIdClientOperationsMixin

from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"ClientRequestIdClientOperationsMixin",
"XmsClientRequestIdClientOperationsMixin",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async

from ..._operations._operations import build_client_request_id_get_request
from .._vendor import ClientRequestIdClientMixinABC
from ..._operations._operations import build_xms_client_request_id_get_request
from .._vendor import XmsClientRequestIdClientMixinABC

if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
Expand All @@ -32,11 +32,11 @@
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]


class ClientRequestIdClientOperationsMixin(ClientRequestIdClientMixinABC):
class XmsClientRequestIdClientOperationsMixin(XmsClientRequestIdClientMixinABC):

@distributed_trace_async
async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements
"""Get operation with azure client request id header.
"""Get operation with azure ``x-ms-client-request-id`` header.
:return: None
:rtype: None
Expand All @@ -55,7 +55,7 @@ async def get(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-retu

cls: ClsType[None] = kwargs.pop("cls", None)

_request = build_client_request_id_get_request(
_request = build_xms_client_request_id_get_request(
headers=_headers,
params=_params,
)
Expand Down
Loading

0 comments on commit 4d3d30c

Please sign in to comment.