Skip to content
This repository was archived by the owner on May 22, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 8 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
2 changes: 1 addition & 1 deletion packages/autorest.python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
"dependencies": {
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTk3OTY3NS9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.27.2.tgz",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTk5ODEzNC9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz",
"@autorest/system-requirements": "~1.0.2",
"fs-extra": "~11.2.0",
"tsx": "^4.21.0"
Expand Down
66 changes: 33 additions & 33 deletions packages/typespec-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,48 +48,48 @@
"generator/**"
],
"peerDependencies": {
"@typespec/compiler": "^1.9.0",
"@typespec/http": "^1.9.0",
"@typespec/rest": ">=0.79.0 <1.0.0",
"@typespec/versioning": ">=0.79.0 <1.0.0",
"@typespec/openapi": "^1.9.0",
"@typespec/events": ">=0.79.0 <1.0.0",
"@typespec/sse": ">=0.79.0 <1.0.0",
"@typespec/streams": ">=0.79.0 <1.0.0",
"@typespec/xml": ">=0.79.0 <1.0.0",
"@azure-tools/typespec-azure-core": ">=0.65.0 <1.0.0",
"@azure-tools/typespec-azure-resource-manager": ">=0.65.0 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.65.0 <1.0.0",
"@azure-tools/typespec-azure-rulesets": ">=0.65.0 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.65.3 <1.0.0"
"@typespec/compiler": "^1.10.0",
"@typespec/http": "^1.10.0",
"@typespec/rest": ">=0.80.0 <1.0.0",
"@typespec/versioning": ">=0.80.0 <1.0.0",
"@typespec/openapi": "^1.10.0",
"@typespec/events": ">=0.80.0 <1.0.0",
"@typespec/sse": ">=0.80.0 <1.0.0",
"@typespec/streams": ">=0.80.0 <1.0.0",
"@typespec/xml": ">=0.80.0 <1.0.0",
"@azure-tools/typespec-azure-core": ">=0.66.0 <1.0.0",
"@azure-tools/typespec-azure-resource-manager": ">=0.66.0 <1.0.0",
"@azure-tools/typespec-autorest": ">=0.66.0 <1.0.0",
"@azure-tools/typespec-azure-rulesets": ">=0.65.1 <1.0.0",
"@azure-tools/typespec-client-generator-core": ">=0.66.1 <1.0.0"
},
"dependencies": {
"js-yaml": "~4.1.0",
"semver": "~7.6.2",
"tsx": "^4.21.0",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTk3OTY3NS9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.27.2.tgz",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNTk5ODEzNC9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.0.tgz",
"fs-extra": "~11.2.0"
},
"devDependencies": {
"@typespec/compiler": "^1.9.0",
"@typespec/http": "^1.9.0",
"@typespec/rest": "~0.79.0",
"@typespec/versioning": "~0.79.0",
"@typespec/openapi": "^1.9.0",
"@typespec/events": "~0.79.0",
"@typespec/sse": "~0.79.0",
"@typespec/streams": "~0.79.0",
"@typespec/compiler": "^1.10.0",
"@typespec/http": "^1.10.0",
"@typespec/rest": "~0.80.0",
"@typespec/versioning": "~0.80.0",
"@typespec/openapi": "^1.10.0",
"@typespec/events": "~0.80.0",
"@typespec/sse": "~0.80.0",
"@typespec/streams": "~0.80.0",
"@typespec/tspd": "~0.74.0",
"@typespec/xml": "~0.79.0",
"@azure-tools/typespec-azure-resource-manager": "~0.65.0",
"@azure-tools/typespec-azure-core": "~0.65.0",
"@azure-tools/typespec-azure-rulesets": "~0.65.0",
"@azure-tools/typespec-autorest": "~0.65.0",
"@azure-tools/typespec-client-generator-core": "~0.65.3",
"@azure-tools/azure-http-specs": "0.1.0-alpha.38-dev.6",
"@typespec/http-specs": "0.1.0-alpha.33-dev.2",
"@typespec/spector": "0.1.0-alpha.23",
"@typespec/spec-api": "0.1.0-alpha.12",
"@typespec/xml": "~0.80.0",
"@azure-tools/typespec-azure-resource-manager": "~0.66.0",
"@azure-tools/typespec-azure-core": "~0.66.0",
"@azure-tools/typespec-azure-rulesets": "~0.65.1",
"@azure-tools/typespec-autorest": "~0.66.0",
"@azure-tools/typespec-client-generator-core": "~0.66.1",
"@azure-tools/azure-http-specs": "0.1.0-alpha.38",
"@typespec/http-specs": "0.1.0-alpha.34",
"@typespec/spector": "0.1.0-alpha.24",
"@typespec/spec-api": "0.1.0-alpha.13",
"@types/js-yaml": "~4.0.5",
"@types/node": "~25.0.2",
"@types/yargs": "~17.0.33",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"specialwords.models.WhileModel": "SpecialWords.Models.while",
"specialwords.models.WithModel": "SpecialWords.Models.with",
"specialwords.models.YieldModel": "SpecialWords.Models.yield",
"specialwords.models.ExtensibleString": "SpecialWords.ExtensibleStrings.ExtensibleString",
"specialwords.operations.ModelsOperations.with_and": "SpecialWords.Models.withAnd",
"specialwords.aio.operations.ModelsOperations.with_and": "SpecialWords.Models.withAnd",
"specialwords.operations.ModelsOperations.with_as": "SpecialWords.Models.withAs",
Expand Down Expand Up @@ -109,6 +110,8 @@
"specialwords.aio.operations.ModelPropertiesOperations.dict_methods": "SpecialWords.ModelProperties.dictMethods",
"specialwords.operations.ModelPropertiesOperations.with_list": "SpecialWords.ModelProperties.withList",
"specialwords.aio.operations.ModelPropertiesOperations.with_list": "SpecialWords.ModelProperties.withList",
"specialwords.operations.ExtensibleStringsOperations.put_extensible_string_value": "SpecialWords.ExtensibleStrings.putExtensibleStringValue",
"specialwords.aio.operations.ExtensibleStringsOperations.put_extensible_string_value": "SpecialWords.ExtensibleStrings.putExtensibleStringValue",
"specialwords.operations.Operations.and_method": "SpecialWords.Operations.and",
"specialwords.aio.operations.Operations.and_method": "SpecialWords.Operations.and",
"specialwords.operations.Operations.as_method": "SpecialWords.Operations.as",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils import recorded_by_proxy
from testpreparer import SpecialWordsClientTestBase, SpecialWordsPreparer


@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestSpecialWordsExtensibleStringsOperations(SpecialWordsClientTestBase):
@SpecialWordsPreparer()
@recorded_by_proxy
def test_extensible_strings_put_extensible_string_value(self, specialwords_endpoint):
client = self.create_client(endpoint=specialwords_endpoint)
response = client.extensible_strings.put_extensible_string_value(
body="str",
content_type="str",
)

# please add some check logic here by yourself
# ...
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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.
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import pytest
from devtools_testutils.aio import recorded_by_proxy_async
from testpreparer import SpecialWordsPreparer
from testpreparer_async import SpecialWordsClientTestBaseAsync


@pytest.mark.skip("you may need to update the auto-generated test case before run it")
class TestSpecialWordsExtensibleStringsOperationsAsync(SpecialWordsClientTestBaseAsync):
@SpecialWordsPreparer()
@recorded_by_proxy_async
async def test_extensible_strings_put_extensible_string_value(self, specialwords_endpoint):
client = self.create_async_client(endpoint=specialwords_endpoint)
response = await client.extensible_strings.put_extensible_string_value(
body="str",
content_type="str",
)

# please add some check logic here by yourself
# ...
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@

from ._configuration import SpecialWordsClientConfiguration
from ._utils.serialization import Deserializer, Serializer
from .operations import ModelPropertiesOperations, ModelsOperations, Operations, ParametersOperations
from .operations import (
ExtensibleStringsOperations,
ModelPropertiesOperations,
ModelsOperations,
Operations,
ParametersOperations,
)


class SpecialWordsClient: # pylint: disable=client-accepts-api-version-keyword
Expand Down Expand Up @@ -66,6 +72,8 @@ class SpecialWordsClient: # pylint: disable=client-accepts-api-version-keyword
:vartype models: specialwords.operations.ModelsOperations
:ivar model_properties: ModelPropertiesOperations operations
:vartype model_properties: specialwords.operations.ModelPropertiesOperations
:ivar extensible_strings: ExtensibleStringsOperations operations
:vartype extensible_strings: specialwords.operations.ExtensibleStringsOperations
:ivar operations: Operations operations
:vartype operations: specialwords.operations.Operations
:ivar parameters: ParametersOperations operations
Expand Down Expand Up @@ -106,6 +114,9 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self.model_properties = ModelPropertiesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.extensible_strings = ExtensibleStringsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.parameters = ParametersOperations(self._client, self._config, self._serialize, self._deserialize)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@

from .._utils.serialization import Deserializer, Serializer
from ._configuration import SpecialWordsClientConfiguration
from .operations import ModelPropertiesOperations, ModelsOperations, Operations, ParametersOperations
from .operations import (
ExtensibleStringsOperations,
ModelPropertiesOperations,
ModelsOperations,
Operations,
ParametersOperations,
)


class SpecialWordsClient: # pylint: disable=client-accepts-api-version-keyword
Expand Down Expand Up @@ -66,6 +72,8 @@ class SpecialWordsClient: # pylint: disable=client-accepts-api-version-keyword
:vartype models: specialwords.aio.operations.ModelsOperations
:ivar model_properties: ModelPropertiesOperations operations
:vartype model_properties: specialwords.aio.operations.ModelPropertiesOperations
:ivar extensible_strings: ExtensibleStringsOperations operations
:vartype extensible_strings: specialwords.aio.operations.ExtensibleStringsOperations
:ivar operations: Operations operations
:vartype operations: specialwords.aio.operations.Operations
:ivar parameters: ParametersOperations operations
Expand Down Expand Up @@ -106,6 +114,9 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential
self.model_properties = ModelPropertiesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.extensible_strings = ExtensibleStringsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.parameters = ParametersOperations(self._client, self._config, self._serialize, self._deserialize)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from ._operations import ModelsOperations # type: ignore
from ._operations import ModelPropertiesOperations # type: ignore
from ._operations import ExtensibleStringsOperations # type: ignore
from ._operations import Operations # type: ignore
from ._operations import ParametersOperations # type: ignore

Expand All @@ -24,6 +25,7 @@
__all__ = [
"ModelsOperations",
"ModelPropertiesOperations",
"ExtensibleStringsOperations",
"Operations",
"ParametersOperations",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
Expand All @@ -26,9 +28,10 @@
from azure.core.utils import case_insensitive_dict

from ... import models as _models
from ..._utils.model_base import SdkJSONEncoder
from ..._utils.model_base import SdkJSONEncoder, _deserialize
from ..._utils.serialization import Deserializer, Serializer
from ...operations._operations import (
build_extensible_strings_put_extensible_string_value_request,
build_model_properties_dict_methods_request,
build_model_properties_same_as_model_request,
build_model_properties_with_list_request,
Expand Down Expand Up @@ -3754,6 +3757,96 @@ async def with_list(self, body: Union[_models.ModelWithList, JSON, IO[bytes]], *
return cls(pipeline_response, None, {}) # type: ignore


class ExtensibleStringsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.

Instead, you should access the following operations through
:class:`~specialwords.aio.SpecialWordsClient`'s
:attr:`extensible_strings` attribute.
"""

def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client")
self._config: SpecialWordsClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer")

@distributed_trace_async
async def put_extensible_string_value(
self, body: Union[str, _models.ExtensibleString], **kwargs: Any
) -> Union[str, _models.ExtensibleString]:
"""put_extensible_string_value.

:param body: Known values are: "and", "as", "assert", "async", "await", "break", "class",
"constructor", "continue", "def", "del", "elif", "else", "except", "exec", "finally", "for",
"from", "global", "if", "import", "in", "is", "lambda", "not", "or", "pass", "raise", "return",
"try", "while", "with", and "yield". Required.
:type body: str or ~specialwords.models.ExtensibleString
:return: ExtensibleString
:rtype: str or ~specialwords.models.ExtensibleString
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}

content_type: str = kwargs.pop("content_type", _headers.pop("content-type", "application/json"))
cls: ClsType[Union[str, _models.ExtensibleString]] = kwargs.pop("cls", None)

_content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore

_request = build_extensible_strings_put_extensible_string_value_request(
content_type=content_type,
content=_content,
headers=_headers,
params=_params,
)
path_format_arguments = {
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
}
_request.url = self._client.format_url(_request.url, **path_format_arguments)

_decompress = kwargs.pop("decompress", True)
_stream = kwargs.pop("stream", False)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
_request, stream=_stream, **kwargs
)

response = pipeline_response.http_response

if response.status_code not in [200]:
if _stream:
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)
raise HttpResponseError(response=response)

response_headers = {}
response_headers["content-type"] = self._deserialize("str", response.headers.get("content-type"))

if _stream:
deserialized = response.iter_bytes() if _decompress else response.iter_raw()
else:
deserialized = _deserialize(Union[str, _models.ExtensibleString], response.json())

if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore

return deserialized # type: ignore


class Operations: # pylint: disable=too-many-public-methods
"""
.. warning::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
WithModel,
YieldModel,
)

from ._enums import ( # type: ignore
ExtensibleString,
)
from ._patch import __all__ as _patch_all
from ._patch import *
from ._patch import patch_sdk as _patch_sdk
Expand Down Expand Up @@ -92,6 +96,7 @@
"WhileModel",
"WithModel",
"YieldModel",
"ExtensibleString",
]
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
Loading
Loading