Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide operation group docs #1179

Merged
merged 5 commits into from
Mar 7, 2022
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
  •  
  •  
  •  
14 changes: 14 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Change Log

### 2022-03-xx - 5.13.1

| Library | Min Version |
| ----------------------------------------------------------------------- | ----------- |
| `@autorest/core` | `3.6.2` |
| `@autorest/modelerfour` | `4.19.1` |
| `azure-core` dep of generated code | `1.20.1` |
| `msrest` dep of generated code | `0.6.21` |
| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` |

**Bug Fixes**

- Improve operation group documentation to prevent users from initializing operation groups themselves #1179

### 2022-03-03 - 5.13.0

| Library | Min Version |
Expand Down
30 changes: 13 additions & 17 deletions autorest/codegen/templates/operation_group.py.jinja2
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
{% set disable = " # pylint: disable=too-many-public-methods" if operation_group.operations | length > 20 else "" %}
class {{ operation_group.class_name }}{{ object_base_class }}:{{ disable }}
{% if not operation_group.is_empty_operation_group %}
"""{{ operation_group.class_name }} {{ operations_description }}.

You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
"""
.. warning::
**DO NOT** instantiate this class directly.

{% if code_model.schemas and code_model.options["models_mode"] %}
:ivar models: Alias to model classes used in this operation group.
:type models: ~{{ code_model.namespace }}.models
{% endif %}
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`{{ "~" + code_model.namespace + (".aio." if async_mode else ".") + code_model.class_name }}`'s
:attr:`{{ operation_group.name }}` attribute.
"""

{% if code_model.schemas and code_model.options["models_mode"] %}
models = _models

{% endif %}
def __init__(self, client, config, serializer, deserializer){{ return_none_type_annotation }}:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def __init__(self, *args, **kwargs){{ return_none_type_annotation }}:
args = list(args)
self._client = args.pop(0) if args else kwargs.pop("client")
self._config = args.pop(0) if args else kwargs.pop("config")
self._serialize = args.pop(0) if args else kwargs.pop("serializer")
self._deserialize = args.pop(0) if args else kwargs.pop("deserializer")

{% endif %}
{% for operation in operation_group.operations %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class HttpSuccessOperations:
"""HttpSuccessOperations async operations.

You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
"""
.. warning::
**DO NOT** instantiate this class directly.

:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.key.credential.sample.aio.AutoRestHeadTestService`'s
:attr:`http_success` attribute.
"""

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


@distributed_trace_async
async def head200( # pylint: disable=inconsistent-return-statements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,22 @@ def build_head404_request(

# fmt: on
class HttpSuccessOperations(object):
"""HttpSuccessOperations operations.

You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
"""
.. warning::
**DO NOT** instantiate this class directly.

:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.key.credential.sample.AutoRestHeadTestService`'s
:attr:`http_success` attribute.
"""

def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def __init__(self, *args, **kwargs):
args = list(args)
self._client = args.pop(0) if args else kwargs.pop("client")
self._config = args.pop(0) if args else kwargs.pop("config")
self._serialize = args.pop(0) if args else kwargs.pop("serializer")
self._deserialize = args.pop(0) if args else kwargs.pop("deserializer")


@distributed_trace
def head200( # pylint: disable=inconsistent-return-statements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class HttpSuccessOperations:
"""HttpSuccessOperations async operations.

You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
"""
.. warning::
**DO NOT** instantiate this class directly.

:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.basic.sample.aio.AutoRestHeadTestService`'s
:attr:`http_success` attribute.
"""

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


@distributed_trace_async
async def head200( # pylint: disable=inconsistent-return-statements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,22 @@ def build_head404_request(

# fmt: on
class HttpSuccessOperations(object):
"""HttpSuccessOperations operations.

You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
"""
.. warning::
**DO NOT** instantiate this class directly.

:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.basic.sample.AutoRestHeadTestService`'s
:attr:`http_success` attribute.
"""

def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def __init__(self, *args, **kwargs):
args = list(args)
self._client = args.pop(0) if args else kwargs.pop("client")
self._config = args.pop(0) if args else kwargs.pop("config")
self._serialize = args.pop(0) if args else kwargs.pop("serializer")
self._deserialize = args.pop(0) if args else kwargs.pop("deserializer")


@distributed_trace
def head200( # pylint: disable=inconsistent-return-statements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class HttpSuccessOperations:
"""HttpSuccessOperations async operations.

You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
"""
.. warning::
**DO NOT** instantiate this class directly.

:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.mgmt.sample.aio.AutoRestHeadTestService`'s
:attr:`http_success` attribute.
"""

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


@distributed_trace_async
async def head200(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,22 @@ def build_head404_request(

# fmt: on
class HttpSuccessOperations(object):
"""HttpSuccessOperations operations.

You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
"""
.. warning::
**DO NOT** instantiate this class directly.

:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.mgmt.sample.AutoRestHeadTestService`'s
:attr:`http_success` attribute.
"""

def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def __init__(self, *args, **kwargs):
args = list(args)
self._client = args.pop(0) if args else kwargs.pop("client")
self._config = args.pop(0) if args else kwargs.pop("config")
self._serialize = args.pop(0) if args else kwargs.pop("serializer")
self._deserialize = args.pop(0) if args else kwargs.pop("deserializer")


@distributed_trace
def head200(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,24 @@
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class OperationGroupOneOperations:
"""OperationGroupOneOperations async operations.

You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
"""
.. warning::
**DO NOT** instantiate this class directly.

:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.multiapi.sample.v1.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.multiapi.sample.v1.aio.MultiapiServiceClient`'s
:attr:`operation_group_one` attribute.
"""

models = _models

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


@distributed_trace_async
async def test_two( # pylint: disable=inconsistent-return-statements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,24 @@ def build_test_two_request(

# fmt: on
class OperationGroupOneOperations(object):
"""OperationGroupOneOperations operations.

You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
"""
.. warning::
**DO NOT** instantiate this class directly.

:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.multiapi.sample.v1.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.multiapi.sample.v1.MultiapiServiceClient`'s
:attr:`operation_group_one` attribute.
"""

models = _models

def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def __init__(self, *args, **kwargs):
args = list(args)
self._client = args.pop(0) if args else kwargs.pop("client")
self._config = args.pop(0) if args else kwargs.pop("config")
self._serialize = args.pop(0) if args else kwargs.pop("serializer")
self._deserialize = args.pop(0) if args else kwargs.pop("deserializer")


@distributed_trace
def test_two( # pylint: disable=inconsistent-return-statements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,24 @@
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]

class OperationGroupOneOperations:
"""OperationGroupOneOperations async operations.

You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
"""
.. warning::
**DO NOT** instantiate this class directly.

:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.multiapi.sample.v2.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
Instead, you should access the following operations through
:class:`~azure.multiapi.sample.v2.aio.MultiapiServiceClient`'s
:attr:`operation_group_one` attribute.
"""

models = _models

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


@distributed_trace_async
async def test_two(
Expand Down
Loading