diff --git a/.chronus/changes/copilot-fix-enum-name-compile-error-2026-3-16-5-51-48.md b/.chronus/changes/copilot-fix-enum-name-compile-error-2026-3-16-5-51-48.md new file mode 100644 index 00000000000..a4b37339352 --- /dev/null +++ b/.chronus/changes/copilot-fix-enum-name-compile-error-2026-3-16-5-51-48.md @@ -0,0 +1,8 @@ +--- +changeKind: fix +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Fix enum member names with hyphens generating invalid Python identifiers \ No newline at end of file diff --git a/.chronus/changes/python-addBackApiViewSphinx-2026-3-9-12-35-1.md b/.chronus/changes/python-addBackApiViewSphinx-2026-3-9-12-35-1.md new file mode 100644 index 00000000000..70fd0fb0142 --- /dev/null +++ b/.chronus/changes/python-addBackApiViewSphinx-2026-3-9-12-35-1.md @@ -0,0 +1,8 @@ +--- +changeKind: internal +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Add apiview and sphinx to ci \ No newline at end of file diff --git a/.chronus/changes/python-drop-39-2026-4-27-6-50-0.md b/.chronus/changes/python-drop-39-2026-4-27-6-50-0.md new file mode 100644 index 00000000000..f7cc418f140 --- /dev/null +++ b/.chronus/changes/python-drop-39-2026-4-27-6-50-0.md @@ -0,0 +1,9 @@ +--- +# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking +changeKind: deprecation +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Drop support for Python 3.9. The minimum supported Python version is now 3.10. Python 3.9 reached end-of-life and is no longer supported by upstream Python. diff --git a/.chronus/changes/python-fixCI-2026-3-24-14-53-10.md b/.chronus/changes/python-fixCI-2026-3-24-14-53-10.md new file mode 100644 index 00000000000..1b3efbca4aa --- /dev/null +++ b/.chronus/changes/python-fixCI-2026-3-24-14-53-10.md @@ -0,0 +1,8 @@ +--- +changeKind: internal +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Fix failing CI \ No newline at end of file diff --git a/.chronus/changes/python-update-contributing-docs-2026-04-23-10-47-41.md b/.chronus/changes/python-update-contributing-docs-2026-04-23-10-47-41.md new file mode 100644 index 00000000000..1b898043944 --- /dev/null +++ b/.chronus/changes/python-update-contributing-docs-2026-04-23-10-47-41.md @@ -0,0 +1,8 @@ +--- +changeKind: internal +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Fix transient mypy CI failures on Windows with retry logic and update CONTRIBUTING docs to reflect the new end-to-end release workflow diff --git a/.chronus/changes/revert-wrong-code-2026-3-29-13-46-47.md b/.chronus/changes/revert-wrong-code-2026-3-29-13-46-47.md new file mode 100644 index 00000000000..8c6a2fb1988 --- /dev/null +++ b/.chronus/changes/revert-wrong-code-2026-3-29-13-46-47.md @@ -0,0 +1,8 @@ +--- +changeKind: fix +packages: + - "@autorest/python" + - "@azure-tools/typespec-python" +--- + +Revert wrong code to avoid overwrite customized code when generation-subdir is set \ No newline at end of file diff --git a/eng/pipelines/ci.yml b/eng/pipelines/ci.yml index 6bbb6e4f6ef..277a7b6927c 100644 --- a/eng/pipelines/ci.yml +++ b/eng/pipelines/ci.yml @@ -54,11 +54,6 @@ jobs: Pool: ${{ variables.LINUXPOOL }} OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.10" - Windows_Python3.10: - OSName: "Windows" - Pool: ${{ variables.WINDOWSPOOL }} - OSVmImage: ${{ variables.WINDOWSVMIMAGE}} - PythonVersion: "3.10" Linux_Python3.11: OSName: "Linux" Pool: ${{ variables.LINUXPOOL }} @@ -69,11 +64,16 @@ jobs: Pool: ${{ variables.LINUXPOOL }} OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.13" - Windows_Python3.13: - OSName: "Windows" - Pool: ${{ variables.WINDOWSPOOL }} - OSVmImage: ${{ variables.WINDOWSVMIMAGE}} - PythonVersion: "3.13" + # Windows_Python3.10: + # OSName: "Windows" + # Pool: ${{ variables.WINDOWSPOOL }} + # OSVmImage: ${{ variables.WINDOWSVMIMAGE}} + # PythonVersion: "3.10" + # Windows_Python3.13: + # OSName: "Windows" + # Pool: ${{ variables.WINDOWSPOOL }} + # OSVmImage: ${{ variables.WINDOWSVMIMAGE}} + # PythonVersion: "3.13" pool: name: $(Pool) @@ -140,11 +140,6 @@ jobs: Pool: ${{ variables.LINUXPOOL }} OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.10" - Windows_Python310: - OSName: "Windows" - Pool: ${{ variables.WINDOWSPOOL }} - OSVmImage: ${{ variables.WINDOWSVMIMAGE}} - PythonVersion: "3.10" Linux_Python311: OSName: "Linux" Pool: ${{ variables.LINUXPOOL }} @@ -155,11 +150,16 @@ jobs: Pool: ${{ variables.LINUXPOOL }} OSVmImage: ${{ variables.LINUXVMIMAGE}} PythonVersion: "3.13" - Windows_Python313: - OSName: "Windows" - Pool: ${{ variables.WINDOWSPOOL }} - OSVmImage: ${{ variables.WINDOWSVMIMAGE}} - PythonVersion: "3.13" + # Windows_Python310: + # OSName: "Windows" + # Pool: ${{ variables.WINDOWSPOOL }} + # OSVmImage: ${{ variables.WINDOWSVMIMAGE}} + # PythonVersion: "3.10" + # Windows_Python313: + # OSName: "Windows" + # Pool: ${{ variables.WINDOWSPOOL }} + # OSVmImage: ${{ variables.WINDOWSVMIMAGE}} + # PythonVersion: "3.13" pool: name: $(Pool) diff --git a/packages/autorest.python/autorest/__init__.py b/packages/autorest.python/autorest/__init__.py index b71e984d4ad..6e0890e4a08 100644 --- a/packages/autorest.python/autorest/__init__.py +++ b/packages/autorest.python/autorest/__init__.py @@ -13,7 +13,6 @@ from pygen import ReaderAndWriter, Plugin, YamlUpdatePlugin, OptionsDict from .jsonrpc import AutorestAPI - _LOGGER = logging.getLogger(__name__) diff --git a/packages/autorest.python/autorest/codegen.py b/packages/autorest.python/autorest/codegen.py index 44491bda99d..d34ab9df237 100644 --- a/packages/autorest.python/autorest/codegen.py +++ b/packages/autorest.python/autorest/codegen.py @@ -16,7 +16,6 @@ from .jsonrpc import AutorestAPI from . import PluginAutorest - _LOGGER = logging.getLogger(__name__) diff --git a/packages/autorest.python/autorest/jsonrpc/localapi.py b/packages/autorest.python/autorest/jsonrpc/localapi.py index e3b990233d5..5bed10228f7 100644 --- a/packages/autorest.python/autorest/jsonrpc/localapi.py +++ b/packages/autorest.python/autorest/jsonrpc/localapi.py @@ -9,7 +9,6 @@ from . import AutorestAPI, Channel - _LOGGER = logging.getLogger(__name__) diff --git a/packages/autorest.python/autorest/jsonrpc/server.py b/packages/autorest.python/autorest/jsonrpc/server.py index 1f4b5e58f1d..c2501654447 100644 --- a/packages/autorest.python/autorest/jsonrpc/server.py +++ b/packages/autorest.python/autorest/jsonrpc/server.py @@ -14,7 +14,6 @@ from .stdstream import read_message, write_message - _LOGGER = logging.getLogger(__name__) diff --git a/packages/autorest.python/autorest/jsonrpc/stdstream.py b/packages/autorest.python/autorest/jsonrpc/stdstream.py index 0fe3f02c696..440b5aa566b 100644 --- a/packages/autorest.python/autorest/jsonrpc/stdstream.py +++ b/packages/autorest.python/autorest/jsonrpc/stdstream.py @@ -14,7 +14,6 @@ from . import AutorestAPI, Channel - _LOGGER = logging.getLogger(__name__) diff --git a/packages/autorest.python/autorest/m2r.py b/packages/autorest.python/autorest/m2r.py index c65134bdf8e..576093aca5d 100644 --- a/packages/autorest.python/autorest/m2r.py +++ b/packages/autorest.python/autorest/m2r.py @@ -4,6 +4,7 @@ # license information. # -------------------------------------------------------------------------- """An autorest MD to RST plugin.""" + import logging from typing import Any, Dict, Set, Union @@ -12,7 +13,6 @@ from . import YamlUpdatePluginAutorest - _LOGGER = logging.getLogger(__name__) diff --git a/packages/autorest.python/autorest/m4reformatter/__init__.py b/packages/autorest.python/autorest/m4reformatter/__init__.py index e51865b3734..010e4babd7c 100644 --- a/packages/autorest.python/autorest/m4reformatter/__init__.py +++ b/packages/autorest.python/autorest/m4reformatter/__init__.py @@ -5,6 +5,7 @@ # license information. # -------------------------------------------------------------------------- """The modelerfour reformatter autorest plugin.""" + import re import copy import logging @@ -19,7 +20,6 @@ ) from .. import YamlUpdatePluginAutorest - ORIGINAL_ID_TO_UPDATED_TYPE: Dict[int, Dict[str, Any]] = {} OAUTH_TYPE = "OAuth2" KEY_TYPE = "Key" @@ -748,7 +748,7 @@ def _update_content_type_parameter( param["language"]["default"]["description"] = description return param - def _update_parameters_helper( + def _update_parameters_helper( # pylint: disable=too-many-positional-arguments self, parameters: List[Dict[str, Any]], body_parameter: Optional[Dict[str, Any]], diff --git a/packages/autorest.python/autorest/preprocess.py b/packages/autorest.python/autorest/preprocess.py index 015a24d2af6..a11c27d2688 100644 --- a/packages/autorest.python/autorest/preprocess.py +++ b/packages/autorest.python/autorest/preprocess.py @@ -4,6 +4,7 @@ # license information. # -------------------------------------------------------------------------- """The preprocessing autorest plugin.""" + from typing import Dict, Any from pygen.preprocess import PreProcessPlugin from . import YamlUpdatePluginAutorest diff --git a/packages/autorest.python/package.json b/packages/autorest.python/package.json index e59809bc311..4230d517fa7 100644 --- a/packages/autorest.python/package.json +++ b/packages/autorest.python/package.json @@ -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/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz", + "@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz", "@autorest/system-requirements": "~1.0.2", "fs-extra": "~11.2.0", "tsx": "^4.21.0" diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_pyproject_mgmt_client.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_pyproject_mgmt_client.py index b27694f1f11..64c589a9204 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_pyproject_mgmt_client.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_pyproject_mgmt_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations, Operations, SelfDefineOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_utils/serialization.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_pyproject_mgmt_client.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_pyproject_mgmt_client.py index 32866d55e4c..ac5bd839577 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_pyproject_mgmt_client.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/_pyproject_mgmt_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import PyprojectMgmtClientConfiguration from .operations import HttpSuccessOperations, Operations, SelfDefineOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/operations/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/operations/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/azure/mgmt/pyproject/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/pyproject.toml b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/pyproject.toml index 70c44516973..8abde5a327a 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/pyproject.toml +++ b/packages/autorest.python/samples/specification/azure-mgmt-pyproject/test/azure-mgmt-pyproject/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_auto_rest_head_test_service.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_auto_rest_head_test_service.py index a6ef89375de..63cfe6af285 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_auto_rest_head_test_service.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_utils/serialization.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_auto_rest_head_test_service.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_auto_rest_head_test_service.py index 2d3478de43d..810364e8638 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/operations/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/operations/_patch.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/azure/mgmt/test/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/setup.py b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/setup.py index f84d55c6a23..b71e7f1dac2 100644 --- a/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/setup.py +++ b/packages/autorest.python/samples/specification/azure-mgmt-test/test/azure-mgmt-test/setup.py @@ -11,7 +11,6 @@ import re from setuptools import setup, find_packages - PACKAGE_NAME = "azure-mgmt-test" PACKAGE_PPRINT_NAME = "Test Management" @@ -42,7 +41,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -67,5 +65,5 @@ "azure-mgmt-core>=1.6.0", "typing-extensions>=4.6.0", ], - python_requires=">=3.9", + python_requires=">=3.10", ) diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_client.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_client.py index 3e259254259..afa5449b4f2 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_client.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_patch.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_patch.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_utils/serialization.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_client.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_client.py index 804ba362ed1..1b0fbe3088b 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_client.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_patch.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_patch.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/operations/_patch.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/models/_patch.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/models/_patch.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/operations/_patch.py b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure-test/test/azure-test/azure/test/_generated/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_client.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_client.py index 7289074a3f7..fbcf69b2e9a 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_client.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_patch.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_patch.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_utils/serialization.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_client.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_client.py index 4c393c268bf..aba04c25607 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_client.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_patch.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_patch.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_patch.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_patch.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_patch.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/azure/key/credential/sample/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/azure_key_credential/generated/setup.py b/packages/autorest.python/samples/specification/azure_key_credential/generated/setup.py index d6e4e96b8f7..cb7577b5b7a 100644 --- a/packages/autorest.python/samples/specification/azure_key_credential/generated/setup.py +++ b/packages/autorest.python/samples/specification/azure_key_credential/generated/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "azure-key-credential-sample" version = "0.1.0" diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_client.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_client.py index e3a605b5b77..c770cd01de3 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_client.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_patch.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_patch.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_utils/serialization.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_client.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_client.py index 35b5e4a9c91..4d6fd534435 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_client.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_patch.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_patch.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_patch.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_patch.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_patch.py b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_patch.py +++ b/packages/autorest.python/samples/specification/basic/generated/azure/basic/sample/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/basic/generated/setup.py b/packages/autorest.python/samples/specification/basic/generated/setup.py index 597610ab531..2a0b62343cd 100644 --- a/packages/autorest.python/samples/specification/basic/generated/setup.py +++ b/packages/autorest.python/samples/specification/basic/generated/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "azure-basic-sample" version = "0.1.0" diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_client.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_client.py index 2419c98e18e..b40fefeb01a 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_client.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _PollingPagingExampleOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PollingPagingExample(_PollingPagingExampleOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Show polling and paging generation. diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_patch.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_patch.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_patch.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_patch.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_utils/serialization.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_client.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_client.py index 3a08c9ade76..e9350bc0440 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_client.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PollingPagingExampleConfiguration from ._operations import _PollingPagingExampleOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PollingPagingExample(_PollingPagingExampleOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Show polling and paging generation. diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_patch.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_patch.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_patch.py b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_patch.py +++ b/packages/autorest.python/samples/specification/directives/generated/azure/directives/sample/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/directives/generated/setup.py b/packages/autorest.python/samples/specification/directives/generated/setup.py index 4ac09a3c1c1..20c122573f6 100644 --- a/packages/autorest.python/samples/specification/directives/generated/setup.py +++ b/packages/autorest.python/samples/specification/directives/generated/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "azure-directives-sample" version = "0.1.0" diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py index 38d921db511..be5e23de467 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_patch.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_patch.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_utils/serialization.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_utils/serialization.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_auto_rest_head_test_service.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_auto_rest_head_test_service.py index 71a00770540..75257a31265 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_patch.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_patch.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_patch.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_patch.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_patch.py b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_patch.py +++ b/packages/autorest.python/samples/specification/management/generated/azure/mgmt/sample/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/samples/specification/management/generated/setup.py b/packages/autorest.python/samples/specification/management/generated/setup.py index 2af2af850d9..bfea5fb2e3f 100644 --- a/packages/autorest.python/samples/specification/management/generated/setup.py +++ b/packages/autorest.python/samples/specification/management/generated/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "azure-mgmt-sample" version = "0.1.0" diff --git a/packages/autorest.python/scripts/venvtools.py b/packages/autorest.python/scripts/venvtools.py index 3b9eb69474d..df1388e6252 100644 --- a/packages/autorest.python/scripts/venvtools.py +++ b/packages/autorest.python/scripts/venvtools.py @@ -10,7 +10,6 @@ import sys from pathlib import Path - _ROOT_DIR = Path(__file__).parent.parent diff --git a/packages/autorest.python/setup.py b/packages/autorest.python/setup.py index 45527034857..7247beea66f 100644 --- a/packages/autorest.python/setup.py +++ b/packages/autorest.python/setup.py @@ -12,7 +12,6 @@ from setuptools import setup, find_packages - # Version extraction inspired from 'requests' with open(os.path.join("autorest", "_version.py"), "r") as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) diff --git a/packages/autorest.python/test/azure/legacy/AcceptanceTests/asynctests/test_lro.py b/packages/autorest.python/test/azure/legacy/AcceptanceTests/asynctests/test_lro.py index 183605582ef..505505e3704 100644 --- a/packages/autorest.python/test/azure/legacy/AcceptanceTests/asynctests/test_lro.py +++ b/packages/autorest.python/test/azure/legacy/AcceptanceTests/asynctests/test_lro.py @@ -45,7 +45,6 @@ from lro.aio import AutoRestLongRunningOperationTestService from lro.models import * # pylint: disable=W0614 - try: from urlparse import urlparse except ImportError: diff --git a/packages/autorest.python/test/azure/legacy/AcceptanceTests/conftest.py b/packages/autorest.python/test/azure/legacy/AcceptanceTests/conftest.py index 6b2ca89b0c7..b77cbc59999 100644 --- a/packages/autorest.python/test/azure/legacy/AcceptanceTests/conftest.py +++ b/packages/autorest.python/test/azure/legacy/AcceptanceTests/conftest.py @@ -35,7 +35,6 @@ import pytest - cwd = dirname(realpath(__file__)) diff --git a/packages/autorest.python/test/azure/legacy/AcceptanceTests/test_lro.py b/packages/autorest.python/test/azure/legacy/AcceptanceTests/test_lro.py index 2cbb5dda965..08c27eacf32 100644 --- a/packages/autorest.python/test/azure/legacy/AcceptanceTests/test_lro.py +++ b/packages/autorest.python/test/azure/legacy/AcceptanceTests/test_lro.py @@ -44,7 +44,6 @@ from lro import AutoRestLongRunningOperationTestService from lro.models import * # pylint: disable=W0614 - try: from urlparse import urlparse except ImportError: diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_auto_rest_duration_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_auto_rest_duration_test_service.py index 99afed42522..2b6c32d5607 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_auto_rest_duration_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_auto_rest_duration_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py index b6145cdcadd..309e576bf85 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestDurationTestServiceConfiguration from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py index 3902fbc6006..f721aeacf69 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureBodyDuration/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdurationtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_auto_rest_parameter_grouping_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_auto_rest_parameter_grouping_test_service.py index 483b7730019..460ebcd6259 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_auto_rest_parameter_grouping_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_auto_rest_parameter_grouping_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestParameterGroupingTestServiceConfiguration from .operations import ParameterGroupingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterGroupingTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_auto_rest_parameter_grouping_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_auto_rest_parameter_grouping_test_service.py index a639888d938..e2587f0e512 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_auto_rest_parameter_grouping_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_auto_rest_parameter_grouping_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestParameterGroupingTestServiceConfiguration from .operations import ParameterGroupingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterGroupingTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py index 03cbb4a0b22..bc6da493da7 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureParameterGrouping/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparametergroupingtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_auto_rest_report_service_for_azure.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_auto_rest_report_service_for_azure.py index 5dff1d95aeb..7037a641ccf 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_auto_rest_report_service_for_azure.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_auto_rest_report_service_for_azure.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutoRestReportServiceForAzureOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportServiceForAzure( _AutoRestReportServiceForAzureOperationsMixin diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_auto_rest_report_service_for_azure.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_auto_rest_report_service_for_azure.py index e6d325b711e..50ee66b501a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_auto_rest_report_service_for_azure.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_auto_rest_report_service_for_azure.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestReportServiceForAzureConfiguration from .operations import _AutoRestReportServiceForAzureOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportServiceForAzure( _AutoRestReportServiceForAzureOperationsMixin diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/azurereport/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py index dd6ab92563d..94e8de7902a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureReport/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestreportserviceforazure" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_auto_rest_azure_special_parameters_test_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_auto_rest_azure_special_parameters_test_client.py index 4cb0ce54599..375cbdd6d41 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_auto_rest_azure_special_parameters_test_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_auto_rest_azure_special_parameters_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -32,6 +32,11 @@ XMsClientRequestIdOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_auto_rest_azure_special_parameters_test_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_auto_rest_azure_special_parameters_test_client.py index 39aa96aed22..1aa6c10bf98 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_auto_rest_azure_special_parameters_test_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_auto_rest_azure_special_parameters_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -32,6 +32,11 @@ XMsClientRequestIdOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py index 44e6524347e..5edf72a51fa 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/AzureSpecials/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestazurespecialparameterstestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py index d2692fca2fb..640682e57fc 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py index 01cd11b1690..68a9909fd67 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py index 1bc312dc472..19c691ad4e5 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedhosttestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_auto_rest_paging_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_auto_rest_paging_test_service.py index a8320725b0e..9b9cc6e9801 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_auto_rest_paging_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_auto_rest_paging_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -22,6 +22,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_auto_rest_paging_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_auto_rest_paging_test_service.py index 533aec3b1c7..c109147aa0d 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_auto_rest_paging_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_auto_rest_paging_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -22,6 +22,11 @@ from ._configuration import AutoRestPagingTestServiceConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/custompollerpager/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/setup.py index 56bba347733..a32602c9c42 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomPollerPager/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "custompollerpager" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_auto_rest_parameterized_host_test_paging_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_auto_rest_parameterized_host_test_paging_client.py index 09d8154a67a..efa3c58e565 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_auto_rest_parameterized_host_test_paging_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_auto_rest_parameterized_host_test_paging_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestPagingClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_auto_rest_parameterized_host_test_paging_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_auto_rest_parameterized_host_test_paging_client.py index f1f554c5a80..e7ef88fe24a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_auto_rest_parameterized_host_test_paging_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_auto_rest_parameterized_host_test_paging_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestParameterizedHostTestPagingClientConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestPagingClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py index a241b7d4eaa..27ac1b3af38 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/CustomUrlPaging/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedhosttestpagingclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_auto_rest_head_test_service.py index 8494e25bb6a..976fe4b1077 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_auto_rest_head_test_service.py index 606cc43c987..44bd9114214 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/head/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py index f86c4179ad6..1a98eeef7be 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Head/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestheadtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_auto_rest_head_exception_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_auto_rest_head_exception_test_service.py index afab653986e..9821ce0c8bb 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_auto_rest_head_exception_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_auto_rest_head_exception_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HeadExceptionOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_auto_rest_head_exception_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_auto_rest_head_exception_test_service.py index 2eefca13d96..2410c44aff0 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_auto_rest_head_exception_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_auto_rest_head_exception_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadExceptionTestServiceConfiguration from .operations import HeadExceptionOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py index 8082b2c9d94..c4699b1da55 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadExceptions/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestheadexceptiontestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_auto_rest_head_test_service.py index c5fa0cbc6b7..9c0c5995a4e 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core.credentials import AzureKeyCredential from azure.core.pipeline import policies @@ -20,6 +20,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_auto_rest_head_test_service.py index e2123958e92..5d1b589844e 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core.credentials import AzureKeyCredential from azure.core.pipeline import policies @@ -20,6 +20,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/headwithazurekeycredentialpolicy/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py index f86c4179ad6..1a98eeef7be 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/HeadWithAzureKeyCredentialPolicy/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestheadtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_auto_rest_long_running_operation_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_auto_rest_long_running_operation_test_service.py index 51365652edf..af0198e298d 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_auto_rest_long_running_operation_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_auto_rest_long_running_operation_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -22,6 +22,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import LRORetrysOperations, LROSADsOperations, LROsCustomHeaderOperations, LROsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_auto_rest_long_running_operation_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_auto_rest_long_running_operation_test_service.py index f1b2cbaf73c..8ea33e720ac 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_auto_rest_long_running_operation_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_auto_rest_long_running_operation_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -22,6 +22,11 @@ from ._configuration import AutoRestLongRunningOperationTestServiceConfiguration from .operations import LRORetrysOperations, LROSADsOperations, LROsCustomHeaderOperations, LROsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/lro/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py index 88e5c20f485..10bd1250e06 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Lro/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestlongrunningoperationtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_lro_with_paramaterized_endpoints.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_lro_with_paramaterized_endpoints.py index f45d0e2a9ed..b51316b2423 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_lro_with_paramaterized_endpoints.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_lro_with_paramaterized_endpoints.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _LROWithParamaterizedEndpointsOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class LROWithParamaterizedEndpoints( _LROWithParamaterizedEndpointsOperationsMixin diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_lro_with_paramaterized_endpoints.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_lro_with_paramaterized_endpoints.py index 1b0af4cb569..f9ae68c8aa1 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_lro_with_paramaterized_endpoints.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_lro_with_paramaterized_endpoints.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import LROWithParamaterizedEndpointsConfiguration from .operations import _LROWithParamaterizedEndpointsOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class LROWithParamaterizedEndpoints( _LROWithParamaterizedEndpointsOperationsMixin diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/lrowithparameterizedendpoints/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py index ce174315da9..08029b7d89a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/LroWithParameterizedEndpoints/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "lrowithparamaterizedendpoints" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_mixed_api_version_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_mixed_api_version_client.py index 3cd26ec240d..92e897f4f8d 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_mixed_api_version_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_mixed_api_version_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -29,6 +29,11 @@ XMsClientRequestIdOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_mixed_api_version_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_mixed_api_version_client.py index 9607a275dd6..25dbb84c9f4 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_mixed_api_version_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_mixed_api_version_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -29,6 +29,11 @@ XMsClientRequestIdOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/mixedapiversion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/setup.py index 40652aab197..869e2088be1 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/MixedApiVersion/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "mixedapiversion" version = "1.0.0b1" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_head_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_head_client.py index 5b1a6a62912..2e41d564232 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_head_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_head_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_head_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_head_client.py index 73811936d0d..e0d41aa2a89 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_head_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_head_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import HeadClientConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/head/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_paging_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_paging_client.py index 7cbd0d0d835..32d6da73bcd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_paging_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_paging_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -22,6 +22,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_paging_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_paging_client.py index 11e90650968..dbf660ffa85 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_paging_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_paging_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -22,6 +22,11 @@ from ._configuration import PagingClientConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/azure/packagemode/batch/paging/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/pyproject.toml b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/pyproject.toml index c44125e7cf7..e8c440128df 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/pyproject.toml +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeBatch/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_auto_rest_head_test_service.py index 47e5d5d5b09..7c037e2e6d8 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_auto_rest_head_test_service.py index addb5dea692..1dddd627dd8 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/azure/packagemode/customize/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/setup.py index cb8f06f5f8b..8f76f6d604d 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeCustomize/setup.py @@ -11,7 +11,6 @@ import re from setuptools import setup, find_packages - PACKAGE_NAME = "azure-packagemode-customize" PACKAGE_PPRINT_NAME = "Azure Customized Package Mode" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_auto_rest_head_test_service.py index f886afb3de3..7a1d388bdc9 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_auto_rest_head_test_service.py index 8ca36706322..f4036b4954a 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/azure/packagemode/dataplane/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml index 2e6250af39b..599ce9e4d85 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_auto_rest_head_test_service.py index 2c64aac7aa4..ea44d8d659c 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_auto_rest_head_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_auto_rest_head_test_service.py index 8c4b5155266..68fd91110a8 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_auto_rest_head_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_auto_rest_head_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/azure/package/mode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/pyproject.toml b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/pyproject.toml index 8792a684a38..ec436888f6f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/pyproject.toml +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/PackageModeMgmtPlane/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_auto_rest_paging_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_auto_rest_paging_test_service.py index 6724d1dceaa..086539781c3 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_auto_rest_paging_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_auto_rest_paging_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestPagingTestService: """Long-running Operation for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_auto_rest_paging_test_service.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_auto_rest_paging_test_service.py index 4edf158d904..53a68edd976 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_auto_rest_paging_test_service.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_auto_rest_paging_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestPagingTestServiceConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestPagingTestService: """Long-running Operation for AutoRest. diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py index b44a4d8eef6..e3824b83d01 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/Paging/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestpagingtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py index 89b9fa90f21..ee2c495d7b5 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutorestSecurityAadOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py index 12a442b0dc9..e60768940b6 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutorestSecurityAadConfiguration from .operations import _AutorestSecurityAadOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py index 15cebfde20f..ba732b256f8 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestsecurityaad" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py index d1f7c10170c..4bbf159a79c 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutorestSecurityKeyOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py index bf89fc6de3b..b4599ab13c8 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutorestSecurityKeyConfiguration from .operations import _AutorestSecurityKeyOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py index de28e024039..357945102bc 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestsecuritykey" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py index 11e5dc47153..f84268cd2ad 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "storagemanagementclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_storage_management_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_storage_management_client.py index 0f15ee04a98..7fca193de2f 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_storage_management_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_storage_management_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -22,6 +22,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StorageAccountsOperations, UsageOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_storage_management_client.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_storage_management_client.py index 894a8fcb1ea..7f9b2f30986 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_storage_management_client.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/_storage_management_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -22,6 +22,11 @@ from ._configuration import StorageManagementClientConfiguration from .operations import StorageAccountsOperations, UsageOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py index b7bf4746661..6bc3274fa70 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "microsoftazuretesturl" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_microsoft_azure_test_url.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_microsoft_azure_test_url.py index fa61c14a66e..0cc60559fbe 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_microsoft_azure_test_url.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_microsoft_azure_test_url.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -22,6 +22,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import GroupOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_utils/serialization.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_utils/serialization.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_microsoft_azure_test_url.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_microsoft_azure_test_url.py index 9f65cfce1ac..34fd2fb37d1 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_microsoft_azure_test_url.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_microsoft_azure_test_url.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -22,6 +22,11 @@ from ._configuration import MicrosoftAzureTestUrlConfiguration from .operations import GroupOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_patch.py b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_patch.py +++ b/packages/autorest.python/test/azure/legacy/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/legacy/tox.ini b/packages/autorest.python/test/azure/legacy/tox.ini index ba92aae27b5..ef0f0b3f2e7 100644 --- a/packages/autorest.python/test/azure/legacy/tox.ini +++ b/packages/autorest.python/test/azure/legacy/tox.ini @@ -16,5 +16,5 @@ commands = [testenv:apiview] commands = - pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_apiview.py -t azure -g legacy diff --git a/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/asynctests/test_lro.py b/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/asynctests/test_lro.py index 7443b397431..59c3a7d49d3 100644 --- a/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/asynctests/test_lro.py +++ b/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/asynctests/test_lro.py @@ -34,7 +34,6 @@ from lroversiontolerant.aio import AutoRestLongRunningOperationTestService - try: from urlparse import urlparse except ImportError: diff --git a/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/conftest.py b/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/conftest.py index 6b2ca89b0c7..b77cbc59999 100644 --- a/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/conftest.py +++ b/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/conftest.py @@ -35,7 +35,6 @@ import pytest - cwd = dirname(realpath(__file__)) diff --git a/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/test_lro.py b/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/test_lro.py index b91af61c156..4b30b1dbd87 100644 --- a/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/test_lro.py +++ b/packages/autorest.python/test/azure/version-tolerant/AcceptanceTests/test_lro.py @@ -32,7 +32,6 @@ from lroversiontolerant import AutoRestLongRunningOperationTestService - try: from urlparse import urlparse except ImportError: diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_client.py index d9386eec17a..2b3cae676de 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py index 449d62630c0..7251a0c6458 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestDurationTestServiceConfiguration from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py index 3902fbc6006..f721aeacf69 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureBodyDurationVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdurationtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_client.py index 9100ccf7808..43823ad9376 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ParameterGroupingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterGroupingTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_client.py index d6f1e2eee31..9bdd75312c5 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestParameterGroupingTestServiceConfiguration from .operations import ParameterGroupingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterGroupingTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/azureparametergroupingversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py index c6ae6f64cef..e15ba80b9ca 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureParameterGroupingVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparametergroupingtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_client.py index 2e8f65f63cd..16616467e7f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AutoRestReportServiceForAzureOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportServiceForAzure( _AutoRestReportServiceForAzureOperationsMixin diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_client.py index cd710344964..20c7d94c1f5 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestReportServiceForAzureConfiguration from ._operations import _AutoRestReportServiceForAzureOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportServiceForAzure( _AutoRestReportServiceForAzureOperationsMixin diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/azurereportversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py index dd6ab92563d..94e8de7902a 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureReportVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestreportserviceforazure" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_client.py index 09a5923e43f..cbb14a6d537 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -30,6 +30,11 @@ XMsClientRequestIdOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_client.py index 3f6d99683ab..4d31e9f1dfe 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -30,6 +30,11 @@ XMsClientRequestIdOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/azurespecialpropertiesversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py index 9784c2389f1..62902b58208 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/AzureSpecialsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestazurespecialparameterstestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py index ef2e3db6534..f6a2050b91d 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py index 0c857272e94..c763846f1f3 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py index dbe06a5c65e..69ce6d162b0 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedhosttestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_client.py index 6b8be1e9765..0d0f9e0b50b 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_client.py index d25bc0a9ca8..f398ecea4c9 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestPagingTestServiceConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py index 210899c7d69..84bc32b8e48 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "custompollerpagerversiontolerant" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_client.py index fee40a61362..bd830825d13 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestPagingClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_client.py index 109050b717c..a1159f0c471 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestParameterizedHostTestPagingClientConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestPagingClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/custombaseurlpagingversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py index a241b7d4eaa..27ac1b3af38 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/CustomUrlPagingVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedhosttestpagingclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_client.py index 067102ab946..9c8cca6575d 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HeadExceptionOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_client.py index cef620dd951..9daef4a3ca7 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadExceptionTestServiceConfiguration from .operations import HeadExceptionOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/headexceptionsversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py index 8082b2c9d94..c4699b1da55 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadExceptionsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestheadexceptiontestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_client.py index 980357592a2..6281146a822 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_client.py index ed9ba128bf6..3edef577353 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestHeadTestServiceConfiguration from .operations import HttpSuccessOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/headversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py index f86c4179ad6..1a98eeef7be 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/HeadVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestheadtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_client.py index ee1dc7ac199..24ebcd5cda0 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import QuestionAnsweringProjectsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class LroPagingClient: """The language service API is a suite of natural language processing (NLP) skills built with diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_client.py index 804fb320e89..4b50ddd992a 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import LroPagingClientConfiguration from .operations import QuestionAnsweringProjectsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class LroPagingClient: """The language service API is a suite of natural language processing (NLP) skills built with diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/lropagingversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/setup.py index 7f50b8b297d..038e045a59a 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroPagingVersionTolerant/setup.py @@ -9,7 +9,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "lropagingversiontolerant" version = "1.0.0b1" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_client.py index ba9159c596a..464b2d0e05e 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import LRORetrysOperations, LROSADsOperations, LROsCustomHeaderOperations, LROsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_client.py index f546bb81163..6c83a5722ee 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import AutoRestLongRunningOperationTestServiceConfiguration from .operations import LRORetrysOperations, LROSADsOperations, LROsCustomHeaderOperations, LROsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/lroversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py index 88e5c20f485..10bd1250e06 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestlongrunningoperationtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_client.py index 5b4f9f4dc39..814121548a6 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _LROWithParamaterizedEndpointsOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class LROWithParamaterizedEndpoints( _LROWithParamaterizedEndpointsOperationsMixin diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_client.py index 6c69e5007f8..e2d8e8a1af7 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import LROWithParamaterizedEndpointsConfiguration from ._operations import _LROWithParamaterizedEndpointsOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class LROWithParamaterizedEndpoints( _LROWithParamaterizedEndpointsOperationsMixin diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/lrowithparameterizedendpointsversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py index ce174315da9..08029b7d89a 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/LroWithParameterizedEndpointsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "lrowithparamaterizedendpoints" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_client.py index d068b3540ee..696e6e53fb2 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestPagingTestService: """Long-running Operation for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_client.py index b035fa1dc27..8c540253e5f 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestPagingTestServiceConfiguration from .operations import PagingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestPagingTestService: """Long-running Operation for AutoRest. diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py index b44a4d8eef6..e3824b83d01 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestpagingtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py index 11e5dc47153..f84268cd2ad 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "storagemanagementclient" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_client.py index 6aaf7d94b37..df62cedb96e 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StorageAccountsOperations, UsageOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_client.py index efc2bd736ff..d8c399b8017 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import StorageManagementClientConfiguration from .operations import StorageAccountsOperations, UsageOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py index b7bf4746661..6bc3274fa70 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "microsoftazuretesturl" version = "0.1.0" diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_client.py index 259c6d6bb94..0d2e6618646 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import GroupOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_utils/serialization.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_client.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_client.py index f730bb8bd9c..b4336338c8e 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import MicrosoftAzureTestUrlConfiguration from .operations import GroupOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_patch.py b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/azure/version-tolerant/Expected/AcceptanceTests/SubscriptionIdApiVersionVersionTolerant/subscriptionidapiversionversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/azure/version-tolerant/tox.ini b/packages/autorest.python/test/azure/version-tolerant/tox.ini index c31775a570a..37d011839d9 100644 --- a/packages/autorest.python/test/azure/version-tolerant/tox.ini +++ b/packages/autorest.python/test/azure/version-tolerant/tox.ini @@ -15,7 +15,7 @@ deps= -r requirements.txt -r ../../../../../eng/dev_requirements.txt commands = - pip install azure-pylint-guidelines-checker==0.5.1 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install azure-pylint-guidelines-checker==0.5.2 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_pylint.py -t azure -g version-tolerant {posargs} [testenv:mypy] @@ -32,5 +32,5 @@ commands = [testenv:apiview] commands = - pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_apiview.py -t azure -g version-tolerant {posargs} diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_client.py index ede9a3fefa4..473832b3bdb 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _DPGClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient(_DPGClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """DPG Swagger that tests our ability to grow up. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_patch.py index 0937b0ba627..8c9afc8cced 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any, Union, cast, IO from azure.core.paging import ItemPaged from azure.core.polling import LROPoller diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_utils/serialization.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_client.py index 048e29a8ab3..0e2aa194c35 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DPGClientConfiguration from ._operations import _DPGClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient(_DPGClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """DPG Swagger that tests our ability to grow up. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_patch.py index 2c1eeb4368f..fbb4dd2ff97 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/dpgcustomizationcustomizedversiontolerant/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any, Union, cast, IO from azure.core.async_paging import AsyncItemPaged from azure.core.polling import AsyncLROPoller diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/setup.py index 9f91dc341c9..250a343c31f 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationCustomizedVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "dpgcustomizationcustomized" version = "0.1.0" diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_client.py index ede9a3fefa4..473832b3bdb 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _DPGClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient(_DPGClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """DPG Swagger that tests our ability to grow up. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_utils/serialization.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_client.py index 048e29a8ab3..0e2aa194c35 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DPGClientConfiguration from ._operations import _DPGClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient(_DPGClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """DPG Swagger that tests our ability to grow up. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/dpgcustomizationinitialversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/setup.py index d58c0e29aa6..aee8e1e5294 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGCustomizationInitialVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "dpgcustomizationinitial" version = "0.1.0" diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_client.py index da8d7f4488a..8421c9c225e 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ParamsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient: # pylint: disable=client-accepts-api-version-keyword """DPG Swagger, this is the initial swagger a service could do. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_utils/serialization.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_client.py index 247c65d3fc9..ea3aa0d53ae 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DPGClientConfiguration from .operations import ParamsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient: # pylint: disable=client-accepts-api-version-keyword """DPG Swagger, this is the initial swagger a service could do. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/dpgservicedriveninitialversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/setup.py index 0a9423116f0..0a64f49daa1 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenInitialVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "dpgservicedriveninitial" version = "0.1.0" diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_client.py index bfeb7fe51a6..1ea0bc973d3 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ParamsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient: # pylint: disable=client-accepts-api-version-keyword """DPG Swagger, this is the initial swagger a service could do. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_utils/serialization.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_client.py index 647c2082290..db85a7c6853 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DPGClientConfiguration from .operations import ParamsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient: # pylint: disable=client-accepts-api-version-keyword """DPG Swagger, this is the initial swagger a service could do. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/dpgservicedrivenupdateoneversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/setup.py index a0e76319665..931d156aebc 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGServiceDrivenUpdateOneVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "dpgservicedrivenupdateone" version = "0.1.0" diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_client.py index 49431f569f5..a5dffc37788 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._operations import _DPGClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient(_DPGClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """DPG Swagger that tests our ability to grow up. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_patch.py index ccae2673af0..c6d685a3988 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any from ..models import Product from ._operations import _DPGClientOperationsMixin as _DPGClientOperationsMixinGenerated diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_patch.py index fa215221810..12c66bab022 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._client import DPGClient as DPGClientGenerated diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_client.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_client.py index 92c68907e4e..8f8bc9d809a 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import DPGClientConfiguration from ._operations import _DPGClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DPGClient(_DPGClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """DPG Swagger that tests our ability to grow up. diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_patch.py index 084c07a6d28..b59678a0250 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any from ...models import Product from ._operations import _DPGClientOperationsMixin as _DPGClientOperationsMixinGenerated diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_patch.py index fa215221810..12c66bab022 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/aio/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._client import DPGClient as DPGClientGenerated diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/models/_patch.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/models/_patch.py index 30c0e5dccdf..b7c15515bf2 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/models/_patch.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/dpgtestmodelsversiontolerant/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._models import Product as ProductGenerated diff --git a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/setup.py b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/setup.py index 95878502fb3..4cc602f9809 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/setup.py +++ b/packages/autorest.python/test/dpg/version-tolerant/Expected/AcceptanceTests/DPGTestModelsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "dpgtestmodels" version = "0.1.0" diff --git a/packages/autorest.python/test/dpg/version-tolerant/tox.ini b/packages/autorest.python/test/dpg/version-tolerant/tox.ini index d6224661c43..b00aed00780 100644 --- a/packages/autorest.python/test/dpg/version-tolerant/tox.ini +++ b/packages/autorest.python/test/dpg/version-tolerant/tox.ini @@ -15,7 +15,7 @@ deps= -r requirements.txt -r ../../../../../eng/dev_requirements.txt commands = - pip install azure-pylint-guidelines-checker==0.5.1 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install azure-pylint-guidelines-checker==0.5.2 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_pylint.py -t dpg -g version-tolerant {posargs} [testenv:mypy] @@ -32,5 +32,5 @@ commands = [testenv:apiview] commands = - pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_apiview.py -t dpg -g version-tolerant diff --git a/packages/autorest.python/test/unittests/storage_models/serialization.py b/packages/autorest.python/test/unittests/storage_models/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/unittests/storage_models/serialization.py +++ b/packages/autorest.python/test/unittests/storage_models/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/unittests/test_m2r.py b/packages/autorest.python/test/unittests/test_m2r.py index 13d124e7ee6..f435f988d53 100644 --- a/packages/autorest.python/test/unittests/test_m2r.py +++ b/packages/autorest.python/test/unittests/test_m2r.py @@ -5,7 +5,6 @@ # -------------------------------------------------------------------------- from autorest import m2r as m2r_autorest - _MD_LINK = "[inline link](https://github.com/Azure/autorest.python)" _RST_LINK = "`inline link `_" diff --git a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_header.py b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_header.py index b25dc4ee0c8..c31c80e4663 100644 --- a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_header.py +++ b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_header.py @@ -185,7 +185,7 @@ async def test_duration(self, client, value_header): @pytest.mark.asyncio async def test_byte(self, client, value_header): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") await client.header.param_byte("valid", u_bytes) response = await client.header.response_byte("valid", cls=value_header) diff --git a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_url.py b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_url.py index 2804bc95359..268622282f2 100644 --- a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_url.py +++ b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/asynctests/test_url.py @@ -73,7 +73,7 @@ async def test_byte_empty_and_null(self, client): @pytest.mark.asyncio async def test_byte_multi_byte(self, client): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") await client.paths.byte_multi_byte(u_bytes) @pytest.mark.asyncio @@ -163,7 +163,7 @@ async def test_base64_url(self, client): @pytest.mark.asyncio async def test_queries_byte(self, client): await client.queries.byte_empty() - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") await client.queries.byte_multi_byte(u_bytes) await client.queries.byte_null() diff --git a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/conftest.py b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/conftest.py index 64139e91e42..fdef7f8070e 100644 --- a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/conftest.py +++ b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/conftest.py @@ -36,7 +36,6 @@ import pytest - cwd = dirname(realpath(__file__)) diff --git a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_header.py b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_header.py index 01b39b96a4b..6c086c6c537 100644 --- a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_header.py +++ b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_header.py @@ -169,7 +169,7 @@ def test_duration(self, client, value_header): assert response == timedelta(days=123, hours=22, minutes=14, seconds=12, milliseconds=11) def test_byte(self, client, value_header): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") client.header.param_byte("valid", u_bytes) response = client.header.response_byte("valid", cls=value_header) diff --git a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_url.py b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_url.py index 84306c535d2..857737ae31d 100644 --- a/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_url.py +++ b/packages/autorest.python/test/vanilla/legacy/AcceptanceTests/test_url.py @@ -67,7 +67,7 @@ def test_byte_empty_and_null(self, client): client.paths.byte_null(None) def test_byte_multi_byte(self, client): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") client.paths.byte_multi_byte(u_bytes) def test_date_null(self, client): @@ -138,7 +138,7 @@ def test_base64_url(self, client): def test_queries_byte(self, client): client.queries.byte_empty() - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") client.queries.byte_multi_byte(u_bytes) client.queries.byte_null() diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_additional_properties_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_additional_properties_client.py index c36eb97e707..f4e2fa92cb4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_additional_properties_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_additional_properties_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_additional_properties_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_additional_properties_client.py index 5c61c049257..ceab4875cb8 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_additional_properties_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_additional_properties_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AdditionalPropertiesClientConfiguration from .operations import PetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/additionalproperties/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py index 708d6ea09f9..c3248500f0e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/AdditionalProperties/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "additionalpropertiesclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_anything_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_anything_client.py index 7b3c2099c60..1f22966ddd4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_anything_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_anything_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AnythingClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_anything_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_anything_client.py index 588e256c8af..d227bb0b292 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_anything_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_anything_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AnythingClientConfiguration from .operations import _AnythingClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/anything/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py index 720471e11a2..45f92248a50 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Anything/setup.py @@ -9,7 +9,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "anythingclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_auto_rest_swagger_bat_array_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_auto_rest_swagger_bat_array_service.py index 17ae7ddb465..65da3077f22 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_auto_rest_swagger_bat_array_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_auto_rest_swagger_bat_array_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_auto_rest_swagger_bat_array_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_auto_rest_swagger_bat_array_service.py index f4b56f17271..d083643eeb5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_auto_rest_swagger_bat_array_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_auto_rest_swagger_bat_array_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/bodyarray/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py index 5c93b4bc4c8..a4646706d29 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArray/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatarrayservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py index 5c93b4bc4c8..a4646706d29 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatarrayservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_auto_rest_swagger_bat_array_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_auto_rest_swagger_bat_array_service.py index f493961f7ff..f2fd942ae55 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_auto_rest_swagger_bat_array_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_auto_rest_swagger_bat_array_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py index 822c3eca370..a863e9d2077 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_auto_rest_swagger_bat_array_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_binary_with_content_type_application_json.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_binary_with_content_type_application_json.py index de84376639d..962aa2dce27 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_binary_with_content_type_application_json.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_binary_with_content_type_application_json.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DownloadOperations, UploadOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BinaryWithContentTypeApplicationJson: # pylint: disable=client-accepts-api-version-keyword """Sample for file with json and binary content type. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_binary_with_content_type_application_json.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_binary_with_content_type_application_json.py index 370e2944356..f66898518e3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_binary_with_content_type_application_json.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_binary_with_content_type_application_json.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import BinaryWithContentTypeApplicationJsonConfiguration from .operations import DownloadOperations, UploadOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BinaryWithContentTypeApplicationJson: # pylint: disable=client-accepts-api-version-keyword """Sample for file with json and binary content type. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/bodybinary/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py index da6cfdbb373..23083519cf4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBinary/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "binarywithcontenttypeapplicationjson" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_auto_rest_bool_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_auto_rest_bool_test_service.py index b7ed25c8ec8..16eb3df8ee3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_auto_rest_bool_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_auto_rest_bool_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import BoolOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestBoolTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_auto_rest_bool_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_auto_rest_bool_test_service.py index 3cdd55a0dd3..08bd86564eb 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_auto_rest_bool_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_auto_rest_bool_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestBoolTestServiceConfiguration from .operations import BoolOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestBoolTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/bodyboolean/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py index 20a8d56b187..327af1e1953 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyBoolean/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestbooltestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_auto_rest_swagger_bat_byte_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_auto_rest_swagger_bat_byte_service.py index 1f8dcf4435f..4ed8e06bc3b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_auto_rest_swagger_bat_byte_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_auto_rest_swagger_bat_byte_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ByteOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATByteService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_auto_rest_swagger_bat_byte_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_auto_rest_swagger_bat_byte_service.py index 061a89a9f76..f8caebbd64f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_auto_rest_swagger_bat_byte_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_auto_rest_swagger_bat_byte_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATByteServiceConfiguration from .operations import ByteOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATByteService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/bodybyte/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py index 2786adf6a4c..26e40f3179a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByte/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatbyteservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_class_name.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_class_name.py index 18a12a64817..3b79d0d1cab 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_class_name.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_class_name.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ByteOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClassName: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_class_name.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_class_name.py index af762d95285..b6ac2c704cc 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_class_name.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_class_name.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ClassNameConfiguration from .operations import ByteOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClassName: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/bodybytewithpackagename/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py index b4b8269f9dd..5c0caf6c681 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyByteWithPackageName/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "packagename" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_auto_rest_complex_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_auto_rest_complex_test_service.py index cd701d8438f..b2e1ab8181a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_auto_rest_complex_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_auto_rest_complex_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -30,6 +30,11 @@ ReadonlypropertyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_auto_rest_complex_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_auto_rest_complex_test_service.py index a182911f9f9..e26f4a2e265 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_auto_rest_complex_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_auto_rest_complex_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -30,6 +30,11 @@ ReadonlypropertyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py index a8f263a0d67..e9f2c8fff37 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyComplex/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestcomplextestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_auto_rest_date_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_auto_rest_date_test_service.py index 07326d39d6d..9513c065c01 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_auto_rest_date_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_auto_rest_date_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DateOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_auto_rest_date_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_auto_rest_date_test_service.py index 4b727743a39..88c5543106e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_auto_rest_date_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_auto_rest_date_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestDateTestServiceConfiguration from .operations import DateOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/bodydate/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py index d9ba100c0cb..54f70b106bc 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDate/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdatetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_auto_rest_date_time_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_auto_rest_date_time_test_service.py index fab856f8462..1003a77bbdb 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_auto_rest_date_time_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_auto_rest_date_time_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DatetimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_auto_rest_date_time_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_auto_rest_date_time_test_service.py index 23e2d973413..d59362f782a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_auto_rest_date_time_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_auto_rest_date_time_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestDateTimeTestServiceConfiguration from .operations import DatetimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py index 8fcb3ee4d77..19f0fea4d0a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTime/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdatetimetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_auto_rest_rfc1123_date_time_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_auto_rest_rfc1123_date_time_test_service.py index 08dbbb19027..a3471f180cd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_auto_rest_rfc1123_date_time_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_auto_rest_rfc1123_date_time_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import Datetimerfc1123Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRFC1123DateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_auto_rest_rfc1123_date_time_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_auto_rest_rfc1123_date_time_test_service.py index 74ee1f09f8c..db9387cb1dc 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_auto_rest_rfc1123_date_time_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_auto_rest_rfc1123_date_time_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestRFC1123DateTimeTestServiceConfiguration from .operations import Datetimerfc1123Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRFC1123DateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py index 7fa61b2e032..a3a8a2515ce 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDateTimeRfc1123/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestrfc1123datetimetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_auto_rest_swagger_bat_dictionary_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_auto_rest_swagger_bat_dictionary_service.py index 4c938c6e952..9557536277d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_auto_rest_swagger_bat_dictionary_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_auto_rest_swagger_bat_dictionary_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DictionaryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATDictionaryService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_auto_rest_swagger_bat_dictionary_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_auto_rest_swagger_bat_dictionary_service.py index 9b71d885cdc..ed0411ec5f2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_auto_rest_swagger_bat_dictionary_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_auto_rest_swagger_bat_dictionary_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATDictionaryServiceConfiguration from .operations import DictionaryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATDictionaryService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py index 91345eef98a..5cea2d2dc8a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDictionary/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatdictionaryservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_auto_rest_duration_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_auto_rest_duration_test_service.py index 99afed42522..2b6c32d5607 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_auto_rest_duration_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_auto_rest_duration_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py index b6145cdcadd..309e576bf85 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_auto_rest_duration_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestDurationTestServiceConfiguration from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py index 3902fbc6006..f721aeacf69 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyDuration/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdurationtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_auto_rest_swagger_bat_file_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_auto_rest_swagger_bat_file_service.py index fd478206ea9..2c4a61718ed 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_auto_rest_swagger_bat_file_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_auto_rest_swagger_bat_file_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FilesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFileService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_auto_rest_swagger_bat_file_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_auto_rest_swagger_bat_file_service.py index a21db654d46..6f44c9524db 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_auto_rest_swagger_bat_file_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_auto_rest_swagger_bat_file_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATFileServiceConfiguration from .operations import FilesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFileService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/bodyfile/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py index 58522e0d67b..26d67cef4f7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFile/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatfileservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_auto_rest_swagger_bat_form_data_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_auto_rest_swagger_bat_form_data_service.py index 84c75e0f793..77f916de41d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_auto_rest_swagger_bat_form_data_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_auto_rest_swagger_bat_form_data_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FormdataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFormDataService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_auto_rest_swagger_bat_form_data_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_auto_rest_swagger_bat_form_data_service.py index aa416952fe6..64411ee4e2f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_auto_rest_swagger_bat_form_data_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_auto_rest_swagger_bat_form_data_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATFormDataServiceConfiguration from .operations import FormdataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFormDataService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/bodyformdata/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py index e528774182b..b0a12262b02 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormData/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatformdataservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_body_forms_data_url_encoded.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_body_forms_data_url_encoded.py index 4df823b7690..48a75f54cc2 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_body_forms_data_url_encoded.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_body_forms_data_url_encoded.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FormdataurlencodedOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyFormsDataURLEncoded: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_body_forms_data_url_encoded.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_body_forms_data_url_encoded.py index 48621c04b1c..d498b311c18 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_body_forms_data_url_encoded.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_body_forms_data_url_encoded.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import BodyFormsDataURLEncodedConfiguration from .operations import FormdataurlencodedOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyFormsDataURLEncoded: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/bodyformurlencodeddata/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py index fe5b2d5b03a..6ac8049d972 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyFormUrlEncodedData/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "bodyformsdataurlencoded" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_auto_rest_integer_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_auto_rest_integer_test_service.py index ed11337baab..40951d65896 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_auto_rest_integer_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_auto_rest_integer_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestIntegerTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_auto_rest_integer_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_auto_rest_integer_test_service.py index 7d54bc40347..7f39af1ab7e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_auto_rest_integer_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_auto_rest_integer_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestIntegerTestServiceConfiguration from .operations import IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestIntegerTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py index a76d16b262a..30a1f48d723 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyInteger/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestintegertestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_auto_rest_number_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_auto_rest_number_test_service.py index b8c468cf2af..b1af6f69a4d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_auto_rest_number_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_auto_rest_number_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import NumberOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestNumberTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_auto_rest_number_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_auto_rest_number_test_service.py index 13e8626eb87..c676c824887 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_auto_rest_number_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_auto_rest_number_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestNumberTestServiceConfiguration from .operations import NumberOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestNumberTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/bodynumber/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py index 3e1f1ec6331..a60980ca8b1 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyNumber/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestnumbertestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_auto_rest_swagger_bat_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_auto_rest_swagger_bat_service.py index 7014254d8be..21a3dc6672d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_auto_rest_swagger_bat_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_auto_rest_swagger_bat_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import EnumOperations, StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_auto_rest_swagger_bat_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_auto_rest_swagger_bat_service.py index 1a8bff82256..267a14954c0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_auto_rest_swagger_bat_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_auto_rest_swagger_bat_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATServiceConfiguration from .operations import EnumOperations, StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/bodystring/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py index 20d8244540e..d655a7e2917 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyString/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_auto_rest_time_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_auto_rest_time_test_service.py index ceec08f7001..3e339cd2060 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_auto_rest_time_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_auto_rest_time_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import TimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_auto_rest_time_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_auto_rest_time_test_service.py index 85e9226f32b..90e73994c5c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_auto_rest_time_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_auto_rest_time_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestTimeTestServiceConfiguration from .operations import TimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/bodytime/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py index 2773de29cf2..bb8c19db37f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/BodyTime/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresttimetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_client_with_enum.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_client_with_enum.py index 8fb167cd5cc..1177755ea7c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_client_with_enum.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_client_with_enum.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _ClientWithEnumOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientWithEnum(_ClientWithEnumOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test client with enum variable. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_client_with_enum.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_client_with_enum.py index 0c0898bc18d..da0240e496e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_client_with_enum.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_client_with_enum.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ClientWithEnumConfiguration from .operations import _ClientWithEnumOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientWithEnum(_ClientWithEnumOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test client with enum variable. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/clientenum/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/setup.py index 62507af3e27..0abf28e31ab 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ClientEnum/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "clientwithenum" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_auto_rest_swagger_constant_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_auto_rest_swagger_constant_service.py index d6358e02604..59c40e47d46 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_auto_rest_swagger_constant_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_auto_rest_swagger_constant_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ContantsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerConstantService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger Constant. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_auto_rest_swagger_constant_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_auto_rest_swagger_constant_service.py index 68fc1044126..015ac806e89 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_auto_rest_swagger_constant_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_auto_rest_swagger_constant_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerConstantServiceConfiguration from .operations import ContantsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerConstantService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger Constant. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/constants/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py index 48fe9cf1240..37fc4bc01e4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Constants/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerconstantservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py index d2692fca2fb..640682e57fc 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_auto_rest_parameterized_host_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py index 01cd11b1690..68a9909fd67 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_auto_rest_parameterized_host_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py index 1bc312dc472..19c691ad4e5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUri/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedhosttestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_auto_rest_parameterized_custom_host_test_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_auto_rest_parameterized_custom_host_test_client.py index c06d791f868..27d38408efc 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_auto_rest_parameterized_custom_host_test_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_auto_rest_parameterized_custom_host_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedCustomHostTestClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_auto_rest_parameterized_custom_host_test_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_auto_rest_parameterized_custom_host_test_client.py index b7025a26a44..3f26f00fc4f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_auto_rest_parameterized_custom_host_test_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_auto_rest_parameterized_custom_host_test_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestParameterizedCustomHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedCustomHostTestClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/custombaseurlmoreoptions/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py index aab082215cd..4f100126f94 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/CustomBaseUriMoreOptions/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedcustomhosttestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_error_with_secrets.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_error_with_secrets.py index 4c5b531c3b9..bdd0ab9f11c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_error_with_secrets.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_error_with_secrets.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _ErrorWithSecretsOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ErrorWithSecrets(_ErrorWithSecretsOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Tests whether loggers/tracers redact secrets and PII within error responses. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_error_with_secrets.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_error_with_secrets.py index e9107532b78..7f4c65f8b72 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_error_with_secrets.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_error_with_secrets.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ErrorWithSecretsConfiguration from .operations import _ErrorWithSecretsOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ErrorWithSecrets(_ErrorWithSecretsOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Tests whether loggers/tracers redact secrets and PII within error responses. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/errorwithsecrets/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/setup.py index c016a619467..7bffd139d93 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ErrorWithSecrets/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "errorwithsecrets" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_pet_store_inc.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_pet_store_inc.py index 338b740558c..bac2d013829 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_pet_store_inc.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_pet_store_inc.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PetStoreInc: # pylint: disable=client-accepts-api-version-keyword """PetStore. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_pet_store_inc.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_pet_store_inc.py index 4c99309a65b..f7976f86e3a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_pet_store_inc.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/_pet_store_inc.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import PetStoreIncConfiguration from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PetStoreInc: # pylint: disable=client-accepts-api-version-keyword """PetStore. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/extensibleenumsswagger/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py index 41041f3e244..25a2b681ee3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ExtensibleEnums/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "petstoreinc" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_auto_rest_swagger_bat_header_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_auto_rest_swagger_bat_header_service.py index 67bf8f1c59d..4373272b57d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_auto_rest_swagger_bat_header_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_auto_rest_swagger_bat_header_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HeaderOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATHeaderService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_auto_rest_swagger_bat_header_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_auto_rest_swagger_bat_header_service.py index b0b86936111..27d5d26d7a0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_auto_rest_swagger_bat_header_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_auto_rest_swagger_bat_header_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATHeaderServiceConfiguration from .operations import HeaderOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATHeaderService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/header/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py index 7220cd67e21..1ebd98cd0be 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Header/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatheaderservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_auto_rest_http_infrastructure_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_auto_rest_http_infrastructure_test_service.py index 0aeb041b2f0..0b8af0ddf4b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_auto_rest_http_infrastructure_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_auto_rest_http_infrastructure_test_service.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -28,6 +28,11 @@ MultipleResponsesOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHttpInfrastructureTestService: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_auto_rest_http_infrastructure_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_auto_rest_http_infrastructure_test_service.py index 03154ee926f..6a0c6dd40e9 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_auto_rest_http_infrastructure_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_auto_rest_http_infrastructure_test_service.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -28,6 +28,11 @@ MultipleResponsesOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHttpInfrastructureTestService: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/httpinfrastructure/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py index f80fec31ada..5d1704d787f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Http/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresthttpinfrastructuretestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_incorrect_returned_error_model.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_incorrect_returned_error_model.py index 31a818b2f20..28eda454ba5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_incorrect_returned_error_model.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_incorrect_returned_error_model.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _IncorrectReturnedErrorModelOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IncorrectReturnedErrorModel( _IncorrectReturnedErrorModelOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_incorrect_returned_error_model.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_incorrect_returned_error_model.py index 92ea16b07f4..ebcbce3de56 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_incorrect_returned_error_model.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_incorrect_returned_error_model.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import IncorrectReturnedErrorModelConfiguration from .operations import _IncorrectReturnedErrorModelOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IncorrectReturnedErrorModel( _IncorrectReturnedErrorModelOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/incorrecterrorresponse/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py index 414044f4ee2..f0685714c56 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/IncorrectErrorResponse/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "incorrectreturnederrormodel" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_media_types_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_media_types_client.py index 45b21a6b86f..ff4e299b194 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_media_types_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_media_types_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _MediaTypesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypesClient(_MediaTypesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Play with produces/consumes and media-types in general. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_media_types_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_media_types_client.py index b0664cf4222..a8ba98c84d4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_media_types_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_media_types_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import MediaTypesClientConfiguration from .operations import _MediaTypesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypesClient(_MediaTypesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Play with produces/consumes and media-types in general. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/internaloperation/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/pyproject.toml b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/pyproject.toml index 726a1836d12..1efd7f1c3b3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/pyproject.toml +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/InternalOperation/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_media_types_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_media_types_client.py index 45b21a6b86f..ff4e299b194 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_media_types_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_media_types_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _MediaTypesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypesClient(_MediaTypesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Play with produces/consumes and media-types in general. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_media_types_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_media_types_client.py index b0664cf4222..a8ba98c84d4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_media_types_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_media_types_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import MediaTypesClientConfiguration from .operations import _MediaTypesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypesClient(_MediaTypesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Play with produces/consumes and media-types in general. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/mediatypes/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py index 17f9c4b7252..0476a6dc335 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MediaTypes/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "mediatypesclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_merge_patch_json_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_merge_patch_json_client.py index fceb0b9d5eb..9cb00421f6b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_merge_patch_json_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_merge_patch_json_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _MergePatchJsonClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MergePatchJsonClient(_MergePatchJsonClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing merge patch json. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_merge_patch_json_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_merge_patch_json_client.py index 21d5acd7811..153a62518fc 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_merge_patch_json_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_merge_patch_json_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MergePatchJsonClientConfiguration from .operations import _MergePatchJsonClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MergePatchJsonClient(_MergePatchJsonClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing merge patch json. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/mergepatchjson/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py index 24682ccbd2f..c1d6be027eb 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MergePatchJson/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "mergepatchjsonclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_auto_rest_resource_flattening_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_auto_rest_resource_flattening_test_service.py index ad85d39edc5..e30d481bc80 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_auto_rest_resource_flattening_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_auto_rest_resource_flattening_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutoRestResourceFlatteningTestServiceOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestResourceFlatteningTestService( _AutoRestResourceFlatteningTestServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_auto_rest_resource_flattening_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_auto_rest_resource_flattening_test_service.py index f0261a9dcae..86c5c45d13d 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_auto_rest_resource_flattening_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_auto_rest_resource_flattening_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestResourceFlatteningTestServiceConfiguration from .operations import _AutoRestResourceFlatteningTestServiceOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestResourceFlatteningTestService( _AutoRestResourceFlatteningTestServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/modelflattening/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py index 96e4ed7ae34..ecc3ce5ed4b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ModelFlattening/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestresourceflatteningtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py index e80fb9ed4d6..553a1217dcc 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _MultipleInheritanceServiceClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleInheritanceServiceClient( _MultipleInheritanceServiceClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client.py index 5f68d507b26..f143dd9774f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import MultipleInheritanceServiceClientConfiguration from .operations import _MultipleInheritanceServiceClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleInheritanceServiceClient( _MultipleInheritanceServiceClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py index 65ce30c1474..106241853f4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/MultipleInheritance/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "multipleinheritanceserviceclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/nooperations/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py index 6bb683a96d7..649479281fb 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NoOperations/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "nooperationsserviceclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_non_string_enums_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_non_string_enums_client.py index 74365294126..6692f8eba64 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_non_string_enums_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_non_string_enums_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FloatOperations, IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NonStringEnumsClient: # pylint: disable=client-accepts-api-version-keyword """Testing non-string enums. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_non_string_enums_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_non_string_enums_client.py index 04e9f183583..bfedb58dfa4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_non_string_enums_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_non_string_enums_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NonStringEnumsClientConfiguration from .operations import FloatOperations, IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NonStringEnumsClient: # pylint: disable=client-accepts-api-version-keyword """Testing non-string enums. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/nonstringenums/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py index 930e6407d7d..ac7b760933b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/NonStringEnums/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "nonstringenumsclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_object_type_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_object_type_client.py index 6ed66d73c1f..e7912a445b0 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_object_type_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_object_type_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _ObjectTypeClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ObjectTypeClient(_ObjectTypeClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic type: object swaggers. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_object_type_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_object_type_client.py index c73b6f2acff..2631f01befa 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_object_type_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_object_type_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ObjectTypeClientConfiguration from .operations import _ObjectTypeClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ObjectTypeClient(_ObjectTypeClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic type: object swaggers. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/objecttype/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py index 61ca91f962f..01c7500f357 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ObjectType/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "objecttypeclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_anything_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_anything_client.py index 7b3c2099c60..1f22966ddd4 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_anything_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_anything_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AnythingClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_anything_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_anything_client.py index 588e256c8af..d227bb0b292 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_anything_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_anything_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AnythingClientConfiguration from .operations import _AnythingClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/packagemode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml index 92ccb71ecd2..6b53e5d78e3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/PackageModeDataPlane/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_auto_rest_parameter_flattening.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_auto_rest_parameter_flattening.py index 3e2c23c2ddd..82f8dce269b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_auto_rest_parameter_flattening.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_auto_rest_parameter_flattening.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AvailabilitySetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterFlattening: # pylint: disable=client-accepts-api-version-keyword """Resource Flattening for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_auto_rest_parameter_flattening.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_auto_rest_parameter_flattening.py index eb0e2049f51..0bfef92a7ba 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_auto_rest_parameter_flattening.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_auto_rest_parameter_flattening.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestParameterFlatteningConfiguration from .operations import AvailabilitySetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterFlattening: # pylint: disable=client-accepts-api-version-keyword """Resource Flattening for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/parameterflattening/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py index 0dbf2cb1c55..ecc852cb591 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterFlattening/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterflattening" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_parmaterized_endpoint_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_parmaterized_endpoint_client.py index 4b84947fb63..7d5187a0f31 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_parmaterized_endpoint_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_parmaterized_endpoint_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _ParmaterizedEndpointClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ParmaterizedEndpointClient( _ParmaterizedEndpointClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_parmaterized_endpoint_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_parmaterized_endpoint_client.py index 6018ae90239..a20c02aa0f1 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_parmaterized_endpoint_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_parmaterized_endpoint_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ParmaterizedEndpointClientConfiguration from .operations import _ParmaterizedEndpointClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ParmaterizedEndpointClient( _ParmaterizedEndpointClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/parameterizedendpoint/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py index 428c21c8f57..c1f03fe870b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ParameterizedEndpoint/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "parmaterizedendpointclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_auto_rest_report_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_auto_rest_report_service.py index bc9cd7953d9..059f4c0a646 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_auto_rest_report_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_auto_rest_report_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutoRestReportServiceOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportService( _AutoRestReportServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_auto_rest_report_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_auto_rest_report_service.py index 5f52bc5ab59..ea285f8a323 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_auto_rest_report_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_auto_rest_report_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestReportServiceConfiguration from .operations import _AutoRestReportServiceOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportService( _AutoRestReportServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/report/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py index 66d07493d2b..1267837c19c 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Report/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestreportservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_auto_rest_required_optional_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_auto_rest_required_optional_test_service.py index ab509ee610f..4cbc4a19875 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_auto_rest_required_optional_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_auto_rest_required_optional_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestRequiredOptionalTestServiceConfiguration from .operations import ExplicitOperations, ImplicitOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRequiredOptionalTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_auto_rest_required_optional_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_auto_rest_required_optional_test_service.py index 1bad1c81c56..98387f159dd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_auto_rest_required_optional_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_auto_rest_required_optional_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestRequiredOptionalTestServiceConfiguration from .operations import ExplicitOperations, ImplicitOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRequiredOptionalTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/requiredoptional/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py index 56cb9592bf5..8cbe2678229 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/RequiredOptional/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestrequiredoptionaltestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_reserved_words_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_reserved_words_client.py index e228c1534cf..8722ddfb036 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_reserved_words_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_reserved_words_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ImportOperations, _ReservedWordsClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReservedWordsClient(_ReservedWordsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Swagger that has operation groups etc. with reserved words. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_reserved_words_client.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_reserved_words_client.py index 7ffde0c1604..e4813311b24 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_reserved_words_client.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/_reserved_words_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ReservedWordsClientConfiguration from .operations import ImportOperations, _ReservedWordsClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReservedWordsClient(_ReservedWordsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Swagger that has operation groups etc. with reserved words. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/reservedwords/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py index d78c7dee390..22425592a4e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/ReservedWords/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "reservedwordsclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py index fa65fdf36d7..851558bdc50 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_autorest_security_aad.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutorestSecurityAadOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py index c27af2810dd..9b3ca0fbb4f 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_autorest_security_aad.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutorestSecurityAadConfiguration from .operations import _AutorestSecurityAadOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/securityaadswagger/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py index a8f2d219068..f669b17405a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwagger/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestsecurityaad" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_security_aad_swagger_credential_flag.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_security_aad_swagger_credential_flag.py index fad1770fc95..dd06c49aeb9 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_security_aad_swagger_credential_flag.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_security_aad_swagger_credential_flag.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _SecurityAadSwaggerCredentialFlagOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SecurityAadSwaggerCredentialFlag( _SecurityAadSwaggerCredentialFlagOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_security_aad_swagger_credential_flag.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_security_aad_swagger_credential_flag.py index eb8d6b2819d..24217548f76 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_security_aad_swagger_credential_flag.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/_security_aad_swagger_credential_flag.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import SecurityAadSwaggerCredentialFlagConfiguration from .operations import _SecurityAadSwaggerCredentialFlagOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SecurityAadSwaggerCredentialFlag( _SecurityAadSwaggerCredentialFlagOperationsMixin diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/securityaadswaggercredentialflag/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/setup.py index fe101331598..951f8b03aca 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityAadSwaggerCredentialFlag/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "securityaadswaggercredentialflag" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py index 71205f5c2f2..15a865feaa7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_autorest_security_key.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _AutorestSecurityKeyOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutorestSecurityKey(_AutorestSecurityKeyOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Autorest Security Key REST APIs. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py index d57900c39a5..b5aef6bfdaf 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_autorest_security_key.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import AutorestSecurityKeyConfiguration from .operations import _AutorestSecurityKeyOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutorestSecurityKey(_AutorestSecurityKeyOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Autorest Security Key REST APIs. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/securitykeyswagger/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py index f5cdf906960..4dc440cb844 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwagger/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestsecuritykey" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_security_key_swagger_credential_flag.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_security_key_swagger_credential_flag.py index 4edc0c2c8b4..676676bd981 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_security_key_swagger_credential_flag.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_security_key_swagger_credential_flag.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import _SecurityKeySwaggerCredentialFlagOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_security_key_swagger_credential_flag.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_security_key_swagger_credential_flag.py index 51ce6675dc8..1168dea91b3 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_security_key_swagger_credential_flag.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/_security_key_swagger_credential_flag.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import SecurityKeySwaggerCredentialFlagConfiguration from .operations import _SecurityKeySwaggerCredentialFlagOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/securitykeyswaggercredentialflag/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/setup.py index 226a03bd88a..7e1a5dd9ef7 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/SecurityKeySwaggerCredentialFlag/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "securitykeyswaggercredentialflag" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py index 24d721ea860..c6cb0a4f546 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresturltestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_auto_rest_url_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_auto_rest_url_test_service.py index 3d8b4d6f2c8..fa53873a111 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_auto_rest_url_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_auto_rest_url_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestUrlTestServiceConfiguration from .operations import PathItemsOperations, PathsOperations, QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_auto_rest_url_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_auto_rest_url_test_service.py index 37032242a5d..eca5b9cce56 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_auto_rest_url_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_auto_rest_url_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestUrlTestServiceConfiguration from .operations import PathItemsOperations, PathsOperations, QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Url/url/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py index c0aa5918898..fec5875a951 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresturlmutlicollectionformattestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_auto_rest_url_mutli_collection_format_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_auto_rest_url_mutli_collection_format_test_service.py index e9fb1e8e6dc..1d7e6678c57 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_auto_rest_url_mutli_collection_format_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_auto_rest_url_mutli_collection_format_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlMutliCollectionFormatTestService: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_auto_rest_url_mutli_collection_format_test_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_auto_rest_url_mutli_collection_format_test_service.py index 83e04282d7f..c4450a63c17 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_auto_rest_url_mutli_collection_format_test_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_auto_rest_url_mutli_collection_format_test_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestUrlMutliCollectionFormatTestServiceConfiguration from .operations import QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlMutliCollectionFormatTestService: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/UrlMultiCollectionFormat/urlmulticollectionformat/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py index 1a96b553903..2f433f54c4a 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestvalidationtest" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_auto_rest_validation_test.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_auto_rest_validation_test.py index 8cb1c66c495..9917611f523 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_auto_rest_validation_test.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_auto_rest_validation_test.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestValidationTestConfiguration from .operations import _AutoRestValidationTestOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestValidationTest(_AutoRestValidationTestOperationsMixin): """Test Infrastructure for AutoRest. No server backend exists for these tests. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_auto_rest_validation_test.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_auto_rest_validation_test.py index 8c7f2408a6f..a1c0ce7d959 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_auto_rest_validation_test.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_auto_rest_validation_test.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from msrest import Deserializer, Serializer @@ -20,6 +20,11 @@ from ._configuration import AutoRestValidationTestConfiguration from .operations import _AutoRestValidationTestOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestValidationTest(_AutoRestValidationTestOperationsMixin): """Test Infrastructure for AutoRest. No server backend exists for these tests. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Validation/validation/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py index 9b979ba7218..fc400ae5604 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatxmlservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_auto_rest_swagger_batxml_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_auto_rest_swagger_batxml_service.py index dde2913a65b..1fc77b06c12 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_auto_rest_swagger_batxml_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_auto_rest_swagger_batxml_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import XmlOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATXMLService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_auto_rest_swagger_batxml_service.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_auto_rest_swagger_batxml_service.py index 54c717cf2c3..23633c1728b 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_auto_rest_swagger_batxml_service.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_auto_rest_swagger_batxml_service.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATXMLServiceConfiguration from .operations import XmlOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATXMLService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/Xml/xmlservice/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py index 015677976be..5b4ca51162e 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "xmserrorresponseextensions" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_utils/serialization.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py index 9934f84856b..8dbce4ad046 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/_xms_error_response_extensions.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XMSErrorResponseExtensions: # pylint: disable=client-accepts-api-version-keyword """XMS Error Response Extensions. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py index 9526e118e33..7716603e7d5 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/_xms_error_response_extensions.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import XMSErrorResponseExtensionsConfiguration from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XMSErrorResponseExtensions: # pylint: disable=client-accepts-api-version-keyword """XMS Error Response Extensions. diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/aio/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/models/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_patch.py b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_patch.py index f7dd3251033..45594112297 100644 --- a/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/legacy/Expected/AcceptanceTests/XmsErrorResponse/xmserrorresponse/operations/_patch.py @@ -6,6 +6,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/legacy/tox.ini b/packages/autorest.python/test/vanilla/legacy/tox.ini index 389118c9d3b..ea03056efa8 100644 --- a/packages/autorest.python/test/vanilla/legacy/tox.ini +++ b/packages/autorest.python/test/vanilla/legacy/tox.ini @@ -16,7 +16,7 @@ commands = [testenv:apiview] commands = - pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_apiview.py -t vanilla -g legacy [testenv:sphinx] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_header.py b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_header.py index d53596daf05..5b232bcfa71 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_header.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_header.py @@ -182,7 +182,7 @@ async def test_duration(client, value_header): @pytest.mark.asyncio async def test_byte(client, value_header): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") await client.header.param_byte(scenario="valid", value=u_bytes) response = await client.header.response_byte(scenario="valid", cls=value_header) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_url.py b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_url.py index 4ed849bf9a1..b0668cebc55 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_url.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/asynctests/test_url.py @@ -61,7 +61,7 @@ async def test_byte_empty_and_null(client): @pytest.mark.asyncio async def test_byte_multi_byte(client): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") await client.paths.byte_multi_byte(u_bytes) @@ -170,7 +170,7 @@ async def test_base64_url(client): @pytest.mark.asyncio async def test_queries_byte(client): await client.queries.byte_empty() - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") await client.queries.byte_multi_byte(byte_query=u_bytes) await client.queries.byte_null() diff --git a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/conftest.py b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/conftest.py index 64139e91e42..fdef7f8070e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/conftest.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/conftest.py @@ -36,7 +36,6 @@ import pytest - cwd = dirname(realpath(__file__)) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_header.py b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_header.py index 407477d4f96..8fb99f6b87c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_header.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_header.py @@ -168,7 +168,7 @@ def test_duration(client, value_header): def test_byte(client, value_header): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") client.header.param_byte(scenario="valid", value=u_bytes) response = client.header.response_byte(scenario="valid", cls=value_header) diff --git a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_url.py b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_url.py index 6e6652faf5f..ab4aab0f1cd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_url.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/AcceptanceTests/test_url.py @@ -56,7 +56,7 @@ def test_byte_empty_and_null(client): def test_byte_multi_byte(client): - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") client.paths.byte_multi_byte(u_bytes) @@ -146,7 +146,7 @@ def test_base64_url(client): def test_queries_byte(client): client.queries.byte_empty() - u_bytes = bytearray("\u554A\u9F44\u4E02\u72DB\u72DC\uF9F1\uF92C\uF9F1\uFA0C\uFA29", encoding="utf-8") + u_bytes = bytearray("\u554a\u9f44\u4e02\u72db\u72dc\uf9f1\uf92c\uf9f1\ufa0c\ufa29", encoding="utf-8") client.queries.byte_multi_byte(byte_query=u_bytes) client.queries.byte_null() diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_client.py index 12b8f1b9c26..d97042977bb 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_client.py index e09f59f1c1b..759b5872ebf 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AdditionalPropertiesClientConfiguration from .operations import PetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/additionalpropertiesversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py index 708d6ea09f9..c3248500f0e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AdditionalPropertiesVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "additionalpropertiesclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_client.py index b41d8770ed1..205806ea371 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AnythingClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_client.py index 3e1e99cf700..aaee2255afc 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AnythingClientConfiguration from ._operations import _AnythingClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/anythingversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py index 720471e11a2..45f92248a50 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/AnythingVersionTolerant/setup.py @@ -9,7 +9,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "anythingclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_client.py index bfb2156950a..ac6c8bc3241 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_client.py index bb2af681471..ae00baebdac 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration from .operations import ArrayOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/bodyarrayversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py index 5c93b4bc4c8..a4646706d29 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyArrayVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatarrayservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_client.py index 5635808c034..3f50eb80050 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DownloadOperations, UploadOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BinaryWithContentTypeApplicationJson: # pylint: disable=client-accepts-api-version-keyword """Sample for file with json and binary content type. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_client.py index 27b9c90e829..7505f1512c8 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import BinaryWithContentTypeApplicationJsonConfiguration from .operations import DownloadOperations, UploadOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BinaryWithContentTypeApplicationJson: # pylint: disable=client-accepts-api-version-keyword """Sample for file with json and binary content type. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/bodybinaryversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py index da6cfdbb373..23083519cf4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBinaryVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "binarywithcontenttypeapplicationjson" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_client.py index 7b8d248e57a..48c7c37ec50 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import BoolOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestBoolTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_client.py index 1ca13321be1..459e5c2836d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestBoolTestServiceConfiguration from .operations import BoolOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestBoolTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/bodybooleanversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py index 20a8d56b187..327af1e1953 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyBooleanVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestbooltestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_client.py index da1af3642c4..dac9b4d8d6a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ByteOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATByteService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_client.py index 65d89a9e868..05284f6a568 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATByteServiceConfiguration from .operations import ByteOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATByteService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/bodybyteversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py index 2786adf6a4c..26e40f3179a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyByteVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatbyteservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_client.py index b1567b9106e..8dd17de3193 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -28,6 +28,11 @@ ReadonlypropertyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_client.py index 9667fcd4e56..916d6df1d42 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -28,6 +28,11 @@ ReadonlypropertyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestComplexTestService: # pylint: disable=too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/bodycomplexversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py index 6c682525433..0bd95369e9d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyComplexVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestcomplextestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_client.py index d4a5759f2c1..6e6b569c9f3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import Datetimerfc1123Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRFC1123DateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_client.py index 1f1375c2f6b..f33ab2eaff9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestRFC1123DateTimeTestServiceConfiguration from .operations import Datetimerfc1123Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRFC1123DateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/bodydatetimerfc1123versiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py index 7fa61b2e032..a3a8a2515ce 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeRfc1123VersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestrfc1123datetimetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_client.py index ac89346984b..9946db9755f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DatetimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_client.py index 2077c6ffa89..e7f2e63a22b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestDateTimeTestServiceConfiguration from .operations import DatetimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/bodydatetimeversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py index 8fcb3ee4d77..19f0fea4d0a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateTimeVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdatetimetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_client.py index e9b72b3144c..8bfc9474614 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DateOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_client.py index 23187ee0c07..42e239be320 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestDateTestServiceConfiguration from .operations import DateOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDateTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/bodydateversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py index d9ba100c0cb..54f70b106bc 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDateVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdatetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_client.py index 52c12807ba5..d971226649e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DictionaryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATDictionaryService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_client.py index 04e0cb0ea05..16deefcd167 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATDictionaryServiceConfiguration from .operations import DictionaryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATDictionaryService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/bodydictionaryversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py index 91345eef98a..5cea2d2dc8a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDictionaryVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatdictionaryservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_client.py index d9386eec17a..2b3cae676de 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py index 449d62630c0..7251a0c6458 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestDurationTestServiceConfiguration from .operations import DurationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestDurationTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/bodydurationversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py index 3902fbc6006..f721aeacf69 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyDurationVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestdurationtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_client.py index ea2266559e7..92516c571f0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FilesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFileService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_client.py index 1724a497a29..0caa67470b6 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATFileServiceConfiguration from .operations import FilesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFileService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/bodyfileversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py index 58522e0d67b..26d67cef4f7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFileVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatfileservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_client.py index 0b50613091f..6348647306a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FormdataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFormDataService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_client.py index b9f45665d2d..e97810a5550 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATFormDataServiceConfiguration from .operations import FormdataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATFormDataService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_patch.py index a798b79c113..5114b984902 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, AsyncIterator, Dict, List from azure.core.tracing.decorator_async import distributed_trace_async diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_patch.py index 38f241075b2..a7a8f9035e0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/bodyformdataversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Dict, List, Iterator, cast, Union from azure.core.tracing.decorator import distributed_trace diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py index e528774182b..b0a12262b02 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormDataVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatformdataservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_client.py index 8fd6dfbfa3a..1844139c709 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FormdataurlencodedOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyFormsDataURLEncoded: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_client.py index b3033c96c14..24f26bebcdd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import BodyFormsDataURLEncodedConfiguration from .operations import FormdataurlencodedOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyFormsDataURLEncoded: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_patch.py index b3c2e6c388e..84c86b1f376 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Dict, List from azure.core.tracing.decorator_async import distributed_trace_async diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_patch.py index 9fabf920f07..8c8edd63379 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/bodyformurlencodeddataversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Dict, List, cast from azure.core.exceptions import ( diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py index fe5b2d5b03a..6ac8049d972 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyFormUrlEncodedDataVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "bodyformsdataurlencoded" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_client.py index 5452ce36a51..7ef43d8351e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestIntegerTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_client.py index d6992a5fdbf..b49c19ef06b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestIntegerTestServiceConfiguration from .operations import IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestIntegerTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/bodyintegerversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py index a76d16b262a..30a1f48d723 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyIntegerVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestintegertestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_client.py index 2d7ba4bac1d..d005e4f1e72 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import NumberOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestNumberTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_client.py index d9f1b8e19fb..af10474f02e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestNumberTestServiceConfiguration from .operations import NumberOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestNumberTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/bodynumberversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py index 3e1f1ec6331..a60980ca8b1 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyNumberVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestnumbertestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_client.py index 2c5711417a3..5f411866eb7 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import EnumOperations, StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_client.py index 11f1b670453..4d9abe4616c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATServiceConfiguration from .operations import EnumOperations, StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/bodystringversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py index 20d8244540e..d655a7e2917 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyStringVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_client.py index 7b1a478ea0c..6b50a7e8017 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import TimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_client.py index 625be8837d9..f1ef0beafdb 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestTimeTestServiceConfiguration from .operations import TimeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestTimeTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/bodytimeversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py index 2773de29cf2..bb8c19db37f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/BodyTimeVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresttimetestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_client.py index c3211a06fb5..c3bd74ab0b0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._operations import _ClientWithEnumOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientWithEnum(_ClientWithEnumOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test client with enum variable. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_client.py index d0158eb6ea1..641ddfd2f49 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ClientWithEnumConfiguration from ._operations import _ClientWithEnumOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientWithEnum(_ClientWithEnumOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test client with enum variable. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/models/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/models/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/clientenumversiontolerant/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/setup.py index 62507af3e27..0abf28e31ab 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ClientEnumVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "clientwithenum" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_client.py index 7528dfc3743..ec3aaf4ac71 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ContantsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerConstantService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger Constant. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_client.py index 999fc01988b..3e6be391580 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerConstantServiceConfiguration from .operations import ContantsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerConstantService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger Constant. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/constantsversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py index 48fe9cf1240..37fc4bc01e4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ConstantsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerconstantservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_client.py index 221ca4a0265..b9af9737921 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedCustomHostTestClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_client.py index 970ff247152..ac146db0be9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestParameterizedCustomHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedCustomHostTestClient: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/custombaseurlmoreoptionsversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py index aab082215cd..4f100126f94 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriMoreOptionsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedcustomhosttestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py index ef2e3db6534..f6a2050b91d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py index 0c857272e94..c763846f1f3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestParameterizedHostTestClientConfiguration from .operations import PathsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterizedHostTestClient: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/custombaseurlversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py index dbe06a5c65e..69ce6d162b0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/CustomBaseUriVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterizedhosttestclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_client.py index 4af0cfe098a..5552d278540 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ErrorWithSecretsOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ErrorWithSecrets(_ErrorWithSecretsOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Tests whether loggers/tracers redact secrets and PII within error responses. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_client.py index 3aa219f73fc..a7e9e449b97 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ErrorWithSecretsConfiguration from ._operations import _ErrorWithSecretsOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ErrorWithSecrets(_ErrorWithSecretsOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Tests whether loggers/tracers redact secrets and PII within error responses. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/errorwithsecretsversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/setup.py index c016a619467..7bffd139d93 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ErrorWithSecretsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "errorwithsecrets" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_client.py index b086b90cbae..816d41ce183 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PetStoreInc: # pylint: disable=client-accepts-api-version-keyword """PetStore. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_client.py index 9d6dbc20c15..19f35b3f638 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PetStoreIncConfiguration from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PetStoreInc: # pylint: disable=client-accepts-api-version-keyword """PetStore. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/extensibleenumsswaggerversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py index 41041f3e244..25a2b681ee3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ExtensibleEnumsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "petstoreinc" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_client.py index 74d64f661cf..a9c6d91333e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HeaderOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATHeaderService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_client.py index 261d39ffcfb..31165ff2c6c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestSwaggerBATHeaderServiceConfiguration from .operations import HeaderOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATHeaderService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/headerversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py index 7220cd67e21..1ebd98cd0be 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HeaderVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatheaderservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_client.py index da057a813b2..8d0d6d5e1bc 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_client.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -27,6 +27,11 @@ MultipleResponsesOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHttpInfrastructureTestService: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_client.py index 711f61fca1e..b11c85f5082 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_client.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -27,6 +27,11 @@ MultipleResponsesOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestHttpInfrastructureTestService: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/httpinfrastructureversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py index f80fec31ada..5d1704d787f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/HttpVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresthttpinfrastructuretestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_client.py index d3743eba56a..f23f32157a8 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _IncorrectReturnedErrorModelOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IncorrectReturnedErrorModel( _IncorrectReturnedErrorModelOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_client.py index a5b3e353d96..0a253183b21 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import IncorrectReturnedErrorModelConfiguration from ._operations import _IncorrectReturnedErrorModelOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IncorrectReturnedErrorModel( _IncorrectReturnedErrorModelOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/incorrecterrorresponseversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py index 414044f4ee2..f0685714c56 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/IncorrectErrorResponseVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "incorrectreturnederrormodel" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_client.py index f752c6d9e60..0d39de49d31 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _MediaTypesClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypesClient(_MediaTypesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Play with produces/consumes and media-types in general. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_patch.py index 4dbaa2e54e7..25002d0fc3d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_operations/_patch.py @@ -8,6 +8,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any, IO, Optional, cast, Union, Tuple, Dict from azure.core.exceptions import ( diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_patch.py index 6ae03df5da8..59fe2876507 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any, overload, IO, Optional, cast, Union, Tuple, Dict from azure.core.exceptions import ( diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_client.py index 11b5a12188e..1211c93e463 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MediaTypesClientConfiguration from ._operations import _MediaTypesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypesClient(_MediaTypesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Play with produces/consumes and media-types in general. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_patch.py index f81908ba59b..f21d2b1d4e8 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/mediatypesversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List, Any, overload, IO, Optional, Union from azure.core.tracing.decorator_async import distributed_trace_async diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py index 17f9c4b7252..0476a6dc335 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MediaTypesVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "mediatypesclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_client.py index 20e877c0b22..ab5e09ac078 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _MergePatchJsonClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MergePatchJsonClient(_MergePatchJsonClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing merge patch json. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_client.py index 384b27ba68a..86f4cf2b69c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MergePatchJsonClientConfiguration from ._operations import _MergePatchJsonClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MergePatchJsonClient(_MergePatchJsonClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing merge patch json. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/mergepatchjsonversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py index 24682ccbd2f..c1d6be027eb 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MergePatchJsonVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "mergepatchjsonclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_client.py index f5d261d711c..d837a938e30 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AutoRestResourceFlatteningTestServiceOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestResourceFlatteningTestService( _AutoRestResourceFlatteningTestServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_client.py index 929bb1f41f2..5d2728e534e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestResourceFlatteningTestServiceConfiguration from ._operations import _AutoRestResourceFlatteningTestServiceOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestResourceFlatteningTestService( _AutoRestResourceFlatteningTestServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/modelflatteningversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py index 96e4ed7ae34..ecc3ce5ed4b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ModelFlatteningVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestresourceflatteningtestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_client.py index 609ff124903..ff1b391d930 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _MultipleInheritanceServiceClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleInheritanceServiceClient( _MultipleInheritanceServiceClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_client.py index de05c306e6b..de2a7b18be8 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MultipleInheritanceServiceClientConfiguration from ._operations import _MultipleInheritanceServiceClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleInheritanceServiceClient( _MultipleInheritanceServiceClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/multipleinheritanceversiontolerant/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py index 65ce30c1474..106241853f4 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/MultipleInheritanceVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "multipleinheritanceserviceclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_client.py index b41d8770ed1..205806ea371 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AnythingClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_client.py index 3e1e99cf700..aaee2255afc 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AnythingClientConfiguration from ._operations import _AnythingClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AnythingClient(_AnythingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic anything types. Those schemas without types can be anything: diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/anything_client/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/setup.py index 4b44e53f1b6..0fb68ebbb7f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoNamespaceFlagVersionTolerant/setup.py @@ -9,7 +9,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "nonamespaceflag" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/nooperationsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py index 6bb683a96d7..649479281fb 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NoOperationsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "nooperationsserviceclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_client.py index 284e036b29f..018046f3931 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FloatOperations, IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NonStringEnumsClient: # pylint: disable=client-accepts-api-version-keyword """Testing non-string enums. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_client.py index f6e123a9361..07c2d794f1a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NonStringEnumsClientConfiguration from .operations import FloatOperations, IntOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NonStringEnumsClient: # pylint: disable=client-accepts-api-version-keyword """Testing non-string enums. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/nonstringenumsversiontolerant/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py index 930e6407d7d..ac7b760933b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/NonStringEnumsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "nonstringenumsclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_client.py index 60e3abbc949..f0d16ef2a1d 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ObjectTypeClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ObjectTypeClient(_ObjectTypeClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic type: object swaggers. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_client.py index f734bc8d17a..4145128a94f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ObjectTypeClientConfiguration from ._operations import _ObjectTypeClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ObjectTypeClient(_ObjectTypeClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Service client for testing basic type: object swaggers. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/objecttypeversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py index 61ca91f962f..01c7500f357 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ObjectTypeVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "objecttypeclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_client.py index 0cfbc79a9ed..7afdff09650 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AvailabilitySetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterFlattening: # pylint: disable=client-accepts-api-version-keyword """Resource Flattening for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_client.py index f6b1c22cd29..25b951acce1 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestParameterFlatteningConfiguration from .operations import AvailabilitySetsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestParameterFlattening: # pylint: disable=client-accepts-api-version-keyword """Resource Flattening for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/parameterflatteningversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py index 0dbf2cb1c55..ecc852cb591 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterFlatteningVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestparameterflattening" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_client.py index e50ae5856e1..b98648e3de9 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ParmaterizedEndpointClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ParmaterizedEndpointClient( _ParmaterizedEndpointClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_client.py index 94266f15b2e..074f35528b1 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ParmaterizedEndpointClientConfiguration from ._operations import _ParmaterizedEndpointClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ParmaterizedEndpointClient( _ParmaterizedEndpointClientOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/parameterizedendpointversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py index 428c21c8f57..c1f03fe870b 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ParameterizedEndpointVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "parmaterizedendpointclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_client.py index 228f73091da..dd3f635ebad 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AutoRestReportServiceOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportService( _AutoRestReportServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_client.py index ec5d9e205a4..533f1ae524c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestReportServiceConfiguration from ._operations import _AutoRestReportServiceOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestReportService( _AutoRestReportServiceOperationsMixin diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/reportversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py index 66d07493d2b..1267837c19c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReportVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestreportservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_client.py index d9e73ca8fca..df52e93cfb3 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ExplicitOperations, ImplicitOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRequiredOptionalTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_client.py index 5a821bcb88b..efd967ad5e8 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestRequiredOptionalTestServiceConfiguration from .operations import ExplicitOperations, ImplicitOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestRequiredOptionalTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/requiredoptionalversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py index 4aaefeadddb..303c9ff2a46 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/RequiredOptionalVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestrequiredoptionaltestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_client.py index 0137d708ad4..b2aa55aae58 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ImportOperations, _ReservedWordsClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReservedWordsClient(_ReservedWordsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Swagger that has operation groups etc. with reserved words. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_patch.py index 250034244e5..2c0cb76a903 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Dict, List, cast from azure.core.exceptions import ( diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_client.py index 1ea8bf14580..877080b44fe 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ReservedWordsClientConfiguration from .operations import ImportOperations, _ReservedWordsClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReservedWordsClient(_ReservedWordsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Swagger that has operation groups etc. with reserved words. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_patch.py index 74a8d056717..3c0436306d0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Any, Dict, List from azure.core.tracing.decorator_async import distributed_trace_async diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/reservedwordsversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py index d78c7dee390..22425592a4e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ReservedWordsVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "reservedwordsclient" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_client.py index 9bcb74f47ba..f69536bd68a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AutorestSecurityAadOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_client.py index 9a29253e761..74703cf0638 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutorestSecurityAadConfiguration from ._operations import _AutorestSecurityAadOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/securityaadswaggerversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/setup.py index a8f2d219068..f669b17405a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityAadSwaggerVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestsecurityaad" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_client.py index 0592cd3398e..9bc40573863 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._operations import _AutorestSecurityKeyOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutorestSecurityKey(_AutorestSecurityKeyOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Autorest Security Key REST APIs. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_client.py index 90f527366d5..03d3a663b33 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import AutorestSecurityKeyConfiguration from ._operations import _AutorestSecurityKeyOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutorestSecurityKey(_AutorestSecurityKeyOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Autorest Security Key REST APIs. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/securitykeyswaggerversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/setup.py index f5cdf906960..4dc440cb844 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/SecurityKeySwaggerVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestsecuritykey" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py index c0aa5918898..fec5875a951 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresturlmutlicollectionformattestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_client.py index c3b3286bc29..dd282b94d5f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlMutliCollectionFormatTestService: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_client.py index 6ace52b7bc2..c6d934224d0 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestUrlMutliCollectionFormatTestServiceConfiguration from .operations import QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlMutliCollectionFormatTestService: # pylint: disable=client-accepts-api-version-keyword,name-too-long """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlMultiCollectionFormatVersionTolerant/urlmulticollectionformatversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py index 0d2b4a6ea1e..db630a0f855 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autoresturltestservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_client.py index 7e7e62277fd..48142861726 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PathItemsOperations, PathsOperations, QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_client.py index 0d21d035505..abb75fc5a7a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestUrlTestServiceConfiguration from .operations import PathItemsOperations, PathsOperations, QueriesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestUrlTestService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/UrlVersionTolerant/urlversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py index 33fc7a81e6d..3b2e232937f 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestvalidationtest" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_client.py index 27f403bfc6a..57609d34098 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AutoRestValidationTestOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestValidationTest(_AutoRestValidationTestOperationsMixin): """Test Infrastructure for AutoRest. No server backend exists for these tests. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_client.py index 7e62e7e99dd..19545309af1 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AutoRestValidationTestConfiguration from ._operations import _AutoRestValidationTestOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestValidationTest(_AutoRestValidationTestOperationsMixin): """Test Infrastructure for AutoRest. No server backend exists for these tests. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/ValidationVersionTolerant/validationversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py index 9b979ba7218..fc400ae5604 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "autorestswaggerbatxmlservice" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_client.py index 6c6d3ffcde3..dd7f848b7fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import XmlOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATXMLService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_client.py index c68117bcc24..1d6b9b44419 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import AutoRestSwaggerBATXMLServiceConfiguration from .operations import XmlOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AutoRestSwaggerBATXMLService: # pylint: disable=client-accepts-api-version-keyword """Test Infrastructure for AutoRest Swagger BAT. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/models/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/models/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/models/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmlVersionTolerant/xmlserviceversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py index 015677976be..5b4ca51162e 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/setup.py @@ -8,7 +8,6 @@ from setuptools import setup, find_packages - PACKAGE_NAME = "xmserrorresponseextensions" version = "0.1.0" diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_client.py index d129bff4b36..3947768b99a 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XMSErrorResponseExtensions: # pylint: disable=client-accepts-api-version-keyword """XMS Error Response Extensions. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_utils/serialization.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_utils/serialization.py index 6da830e0cf4..11e61de54fd 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_utils/serialization.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_client.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_client.py index 6439a621e8c..98338ed492c 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_client.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import XMSErrorResponseExtensionsConfiguration from .operations import PetOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XMSErrorResponseExtensions: # pylint: disable=client-accepts-api-version-keyword """XMS Error Response Extensions. diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_patch.py b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_patch.py index 49900f6ab12..47e75e87874 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_patch.py +++ b/packages/autorest.python/test/vanilla/version-tolerant/Expected/AcceptanceTests/XmsErrorResponseVersionTolerant/xmserrorresponseversiontolerant/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/autorest.python/test/vanilla/version-tolerant/tox.ini b/packages/autorest.python/test/vanilla/version-tolerant/tox.ini index fab3e65993d..6ce94e95f03 100644 --- a/packages/autorest.python/test/vanilla/version-tolerant/tox.ini +++ b/packages/autorest.python/test/vanilla/version-tolerant/tox.ini @@ -15,7 +15,7 @@ deps= -r requirements.txt -r ../../../../../eng/dev_requirements.txt commands = - pip install azure-pylint-guidelines-checker==0.5.1 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install azure-pylint-guidelines-checker==0.5.2 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_pylint.py -t vanilla -g version-tolerant {posargs} [testenv:mypy] @@ -32,5 +32,5 @@ commands = [testenv:apiview] commands = - pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" + uv pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/" python ../../../../../eng/scripts/run_apiview.py -t vanilla -g version-tolerant diff --git a/packages/typespec-python/dev_requirements.txt b/packages/typespec-python/dev_requirements.txt index f05990860ca..42b0ed775a9 100644 --- a/packages/typespec-python/dev_requirements.txt +++ b/packages/typespec-python/dev_requirements.txt @@ -1,15 +1,16 @@ # shall keep aligned with dev_requirements.txt of @typespec/http-client-python -pyright==1.1.391 -pylint==3.2.7 -tox==4.23.2 -mypy==1.13.0 +pyright==1.1.407 +pylint==4.0.4 +tox==4.16.0 +tox-uv +mypy==1.19.1 colorama==0.4.6 -debugpy==1.8.12 -pytest==8.3.4 +debugpy==1.8.2 +pytest==8.3.2 coverage==7.6.1 -black==24.8.0 +black==26.3.1 ptvsd==4.3.2 -types-PyYAML==6.0.12.20241230 +types-PyYAML==6.0.12.8 # additional dependency needed for development setuptools diff --git a/packages/typespec-python/eng/scripts/setup/venvtools.py b/packages/typespec-python/eng/scripts/setup/venvtools.py index f15abdd5250..c733957dc90 100644 --- a/packages/typespec-python/eng/scripts/setup/venvtools.py +++ b/packages/typespec-python/eng/scripts/setup/venvtools.py @@ -8,7 +8,6 @@ import sys from pathlib import Path - _ROOT_DIR = Path(__file__).parent.parent diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index b68b4bd8440..f98a367616b 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -65,7 +65,7 @@ "@typespec/xml": ">=0.81.0 <1.0.0" }, "dependencies": { - "@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz", + "@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz", "fs-extra": "~11.2.0", "js-yaml": "~4.1.0", "semver": "~7.6.2", diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_client.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_client.py index b41d3a47701..51b5ff1bd4c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._operations import _ApiKeyClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ApiKeyClient(_ApiKeyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey authentication. diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_operations/_patch.py index fc4fac79b3b..8391c35e9d5 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._operations import _ApiKeyClientOperationsMixin as Generated diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_client.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_client.py index 496661c0e01..7636f8574f1 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import ApiKeyClientConfiguration from ._operations import _ApiKeyClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ApiKeyClient(_ApiKeyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey authentication. diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_operations/_patch.py index fc4fac79b3b..8391c35e9d5 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._operations import _ApiKeyClientOperationsMixin as Generated diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/models/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/authentication/apikey/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-api-key/pyproject.toml b/packages/typespec-python/tests/generated/azure/authentication-api-key/pyproject.toml index b9892fa24de..a72c01ac208 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-api-key/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/authentication-api-key/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_client.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_client.py index 0b94f5629dc..c6bb8d60143 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._operations import _CustomClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CustomClient(_CustomClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with generic HTTP auth. diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_client.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_client.py index c845aab2e10..9d00d20c3df 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import CustomClientConfiguration from ._operations import _CustomClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CustomClient(_CustomClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with generic HTTP auth. diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/models/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/authentication/http/custom/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-http-custom/pyproject.toml b/packages/typespec-python/tests/generated/azure/authentication-http-custom/pyproject.toml index 04a9c177f17..37427507380 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-http-custom/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/authentication-http-custom/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_client.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_client.py index 7dd81d3d033..74dad94331f 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _UnionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_client.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_client.py index 57283c65531..cd1e18605ff 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import UnionClientConfiguration from ._operations import _UnionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/authentication/noauth/union/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/pyproject.toml b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/pyproject.toml index 11039807894..06298f5944d 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-noauth-union/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/authentication-noauth-union/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_client.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_client.py index 0942dadeb8f..6909af7c633 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _OAuth2ClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_client.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_client.py index 395cc216bc8..5a641a54df2 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import OAuth2ClientConfiguration from ._operations import _OAuth2ClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/models/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/authentication/oauth2/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-oauth2/pyproject.toml b/packages/typespec-python/tests/generated/azure/authentication-oauth2/pyproject.toml index 98e794779c4..475e43b540d 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-oauth2/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/authentication-oauth2/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_client.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_client.py index 667dadb9ad9..d885b938a6d 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._operations import _UnionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_client.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_client.py index 7bcbfc2c01d..5b6e205f2ac 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import UnionClientConfiguration from ._operations import _UnionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_patch.py b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/authentication-union/authentication/union/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/authentication-union/pyproject.toml b/packages/typespec-python/tests/generated/azure/authentication-union/pyproject.toml index c47183cf0c8..3be63bda883 100644 --- a/packages/typespec-python/tests/generated/azure/authentication-union/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/authentication-union/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/pyproject.toml index 5d21837a149..a99e4bd807f 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_client.py index d9c94e451c6..8c15eb79f85 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -23,6 +23,11 @@ SharedModelInOperationOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AccessClient: # pylint: disable=client-accepts-api-version-keyword """Test for internal decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_client.py index e731ef7b56e..444dc14a78d 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -23,6 +23,11 @@ SharedModelInOperationOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AccessClient: # pylint: disable=client-accepts-api-version-keyword """Test for internal decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-access/specs/azure/clientgenerator/core/access/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/pyproject.toml index 252eb46ea83..f2ab7b5fb6e 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_client.py index 5f6f4f3a361..6b510a7d95c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ExternalTypeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AlternateTypeClient: # pylint: disable=client-accepts-api-version-keyword """Test for alternate type decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/model_base.py index 6194c9d9d7c..7c4f47a2bc7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/model_base.py @@ -23,15 +23,20 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.serialization import TypeHandlerRegistry from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -609,11 +614,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1127,7 +1128,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_client.py index 700583712c1..31100c62a5e 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AlternateTypeClientConfiguration from .operations import ExternalTypeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AlternateTypeClient: # pylint: disable=client-accepts-api-version-keyword """Test for alternate type decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/models/_patch.py index fa513da4c00..565fc9249b6 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import Type import geojson from .._utils.model_base import TYPE_HANDLER_REGISTRY diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-alternate-type/specs/azure/clientgenerator/core/alternatetype/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_client.py index 5caa918fa5d..0b8eb2bb56d 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _HeaderClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class HeaderClient(_HeaderClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """HeaderClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_client.py index 74d0e350379..e14b19a93e0 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import HeaderClientConfiguration from ._operations import _HeaderClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class HeaderClient(_HeaderClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """HeaderClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/client/alternateapiversion/service/header/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/pyproject.toml index 318f81bea43..f19913acee7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-header/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_client.py index f3dc482bcd1..f751106a19f 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _PathClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PathClient(_PathClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """PathClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_client.py index eb223856d4a..8c42ac8c9a9 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PathClientConfiguration from ._operations import _PathClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PathClient(_PathClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """PathClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/client/alternateapiversion/service/path/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/pyproject.toml index 333f74df676..221880bd2b4 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-path/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_client.py index 75edccdf7e6..6db2a2d061e 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _QueryClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class QueryClient(_QueryClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """QueryClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_client.py index 9805772f700..25729475779 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import QueryClientConfiguration from ._operations import _QueryClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class QueryClient(_QueryClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """QueryClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/client/alternateapiversion/service/query/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/pyproject.toml index 7b220604eb3..a6e0f7c92ad 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-api-version-query/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value.py index 24fcaa570be..4ac0cdce6de 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value.py @@ -17,7 +17,7 @@ class TestDefaultValue(ClientDefaultValueClientTestBase): def test_put_model_property(self, defaultvalue_endpoint): client = self.create_client(endpoint=defaultvalue_endpoint) response = client.put_model_property( - body={"name": "str", "retry": bool, "tier": "str", "timeout": 0}, + body={"name": "str", "retry": True, "tier": "standard", "timeout": 30}, ) # please add some check logic here by yourself diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value_async.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value_async.py index 05cd22175be..a5df13d3c02 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value_async.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/generated_tests/test_default_value_async.py @@ -18,7 +18,7 @@ class TestDefaultValueAsync(ClientDefaultValueClientTestBaseAsync): async def test_put_model_property(self, defaultvalue_endpoint): client = self.create_async_client(endpoint=defaultvalue_endpoint) response = await client.put_model_property( - body={"name": "str", "retry": bool, "tier": "str", "timeout": 0}, + body={"name": "str", "retry": True, "tier": "standard", "timeout": 30}, ) # please add some check logic here by yourself diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/pyproject.toml index d62d885cbae..996faf4e29a 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_client.py index 673e3c5ca66..50670f53763 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ClientDefaultValueClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientDefaultValueClient( _ClientDefaultValueClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_client.py index 2a0b89be46f..10070f04b7d 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ClientDefaultValueClientConfiguration from ._operations import _ClientDefaultValueClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientDefaultValueClient( _ClientDefaultValueClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_models.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_models.py index 12cde996646..9d099f255ac 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_models.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_models.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- # pylint: disable=useless-super-delegation -from typing import Any, Mapping, Optional, overload +from typing import Any, Mapping, overload from .._utils.model_base import Model as _Model, rest_field @@ -27,11 +27,11 @@ class ModelWithDefaultValues(_Model): name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Name property with no default value. Required.""" - timeout: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + timeout: int = rest_field(visibility=["read", "create", "update", "delete", "query"], default=30) """Timeout property with client default value of 30.""" - tier: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + tier: str = rest_field(visibility=["read", "create", "update", "delete", "query"], default="standard") """Tier property with client default value of 'standard'.""" - retry: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + retry: bool = rest_field(visibility=["read", "create", "update", "delete", "query"], default=True) """Retry property with client default value of true.""" @overload @@ -39,9 +39,9 @@ def __init__( self, *, name: str, - timeout: Optional[int] = None, - tier: Optional[str] = None, - retry: Optional[bool] = None, + timeout: int = 30, + tier: str = "standard", + retry: bool = True, ) -> None: ... @overload diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-default-value/specs/azure/clientgenerator/core/clientdefaultvalue/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/pyproject.toml index 42cac9e54e3..928f1dfc351 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_client.py index 1b3753644b2..87b89320e04 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -32,6 +32,11 @@ ) from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class HeaderParamClient(_HeaderParamClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Client for testing header parameter moved to client level. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_client.py index 17672ef52d4..ce892753460 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -32,6 +32,11 @@ _QueryParamClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class HeaderParamClient(_HeaderParamClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Client for testing header parameter moved to client level. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-default/specs/azure/clientgenerator/core/clientinitialization/default/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/pyproject.toml index 1f3865ebfc1..4bb4f486599 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_client.py index 4ba5024bafd..58d4c595f8c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -32,6 +32,11 @@ ) from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IndividuallyNestedWithPathClient( _IndividuallyNestedWithPathClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_client.py index 6e14353cef7..c9e7e2638d1 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -32,6 +32,11 @@ _IndividuallyNestedWithQueryClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IndividuallyNestedWithPathClient( _IndividuallyNestedWithPathClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individually/specs/azure/clientgenerator/core/clientinitialization/individually/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/pyproject.toml index fd345840a7f..7b9b2f6c5ce 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_client.py index 421a939dd50..1e3a311a75b 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_client.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -26,6 +26,11 @@ IndividuallyParentNestedWithQueryClientOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IndividuallyParentClient: # pylint: disable=client-accepts-api-version-keyword """Test for client initialization decorator - moving parameters from method to client level. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_client.py index 0dcd88c3029..27579294ddb 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_client.py @@ -8,8 +8,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -26,6 +26,11 @@ IndividuallyParentNestedWithQueryClientOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class IndividuallyParentClient: # pylint: disable=client-accepts-api-version-keyword """Test for client initialization decorator - moving parameters from method to client level. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-initialization-individuallyparent/specs/azure/clientgenerator/core/clientinitialization/individuallyparent/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/pyproject.toml index b090a2a8715..3eaa21601fd 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_client.py index 4cc1f63ca7a..52bb510b189 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import BlobOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveMethodParameterToClient: # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_client.py index c66717949c6..45a88c12837 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MoveMethodParameterToClientConfiguration from .operations import BlobOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveMethodParameterToClient: # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-method-parameter-to-client/specs/azure/clientgenerator/core/clientlocation/parameter/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/pyproject.toml index a29f4add1ec..e316f068200 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_client.py index fa5125e977c..42f4e4e6718 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AdminOperationsOperations, UserOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveToExistingSubClient: # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_client.py index 57c994423a7..47223706098 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MoveToExistingSubClientConfiguration from .operations import AdminOperationsOperations, UserOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveToExistingSubClient: # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-existing-sub-client/specs/azure/clientgenerator/core/clientlocation/subclient/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/pyproject.toml index b49bc2db198..a798b23e002 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_client.py index 22b5fd7dfa7..010560027a3 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ArchiveOperationsOperations, ProductOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveToNewSubClient: # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_client.py index e9bab050e78..0ba7ef78d46 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MoveToNewSubClientConfiguration from .operations import ArchiveOperationsOperations, ProductOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveToNewSubClient: # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-new-sub-client/specs/azure/clientgenerator/core/clientlocation/newsubclient/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/pyproject.toml index b950a801b2a..7cd0046e517 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_client.py index abbf51cf098..3820705a371 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ResourceOperationsOperations, _MoveToRootClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveToRootClient(_MoveToRootClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_client.py index 8ea90e4529d..5e81765701a 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MoveToRootClientConfiguration from .operations import ResourceOperationsOperations, _MoveToRootClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MoveToRootClient(_MoveToRootClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for @clientLocation decorator - moving operations between clients. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-client-location-move-to-root-client/specs/azure/clientgenerator/core/clientlocation/rootclient/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/pyproject.toml index 3a049f9bd05..da28d960f27 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_client.py index d9f47211756..c55b59704ad 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _DeserializeEmptyStringAsNullClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DeserializeEmptyStringAsNullClient( _DeserializeEmptyStringAsNullClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_client.py index 4666d7b8f66..bfc9e55d417 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DeserializeEmptyStringAsNullClientConfiguration from ._operations import _DeserializeEmptyStringAsNullClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DeserializeEmptyStringAsNullClient( _DeserializeEmptyStringAsNullClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-deserialize-empty-string-as-null/specs/azure/clientgenerator/core/emptystring/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/pyproject.toml index f19206769ba..21ed005cead 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_client.py index 2867c8db44a..ce9924a5adc 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _FlattenPropertyClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FlattenPropertyClient( _FlattenPropertyClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_client.py index b079e852129..315ab191ec1 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import FlattenPropertyClientConfiguration from ._operations import _FlattenPropertyClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FlattenPropertyClient( _FlattenPropertyClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-flatten-property/specs/azure/clientgenerator/core/flattenproperty/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/pyproject.toml index 96c5111bf5e..fa265884228 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_client.py index 2fbc7d670d8..9a7cecd40b7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AnimalOperationsOperations, DogOperationsOperations, PetOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class HierarchyBuildingClient: # pylint: disable=client-accepts-api-version-keyword """Test for @hierarchyBuilding decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_client.py index ffce83178a6..a757d657af8 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import HierarchyBuildingClientConfiguration from .operations import AnimalOperationsOperations, DogOperationsOperations, PetOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class HierarchyBuildingClient: # pylint: disable=client-accepts-api-version-keyword """Test for @hierarchyBuilding decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-hierarchy-building/specs/azure/clientgenerator/core/hierarchybuilding/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/pyproject.toml index 80b8d412a77..1881e057f97 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_client.py index 97d21cfd1d4..94e0341ce9b 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _NextLinkVerbClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NextLinkVerbClient(_NextLinkVerbClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for @nextLinkVerb decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_client.py index c006d1c2045..e0cd6d4e889 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NextLinkVerbClientConfiguration from ._operations import _NextLinkVerbClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NextLinkVerbClient(_NextLinkVerbClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for @nextLinkVerb decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-next-link-verb/specs/azure/clientgenerator/core/nextlinkverb/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/pyproject.toml index 39123d69421..a4d03b43501 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_client.py index 18f33dea2f0..541f37bf593 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -23,6 +23,11 @@ RequireOptionalParameterOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OverrideClient: # pylint: disable=client-accepts-api-version-keyword """Test scenarios for client override behavior. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_client.py index f5f9bd68d99..b88438e69cc 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -23,6 +23,11 @@ RequireOptionalParameterOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OverrideClient: # pylint: disable=client-accepts-api-version-keyword """Test scenarios for client override behavior. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-override/specs/azure/clientgenerator/core/override/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/pyproject.toml index d2a6f3cf349..14a791298b7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_client.py index e46fc7d382d..f196d51a212 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ModelInOperationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UsageClient: # pylint: disable=client-accepts-api-version-keyword """Test for internal decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_client.py index e613aa05e51..c6eaeceec6c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import UsageClientConfiguration from .operations import ModelInOperationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UsageClient: # pylint: disable=client-accepts-api-version-keyword """Test for internal decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-basic/pyproject.toml index edf9ef0a270..1a5a30200ef 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_client.py index 8a8296eab82..5c0758e300c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _BasicClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BasicClient(_BasicClientOperationsMixin): """Illustrates bodies templated with Azure Core. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_client.py index d1ffea1fa3b..364133474c7 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import BasicClientConfiguration from ._operations import _BasicClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BasicClient(_BasicClientOperationsMixin): """Illustrates bodies templated with Azure Core. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-basic/specs/azure/core/basic/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/pyproject.toml index 93e7c030dda..6509f7ea17b 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_client.py index acd49a788b2..1fea1d4c379 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _RpcClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RpcClient(_RpcClientOperationsMixin): """Illustrates bodies templated with Azure Core with long-running RPC operation. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_client.py index f5895bce2ff..413f9852e8b 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import RpcClientConfiguration from ._operations import _RpcClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RpcClient(_RpcClientOperationsMixin): """Illustrates bodies templated with Azure Core with long-running RPC operation. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-rpc/specs/azure/core/lro/rpc/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/pyproject.toml index bc052fce86b..d162f8adaee 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_client.py index da4c813fbbb..50e4be91641 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _StandardClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class StandardClient(_StandardClientOperationsMixin): """Illustrates bodies templated with Azure Core with long-running operation. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_client.py index 79c0a0a27ad..8a73c913d62 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import StandardClientConfiguration from ._operations import _StandardClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class StandardClient(_StandardClientOperationsMixin): """Illustrates bodies templated with Azure Core with long-running operation. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-lro-standard/specs/azure/core/lro/standard/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-model/pyproject.toml index 9df914dbc7f..a9500359493 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_client.py index e058323504f..9ab1ea009e4 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AzureCoreEmbeddingVectorOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ModelClient: # pylint: disable=client-accepts-api-version-keyword """ModelClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_client.py index 13c47c2bae1..8808cd3a918 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ModelClientConfiguration from .operations import AzureCoreEmbeddingVectorOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ModelClient: # pylint: disable=client-accepts-api-version-keyword """ModelClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-model/specs/azure/core/model/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-page/pyproject.toml index 9bd6508bdae..4bb188a8651 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_client.py index 03abd3d7124..31748e28134 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import TwoModelsAsPageItemOperations, _PageClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageClient(_PageClientOperationsMixin): """Illustrates bodies templated with Azure Core with paging support. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_client.py index 131fcb2fbb4..57eacf2f19f 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PageClientConfiguration from .operations import TwoModelsAsPageItemOperations, _PageClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageClient(_PageClientOperationsMixin): """Illustrates bodies templated with Azure Core with paging support. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-page/specs/azure/core/page/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-scalar/pyproject.toml index b49d85d9c35..341e0f56baa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_client.py index ce90cf2486e..c83ac35762c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AzureLocationScalarOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ScalarClient: # pylint: disable=client-accepts-api-version-keyword """ScalarClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_client.py index 069a26f68e8..29f23dcdfdd 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ScalarClientConfiguration from .operations import AzureLocationScalarOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ScalarClient: # pylint: disable=client-accepts-api-version-keyword """ScalarClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-scalar/specs/azure/core/scalar/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-core-traits/pyproject.toml index 0db824d41fe..8459f627477 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_client.py index e28b69d8b30..ff42f56fd24 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _TraitsClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TraitsClient(_TraitsClientOperationsMixin): """Illustrates Azure Core operation customizations by traits. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_client.py index 8b2ec0a0282..c7e6b716bd8 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import TraitsClientConfiguration from ._operations import _TraitsClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TraitsClient(_TraitsClientOperationsMixin): """Illustrates Azure Core operation customizations by traits. diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-core-traits/specs/azure/core/traits/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-encode-duration/pyproject.toml index f059244eeb3..c316bf2202d 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_client.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_client.py index ce4ff9e4bc9..339fd345f89 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _DurationClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DurationClient(_DurationClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for azure related encode decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_patch.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_client.py index 9c467dae996..05fd61b3fb3 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DurationClientConfiguration from ._operations import _DurationClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DurationClient(_DurationClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for azure related encode decorator. diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-encode-duration/specs/azure/encode/duration/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-example-basic/pyproject.toml index eb2b606a5de..f970b438200 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_client.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_client.py index 0f387711f35..14946c3f4f8 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _AzureExampleClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AzureExampleClient(_AzureExampleClientOperationsMixin): """AzureExampleClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_patch.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_client.py index e4bbd107c92..b52d48a07a0 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AzureExampleClientConfiguration from ._operations import _AzureExampleClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AzureExampleClient(_AzureExampleClientOperationsMixin): """AzureExampleClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-example-basic/specs/azure/example/basic/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/pyproject.toml index afa3fe5b80e..6cf64f058b1 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_client.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_client.py index 865cb7678f3..cc8c7a7faba 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _PageableClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageableClient(_PageableClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test describing pageable. diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_patch.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_client.py index 9f5a244bf94..4bdde447364 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PageableClientConfiguration from ._operations import _PageableClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageableClient(_PageableClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test describing pageable. diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-payload-pageable/specs/azure/payload/pageable/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_client.py index d94ad53fa82..9d8330cf433 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ErrorOperations, ManagedIdentityOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_client.py index 874b07e3b4d..63514b9ddee 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import CommonPropertiesClientConfiguration from .operations import ErrorOperations, ManagedIdentityOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/azure/resourcemanager/commonproperties/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/pyproject.toml index c35ccd4b81b..a90f3d2bfc2 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-common-properties/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_client.py index 3f57f6f5706..c308527f7b8 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import LargeHeadersOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_client.py index 45898de9c61..8f7f02dc2cd 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import LargeHeaderClientConfiguration from .operations import LargeHeadersOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/azure/resourcemanager/largeheader/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/pyproject.toml index af78f6186d4..2a30ee51ba3 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-large-header/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_client.py index 2f41e9c1b95..be5c62e4453 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import MixedSubscriptionPlacementOperations, Operations, TwoSubscriptionResourcesMethodLevelOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_client.py index 318dd0f622c..5497860897c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import MethodSubscriptionIdClientConfiguration from .operations import MixedSubscriptionPlacementOperations, Operations, TwoSubscriptionResourcesMethodLevelOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/azure/resourcemanager/methodsubscriptionid/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/pyproject.toml index 1cf5c18087b..cd973c646bb 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-method-subscription-id/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_client.py index 88ac2876a00..0465e913515 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StorageAccountsOperations, VirtualMachinesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_client.py index 0cc8870c56e..a8963d141fd 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import CombinedClientConfiguration from .operations import StorageAccountsOperations, VirtualMachinesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/azure/resourcemanager/multiservicesharedmodels/combined/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/pyproject.toml index dc468d86465..270dddee34d 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service-shared-models/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_client.py index 20e90e92889..2af1ff380ac 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DisksOperations, VirtualMachinesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_client.py index 4c4c40bd0eb..7638e2ed524 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import CombinedClientConfiguration from .operations import DisksOperations, VirtualMachinesOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/azure/resourcemanager/multiservice/combined/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/pyproject.toml index 2c6a0145646..286dc458689 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-multi-service/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_client.py index ac9f3eeb8f1..22d7ed2f691 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -21,6 +21,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import NonResourceOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_client.py index f4fb00f2447..b3169a6260e 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -21,6 +21,11 @@ from ._configuration import NonResourceClientConfiguration from .operations import NonResourceOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/azure/resourcemanager/nonresource/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/pyproject.toml index e9d471588ba..20d31b79167 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-non-resource/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_client.py index f8b48e18c70..108d69cc242 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -27,6 +27,11 @@ OptionalBodyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_client.py index cdc53e0b3ef..0a56e693eb6 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -27,6 +27,11 @@ OptionalBodyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/azure/resourcemanager/operationtemplates/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/pyproject.toml index 82d73c80b61..4aad24d5304 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-operation-templates/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_client.py index 689b326c98b..9e4eda8bf07 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -27,6 +27,11 @@ TopLevelOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_client.py index 69a7ff1e2e2..beb94eaaff5 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -27,6 +27,11 @@ TopLevelOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/azure/resourcemanager/resources/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/pyproject.toml index 81661bc317a..726d227e2e1 100644 --- a/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-resource-manager-resources/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_client.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_client.py index d74870945e4..20901c47c2e 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _XmsClientRequestIdClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XmsClientRequestIdClient( _XmsClientRequestIdClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_patch.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_client.py index 7cbb5686654..17e34f0c493 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import XmsClientRequestIdClientConfiguration from ._operations import _XmsClientRequestIdClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XmsClientRequestIdClient( _XmsClientRequestIdClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/azure/specialheaders/xmsclientrequestid/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/pyproject.toml index 873360a4b8e..9748c4d8ef9 100644 --- a/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-special-headers-client-request-id/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/pyproject.toml b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/pyproject.toml index 2e9fea0c54f..e72ff6a5365 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_client.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_client.py index 333d49a72f7..c0a3c46caa4 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _PreviewVersionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PreviewVersionClient(_PreviewVersionClientOperationsMixin): """PreviewVersionClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_patch.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_client.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_client.py index 2f1f888be12..af120d7c51a 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PreviewVersionClientConfiguration from ._operations import _PreviewVersionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PreviewVersionClient(_PreviewVersionClientOperationsMixin): """PreviewVersionClient. diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_patch.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/models/_patch.py b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/azure-versioning-previewversion/specs/azure/versioning/previewversion/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_client.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_client.py index 4c2a2d79ebd..f0770ee915a 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ClientNamespaceFirstClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientNamespaceFirstClient( _ClientNamespaceFirstClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_client.py index 150ce47a09c..e259dd19d84 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ClientNamespaceFirstClientConfiguration from ._operations import _ClientNamespaceFirstClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientNamespaceFirstClient( _ClientNamespaceFirstClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/first/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/first/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/first/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/first/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_client.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_client.py index 521fd3c81f0..ee29eb28559 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ClientNamespaceSecondClientConfiguration from ._operations import _ClientNamespaceSecondClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientNamespaceSecondClient( _ClientNamespaceSecondClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_client.py index da23574ad54..0c1f4ec21f8 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ClientNamespaceSecondClientConfiguration from ._operations import _ClientNamespaceSecondClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientNamespaceSecondClient( _ClientNamespaceSecondClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/sub/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/sub/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/sub/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-namespace/client/clientnamespace/second/sub/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-namespace/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-namespace/pyproject.toml index a508068857c..c1392c75554 100644 --- a/packages/typespec-python/tests/generated/azure/client-namespace/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-namespace/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_client.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_client.py index fc921cfc2d5..795db6ba145 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FirstOperationsOperations, SecondOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EnumConflictClient: # pylint: disable=client-accepts-api-version-keyword """Test for enum with same name in different namespace. diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_client.py index 715c2a01200..231a85d6bf8 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import EnumConflictClientConfiguration from .operations import FirstOperationsOperations, SecondOperationsOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EnumConflictClient: # pylint: disable=client-accepts-api-version-keyword """Test for enum with same name in different namespace. diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/firstnamespace/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/client/naming/enumconflict/secondnamespace/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/pyproject.toml index 62c8feb9c33..28e8995c6bc 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-naming-enum-conflict/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_client.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_client.py index 398e6aed351..6d58dcc21d5 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -24,6 +24,11 @@ _NamingClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NamingClient(_NamingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Describe changing names of types in a client with ``@clientName``. diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_client.py index 99eb52a012a..4fd88fa786f 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -24,6 +24,11 @@ _NamingClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NamingClient(_NamingClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Describe changing names of types in a client with ``@clientName``. diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-naming/client/naming/main/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-naming/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-naming/pyproject.toml index 4a7f98f5f82..d5aa5908665 100644 --- a/packages/typespec-python/tests/generated/azure/client-naming/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-naming/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_client.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_client.py index 4aa09302195..8e7a2b66d2d 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _OverloadClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OverloadClient(_OverloadClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for overload operation in .NET. diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_patch.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_client.py index d66ff6db473..a8a24c09729 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import OverloadClientConfiguration from ._operations import _OverloadClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OverloadClient(_OverloadClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for overload operation in .NET. diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/client/overload/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-overload/client/overload/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-overload/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-overload/pyproject.toml index 8d21e964562..ea1f60dbdc5 100644 --- a/packages/typespec-python/tests/generated/azure/client-overload/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-overload/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_client.py index aad355f1ae4..62471f251af 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -25,6 +25,11 @@ _SecondClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FirstClient(_FirstClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """FirstClient. diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_client.py index 0639d170958..766af80bfb3 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -25,6 +25,11 @@ _SecondClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FirstClient(_FirstClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """FirstClient. diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/client/structure/clientoperationgroup/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/pyproject.toml index d98ae71c661..f4b203cdf3d 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-structure-clientoperationgroup/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_client.py index 81771551b71..50ec83c44a0 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import BarOperations, BazOperations, FooOperations, QuxOperations, _ServiceClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ServiceClient(_ServiceClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test that we can use @client decorators to customize client side code structure, such as: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_client.py index f839fface2b..6f030b714d5 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ServiceClientConfiguration from .operations import BarOperations, BazOperations, FooOperations, QuxOperations, _ServiceClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ServiceClient(_ServiceClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test that we can use @client decorators to customize client side code structure, such as: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/client/structure/service/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-default/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-structure-default/pyproject.toml index 8ee8246ae0f..a8a068e338b 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-default/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-structure-default/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_client.py index 0754cd63c5b..d2cbac20a4c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._operations import _ClientAClientOperationsMixin, _ClientBClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientAClient(_ClientAClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """ClientAClient. diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_client.py index c0caa421db7..ee7c58995e5 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import ClientAClientConfiguration, ClientBClientConfiguration from ._operations import _ClientAClientOperationsMixin, _ClientBClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ClientAClient(_ClientAClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """ClientAClient. diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/client/structure/multiclient/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/pyproject.toml index 6b8d434addd..361f3f0b343 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-multiclient/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-structure-multiclient/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_client.py index e82ad01b4eb..91d0344df10 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import GroupOperations, _RenamedOperationClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RenamedOperationClient( _RenamedOperationClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py index 3b0a7f3ffae..cddbff13bcb 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import RenamedOperationClientConfiguration from .operations import GroupOperations, _RenamedOperationClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RenamedOperationClient( _RenamedOperationClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/client/structure/renamedoperation/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/pyproject.toml index 45ae8884c42..3d164b720e5 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-structure-renamedoperation/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py index 70e2eca45c0..9e2320a5e79 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import Group1Operations, Group2Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TwoOperationGroupClient: # pylint: disable=client-accepts-api-version-keyword """TwoOperationGroupClient. diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py index cc483e5523d..265da0355d2 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import TwoOperationGroupClientConfiguration from .operations import Group1Operations, Group2Operations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TwoOperationGroupClient: # pylint: disable=client-accepts-api-version-keyword """TwoOperationGroupClient. diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/models/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_patch.py b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/client/structure/twooperationgroup/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/pyproject.toml b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/pyproject.toml index 73c94b3b316..0721a0ca113 100644 --- a/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/client-structure-twooperationgroup/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_client.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_client.py index 67be983dad1..05c3bd12a0d 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .property.operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on array. diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_patch.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_client.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_client.py index daefc42540c..ff8830c62e0 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ..property.aio.operations import PropertyOperations from ._configuration import ArrayClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on array. diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_patch.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/models/_patch.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-array/encode/array/property/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-array/pyproject.toml b/packages/typespec-python/tests/generated/azure/encode-array/pyproject.toml index 7b107ab8aa0..657d70b808d 100644 --- a/packages/typespec-python/tests/generated/azure/encode-array/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/encode-array/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_client.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_client.py index 804a4e5fb29..d2364c8ae23 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -22,6 +22,11 @@ from .requestbody.operations import RequestBodyOperations from .responsebody.operations import ResponseBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BytesClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on bytes. diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_client.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_client.py index a5417e14639..14f5004e138 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -22,6 +22,11 @@ from ..responsebody.aio.operations import ResponseBodyOperations from ._configuration import BytesClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BytesClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on bytes. diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/header/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/models/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/property/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/query/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/requestbody/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/encode/bytes/responsebody/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-bytes/pyproject.toml b/packages/typespec-python/tests/generated/azure/encode-bytes/pyproject.toml index 09a6886fd7d..11e758e62ab 100644 --- a/packages/typespec-python/tests/generated/azure/encode-bytes/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/encode-bytes/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_client.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_client.py index 75e498112af..a0c23cfb222 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -21,6 +21,11 @@ from .query.operations import QueryOperations from .responseheader.operations import ResponseHeaderOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DatetimeClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on datetime. diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_client.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_client.py index fdc3587ba26..564306e305d 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -21,6 +21,11 @@ from ..responseheader.aio.operations import ResponseHeaderOperations from ._configuration import DatetimeClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DatetimeClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on datetime. diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/header/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/models/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/property/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/query/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/encode/datetime/responseheader/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-datetime/pyproject.toml b/packages/typespec-python/tests/generated/azure/encode-datetime/pyproject.toml index c57df8896b8..b64a64a599e 100644 --- a/packages/typespec-python/tests/generated/azure/encode-datetime/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/encode-datetime/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_client.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_client.py index eaa36842d9a..d42c017368f 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import HeaderOperations, PropertyOperations, QueryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DurationClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on duration. diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_patch.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_client.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_client.py index f67866d4be9..6991ececbac 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DurationClientConfiguration from .operations import HeaderOperations, PropertyOperations, QueryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DurationClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on duration. diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_patch.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/models/_patch.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-duration/encode/duration/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-duration/pyproject.toml b/packages/typespec-python/tests/generated/azure/encode-duration/pyproject.toml index 671ea883b0b..cfacfacc955 100644 --- a/packages/typespec-python/tests/generated/azure/encode-duration/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/encode-duration/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_client.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_client.py index 72bca37699d..ad04eed4907 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NumericClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on integer. diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_patch.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_client.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_client.py index abe20217686..b1afaeaa44d 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NumericClientConfiguration from .operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NumericClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on integer. diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_patch.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/models/_patch.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/operations/_patch.py b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/encode/numeric/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/encode-numeric/pyproject.toml b/packages/typespec-python/tests/generated/azure/encode-numeric/pyproject.toml index b69fd548fc4..dffe466030a 100644 --- a/packages/typespec-python/tests/generated/azure/encode-numeric/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/encode-numeric/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_client.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_client.py index a22a131850b..3d217450cd8 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_client.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _RecursiveClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_client.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_client.py index 87d2e92a383..da020e78de8 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import RecursiveClientConfiguration from ._operations import _RecursiveClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/models/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/generation/subdir/_generated/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir/pyproject.toml b/packages/typespec-python/tests/generated/azure/generation-subdir/pyproject.toml index 10545f549e9..28afd8f8093 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/generation-subdir/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_client.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_client.py index 2887b6ea13a..56c48a8f705 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_client.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_client.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_client.py index 051eb6a46ca..72163edc53f 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AddedClientConfiguration from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/models/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/operations/_patch.py b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/generation/subdir2/_generated/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/generation-subdir2/pyproject.toml b/packages/typespec-python/tests/generated/azure/generation-subdir2/pyproject.toml index 75062ec7b79..515ad289d2a 100644 --- a/packages/typespec-python/tests/generated/azure/generation-subdir2/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/generation-subdir2/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_client.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_client.py index 183a28836d2..f246a0af873 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_client.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _VisibilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_client.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_client.py index 2bd3027bb36..1216228de36 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import VisibilityClientConfiguration from ._operations import _VisibilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/models/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/headasbooleanfalse/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/pyproject.toml b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/pyproject.toml index 07b3436f489..18bb93d42ec 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleanfalse/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/headasbooleanfalse/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_client.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_client.py index 183a28836d2..f246a0af873 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_client.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _VisibilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_client.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_client.py index 2bd3027bb36..1216228de36 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import VisibilityClientConfiguration from ._operations import _VisibilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/models/_patch.py b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/headasbooleantrue/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/headasbooleantrue/pyproject.toml b/packages/typespec-python/tests/generated/azure/headasbooleantrue/pyproject.toml index b41f5854d11..3191eecc665 100644 --- a/packages/typespec-python/tests/generated/azure/headasbooleantrue/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/headasbooleantrue/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_client.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_client.py index a7ec55a26d3..e84955b834d 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ExplicitBodyOperations, ImplicitBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BasicClient: # pylint: disable=client-accepts-api-version-keyword """Test for basic parameters cases. diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_client.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_client.py index 37dde679254..bbe28545c43 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import BasicClientConfiguration from .operations import ExplicitBodyOperations, ImplicitBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BasicClient: # pylint: disable=client-accepts-api-version-keyword """Test for basic parameters cases. diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/models/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/parameters/basic/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-basic/pyproject.toml b/packages/typespec-python/tests/generated/azure/parameters-basic/pyproject.toml index 01d4e56ccd4..b7ff6a05b65 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-basic/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/parameters-basic/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_client.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_client.py index c7b1bb740ad..1ce951bbb43 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._utils.serialization import Deserializer, Serializer from .optionalexplicit.operations import OptionalExplicitOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyOptionalityClient( _BodyOptionalityClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py index 58b2dac665e..e39c8ae5700 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ._configuration import BodyOptionalityClientConfiguration from ._operations import _BodyOptionalityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyOptionalityClient( _BodyOptionalityClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/pyproject.toml b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/pyproject.toml index dc008d40b77..669bd4bba38 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-body-optionality/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/parameters-body-optionality/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_client.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_client.py index bd0638069da..96700e3782e 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from .header.operations import HeaderOperations from .query.operations import QueryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CollectionFormatClient: # pylint: disable=client-accepts-api-version-keyword """Test for collectionFormat. diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_client.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_client.py index bb984ca39ed..943bf289bd5 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -19,6 +19,11 @@ from ..query.aio.operations import QueryOperations from ._configuration import CollectionFormatClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CollectionFormatClient: # pylint: disable=client-accepts-api-version-keyword """Test for collectionFormat. diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-collection-format/pyproject.toml b/packages/typespec-python/tests/generated/azure/parameters-collection-format/pyproject.toml index 3e22ae85a05..39a03ebd23b 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-collection-format/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/parameters-collection-format/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_client.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_client.py index 701fad89813..4f22ca98b82 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _PathClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PathClient(_PathClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for path parameters cases. diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_client.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_client.py index 0a5b8febb16..a99cee28213 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import PathClientConfiguration from ._operations import _PathClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PathClient(_PathClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for path parameters cases. diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-path/parameters/path/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-path/pyproject.toml b/packages/typespec-python/tests/generated/azure/parameters-path/pyproject.toml index e1fda47747e..326bc0490f9 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-path/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/parameters-path/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_client.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_client.py index e5b151a63f4..566b689ddda 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ConstantOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class QueryClient: # pylint: disable=client-accepts-api-version-keyword """Test for query parameter cases. diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_client.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_client.py index f5dff68396b..6508a43f560 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import QueryClientConfiguration from .operations import ConstantOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class QueryClient: # pylint: disable=client-accepts-api-version-keyword """Test for query parameter cases. diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-query/parameters/query/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-query/pyproject.toml b/packages/typespec-python/tests/generated/azure/parameters-query/pyproject.toml index 86bc87ae78c..7195a5207f7 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-query/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/parameters-query/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_client.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_client.py index e33cf068f4b..5329d59b775 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import AliasOperations, ModelOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpreadClient: # pylint: disable=client-accepts-api-version-keyword """Test for the spread operator. diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_client.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_client.py index 1fe65ba2639..e76248fd4b6 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import SpreadClientConfiguration from .operations import AliasOperations, ModelOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpreadClient: # pylint: disable=client-accepts-api-version-keyword """Test for the spread operator. diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/models/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/operations/_patch.py b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/parameters/spread/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/parameters-spread/pyproject.toml b/packages/typespec-python/tests/generated/azure/parameters-spread/pyproject.toml index 136dcdbce87..5d2df804a2f 100644 --- a/packages/typespec-python/tests/generated/azure/parameters-spread/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/parameters-spread/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_client.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_client.py index 7065690fe7a..c819d87b531 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import DifferentBodyOperations, SameBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ContentNegotiationClient: # pylint: disable=client-accepts-api-version-keyword """Test describing optionality of the request body. diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_patch.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_client.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_client.py index 5880c31f1ab..da6aaf36de3 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ContentNegotiationClientConfiguration from .operations import DifferentBodyOperations, SameBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ContentNegotiationClient: # pylint: disable=client-accepts-api-version-keyword """Test describing optionality of the request body. diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/payload/contentnegotiation/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/pyproject.toml b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/pyproject.toml index 28465263185..c14da5e477e 100644 --- a/packages/typespec-python/tests/generated/azure/payload-content-negotiation/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/payload-content-negotiation/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_client.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_client.py index e975940a8ba..9012f9dd61c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _JsonMergePatchClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonMergePatchClient(_JsonMergePatchClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for merge-patch+json content-type. diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_patch.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py index 97340c807f3..f57ee7276a9 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import JsonMergePatchClientConfiguration from ._operations import _JsonMergePatchClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonMergePatchClient(_JsonMergePatchClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for merge-patch+json content-type. diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/pyproject.toml b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/pyproject.toml index cf2a6588e7d..b849a41724d 100644 --- a/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/payload-json-merge-patch/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_client.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_client.py index 9caa9feb5b6..966e5d8f1b6 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .stringbody.operations import StringBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypeClient: # pylint: disable=client-accepts-api-version-keyword """Test the payload with different media types and different types of the payload itself. diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_patch.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_client.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_client.py index 79c18ef8621..659e1a8593e 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ..stringbody.aio.operations import StringBodyOperations from ._configuration import MediaTypeClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypeClient: # pylint: disable=client-accepts-api-version-keyword """Test the payload with different media types and different types of the payload itself. diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_patch.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/payload/mediatype/stringbody/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-media-type/pyproject.toml b/packages/typespec-python/tests/generated/azure/payload-media-type/pyproject.toml index 623293a3460..269f8a2c962 100644 --- a/packages/typespec-python/tests/generated/azure/payload-media-type/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/payload-media-type/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_client.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_client.py index 96dedc4fa3e..455583c1b92 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import FormDataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultiPartClient: # pylint: disable=client-accepts-api-version-keyword """Test for multipart. diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_patch.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/utils.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/utils.py index bd821750f4c..707b7d8fac7 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/utils.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/_utils/utils.py @@ -10,7 +10,6 @@ from .._utils.model_base import Model, SdkJSONEncoder - # file-like tuple could be `(filename, IO (or bytes))` or `(filename, IO (or bytes), content_type)` FileContent = Union[str, bytes, IO[str], IO[bytes]] diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_client.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_client.py index 2405f08bb79..93d0bffeff5 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MultiPartClientConfiguration from .operations import FormDataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultiPartClient: # pylint: disable=client-accepts-api-version-keyword """Test for multipart. diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_patch.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/payload/multipart/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-multipart/pyproject.toml b/packages/typespec-python/tests/generated/azure/payload-multipart/pyproject.toml index fdf885caf8e..73f2e368995 100644 --- a/packages/typespec-python/tests/generated/azure/payload-multipart/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/payload-multipart/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_client.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_client.py index 20b9cdc7b9e..cad55d85fe8 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -20,6 +20,11 @@ from .serverdrivenpagination.operations import ServerDrivenPaginationOperations from .xmlpagination.operations import XmlPaginationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageableClient: # pylint: disable=client-accepts-api-version-keyword """Test for pageable payload. diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_client.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_client.py index c25cf8b3cc5..076ecffd294 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -20,6 +20,11 @@ from ..xmlpagination.aio.operations import XmlPaginationOperations from ._configuration import PageableClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageableClient: # pylint: disable=client-accepts-api-version-keyword """Test for pageable payload. diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/pagesize/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-pageable/pyproject.toml b/packages/typespec-python/tests/generated/azure/payload-pageable/pyproject.toml index 1dfed7d8ec0..f24b501875d 100644 --- a/packages/typespec-python/tests/generated/azure/payload-pageable/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/payload-pageable/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_client.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_client.py index ace3cc0b6af..d9ebb100fe6 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -45,6 +45,11 @@ XmlErrorValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XmlClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Sends and receives bodies in XML format. diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_patch.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/model_base.py index eef4e52ed1a..76b48f9a84b 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1129,7 +1130,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_client.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_client.py index f714d4a975f..705ef85c90d 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -45,6 +45,11 @@ XmlErrorValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XmlClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Sends and receives bodies in XML format. diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_patch.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/models/_patch.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/operations/_patch.py b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/payload-xml/payload/xml/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/payload-xml/pyproject.toml b/packages/typespec-python/tests/generated/azure/payload-xml/pyproject.toml index cc316147fe2..958fec5292c 100644 --- a/packages/typespec-python/tests/generated/azure/payload-xml/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/payload-xml/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/pyproject.toml b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/pyproject.toml index 9c512865c63..c8efc8d12c0 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_client.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_client.py index 10de6e65b1b..7f88989c62c 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_client.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ResiliencyServiceDrivenClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ResiliencyServiceDrivenClient(_ResiliencyServiceDrivenClientOperationsMixin): """Test that we can grow up a service spec and service deployment into a multi-versioned service diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py index 909f9e6e9cc..1a77f8e802a 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ResiliencyServiceDrivenClientConfiguration from ._operations import _ResiliencyServiceDrivenClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ResiliencyServiceDrivenClient(_ResiliencyServiceDrivenClientOperationsMixin): """Test that we can grow up a service spec and service deployment into a multi-versioned service diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven1/resiliency/srv/driven1/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/pyproject.toml b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/pyproject.toml index f2483a88189..d35ee8bfa48 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_client.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_client.py index 1e59d598efb..dc593131bc2 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_client.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ResiliencyServiceDrivenClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ResiliencyServiceDrivenClient(_ResiliencyServiceDrivenClientOperationsMixin): """Test that we can grow up a service spec and service deployment into a multi-versioned service diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py index 57e53556b8f..556d61f5a20 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ResiliencyServiceDrivenClientConfiguration from ._operations import _ResiliencyServiceDrivenClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ResiliencyServiceDrivenClient(_ResiliencyServiceDrivenClientOperationsMixin): """Test that we can grow up a service spec and service deployment into a multi-versioned service diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_patch.py b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/resiliency-srv-driven2/resiliency/srv/driven2/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/pyproject.toml b/packages/typespec-python/tests/generated/azure/response-status-code-range/pyproject.toml index f4e712b2181..4c973278fda 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_client.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_client.py index 274f01d8659..62d80271d5f 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_client.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _StatusCodeRangeClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class StatusCodeRangeClient( _StatusCodeRangeClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_patch.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_patch.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_client.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_client.py index 471d0b3f3ac..8e51872b53c 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import StatusCodeRangeClientConfiguration from ._operations import _StatusCodeRangeClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class StatusCodeRangeClient( _StatusCodeRangeClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_patch.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/models/_patch.py b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/response-status-code-range/response/statuscoderange/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/pyproject.toml b/packages/typespec-python/tests/generated/azure/routes/pyproject.toml index e77e758219f..d07e7524e03 100644 --- a/packages/typespec-python/tests/generated/azure/routes/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/routes/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/_client.py b/packages/typespec-python/tests/generated/azure/routes/routes/_client.py index ea84f981a17..e24770820c7 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/_client.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -20,6 +20,11 @@ from .pathparameters.operations import PathParametersOperations from .queryparameters.operations import QueryParametersOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RoutesClient(_RoutesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Define scenario in building the http route/uri. diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/routes/routes/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/routes/routes/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/aio/_client.py b/packages/typespec-python/tests/generated/azure/routes/routes/aio/_client.py index 7ca64d8eb70..f10aea7d283 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -20,6 +20,11 @@ from ._configuration import RoutesClientConfiguration from .operations import InInterfaceOperations, _RoutesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RoutesClient(_RoutesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Define scenario in building the http route/uri. diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/aio/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/reservedexpansion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/pyproject.toml b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/pyproject.toml index 355a45fd14a..5b9d45a40fb 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_client.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_client.py index f64752e55ef..308d6eedf94 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_client.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonClient: # pylint: disable=client-accepts-api-version-keyword """Encoded names. diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_patch.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_patch.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py index 2501049d665..63e0f71f91f 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import JsonClientConfiguration from .operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonClient: # pylint: disable=client-accepts-api-version-keyword """Encoded names. diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/models/_patch.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/operations/_patch.py b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/serialization-encoded-name-json/serialization/encodedname/json/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/pyproject.toml b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/pyproject.toml index c2ae08dbc98..0cd8a1a7216 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_client.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_client.py index 5c189762ff7..63fa721a755 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _NotDefinedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDefinedClient(_NotDefinedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py index a46421e934d..17b562b48b4 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NotDefinedClientConfiguration from ._operations import _NotDefinedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDefinedClient(_NotDefinedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/pyproject.toml b/packages/typespec-python/tests/generated/azure/server-path-multiple/pyproject.toml index f2e5c9eec49..5a72365a561 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_client.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_client.py index dcdf9d60371..ec244d5f855 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _MultipleClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleClient(_MultipleClientOperationsMixin): """MultipleClient. diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_client.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_client.py index 3fcd2b7d47d..0e00b3e43be 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MultipleClientConfiguration from ._operations import _MultipleClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleClient(_MultipleClientOperationsMixin): """MultipleClient. diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/models/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-multiple/server/path/multiple/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/pyproject.toml b/packages/typespec-python/tests/generated/azure/server-path-single/pyproject.toml index adbba474032..a25c659cde4 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/server-path-single/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_client.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_client.py index c3d23264a3a..22a3ee62151 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _SingleClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleClient(_SingleClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server with a single path parameter @server. diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_client.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_client.py index a641b5c0562..2202147d1b0 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import SingleClientConfiguration from ._operations import _SingleClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleClient(_SingleClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server with a single path parameter @server. diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_patch.py b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-path-single/server/path/single/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/pyproject.toml b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/pyproject.toml index f88748c8a0b..324ba3752c5 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_client.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_client.py index 33023825a28..70e55acb653 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _NotVersionedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotVersionedClient(_NotVersionedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates not-versioned server. diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_client.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_client.py index cb7d8cfb993..460135c2b95 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NotVersionedClientConfiguration from ._operations import _NotVersionedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotVersionedClient(_NotVersionedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates not-versioned server. diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/pyproject.toml b/packages/typespec-python/tests/generated/azure/server-versions-versioned/pyproject.toml index e11b3fe96de..1a9c37f7146 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_client.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_client.py index fb2758217ac..0b516346587 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _VersionedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VersionedClient(_VersionedClientOperationsMixin): """Illustrates versioned server. diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_client.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_client.py index 247aa9a0f49..b0af349ce18 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import VersionedClientConfiguration from ._operations import _VersionedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VersionedClient(_VersionedClientOperationsMixin): """Illustrates versioned server. diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_patch.py b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/server-versions-versioned/server/versions/versioned/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/pyproject.toml b/packages/typespec-python/tests/generated/azure/service-multi-service/pyproject.toml index c3462a8e101..9f19b514459 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_client.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_client.py index 6dd0d05fca3..3949b6c5dd0 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_client.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import BarOperations, FooOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CombinedClient: # pylint: disable=client-accepts-api-version-keyword """CombinedClient. diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_patch.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_patch.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_client.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_client.py index 7294b6625b7..7bb1cc9c4c5 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import CombinedClientConfiguration from .operations import BarOperations, FooOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CombinedClient: # pylint: disable=client-accepts-api-version-keyword """CombinedClient. diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_patch.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/models/_patch.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/operations/_patch.py b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/service-multi-service/service/multiservice/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setup.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setup.py index 617246b2958..bd6f06f00be 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setup.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setup.py @@ -11,7 +11,6 @@ import re from setuptools import setup, find_packages - PACKAGE_NAME = "setuppy-authentication-union" PACKAGE_PPRINT_NAME = "Setuppy Authentication Union" PACKAGE_NAMESPACE = "setuppy.authentication.union" @@ -43,7 +42,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -68,5 +66,5 @@ "azure-core>=1.37.0", "typing-extensions>=4.6.0", ], - python_requires=">=3.9", + python_requires=">=3.10", ) diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_client.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_client.py index 667dadb9ad9..d885b938a6d 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_client.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import PipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._operations import _UnionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_patch.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_patch.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py index 7bcbfc2c01d..5b6e205f2ac 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING, Union -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.credentials import AzureKeyCredential @@ -19,6 +19,11 @@ from ._configuration import UnionClientConfiguration from ._operations import _UnionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/pyproject.toml b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/pyproject.toml index a0471155a4b..d4e8c21dff5 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py index 7d6c08d8b93..4191b40b9f7 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ConditionalRequestClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ConditionalRequestClient( _ConditionalRequestClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py index 6ea0db7a323..05b3561f7d4 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ConditionalRequestClientConfiguration from ._operations import _ConditionalRequestClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ConditionalRequestClient( _ConditionalRequestClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/pyproject.toml b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/pyproject.toml index 15a71cf3617..f6fe56670f3 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_client.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_client.py index 18016f43758..622c9f85b08 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_client.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _RepeatabilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RepeatabilityClient(_RepeatabilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates OASIS repeatability headers. diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_client.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_client.py index 45a02c2e577..a94c36e5303 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import RepeatabilityClientConfiguration from ._operations import _RepeatabilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RepeatabilityClient(_RepeatabilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates OASIS repeatability headers. diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-words/pyproject.toml b/packages/typespec-python/tests/generated/azure/special-words/pyproject.toml index b1a342ba3f4..68d3ec30e26 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/special-words/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_client.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_client.py index 3a9facdb113..e19976b0cbf 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_client.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -24,6 +24,11 @@ ParametersOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpecialWordsClient: # pylint: disable=client-accepts-api-version-keyword """Scenarios to verify that reserved words can be used in service and generators will handle it diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_patch.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/model_base.py index eef4e52ed1a..76b48f9a84b 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1129,7 +1130,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_client.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_client.py index 0be36300c4e..ec6e263c630 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -24,6 +24,11 @@ ParametersOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpecialWordsClient: # pylint: disable=client-accepts-api-version-keyword """Scenarios to verify that reserved words can be used in service and generators will handle it diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_patch.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/models/_patch.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/special-words/specialwords/operations/_patch.py b/packages/typespec-python/tests/generated/azure/special-words/specialwords/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/special-words/specialwords/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/special-words/specialwords/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/pyproject.toml b/packages/typespec-python/tests/generated/azure/specs-documentation/pyproject.toml index d6283af7bd8..d97a520074d 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_client.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_client.py index b852921b762..5a5b121ef56 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_client.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ListsOperations, TextFormattingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DocumentationClient: # pylint: disable=client-accepts-api-version-keyword """Illustrates documentation generation and formatting features. diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_patch.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_patch.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_client.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_client.py index f20313142f4..32138ee3d0a 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DocumentationClientConfiguration from .operations import ListsOperations, TextFormattingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DocumentationClient: # pylint: disable=client-accepts-api-version-keyword """Illustrates documentation generation and formatting features. diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_patch.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/models/_patch.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/operations/_patch.py b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/specs-documentation/specs/documentation/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/pyproject.toml b/packages/typespec-python/tests/generated/azure/streaming-jsonl/pyproject.toml index b7886d67855..600f163f205 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_client.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_client.py index ebb26214dd8..254098e05e5 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_client.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .basic.operations import BasicOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonlClient: # pylint: disable=client-accepts-api-version-keyword """Test of jsonl streaming. diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_patch.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_patch.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_client.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_client.py index 481fc5aa1ea..5777e2a0ecd 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ..basic.aio.operations import BasicOperations from ._configuration import JsonlClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonlClient: # pylint: disable=client-accepts-api-version-keyword """Test of jsonl streaming. diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_patch.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/models/_patch.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-array/pyproject.toml index c1d972c8a52..2b248546f05 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-array/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_client.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_client.py index 030f534ce83..1c9d0d930bf 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -33,6 +33,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various types of arrays. diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_client.py index 2012baab7a6..7698ded2c57 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -33,6 +33,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various types of arrays. diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-array/typetest/array/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-dictionary/pyproject.toml index c17c8fab280..74724aa7abc 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_client.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_client.py index 393c329d4ba..705b5ae776f 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -30,6 +30,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DictionaryClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various of dictionaries. diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_client.py index f48f157063d..72681a6c337 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -30,6 +30,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DictionaryClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various of dictionaries. diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-dictionary/typetest/dictionary/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/pyproject.toml index 48a6efdd15a..a5ca63c1704 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_client.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_client.py index d66fd90ed0b..8388fbb7fdd 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import EnvelopeOperations, NoEnvelopeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DiscriminatedClient: # pylint: disable=client-accepts-api-version-keyword """Describe scenarios for discriminated unions. diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py index 16a47109874..b644fb04090 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import DiscriminatedClientConfiguration from .operations import EnvelopeOperations, NoEnvelopeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DiscriminatedClient: # pylint: disable=client-accepts-api-version-keyword """Describe scenarios for discriminated unions. diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/pyproject.toml index fb250105f4a..2909f0b2770 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_client.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_client.py index 19c0cf52485..7160555cff9 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ExtensibleClient: # pylint: disable=client-accepts-api-version-keyword """ExtensibleClient. diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py index 933280b471a..d4b4e185cfa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ExtensibleClientConfiguration from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ExtensibleClient: # pylint: disable=client-accepts-api-version-keyword """ExtensibleClient. diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/pyproject.toml index 49b0e7ba0b4..51537f411ae 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_client.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_client.py index 5d64b8956b6..f3ed352f1c7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FixedClient: # pylint: disable=client-accepts-api-version-keyword """FixedClient. diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py index dcca3ee6ef2..b38340f49fd 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import FixedClientConfiguration from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FixedClient: # pylint: disable=client-accepts-api-version-keyword """FixedClient. diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-empty/pyproject.toml index d300c4d9f1e..22800e8b57a 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_client.py index 039ed2e25a8..36501df6b50 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _EmptyClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EmptyClient(_EmptyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of empty model used in operation's parameters and responses. diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_client.py index 8c0444249d8..7d6592cb041 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import EmptyClientConfiguration from ._operations import _EmptyClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EmptyClient(_EmptyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of empty model used in operation's parameters and responses. diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-empty/typetest/model/empty/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/pyproject.toml index ca7b1b964b7..7ce21d4aa11 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py index 24bc34b4ba5..227a42d351d 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _EnumDiscriminatorClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EnumDiscriminatorClient( _EnumDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py index 77f63be3854..a8e482c627b 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import EnumDiscriminatorClientConfiguration from ._operations import _EnumDiscriminatorClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EnumDiscriminatorClient( _EnumDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/pyproject.toml index d56b8c4e638..d5744413cce 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py index f4610340800..73f00e621e5 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _NestedDiscriminatorClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NestedDiscriminatorClient( _NestedDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py index 189454a56d7..2cf56f3ce17 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NestedDiscriminatorClientConfiguration from ._operations import _NestedDiscriminatorClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NestedDiscriminatorClient( _NestedDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/pyproject.toml index 9485d03eba7..0011233d988 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py index 9dbee25b991..d7ef2a7b2fa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _NotDiscriminatedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDiscriminatedClient( _NotDiscriminatedClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py index fdd16ab8c3d..4c923319663 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import NotDiscriminatedClientConfiguration from ._operations import _NotDiscriminatedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDiscriminatedClient( _NotDiscriminatedClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/pyproject.toml index 4a07e1b3759..965483487c3 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_client.py index a22a131850b..3d217450cd8 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _RecursiveClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_client.py index 87d2e92a383..da020e78de8 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import RecursiveClientConfiguration from ._operations import _RecursiveClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-recursive/typetest/model/recursive/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/pyproject.toml index aae6673f03c..d685d72a8c1 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py index e3a002c68e6..148a0ce6209 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _SingleDiscriminatorClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleDiscriminatorClient( _SingleDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py index cf1247fd5b9..99db70d4bb7 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import SingleDiscriminatorClientConfiguration from ._operations import _SingleDiscriminatorClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleDiscriminatorClient( _SingleDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-usage/pyproject.toml index 13430792426..71671438384 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_client.py index 0d20263c03e..0c89427f010 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _UsageClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UsageClient(_UsageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of Record in different places(Operation parameters, return type or both). diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_client.py index 581fb9ce431..c0c86a1c19e 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import UsageClientConfiguration from ._operations import _UsageClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UsageClient(_UsageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of Record in different places(Operation parameters, return type or both). diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-usage/typetest/model/usage/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/pyproject.toml index f080f99d7c4..f9b7a126613 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_client.py index 183a28836d2..f246a0af873 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _VisibilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_client.py index 2bd3027bb36..1216228de36 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import VisibilityClientConfiguration from ._operations import _VisibilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-model-visibility/typetest/model/visibility/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/pyproject.toml index d0920564b66..ca73fe8b62d 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py index e727c1f0ac4..ed7b0201bf0 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -50,6 +50,11 @@ SpreadStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Tests for additional properties of models. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py index 1afeb43acc1..71bf01605f8 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -50,6 +50,11 @@ SpreadStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Tests for additional properties of models. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/pyproject.toml index 1edbd021b8e..087e4554c1a 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_client.py index f7015c59690..e84bc433e71 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -26,6 +26,11 @@ StringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NullableClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with nullable properties. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_client.py index 3ae4a7daab0..dc8449eab50 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -26,6 +26,11 @@ StringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NullableClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with nullable properties. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-nullable/typetest/property/nullable/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-property-optional/pyproject.toml index b513ac5ef37..47b00e2d54d 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_client.py index b06efb80a58..2a7c1de64c2 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -35,6 +35,11 @@ UnionStringLiteralOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OptionalClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with optional properties. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_client.py index 504284f11f3..3e82ebb4459 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -35,6 +35,11 @@ UnionStringLiteralOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OptionalClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with optional properties. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-optional/typetest/property/optional/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/pyproject.toml index 6f40eaccf7c..4692d5ef508 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_client.py index e284c7ec2eb..48c6de44483 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -48,6 +48,11 @@ UnknownStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ValueTypesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various property types for models. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py index 1b455c9c8a8..5877eeed5c5 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -48,6 +48,11 @@ UnknownStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ValueTypesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various property types for models. diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-scalar/pyproject.toml index b37d18805cd..18f7d4cb4d5 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_client.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_client.py index 1d3f74d18d0..d51c5ec6804 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -26,6 +26,11 @@ UnknownOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ScalarClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ScalarClient. diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_client.py index 488eac03d3b..07e9de3dea2 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -26,6 +26,11 @@ UnknownOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ScalarClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ScalarClient. diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-scalar/typetest/scalar/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/pyproject.toml b/packages/typespec-python/tests/generated/azure/typetest-union/pyproject.toml index c85924899f5..ed91415e85d 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/typetest-union/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_client.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_client.py index 8863b50c815..0bca43587d0 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -29,6 +29,11 @@ StringsOnlyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UnionClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Describe scenarios for various combinations of unions. diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_client.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_client.py index 1b43016396f..c7059d7210f 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -29,6 +29,11 @@ StringsOnlyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UnionClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Describe scenarios for various combinations of unions. diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/aio/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/models/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/models/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/models/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/operations/_patch.py b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/operations/_patch.py index 87676c65a8f..ea765788358 100644 --- a/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/typetest-union/typetest/union/operations/_patch.py @@ -8,7 +8,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/pyproject.toml b/packages/typespec-python/tests/generated/azure/versioning-added/pyproject.toml index 44c6835764b..23d3bce7e24 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/versioning-added/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_client.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_client.py index f613be489e8..f9efe3b76a8 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_client.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_client.py index 3121d534a14..63a517a4d30 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import AddedClientConfiguration from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/models/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-added/versioning/added/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/pyproject.toml b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/pyproject.toml index dbdaed46fee..9a4cac941df 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_client.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_client.py index 6839ee13d85..379c2553356 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _MadeOptionalClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MadeOptionalClient(_MadeOptionalClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@madeOptional`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_client.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_client.py index 8650cf7ea07..c22285756ed 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import MadeOptionalClientConfiguration from ._operations import _MadeOptionalClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MadeOptionalClient(_MadeOptionalClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@madeOptional`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/models/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-madeoptional/versioning/madeoptional/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/pyproject.toml b/packages/typespec-python/tests/generated/azure/versioning-removed/pyproject.toml index fb005f83826..45fe86465d6 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_client.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_client.py index e7419674d81..4a9769a93b7 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _RemovedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RemovedClient(_RemovedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@removed`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_client.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_client.py index fa156c6f3de..a1fda175edd 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import RemovedClientConfiguration from ._operations import _RemovedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RemovedClient(_RemovedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@removed`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/models/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-removed/versioning/removed/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/pyproject.toml b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/pyproject.toml index f8a49f40b5e..750a3143a3c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_client.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_client.py index fbb7c1bcc36..8df234c4bb5 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import NewInterfaceOperations, _RenamedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RenamedFromClient(_RenamedFromClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@renamedFrom`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py index 205c94f2312..b27d2b40285 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import RenamedFromClientConfiguration from .operations import NewInterfaceOperations, _RenamedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RenamedFromClient(_RenamedFromClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@renamedFrom`` decorator. diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/pyproject.toml b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/pyproject.toml index af855d22310..00744a792e0 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py index 137f4a598d3..517cc2fbf11 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _ReturnTypeChangedFromClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReturnTypeChangedFromClient( _ReturnTypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py index 94c0d1b6fd0..67d0f867119 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import ReturnTypeChangedFromClientConfiguration from ._operations import _ReturnTypeChangedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReturnTypeChangedFromClient( _ReturnTypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/pyproject.toml b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/pyproject.toml index 81735c2174f..0be623bdae2 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/pyproject.toml +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/pyproject.toml @@ -21,13 +21,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" keywords = ["azure", "azure sdk"] dependencies = [ diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_client.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_client.py index 8091f28a82a..557c79b4679 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from azure.core import PipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._operations import _TypeChangedFromClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TypeChangedFromClient( _TypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py index db24930fdca..e388041e456 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py @@ -23,14 +23,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError from azure.core import CaseInsensitiveEnumMeta from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null + from azure.core.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -595,11 +600,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1113,7 +1114,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py index 81ec1de5922..954bf7ebffa 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py @@ -39,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py index 38383e658ee..9357d929823 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py @@ -7,8 +7,8 @@ # -------------------------------------------------------------------------- from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from azure.core import AsyncPipelineClient from azure.core.pipeline import policies @@ -18,6 +18,11 @@ from ._configuration import TypeChangedFromClientConfiguration from ._operations import _TypeChangedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TypeChangedFromClient( _TypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py index 8bcb627aa47..b6400f50d7c 100644 --- a/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py +++ b/packages/typespec-python/tests/generated/azure/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py @@ -7,6 +7,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_client.py index 39c3789576b..f8317bcde8e 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import HttpRequest, HttpResponse @@ -12,6 +12,11 @@ from ._operations import _ApiKeyClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ApiKeyClient(_ApiKeyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey authentication. diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_operations/_patch.py index fc4fac79b3b..8391c35e9d5 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._operations import _ApiKeyClientOperationsMixin as Generated diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_client.py index 77cc728a366..614bffb94a7 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import AsyncHttpResponse, HttpRequest @@ -12,6 +12,11 @@ from ._configuration import ApiKeyClientConfiguration from ._operations import _ApiKeyClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ApiKeyClient(_ApiKeyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with ApiKey authentication. diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_operations/_patch.py index fc4fac79b3b..8391c35e9d5 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List from ._operations import _ApiKeyClientOperationsMixin as Generated diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/authentication/apikey/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/pyproject.toml index bded6e6b36a..a3dff402694 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-api-key/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/authentication-api-key/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_client.py index e783ba86411..ceb80565b84 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import HttpRequest, HttpResponse @@ -12,6 +12,11 @@ from ._operations import _CustomClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CustomClient(_CustomClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with generic HTTP auth. diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_client.py index f2c2c91339d..0fbc4f4f6a6 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import AsyncHttpResponse, HttpRequest @@ -12,6 +12,11 @@ from ._configuration import CustomClientConfiguration from ._operations import _CustomClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CustomClient(_CustomClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates clients generated with generic HTTP auth. diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/authentication/http/custom/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/pyproject.toml index a10b8d16ae4..8d9373ed536 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/authentication-http-custom/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_client.py index 5761b531759..e1e127bd1c3 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _UnionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_client.py index 5e1fb2b7f5e..a66390d82c7 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import UnionClientConfiguration from ._operations import _UnionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/authentication/noauth/union/aio/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/pyproject.toml index c67a3d3ce6f..eda5789e71b 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/authentication-noauth-union/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_client.py index b6c2f221e76..b8697080032 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _OAuth2ClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_client.py index 378fb98eda1..7de2f6fee70 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import OAuth2ClientConfiguration from ._operations import _OAuth2ClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/authentication/oauth2/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/pyproject.toml index 174f0b242b4..f7872e2910e 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/authentication-oauth2/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_client.py index 171a71a4f5f..95f49ffa7b8 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import HttpRequest, HttpResponse @@ -12,6 +12,11 @@ from ._operations import _UnionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_client.py index 0ee916f5411..a68a59458da 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING, Union -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import AsyncHttpResponse, HttpRequest @@ -12,6 +12,11 @@ from ._configuration import UnionClientConfiguration from ._operations import _UnionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/authentication/union/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/authentication-union/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/authentication-union/pyproject.toml index 49f7c432079..27e808c510e 100644 --- a/packages/typespec-python/tests/generated/unbranded/authentication-union/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/authentication-union/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_client.py index f86a0474608..9ad00c5d1ef 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .property.operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on array. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_client.py index d878331c5dc..3416d114f10 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ..property.aio.operations import PropertyOperations from ._configuration import ArrayClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on array. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/aio/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/models/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/aio/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/encode/array/property/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-array/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/encode-array/pyproject.toml index 55d69be7b3c..8a2a14005ec 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-array/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/encode-array/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_client.py index b3ef7174677..c9bec7770df 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -15,6 +15,11 @@ from .requestbody.operations import RequestBodyOperations from .responsebody.operations import ResponseBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BytesClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on bytes. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_client.py index 0ddad29adb4..f2fc6e33557 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -15,6 +15,11 @@ from ..responsebody.aio.operations import ResponseBodyOperations from ._configuration import BytesClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BytesClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on bytes. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/header/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/property/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/query/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/requestbody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/encode/bytes/responsebody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-bytes/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/encode-bytes/pyproject.toml index ccfcb0137fc..6e72db998ef 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-bytes/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/encode-bytes/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_client.py index e30653f26a2..248759b4b0e 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -14,6 +14,11 @@ from .query.operations import QueryOperations from .responseheader.operations import ResponseHeaderOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DatetimeClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on datetime. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_client.py index 9cc99d98c7e..ee6f58cac98 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -14,6 +14,11 @@ from ..responseheader.aio.operations import ResponseHeaderOperations from ._configuration import DatetimeClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DatetimeClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on datetime. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/header/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/property/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/query/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/encode/datetime/responseheader/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-datetime/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/encode-datetime/pyproject.toml index 5d19f1ff5b0..b54be7c6b7a 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-datetime/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/encode-datetime/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_client.py index 10feef8b77d..2deedb900db 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -13,6 +13,11 @@ from .property.operations import PropertyOperations from .query.operations import QueryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DurationClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on duration. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_client.py index b24a09c6f34..d5ce7657a04 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -13,6 +13,11 @@ from ..query.aio.operations import QueryOperations from ._configuration import DurationClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DurationClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on duration. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/header/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/property/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/encode/duration/query/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-duration/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/encode-duration/pyproject.toml index 9392503fb1d..80959aaf243 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-duration/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/encode-duration/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_client.py index ae39adff41e..97b0d4ea021 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .property.operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NumericClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on integer. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_client.py index 0afca9d0198..3e6ae709399 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ..property.aio.operations import PropertyOperations from ._configuration import NumericClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NumericClient: # pylint: disable=client-accepts-api-version-keyword """Test for encode decorator on integer. diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/encode/numeric/property/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/encode-numeric/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/encode-numeric/pyproject.toml index 4c6927193d8..39fc7b735ca 100644 --- a/packages/typespec-python/tests/generated/unbranded/encode-numeric/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/encode-numeric/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_client.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_client.py index d75669f2e33..c0f898c8ec4 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _RecursiveClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_client.py index 67a5ba7469c..88a14a58a19 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import RecursiveClientConfiguration from ._operations import _RecursiveClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/generation/subdir/_generated/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/generation-subdir/pyproject.toml index 8e6b6146aa2..3a8f74061ff 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_client.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_client.py index 280d95dd776..38439bb195a 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_client.py index d4ddb5f9add..815f8968306 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import AddedClientConfiguration from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/models/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/generation/subdir2/_generated/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/pyproject.toml index 150e1d42ccd..487fe99786d 100644 --- a/packages/typespec-python/tests/generated/unbranded/generation-subdir2/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/generation-subdir2/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_client.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_client.py index caef522b8f6..f207443c595 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _VisibilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_client.py index 0e56f7b7be2..ad48920babf 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import VisibilityClientConfiguration from ._operations import _VisibilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/headasbooleanfalse/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/pyproject.toml index 289f871f52f..4b4aecb5e24 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleanfalse/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_client.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_client.py index caef522b8f6..f207443c595 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _VisibilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_client.py index 0e56f7b7be2..ad48920babf 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import VisibilityClientConfiguration from ._operations import _VisibilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/headasbooleantrue/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/pyproject.toml index c72808cef78..292f5b43b92 100644 --- a/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/headasbooleantrue/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_client.py index c6f0c505e86..71dce673a51 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -12,6 +12,11 @@ from .explicitbody.operations import ExplicitBodyOperations from .implicitbody.operations import ImplicitBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BasicClient: # pylint: disable=client-accepts-api-version-keyword """Test for basic parameters cases. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_client.py index 129562a9cf5..706198ab1d3 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -12,6 +12,11 @@ from ..implicitbody.aio.operations import ImplicitBodyOperations from ._configuration import BasicClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BasicClient: # pylint: disable=client-accepts-api-version-keyword """Test for basic parameters cases. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/explicitbody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/parameters/basic/implicitbody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-basic/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/parameters-basic/pyproject.toml index bfbf7c0e1f6..88bfa62d966 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-basic/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/parameters-basic/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_client.py index b9f179a0361..a8ece0871a5 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -12,6 +12,11 @@ from ._utils.serialization import Deserializer, Serializer from .optionalexplicit.operations import OptionalExplicitOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyOptionalityClient( _BodyOptionalityClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py index 053836c3ca9..d306cd5f4f0 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -12,6 +12,11 @@ from ._configuration import BodyOptionalityClientConfiguration from ._operations import _BodyOptionalityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class BodyOptionalityClient( _BodyOptionalityClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/parameters/bodyoptionality/optionalexplicit/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/pyproject.toml index 4837fc2c288..39fb1827486 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/parameters-body-optionality/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_client.py index 11a2623f9bb..3c6917b1a36 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -12,6 +12,11 @@ from .header.operations import HeaderOperations from .query.operations import QueryOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CollectionFormatClient: # pylint: disable=client-accepts-api-version-keyword """Test for collectionFormat. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_client.py index e58a9c21575..d8433a986e2 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -12,6 +12,11 @@ from ..query.aio.operations import QueryOperations from ._configuration import CollectionFormatClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class CollectionFormatClient: # pylint: disable=client-accepts-api-version-keyword """Test for collectionFormat. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/header/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/parameters/collectionformat/query/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/pyproject.toml index 73b14cf8126..950933d444d 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/parameters-collection-format/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_client.py index 6f1e48f1911..b9aa720f258 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _PathClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PathClient(_PathClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for path parameters cases. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_client.py index 78bdc4af9cb..a9b3fe9588a 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import PathClientConfiguration from ._operations import _PathClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PathClient(_PathClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for path parameters cases. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/parameters/path/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-path/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/parameters-path/pyproject.toml index a0dadd4896a..292395fb03a 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-path/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/parameters-path/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_client.py index b2e753b4148..a4bb9e32ce1 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ConstantOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class QueryClient: # pylint: disable=client-accepts-api-version-keyword """Test for query parameter cases. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_client.py index 4b2b6c630f0..bf9583fa41d 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import QueryClientConfiguration from .operations import ConstantOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class QueryClient: # pylint: disable=client-accepts-api-version-keyword """Test for query parameter cases. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/parameters/query/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-query/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/parameters-query/pyproject.toml index 8626a2a9896..5b1ca92a2d4 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-query/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/parameters-query/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_client.py index 65ea2614906..92b11200c4c 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -12,6 +12,11 @@ from .alias.operations import AliasOperations from .model.operations import ModelOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpreadClient: # pylint: disable=client-accepts-api-version-keyword """Test for the spread operator. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_client.py index fd96b553be6..bc632ac4410 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -12,6 +12,11 @@ from ..model.aio.operations import ModelOperations from ._configuration import SpreadClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpreadClient: # pylint: disable=client-accepts-api-version-keyword """Test for the spread operator. diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/alias/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/parameters/spread/model/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/parameters-spread/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/parameters-spread/pyproject.toml index 344d1a8c254..efc5e459146 100644 --- a/packages/typespec-python/tests/generated/unbranded/parameters-spread/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/parameters-spread/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_client.py index 3dc6c6dc511..417ae946c40 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -12,6 +12,11 @@ from .differentbody.operations import DifferentBodyOperations from .samebody.operations import SameBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ContentNegotiationClient: # pylint: disable=client-accepts-api-version-keyword """Test describing optionality of the request body. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_client.py index 46f3edf4408..78bc65d2f41 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -12,6 +12,11 @@ from ..samebody.aio.operations import SameBodyOperations from ._configuration import ContentNegotiationClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ContentNegotiationClient: # pylint: disable=client-accepts-api-version-keyword """Test describing optionality of the request body. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/differentbody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/payload/contentnegotiation/samebody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/pyproject.toml index 2542ede9167..2c4d25c9872 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/payload-content-negotiation/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_client.py index 57e104964f2..c31728d420d 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _JsonMergePatchClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonMergePatchClient(_JsonMergePatchClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for merge-patch+json content-type. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py index a0f2cf55a9c..1b615ca7039 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import JsonMergePatchClientConfiguration from ._operations import _JsonMergePatchClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonMergePatchClient(_JsonMergePatchClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for merge-patch+json content-type. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/payload/jsonmergepatch/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/pyproject.toml index d98f4e5f4d1..a3505f3a8ef 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/payload-json-merge-patch/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_client.py index 90dadced1c4..945f49c151d 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .stringbody.operations import StringBodyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypeClient: # pylint: disable=client-accepts-api-version-keyword """Test the payload with different media types and different types of the payload itself. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_client.py index f35d7df40b0..d47623f5102 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ..stringbody.aio.operations import StringBodyOperations from ._configuration import MediaTypeClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MediaTypeClient: # pylint: disable=client-accepts-api-version-keyword """Test the payload with different media types and different types of the payload itself. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/payload/mediatype/stringbody/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-media-type/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/payload-media-type/pyproject.toml index fa5fa184c34..9a86ee621de 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-media-type/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/payload-media-type/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_client.py index 6ea2b329dbc..09d354a876e 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .formdata.operations import FormDataOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultiPartClient: # pylint: disable=client-accepts-api-version-keyword """Test for multipart. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/utils.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/utils.py index ac0302f5967..4df01ac7bff 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/utils.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/_utils/utils.py @@ -3,7 +3,6 @@ from .._utils.model_base import Model, SdkJSONEncoder - # file-like tuple could be `(filename, IO (or bytes))` or `(filename, IO (or bytes), content_type)` FileContent = Union[str, bytes, IO[str], IO[bytes]] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_client.py index cfc5b1fe28b..c3fbac9e1ef 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ..formdata.aio.operations import FormDataOperations from ._configuration import MultiPartClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultiPartClient: # pylint: disable=client-accepts-api-version-keyword """Test for multipart. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/aio/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/models/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/file/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/contenttype/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/nonstring/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/httpparts/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/formdata/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/payload/multipart/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-multipart/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/payload-multipart/pyproject.toml index 006319a1182..64dc4754a3c 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-multipart/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/payload-multipart/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_client.py index dc031a8f67d..f0e09be3d65 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -13,6 +13,11 @@ from .serverdrivenpagination.operations import ServerDrivenPaginationOperations from .xmlpagination.operations import XmlPaginationOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageableClient: # pylint: disable=client-accepts-api-version-keyword """Test for pageable payload. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_client.py index ad05d7bcea2..ee6be0ce731 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -13,6 +13,11 @@ from ..xmlpagination.aio.operations import XmlPaginationOperations from ._configuration import PageableClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class PageableClient: # pylint: disable=client-accepts-api-version-keyword """Test for pageable payload. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/pagesize/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/alternateinitialverb/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/continuationtoken/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/serverdrivenpagination/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/payload/pageable/xmlpagination/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-pageable/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/payload-pageable/pyproject.toml index 2a39c3fdf3b..a13b3e420fd 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-pageable/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/payload-pageable/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_client.py index c10596c7211..198e940d5e0 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -38,6 +38,11 @@ XmlErrorValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XmlClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Sends and receives bodies in XML format. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/model_base.py index 4bce0460ec2..1ec76185f44 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1123,7 +1124,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_client.py index 0b10891acd0..82a6676f29c 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -38,6 +38,11 @@ XmlErrorValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class XmlClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Sends and receives bodies in XML format. diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/payload/xml/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/payload-xml/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/payload-xml/pyproject.toml index a95dd090890..7c8c79c9aa6 100644 --- a/packages/typespec-python/tests/generated/unbranded/payload-xml/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/payload-xml/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/pyproject.toml index 9100428b3f1..ef2a1de0e89 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_client.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_client.py index 1c4006cb1d0..164fecaec28 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _StatusCodeRangeClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class StatusCodeRangeClient( _StatusCodeRangeClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_patch.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_client.py index 7025f6c0f8a..94e110fee09 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import StatusCodeRangeClientConfiguration from ._operations import _StatusCodeRangeClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class StatusCodeRangeClient( _StatusCodeRangeClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/response-status-code-range/response/statuscoderange/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/routes/pyproject.toml index f38b571949a..05b15249b90 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/routes/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/_client.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/_client.py index 5774cd376f3..c01a9e6ea09 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -13,6 +13,11 @@ from .pathparameters.operations import PathParametersOperations from .queryparameters.operations import QueryParametersOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RoutesClient(_RoutesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Define scenario in building the http route/uri. diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_client.py index 5c5ec1bf12c..dc4a0ef65c3 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -13,6 +13,11 @@ from ._configuration import RoutesClientConfiguration from .operations import InInterfaceOperations, _RoutesClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RoutesClient(_RoutesClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Define scenario in building the http route/uri. diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/explode/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/labelexpansion/standard/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/explode/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/matrixexpansion/standard/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/explode/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/pathexpansion/standard/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/reservedexpansion/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/explode/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/pathparameters/simpleexpansion/standard/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/explode/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/querycontinuation/standard/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/explode/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/routes/routes/queryparameters/queryexpansion/standard/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/pyproject.toml index f1f07a96d9d..800a3d97073 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_client.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_client.py index 4aff34de051..db25ad433c4 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .property.operations import PropertyOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonClient: # pylint: disable=client-accepts-api-version-keyword """Encoded names. diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_patch.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py index 3c73b23acbb..eacb1ab0bfe 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ..property.aio.operations import PropertyOperations from ._configuration import JsonClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonClient: # pylint: disable=client-accepts-api-version-keyword """Encoded names. diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/serialization-encoded-name-json/serialization/encodedname/json/property/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/pyproject.toml index d1ff2cd2a88..0893efe98f3 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_client.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_client.py index 1548cdef036..e59ebce3c2c 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _NotDefinedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDefinedClient(_NotDefinedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py index 199fa637850..2031a741b07 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import NotDefinedClientConfiguration from ._operations import _NotDefinedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDefinedClient(_NotDefinedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server doesn't define endpoint. Client should automatically add an endpoint to let diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-endpoint-not-defined/server/endpoint/notdefined/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/pyproject.toml index 490fd04d823..0b2f4924622 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_client.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_client.py index 2691f622839..9a4f8c6fa86 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _MultipleClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleClient(_MultipleClientOperationsMixin): """MultipleClient. diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_client.py index 9d670043650..f55f6d00e75 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import MultipleClientConfiguration from ._operations import _MultipleClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MultipleClient(_MultipleClientOperationsMixin): """MultipleClient. diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-multiple/server/path/multiple/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/server-path-single/pyproject.toml index 844f1c44463..d1d04757d38 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_client.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_client.py index cc9e78bcf68..869d307122a 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _SingleClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleClient(_SingleClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server with a single path parameter @server. diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_client.py index ea72d5bb061..7ad99ceaf7e 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import SingleClientConfiguration from ._operations import _SingleClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleClient(_SingleClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates server with a single path parameter @server. diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-path-single/server/path/single/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/pyproject.toml index 255ec4c121e..64ffd63928e 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_client.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_client.py index 05919a4440c..4d0af04d9c2 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _NotVersionedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotVersionedClient(_NotVersionedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates not-versioned server. diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_client.py index fd416b17d69..c860076f519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import NotVersionedClientConfiguration from ._operations import _NotVersionedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotVersionedClient(_NotVersionedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates not-versioned server. diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-not-versioned/server/versions/notversioned/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/pyproject.toml index ec8037eb2ba..6fcae26ae72 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_client.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_client.py index a1c6b700dea..d138215c41c 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _VersionedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VersionedClient(_VersionedClientOperationsMixin): """Illustrates versioned server. diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_client.py index 0fb9efb66b6..43ee6a3949f 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import VersionedClientConfiguration from ._operations import _VersionedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VersionedClient(_VersionedClientOperationsMixin): """Illustrates versioned server. diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/server-versions-versioned/server/versions/versioned/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setup.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setup.py index f18e1fd4ca4..a60e187b463 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setup.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setup.py @@ -5,7 +5,6 @@ import re from setuptools import setup, find_packages - PACKAGE_NAME = "setuppy-authentication-union" PACKAGE_PPRINT_NAME = "Setuppy Authentication Union" PACKAGE_NAMESPACE = "setuppy.authentication.union" @@ -34,7 +33,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -59,5 +57,5 @@ "corehttp[requests]>=1.0.0b6", "typing-extensions>=4.6.0", ], - python_requires=">=3.9", + python_requires=">=3.10", ) diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_client.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_client.py index 171a71a4f5f..95f49ffa7b8 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, TYPE_CHECKING, Union -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import HttpRequest, HttpResponse @@ -12,6 +12,11 @@ from ._operations import _UnionClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import TokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_patch.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py index 0ee916f5411..a68a59458da 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable, TYPE_CHECKING, Union -from typing_extensions import Self from corehttp.credentials import ServiceKeyCredential from corehttp.rest import AsyncHttpResponse, HttpRequest @@ -12,6 +12,11 @@ from ._configuration import UnionClientConfiguration from ._operations import _UnionClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: from corehttp.credentials import AsyncTokenCredential diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/setuppy-authentication-union/setuppy/authentication/union/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/pyproject.toml index a67788908ab..83ee64aeed3 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py index 79ac424bd60..9393cc6c2ea 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _ConditionalRequestClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ConditionalRequestClient( _ConditionalRequestClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py index d5635744516..22b26d75388 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import ConditionalRequestClientConfiguration from ._operations import _ConditionalRequestClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ConditionalRequestClient( _ConditionalRequestClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-conditional-request/specialheaders/conditionalrequest/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/pyproject.toml index 32fe401c23a..fa712cba243 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_client.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_client.py index 9acb382959a..16b0b37884e 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _RepeatabilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RepeatabilityClient(_RepeatabilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates OASIS repeatability headers. diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_client.py index ea79e646a91..657207d6b78 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import RepeatabilityClientConfiguration from ._operations import _RepeatabilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RepeatabilityClient(_RepeatabilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates OASIS repeatability headers. diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-headers-repeatability/specialheaders/repeatability/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/special-words/pyproject.toml index 5ce5e779929..fa7b25b4349 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/special-words/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_client.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_client.py index bb4763d92fc..bae36e85ec5 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -14,6 +14,11 @@ from .models.operations import ModelsOperations from .operations import Operations, ParametersOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpecialWordsClient: # pylint: disable=client-accepts-api-version-keyword """Scenarios to verify that reserved words can be used in service and generators will handle it diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/model_base.py index 4bce0460ec2..1ec76185f44 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1123,7 +1124,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_client.py index df7d3d3e65e..6e122475e70 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -14,6 +14,11 @@ from ._configuration import SpecialWordsClientConfiguration from .operations import Operations, ParametersOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SpecialWordsClient: # pylint: disable=client-accepts-api-version-keyword """Scenarios to verify that reserved words can be used in service and generators will handle it diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/aio/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/models/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/extensiblestrings/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/modelproperties/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/models/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/special-words/specialwords/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/specs-documentation/pyproject.toml index d416e872f75..5bf059ca3c7 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_client.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_client.py index b1e72ea5772..88d9d7daacb 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import ListsOperations, TextFormattingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DocumentationClient: # pylint: disable=client-accepts-api-version-keyword """Illustrates documentation generation and formatting features. diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_patch.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_client.py index 3670430e95c..eff88411925 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import DocumentationClientConfiguration from .operations import ListsOperations, TextFormattingOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DocumentationClient: # pylint: disable=client-accepts-api-version-keyword """Illustrates documentation generation and formatting features. diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/models/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/specs-documentation/specs/documentation/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/pyproject.toml index 706e00e5b3d..7232bd6ddd4 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_client.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_client.py index feb3d65ac5b..94cb915f1bd 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .basic.operations import BasicOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonlClient: # pylint: disable=client-accepts-api-version-keyword """Test of jsonl streaming. diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_patch.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_client.py index f0123acbc4f..b08ee96cc2d 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ..basic.aio.operations import BasicOperations from ._configuration import JsonlClientConfiguration +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class JsonlClient: # pylint: disable=client-accepts-api-version-keyword """Test of jsonl streaming. diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/models/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/streaming-jsonl/streaming/jsonl/basic/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-array/pyproject.toml index 079ed8b2432..e083038c87c 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_client.py index 08e71e15c10..1c0f5d977b0 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -26,6 +26,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various types of arrays. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_client.py index 19c24fc6456..fdb25ad8d8d 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -26,6 +26,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ArrayClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various types of arrays. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-array/typetest/array/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/pyproject.toml index d58a94fd494..ba82dee2060 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_client.py index 5fad49ebd0a..ac57f82e6af 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -23,6 +23,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DictionaryClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various of dictionaries. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_client.py index a01df3d4f6d..1e0cd303be3 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -23,6 +23,11 @@ UnknownValueOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DictionaryClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various of dictionaries. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-dictionary/typetest/dictionary/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/pyproject.toml index de6898e9822..b381e57d24e 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_client.py index 8e553bd6353..2f9d20c194c 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import EnvelopeOperations, NoEnvelopeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DiscriminatedClient: # pylint: disable=client-accepts-api-version-keyword """Describe scenarios for discriminated unions. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py index 542cf464f60..2187cd687b6 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import DiscriminatedClientConfiguration from .operations import EnvelopeOperations, NoEnvelopeOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class DiscriminatedClient: # pylint: disable=client-accepts-api-version-keyword """Describe scenarios for discriminated unions. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/aio/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/models/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py index bbe39eaf695..b208fb11fbc 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-discriminatedunion/typetest/discriminatedunion/operations/_patch.py @@ -5,7 +5,6 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ - __all__: list[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/pyproject.toml index af2e373fc03..7ecff2ccf98 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_client.py index 41ba8593129..9bfb6f08a56 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ExtensibleClient: # pylint: disable=client-accepts-api-version-keyword """ExtensibleClient. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py index 9fb7f42219d..229073d7cb5 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import ExtensibleClientConfiguration from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ExtensibleClient: # pylint: disable=client-accepts-api-version-keyword """ExtensibleClient. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-extensible/typetest/enum/extensible/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/pyproject.toml index f19fd75c355..e7a4d7cc78d 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_client.py index 9796efb373e..c1e9d972630 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FixedClient: # pylint: disable=client-accepts-api-version-keyword """FixedClient. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py index b816e9c3124..1213b870a1b 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import FixedClientConfiguration from .operations import StringOperations +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class FixedClient: # pylint: disable=client-accepts-api-version-keyword """FixedClient. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-enum-fixed/typetest/enum/fixed/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/pyproject.toml index 879dc35df00..8865ac1ce5d 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_client.py index 73ecb421192..529036719ae 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _EmptyClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EmptyClient(_EmptyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of empty model used in operation's parameters and responses. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_client.py index c9a467bf4d9..ac2a21d3660 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import EmptyClientConfiguration from ._operations import _EmptyClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EmptyClient(_EmptyClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of empty model used in operation's parameters and responses. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-empty/typetest/model/empty/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/pyproject.toml index 982a4a38e37..712344271a6 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py index f330becebc8..65884404847 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _EnumDiscriminatorClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EnumDiscriminatorClient( _EnumDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py index 317b3948624..94bb9bebe9e 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import EnumDiscriminatorClientConfiguration from ._operations import _EnumDiscriminatorClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class EnumDiscriminatorClient( _EnumDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-enumdiscriminator/typetest/model/enumdiscriminator/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/pyproject.toml index f7426f1c97d..e5dff82c64c 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py index ceb015ca6f5..d5438cca4a0 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _NestedDiscriminatorClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NestedDiscriminatorClient( _NestedDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py index 5ef38d01840..b6c6c29df8a 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import NestedDiscriminatorClientConfiguration from ._operations import _NestedDiscriminatorClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NestedDiscriminatorClient( _NestedDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-nesteddiscriminator/typetest/model/nesteddiscriminator/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/pyproject.toml index 1ecb07a32a1..bcec7140bf0 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py index 8a1be48f025..95a446200a6 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _NotDiscriminatedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDiscriminatedClient( _NotDiscriminatedClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py index 5e79ac2220b..22d0a9c0f66 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import NotDiscriminatedClientConfiguration from ._operations import _NotDiscriminatedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NotDiscriminatedClient( _NotDiscriminatedClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-notdiscriminated/typetest/model/notdiscriminated/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/pyproject.toml index b05394033b2..b5db0b394ef 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_client.py index d75669f2e33..c0f898c8ec4 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _RecursiveClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_client.py index 67a5ba7469c..88a14a58a19 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import RecursiveClientConfiguration from ._operations import _RecursiveClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RecursiveClient(_RecursiveClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates inheritance recursion. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-recursive/typetest/model/recursive/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/pyproject.toml index a1b2143ea7b..bb04ce600ef 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py index eb5a824a771..cdfef7009bc 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _SingleDiscriminatorClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleDiscriminatorClient( _SingleDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py index 91952d03f15..8c5c8bca884 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import SingleDiscriminatorClientConfiguration from ._operations import _SingleDiscriminatorClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class SingleDiscriminatorClient( _SingleDiscriminatorClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-singlediscriminator/typetest/model/singlediscriminator/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/pyproject.toml index 0c54c59093b..3f493fac8dc 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_client.py index fbf27f47c72..e8dd4f5ff96 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _UsageClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UsageClient(_UsageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of Record in different places(Operation parameters, return type or both). diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_client.py index 3e83a457d90..5afd7fc0bb8 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import UsageClientConfiguration from ._operations import _UsageClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UsageClient(_UsageClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates usage of Record in different places(Operation parameters, return type or both). diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-usage/typetest/model/usage/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/pyproject.toml index 35bdb60fb35..146830b5290 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_client.py index caef522b8f6..f207443c595 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _VisibilityClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_client.py index 0e56f7b7be2..ad48920babf 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import VisibilityClientConfiguration from ._operations import _VisibilityClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class VisibilityClient(_VisibilityClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Illustrates models with visibility properties. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-model-visibility/typetest/model/visibility/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/pyproject.toml index ab0106266f4..c7fa8b58b5c 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py index 3c9588ace34..9bc9679666f 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -43,6 +43,11 @@ SpreadStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Tests for additional properties of models. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py index 944cc1e8314..eea3ae6c759 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -43,6 +43,11 @@ SpreadStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AdditionalPropertiesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Tests for additional properties of models. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-additionalproperties/typetest/property/additionalproperties/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/pyproject.toml index 04631d25885..271a3ff524b 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_client.py index 8e6bd430676..114ddfd0984 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -19,6 +19,11 @@ StringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NullableClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with nullable properties. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_client.py index 541493385a2..7e8c35ef6fa 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -19,6 +19,11 @@ StringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class NullableClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with nullable properties. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-nullable/typetest/property/nullable/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/pyproject.toml index ac2ccfec2ec..f59adf70bd5 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_client.py index 82b4163b386..72a58ec0526 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -28,6 +28,11 @@ UnionStringLiteralOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OptionalClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with optional properties. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_client.py index 39870a4ba8e..b643ca5a803 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -28,6 +28,11 @@ UnionStringLiteralOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class OptionalClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates models with optional properties. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-optional/typetest/property/optional/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/pyproject.toml index 06a9e35cc11..c3456d8c5c4 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_client.py index 920e91040cd..a013896eb5f 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -41,6 +41,11 @@ UnknownStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ValueTypesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various property types for models. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py index 529c61c49ac..edc747e065b 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -41,6 +41,11 @@ UnknownStringOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ValueTypesClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Illustrates various property types for models. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-property-valuetypes/typetest/property/valuetypes/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/pyproject.toml index 6ec6aa804d4..c40f41e696d 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_client.py index 5fb6ec4709d..3e3ca844bb3 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -19,6 +19,11 @@ UnknownOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ScalarClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ScalarClient. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_client.py index 1d795579c18..54b9aa979ec 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -19,6 +19,11 @@ UnknownOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ScalarClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """ScalarClient. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-scalar/typetest/scalar/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/typetest-union/pyproject.toml index 6eb17fe34b6..b9b86fead92 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_client.py index 433896cf638..3d8e3bb9fec 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -22,6 +22,11 @@ StringsOnlyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UnionClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Describe scenarios for various combinations of unions. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_client.py index c99bcdd1490..42ff0d8a856 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -22,6 +22,11 @@ StringsOnlyOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class UnionClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Describe scenarios for various combinations of unions. diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/typetest-union/typetest/union/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/versioning-added/pyproject.toml index 335bc99c838..f8b12c5ed50 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_client.py index 37acafcf3b0..75182a2237f 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_client.py index 8cd0849bcbf..d0137f4f3fd 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import AddedClientConfiguration from .operations import InterfaceV2Operations, _AddedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class AddedClient(_AddedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@added`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-added/versioning/added/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/pyproject.toml index d6bd0b8dc12..ca345631d45 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_client.py index b462f38cff9..90567a6c481 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _MadeOptionalClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MadeOptionalClient(_MadeOptionalClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@madeOptional`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_client.py index 06badd8d45f..a194f3b67f7 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import MadeOptionalClientConfiguration from ._operations import _MadeOptionalClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class MadeOptionalClient(_MadeOptionalClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@madeOptional`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-madeoptional/versioning/madeoptional/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/versioning-removed/pyproject.toml index 9cb6d36eca0..a5d3b82d1f2 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_client.py index f09f933a739..f11b0c20bda 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _RemovedClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RemovedClient(_RemovedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@removed`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_client.py index ce606c775ce..d5b46ff4b67 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import RemovedClientConfiguration from ._operations import _RemovedClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RemovedClient(_RemovedClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@removed`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-removed/versioning/removed/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/pyproject.toml index 972cfdbd2a6..b3e2f1903c0 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_client.py index 2fa7744c2ed..1689fc0f915 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._utils.serialization import Deserializer, Serializer from .operations import NewInterfaceOperations, _RenamedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RenamedFromClient(_RenamedFromClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@renamedFrom`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py index 0441277ba58..f100404c83e 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import RenamedFromClientConfiguration from .operations import NewInterfaceOperations, _RenamedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class RenamedFromClient(_RenamedFromClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword """Test for the ``@renamedFrom`` decorator. diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/aio/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-renamedfrom/versioning/renamedfrom/operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/pyproject.toml index f8effa7387b..af6124d382d 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py index b891b5f779b..0bfeacc72ef 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _ReturnTypeChangedFromClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReturnTypeChangedFromClient( _ReturnTypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py index 7bb83ab5c97..e29699d26e4 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import ReturnTypeChangedFromClientConfiguration from ._operations import _ReturnTypeChangedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class ReturnTypeChangedFromClient( _ReturnTypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-returntypechangedfrom/versioning/returntypechangedfrom/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/pyproject.toml b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/pyproject.toml index fe18e1598bc..bb2f3e6a806 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/pyproject.toml +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/pyproject.toml @@ -15,13 +15,12 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", ] -requires-python = ">=3.9" +requires-python = ">=3.10" dependencies = [ "isodate>=0.6.1", diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_client.py index 29c9ba9d7ee..bd71ee50b7e 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any -from typing_extensions import Self from corehttp.rest import HttpRequest, HttpResponse from corehttp.runtime import PipelineClient, policies @@ -11,6 +11,11 @@ from ._operations import _TypeChangedFromClientOperationsMixin from ._utils.serialization import Deserializer, Serializer +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TypeChangedFromClient( _TypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py index 93c61bab853..93229827281 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/model_base.py @@ -17,14 +17,19 @@ from json import JSONEncoder import xml.etree.ElementTree as ET from collections.abc import MutableMapping -from typing_extensions import Self import isodate from corehttp.exceptions import DeserializationError from corehttp.utils import CaseInsensitiveEnumMeta from corehttp.runtime.pipeline import PipelineResponse from corehttp.serialization import _Null + from corehttp.rest import HttpResponse +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -589,11 +594,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: class_name = self.__class__.__name__ if len(args) > 1: raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") - dict_to_pass = { - rest_field._rest_name: rest_field._default - for rest_field in self._attr_to_rest_field.values() - if rest_field._default is not _UNSET - } + dict_to_pass: dict[str, typing.Any] = {} if args: if isinstance(args[0], ET.Element): dict_to_pass.update(self._init_from_xml(args[0])) @@ -1107,7 +1108,10 @@ def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class # Use _data.get() directly to avoid triggering __getitem__ which clears the cache - item = obj._data.get(self._rest_name) + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None if item is None: return item if self._is_model: diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py index 029256399ed..f1eb13d9786 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/_utils/serialization.py @@ -33,11 +33,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from corehttp.exceptions import DeserializationError, SerializationError from corehttp.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py index f812b0ef7b3..dc9a4026ade 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_client.py @@ -1,8 +1,8 @@ # coding=utf-8 from copy import deepcopy +import sys from typing import Any, Awaitable -from typing_extensions import Self from corehttp.rest import AsyncHttpResponse, HttpRequest from corehttp.runtime import AsyncPipelineClient, policies @@ -11,6 +11,11 @@ from ._configuration import TypeChangedFromClientConfiguration from ._operations import _TypeChangedFromClientOperationsMixin +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + class TypeChangedFromClient( _TypeChangedFromClientOperationsMixin diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_operations/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/aio/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py index 894b28a174c..e9ae9283519 100644 --- a/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py +++ b/packages/typespec-python/tests/generated/unbranded/versioning-typechangedfrom/versioning/typechangedfrom/models/_patch.py @@ -4,6 +4,7 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ + from typing import List __all__: List[str] = [] # Add all objects you want publicly available to users at this package level diff --git a/packages/typespec-python/tests/mock_api/unbranded/conftest.py b/packages/typespec-python/tests/mock_api/unbranded/conftest.py index a94535b6905..1d69d8bd1ef 100644 --- a/packages/typespec-python/tests/mock_api/unbranded/conftest.py +++ b/packages/typespec-python/tests/mock_api/unbranded/conftest.py @@ -10,7 +10,6 @@ import pytest from typing import List - SPECIAL_WORDS = [ "and", "as", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1ba3a2a8567..362bd689bf9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -60,8 +60,8 @@ importers: specifier: ~1.0.2 version: 1.0.2 '@typespec/http-client-python': - specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz - version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz(y2blksstlsblh3iqmgy3brbone) + specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz + version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz(y2blksstlsblh3iqmgy3brbone) fs-extra: specifier: ~11.2.0 version: 11.2.0 @@ -82,8 +82,8 @@ importers: packages/typespec-python: dependencies: '@typespec/http-client-python': - specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz - version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz(y2blksstlsblh3iqmgy3brbone) + specifier: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz + version: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz(y2blksstlsblh3iqmgy3brbone) fs-extra: specifier: ~11.2.0 version: 11.2.0 @@ -1723,8 +1723,8 @@ packages: peerDependencies: '@typespec/compiler': ^1.11.0 - '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz': - resolution: {tarball: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz} + '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz': + resolution: {tarball: https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz} version: 0.28.3 engines: {node: '>=20.0.0'} peerDependencies: @@ -6708,7 +6708,7 @@ snapshots: dependencies: '@typespec/compiler': 1.11.0(@types/node@25.0.10) - '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjE3ODYzNi9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz(y2blksstlsblh3iqmgy3brbone)': + '@typespec/http-client-python@https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNjIyNTU3My9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.28.3.tgz(y2blksstlsblh3iqmgy3brbone)': dependencies: '@azure-tools/typespec-autorest': 0.67.0(7o3sem7p6i3t4jykacdovvl7ii) '@azure-tools/typespec-azure-core': 0.67.0(@typespec/compiler@1.11.0(@types/node@25.0.10))(@typespec/http@1.11.0(@typespec/compiler@1.11.0(@types/node@25.0.10))(@typespec/streams@0.81.0(@typespec/compiler@1.11.0(@types/node@25.0.10))))(@typespec/rest@0.81.0(@typespec/compiler@1.11.0(@types/node@25.0.10))(@typespec/http@1.11.0(@typespec/compiler@1.11.0(@types/node@25.0.10))(@typespec/streams@0.81.0(@typespec/compiler@1.11.0(@types/node@25.0.10)))))