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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 8 additions & 0 deletions .chronus/changes/create_vendor_folder-2025-3-17-15-28-15.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
changeKind: fix
packages:
- "@autorest/python"
- "@azure-tools/typespec-python"
---

Move all utils code into a `_utils` folder
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ def serialize(self, code_model: CodeModel, no_async: Optional[bool]) -> None:
lstrip_blocks=True,
)
self.write_file(
Path("_serialization.py"),
Path("_utils/__init__.py"),
self.env.get_template("multiapi_utils_init.py.jinja2").render(),
)
self.write_file(
Path("_utils/serialization.py"),
codegen_env.get_template("serialization.py.jinja2").render(
code_model=code_model,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from {{ ".." if async_mode else "." }}_serialization import Serializer, Deserializer
from {{ ".." if async_mode else "." }}_utils.serialization import Serializer, Deserializer
{% if imports %}
{{ imports }}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
2 changes: 1 addition & 1 deletion packages/autorest.python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
"dependencies": {
"@typespec/http-client-python": "~0.11.0",
"@typespec/http-client-python": "~0.11.1",
"@autorest/system-requirements": "~1.0.2",
"fs-extra": "~11.2.0",
"tsx": "~4.19.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from . import models as _models
from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration
from ._serialization import Deserializer, Serializer
from ._utils.serialization import Deserializer, Serializer
from .operations import ArrayOperations

if TYPE_CHECKING:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from azure.mgmt.core.tools import get_arm_endpoints

from .. import models as _models
from .._serialization import Deserializer, Serializer
from .._utils.serialization import Deserializer, Serializer
from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration
from .operations import ArrayOperations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models as _models
from ..._serialization import Deserializer, Serializer
from ..._utils.serialization import Deserializer, Serializer
from ...operations._array_operations import (
build_get_array_empty_request,
build_get_array_item_empty_request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from typing import Any, Optional

from .. import _serialization
from .._utils import serialization as _serialization


class Error(_serialization.Model):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from .. import models as _models
from .._configuration import AutoRestSwaggerBATArrayServiceConfiguration
from .._serialization import Deserializer, Serializer
from .._utils.serialization import Deserializer, Serializer

T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from . import models as _models
from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration
from ._serialization import Deserializer, Serializer
from ._utils.serialization import Deserializer, Serializer
from .operations import ArrayOperations


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from azure.core.rest import AsyncHttpResponse, HttpRequest

from .. import models as _models
from .._serialization import Deserializer, Serializer
from .._utils.serialization import Deserializer, Serializer
from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration
from .operations import ArrayOperations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from azure.core.utils import case_insensitive_dict

from ... import models as _models
from ..._serialization import Deserializer, Serializer
from ..._utils.serialization import Deserializer, Serializer
from ...operations._operations import (
build_array_get_array_empty_request,
build_array_get_array_item_empty_request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from typing import Any, Optional

from .. import _serialization
from .._utils import serialization as _serialization


class Error(_serialization.Model):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from .. import models as _models
from .._configuration import AutoRestSwaggerBATArrayServiceConfiguration
from .._serialization import Deserializer, Serializer
from .._utils.serialization import Deserializer, Serializer

T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from azure.core.rest import HttpRequest, HttpResponse

from ._configuration import AutoRestHeadTestServiceConfiguration
from ._serialization import Deserializer, Serializer
from ._utils.serialization import Deserializer, Serializer
from .operations import HttpSuccessOperations


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest

from .._serialization import Deserializer, Serializer
from .._utils.serialization import Deserializer, Serializer
from ._configuration import AutoRestHeadTestServiceConfiguration
from .operations import HttpSuccessOperations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async

from ..._serialization import Deserializer, Serializer
from ..._utils.serialization import Deserializer, Serializer
from ...operations._operations import (
build_http_success_head200_request,
build_http_success_head204_request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from azure.core.tracing.decorator import distributed_trace

from .._configuration import AutoRestHeadTestServiceConfiguration
from .._serialization import Deserializer, Serializer
from .._utils.serialization import Deserializer, Serializer

T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from azure.core.rest import HttpRequest, HttpResponse

from ._configuration import AutoRestHeadTestServiceConfiguration
from ._serialization import Deserializer, Serializer
from ._utils.serialization import Deserializer, Serializer
from .operations import HttpSuccessOperations


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest

from .._serialization import Deserializer, Serializer
from .._utils.serialization import Deserializer, Serializer
from ._configuration import AutoRestHeadTestServiceConfiguration
from .operations import HttpSuccessOperations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async

from ..._serialization import Deserializer, Serializer
from ..._utils.serialization import Deserializer, Serializer
from ...operations._operations import (
build_http_success_head200_request,
build_http_success_head204_request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from azure.core.tracing.decorator import distributed_trace

from .._configuration import AutoRestHeadTestServiceConfiguration
from .._serialization import Deserializer, Serializer
from .._utils.serialization import Deserializer, Serializer

T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from ._configuration import PollingPagingExampleConfiguration
from ._operations import PollingPagingExampleOperationsMixin
from ._serialization import Deserializer, Serializer
from ._utils.serialization import Deserializer, Serializer


class PollingPagingExample(PollingPagingExampleOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from my.library import CustomDefaultPollingMethod, CustomPager, CustomPoller

from azure.core import PipelineClient
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
Expand All @@ -27,8 +28,9 @@
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict

from .._serialization import Serializer
from .._vendor import PollingPagingExampleMixinABC
from .._configuration import PollingPagingExampleConfiguration
from .._utils.serialization import Serializer
from .._utils.utils import ClientMixinABC

JSON = MutableMapping[str, Any]
T = TypeVar("T")
Expand Down Expand Up @@ -69,7 +71,7 @@ def build_polling_paging_example_basic_paging_request(**kwargs: Any) -> HttpRequ
return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)


class PollingPagingExampleOperationsMixin(PollingPagingExampleMixinABC):
class PollingPagingExampleOperationsMixin(ClientMixinABC[PipelineClient, PollingPagingExampleConfiguration]):

def _basic_polling_initial(
self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from abc import ABC
from typing import Generic, TYPE_CHECKING, TypeVar

if TYPE_CHECKING:
from .serialization import Deserializer, Serializer


TClient = TypeVar("TClient")
TConfig = TypeVar("TConfig")


class ClientMixinABC(ABC, Generic[TClient, TConfig]):
"""DO NOT use this class. It is for internal typing use only."""

_client: TClient
_config: TConfig
_serialize: "Serializer"
_deserialize: "Deserializer"

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest

from .._serialization import Deserializer, Serializer
from .._utils.serialization import Deserializer, Serializer
from ._configuration import PollingPagingExampleConfiguration
from ._operations import PollingPagingExampleOperationsMixin

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

from my.library.aio import AsyncCustomDefaultPollingMethod, AsyncCustomPager, AsyncCustomPoller

from azure.core import AsyncPipelineClient
from azure.core.async_paging import AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
Expand All @@ -34,14 +35,15 @@
build_polling_paging_example_basic_paging_request,
build_polling_paging_example_basic_polling_request,
)
from .._vendor import PollingPagingExampleMixinABC
from ..._utils.utils import ClientMixinABC
from .._configuration import PollingPagingExampleConfiguration

JSON = MutableMapping[str, Any]
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]


class PollingPagingExampleOperationsMixin(PollingPagingExampleMixinABC):
class PollingPagingExampleOperationsMixin(ClientMixinABC[AsyncPipelineClient, PollingPagingExampleConfiguration]):

async def _basic_polling_initial(
self, product: Optional[Union[JSON, IO[bytes]]] = None, **kwargs: Any
Expand Down

This file was deleted.

Loading
Loading