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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/autorest.python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Release


## 6.28.2

### Bug Fixes
Expand All @@ -10,6 +11,7 @@
- [#3025](https://github.com/Azure/autorest.python/pull/3025) Fix sphinx typing for raising documentation
- [#3025](https://github.com/Azure/autorest.python/pull/3025) fix typing for class methods in _serialization.py
- [#3015](https://github.com/Azure/autorest.python/pull/3015) Order keyword-only args overload first in generated operations
- [#3030](https://github.com/Azure/autorest.python/pull/3030) Fix output folder of models when output folder is different with namespace in configuration


## 6.28.1
Expand Down
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.6.8",
"@typespec/http-client-python": "~0.6.9",
"@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 @@ -5,13 +5,14 @@ This file is to check whether standard [readme.python.md](https://github.com/Azu
### Settings

``` yaml $(python)
input-file: ../../../node_modules/@microsoft.azure/autorest.testserver/swagger/head.json
input-file: ../../../node_modules/@microsoft.azure/autorest.testserver/swagger/body-array.json
azure-arm: true
license-header: MICROSOFT_MIT_NO_VERSION
package-name: azure-mgmt-test
namespace: azure.mgmt.test
package-version: 1.0.0b1
clear-output-folder: true
version-tolerant: false
```

``` yaml $(python)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._client import AutoRestHeadTestService # type: ignore
from ._auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService # type: ignore
from ._version import VERSION

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

__all__ = [
"AutoRestHeadTestService",
"AutoRestSwaggerBATArrayService",
]
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,28 @@
from azure.mgmt.core import ARMPipelineClient
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy

from ._configuration import AutoRestHeadTestServiceConfiguration
from . import models as _models
from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration
from ._serialization import Deserializer, Serializer
from .operations import HttpSuccessOperations
from .operations import ArrayOperations

if TYPE_CHECKING:
from azure.core.credentials import TokenCredential


class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword
"""Test Infrastructure for AutoRest.
class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword
"""Test Infrastructure for AutoRest Swagger BAT.

:ivar http_success: HttpSuccessOperations operations
:vartype http_success: azure.mgmt.test.operations.HttpSuccessOperations
:ivar array: ArrayOperations operations
:vartype array: azure.mgmt.test.operations.ArrayOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param endpoint: Service URL. Default value is "http://localhost:3000".
:type endpoint: str
:param base_url: Service URL. Default value is "http://localhost:3000".
:type base_url: str
"""

def __init__(self, credential: "TokenCredential", endpoint: str = "http://localhost:3000", **kwargs: Any) -> None:
self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs)
def __init__(self, credential: "TokenCredential", base_url: str = "http://localhost:3000", **kwargs: Any) -> None:
self._config = AutoRestSwaggerBATArrayServiceConfiguration(credential=credential, **kwargs)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
Expand All @@ -54,20 +55,21 @@ def __init__(self, credential: "TokenCredential", endpoint: str = "http://localh
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: ARMPipelineClient = ARMPipelineClient(base_url=endpoint, policies=_policies, **kwargs)
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize)
self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize)

def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.

>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
>>> response = client._send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from azure.core.credentials import TokenCredential


class AutoRestHeadTestServiceConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for AutoRestHeadTestService.
class AutoRestSwaggerBATArrayServiceConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AutoRestSwaggerBATArrayService.

Note that all parameters used to create this instance are saved as instance
attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._client import AutoRestHeadTestService # type: ignore
from ._auto_rest_swagger_bat_array_service import AutoRestSwaggerBATArrayService # type: ignore

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

__all__ = [
"AutoRestHeadTestService",
"AutoRestSwaggerBATArrayService",
]
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,30 @@
from azure.mgmt.core import AsyncARMPipelineClient
from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy

from .. import models as _models
from .._serialization import Deserializer, Serializer
from ._configuration import AutoRestHeadTestServiceConfiguration
from .operations import HttpSuccessOperations
from ._configuration import AutoRestSwaggerBATArrayServiceConfiguration
from .operations import ArrayOperations

if TYPE_CHECKING:
from azure.core.credentials_async import AsyncTokenCredential


class AutoRestHeadTestService: # pylint: disable=client-accepts-api-version-keyword
"""Test Infrastructure for AutoRest.
class AutoRestSwaggerBATArrayService: # pylint: disable=client-accepts-api-version-keyword
"""Test Infrastructure for AutoRest Swagger BAT.

:ivar http_success: HttpSuccessOperations operations
:vartype http_success: azure.mgmt.test.aio.operations.HttpSuccessOperations
:ivar array: ArrayOperations operations
:vartype array: azure.mgmt.test.aio.operations.ArrayOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param endpoint: Service URL. Default value is "http://localhost:3000".
:type endpoint: str
:param base_url: Service URL. Default value is "http://localhost:3000".
:type base_url: str
"""

def __init__(
self, credential: "AsyncTokenCredential", endpoint: str = "http://localhost:3000", **kwargs: Any
self, credential: "AsyncTokenCredential", base_url: str = "http://localhost:3000", **kwargs: Any
) -> None:
self._config = AutoRestHeadTestServiceConfiguration(credential=credential, **kwargs)
self._config = AutoRestSwaggerBATArrayServiceConfiguration(credential=credential, **kwargs)
_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
Expand All @@ -56,22 +57,23 @@ def __init__(
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
self._config.http_logging_policy,
]
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=endpoint, policies=_policies, **kwargs)
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.http_success = HttpSuccessOperations(self._client, self._config, self._serialize, self._deserialize)
self.array = ArrayOperations(self._client, self._config, self._serialize, self._deserialize)

def send_request(
def _send_request(
self, request: HttpRequest, *, stream: bool = False, **kwargs: Any
) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.

>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client.send_request(request)
>>> response = await client._send_request(request)
<AsyncHttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from azure.core.credentials_async import AsyncTokenCredential


class AutoRestHeadTestServiceConfiguration: # pylint: disable=too-many-instance-attributes
"""Configuration for AutoRestHeadTestService.
class AutoRestSwaggerBATArrayServiceConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
"""Configuration for AutoRestSwaggerBATArrayService.

Note that all parameters used to create this instance are saved as instance
attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._operations import HttpSuccessOperations # type: ignore
from ._array_operations import ArrayOperations # type: ignore

from ._patch import __all__ as _patch_all
from ._patch import *
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"HttpSuccessOperations",
"ArrayOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
Loading
Loading