Skip to content

Commit 8d5fbf2

Browse files
annatischYalin Li
andauthored
[ACR] Docstring updates (Azure#22767)
* Sync update docstrings * Updated model docstrings * Async update docstrings * Sync client docstring formatting * Fix pylint * Async client docstring * Fix pylint * Fix pylint * Apply suggestions from code review Co-authored-by: Yalin Li <[email protected]> Co-authored-by: Yalin Li <[email protected]>
1 parent 1b98ca8 commit 8d5fbf2

File tree

3 files changed

+127
-94
lines changed

3 files changed

+127
-94
lines changed

sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,22 @@
2626
class ContainerRegistryClient(ContainerRegistryBaseClient):
2727
def __init__(self, endpoint, credential=None, **kwargs):
2828
# type: (str, Optional[TokenCredential], **Any) -> None
29-
"""Create a ContainerRegistryClient from an ACR endpoint and a credential
29+
"""Create a ContainerRegistryClient from an ACR endpoint and a credential.
3030
31-
:param str endpoint: An ACR endpoint
32-
:param credential: The credential with which to authenticate
31+
:param str endpoint: An ACR endpoint.
32+
:param credential: The credential with which to authenticate.
3333
:type credential: ~azure.core.credentials.TokenCredential
3434
:keyword api_version: API Version. The default value is "2021-07-01". Note that overriding this default value
35-
may result in unsupported behavior.
35+
may result in unsupported behavior.
3636
:paramtype api_version: str
3737
:keyword audience: URL to use for credential authentication with AAD. Its value could be
38-
"https://management.azure.com", "https://management.chinacloudapi.cn", "https://management.microsoftazure.de" or
39-
"https://management.usgovcloudapi.net"
38+
"https://management.azure.com", "https://management.chinacloudapi.cn", "https://management.microsoftazure.de"
39+
or "https://management.usgovcloudapi.net".
4040
:paramtype audience: str
4141
:returns: None
4242
:rtype: None
43-
:raises ValueError: if the provided api_version keyword-only argument isn't supported or
44-
audience keyword-only argument isn't provided
43+
:raises ValueError: If the provided api_version keyword-only argument isn't supported or
44+
audience keyword-only argument isn't provided.
4545
4646
.. admonition:: Example:
4747
@@ -590,14 +590,19 @@ def update_manifest_properties(self, repository, tag_or_digest, **kwargs):
590590
@distributed_trace
591591
def update_manifest_properties(self, *args, **kwargs):
592592
# type: (Union[str, ArtifactManifestProperties], **Any) -> ArtifactManifestProperties
593-
"""Set the properties for a manifest
593+
"""Set the permission properties for a manifest.
594594
595-
:param args:
596-
:type args: Union[str, ~azure.containerregistry.ArtifactManifestProperties]
597-
:param str repository: Repository the manifest belongs to
598-
:param str tag_or_digest: Tag or digest of the manifest
599-
:param properties: The property's values to be set
595+
The updatable properties include: `can_delete`, `can_list`, `can_read`, and `can_write`.
596+
597+
:param str repository: Repository the manifest belongs to.
598+
:param str tag_or_digest: Tag or digest of the manifest.
599+
:param properties: The property's values to be set. This is a positional-only
600+
parameter. Please provide either this or individual keyword parameters.
600601
:type properties: ~azure.containerregistry.ArtifactManifestProperties
602+
:keyword bool can_delete: Delete permissions for a manifest.
603+
:keyword bool can_list: List permissions for a manifest.
604+
:keyword bool can_read: Read permissions for a manifest.
605+
:keyword bool can_write: Write permissions for a manifest.
601606
:rtype: ~azure.containerregistry.ArtifactManifestProperties
602607
:raises: ~azure.core.exceptions.ResourceNotFoundError
603608
@@ -659,14 +664,19 @@ def update_tag_properties(self, repository, tag, **kwargs):
659664
@distributed_trace
660665
def update_tag_properties(self, *args, **kwargs):
661666
# type: (Union[str, ArtifactTagProperties], **Any) -> ArtifactTagProperties
662-
"""Set the properties for a tag
663-
664-
:param args:
665-
:type args: Union[str, ~azure.containerregistry.ArtifactTagProperties]
666-
:param str repository: Repository the tag belongs to
667-
:param str tag: Tag to set properties for
668-
:param properties: The property's values to be set
669-
:type properties: ArtifactTagProperties
667+
"""Set the permission properties for a tag.
668+
669+
The updatable properties include: `can_delete`, `can_list`, `can_read`, and `can_write`.
670+
671+
:param str repository: Repository the tag belongs to.
672+
:param str tag: Tag to set properties for.
673+
:param properties: The property's values to be set. This is a positional-only
674+
parameter. Please provide either this or individual keyword parameters.
675+
:type properties: ~azure.containerregistry.ArtifactTagProperties
676+
:keyword bool can_delete: Delete permissions for a tag.
677+
:keyword bool can_list: List permissions for a tag.
678+
:keyword bool can_read: Read permissions for a tag.
679+
:keyword bool can_write: Write permissions for a tag.
670680
:rtype: ~azure.containerregistry.ArtifactTagProperties
671681
:raises: ~azure.core.exceptions.ResourceNotFoundError
672682
@@ -721,13 +731,18 @@ def update_repository_properties(self, repository, **kwargs):
721731
@distributed_trace
722732
def update_repository_properties(self, *args, **kwargs):
723733
# type: (Union[str, RepositoryProperties], **Any) -> RepositoryProperties
724-
"""Set the properties of a repository
734+
"""Set the permission properties of a repository.
725735
726-
:param args:
727-
:type args: Union[str, ~azure.containerregistry.RepositoryProperties]
728-
:param str repository: Name of the repository
729-
:param properties: Properties to set for the repository
736+
The updatable properties include: `can_delete`, `can_list`, `can_read`, and `can_write`.
737+
738+
:param str repository: Name of the repository.
739+
:param properties: Properties to set for the repository. This is a positional-only
740+
parameter. Please provide either this or individual keyword parameters.
730741
:type properties: ~azure.containerregistry.RepositoryProperties
742+
:keyword bool can_delete: Delete permissions for a repository.
743+
:keyword bool can_list: List permissions for a repository.
744+
:keyword bool can_read: Read permissions for a repository.
745+
:keyword bool can_write: Write permissions for a repository.
731746
:rtype: ~azure.containerregistry.RepositoryProperties
732747
:raises: ~azure.core.exceptions.ResourceNotFoundError
733748
"""

sdk/containerregistry/azure-containerregistry/azure/containerregistry/_models.py

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@
2222

2323

2424
class ArtifactManifestProperties(object): # pylint: disable=too-many-instance-attributes
25-
"""Represents properties of a registry artifact
25+
"""Represents properties of a registry artifact.
2626
27-
:ivar bool can_delete: Delete Permissions for an artifact
28-
:ivar bool can_write: Delete Permissions for an artifact
29-
:ivar bool can_read: Delete Permissions for an artifact
30-
:ivar bool can_list: Delete Permissions for an artifact
31-
:ivar architecture: CPU Architecture of an artifact
27+
:ivar bool can_delete: Delete Permissions for an artifact.
28+
:ivar bool can_write: Write Permissions for an artifact.
29+
:ivar bool can_read: Read Permissions for an artifact.
30+
:ivar bool can_list: List Permissions for an artifact.
31+
:ivar architecture: CPU Architecture of an artifact.
3232
:vartype architecture: ~azure.containerregistry.ArtifactArchitecture
33-
:ivar created_on: Time and date an artifact was created
33+
:ivar created_on: Time and date an artifact was created.
3434
:vartype created_on: ~datetime.datetime
35-
:ivar str digest: Digest for the artifact
36-
:ivar last_updated_on: Time and date an artifact was last updated
37-
:vartype last_updated_on: datetime.datetime
38-
:ivar operating_system: Operating system for the artifact
35+
:ivar str digest: Digest for the artifact.
36+
:ivar last_updated_on: Time and date an artifact was last updated.
37+
:vartype last_updated_on: ~datetime.datetime
38+
:ivar operating_system: Operating system for the artifact.
3939
:vartype operating_system: ~azure.containerregistry.ArtifactOperatingSystem
40-
:ivar str repository_name: Repository name the artifact belongs to
41-
:ivar str size_in_bytes: Size of the artifact
42-
:ivar List[str] tags: Tags associated with a registry artifact
40+
:ivar str repository_name: Repository name the artifact belongs to.
41+
:ivar str size_in_bytes: Size of the artifact.
42+
:ivar List[str] tags: Tags associated with a registry artifact.
4343
"""
4444

4545
def __init__(self, **kwargs):
@@ -150,19 +150,19 @@ def _to_generated(self):
150150

151151

152152
class RepositoryProperties(object):
153-
"""Model for storing properties of a single repository
153+
"""Represents properties of a single repository.
154154
155-
:ivar bool can_delete: Delete Permissions for an artifact
156-
:ivar bool can_write: Delete Permissions for an artifact
157-
:ivar bool can_read: Delete Permissions for an artifact
158-
:ivar bool can_list: Delete Permissions for an artifact
155+
:ivar bool can_delete: Delete Permissions for a repository.
156+
:ivar bool can_write: Write Permissions for a repository.
157+
:ivar bool can_read: Read Permissions for a repository.
158+
:ivar bool can_list: List Permissions for a repository.
159159
:ivar created_on: Time the repository was created
160-
:vartype created_on: datetime.datetime
161-
:ivar last_updated_on: Time the repository was last updated
162-
:vartype last_updated_on: datetime.datetime
163-
:ivar int manifest_count: Number of manifest in the repository
164-
:ivar str name: Name of the repository
165-
:ivar int tag_count: Number of tags associated with the repository
160+
:vartype created_on: ~datetime.datetime
161+
:ivar last_updated_on: Time the repository was last updated.
162+
:vartype last_updated_on: ~datetime.datetime
163+
:ivar int manifest_count: Number of manifest in the repository.
164+
:ivar str name: Name of the repository.
165+
:ivar int tag_count: Number of tags associated with the repository.
166166
"""
167167

168168
def __init__(self, **kwargs):
@@ -227,19 +227,19 @@ def tag_count(self):
227227

228228

229229
class ArtifactTagProperties(object):
230-
"""Model for storing properties of a single tag
231-
232-
:ivar bool can_delete: Delete Permissions for an artifact
233-
:ivar bool can_write: Delete Permissions for an artifact
234-
:ivar bool can_read: Delete Permissions for an artifact
235-
:ivar bool can_list: Delete Permissions for an artifact
236-
:ivar created_on: Time the tag was created
237-
:vartype created_on: datetime.datetime
238-
:ivar str digest: Digest for the tag
239-
:ivar last_updated_on: Time the tag was last updated
240-
:vartype last_updated_on: datetime.datetime
241-
:ivar str name: Name of the image the tag corresponds to
242-
:ivar str repository: Repository the tag belongs to
230+
"""Represents properties of a single tag
231+
232+
:ivar bool can_delete: Delete Permissions for a tag.
233+
:ivar bool can_write: Write Permissions for a tag.
234+
:ivar bool can_read: Read Permissions for a tag.
235+
:ivar bool can_list: List Permissions for a tag.
236+
:ivar created_on: Time the tag was created.
237+
:vartype created_on: ~datetime.datetime
238+
:ivar str digest: Digest for the tag.
239+
:ivar last_updated_on: Time the tag was last updated.
240+
:vartype last_updated_on: ~datetime.datetime
241+
:ivar str name: Name of the image the tag corresponds to.
242+
:ivar str repository: Repository the tag belongs to.
243243
"""
244244

245245
def __init__(self, **kwargs):

sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,22 @@
2828
class ContainerRegistryClient(ContainerRegistryBaseClient):
2929
def __init__(
3030
self, endpoint: str, credential: Optional["AsyncTokenCredential"] = None, *, audience, **kwargs: Any) -> None:
31-
"""Create a ContainerRegistryClient from an endpoint and a credential
31+
"""Create a ContainerRegistryClient from an ACR endpoint and a credential.
3232
33-
:param endpoint: An ACR endpoint
34-
:type endpoint: str
35-
:param credential: The credential with which to authenticate
33+
:param str endpoint: An ACR endpoint.
34+
:param credential: The credential with which to authenticate.
3635
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
36+
:keyword api_version: API Version. The default value is "2021-07-01". Note that overriding this default value
37+
may result in unsupported behavior.
38+
:paramtype api_version: str
3739
:keyword audience: URL to use for credential authentication with AAD. Its value could be
38-
"https://management.azure.com", "https://management.chinacloudapi.cn", "https://management.microsoftazure.de" or
39-
"https://management.usgovcloudapi.net"
40-
:paramtype audience: ~azure.containerregistry.ContainerRegistryAudience or str
40+
"https://management.azure.com", "https://management.chinacloudapi.cn", "https://management.microsoftazure.de"
41+
or "https://management.usgovcloudapi.net".
42+
:paramtype audience: str
4143
:returns: None
4244
:rtype: None
43-
:raises: if the provided api_version keyword-only argument isn't supported
45+
:raises ValueError: If the provided api_version keyword-only argument isn't supported or
46+
audience keyword-only argument isn't provided.
4447
4548
.. admonition:: Example:
4649
@@ -581,13 +584,18 @@ def update_repository_properties(self, repository: str, **kwargs: Any) -> Reposi
581584
async def update_repository_properties(
582585
self, *args: Union[str, RepositoryProperties], **kwargs: Any
583586
) -> RepositoryProperties:
584-
"""Set the properties of a repository
587+
"""Set the permission properties of a repository.
585588
586-
:param args:
587-
:type args: Union[str, ~azure.containerregistry.RepositoryProperties]
588-
:param str repository: Name of the repository
589-
:param properties: Properties to set for the repository
589+
The updatable properties include: `can_delete`, `can_list`, `can_read`, and `can_write`.
590+
591+
:param str repository: Name of the repository.
592+
:param properties: Properties to set for the repository. This is a positional-only
593+
parameter. Please provide either this or individual keyword parameters.
590594
:type properties: ~azure.containerregistry.RepositoryProperties
595+
:keyword bool can_delete: Delete permissions for a repository.
596+
:keyword bool can_list: List permissions for a repository.
597+
:keyword bool can_read: Read permissions for a repository.
598+
:keyword bool can_write: Write permissions for a repository.
591599
:rtype: ~azure.containerregistry.RepositoryProperties
592600
:raises: ~azure.core.exceptions.ResourceNotFoundError
593601
"""
@@ -626,14 +634,19 @@ def update_manifest_properties(
626634
async def update_manifest_properties(
627635
self, *args: Union[str, ArtifactManifestProperties], **kwargs: Any
628636
) -> ArtifactManifestProperties:
629-
"""Set the properties for a manifest
630-
631-
:param args:
632-
:type args: Union[str, ~azure.containerregistry.ArtifactManifestProperties]
633-
:param str repository: Name of the repository
634-
:param str tag_or_digest: Tag or digest of the manifest
635-
:param properties: The property's values to be set
636-
:type properties: ArtifactManifestProperties
637+
"""Set the permission properties for a manifest.
638+
639+
The updatable properties include: `can_delete`, `can_list`, `can_read`, and `can_write`.
640+
641+
:param str repository: Repository the manifest belongs to.
642+
:param str tag_or_digest: Tag or digest of the manifest.
643+
:param properties: The property's values to be set. This is a positional-only
644+
parameter. Please provide either this or individual keyword parameters.
645+
:type properties: ~azure.containerregistry.ArtifactManifestProperties
646+
:keyword bool can_delete: Delete permissions for a manifest.
647+
:keyword bool can_list: List permissions for a manifest.
648+
:keyword bool can_read: Read permissions for a manifest.
649+
:keyword bool can_write: Write permissions for a manifest.
637650
:rtype: ~azure.containerregistry.ArtifactManifestProperties
638651
:raises: ~azure.core.exceptions.ResourceNotFoundError
639652
@@ -696,14 +709,19 @@ def update_tag_properties(self, repository: str, tag: str, **kwargs: Any) -> Art
696709
async def update_tag_properties(
697710
self, *args: Union[str, ArtifactTagProperties], **kwargs: Any
698711
) -> ArtifactTagProperties:
699-
"""Set the properties for a tag
700-
701-
:param args:
702-
:type args: Union[str, ~azure.containerregistry.ArtifactTagProperties]
703-
:param str repository: Repository the tag belongs to
704-
:param str tag: Tag to set properties for
705-
:param properties: The property's values to be set
706-
:type properties: ArtifactTagProperties
712+
"""Set the permission properties for a tag.
713+
714+
The updatable properties include: `can_delete`, `can_list`, `can_read`, and `can_write`.
715+
716+
:param str repository: Repository the tag belongs to.
717+
:param str tag: Tag to set properties for.
718+
:param properties: The property's values to be set. This is a positional-only
719+
parameter. Please provide either this or individual keyword parameters.
720+
:type properties: ~azure.containerregistry.ArtifactTagProperties
721+
:keyword bool can_delete: Delete permissions for a tag.
722+
:keyword bool can_list: List permissions for a tag.
723+
:keyword bool can_read: Read permissions for a tag.
724+
:keyword bool can_write: Write permissions for a tag.
707725
:rtype: ~azure.containerregistry.ArtifactTagProperties
708726
:raises: ~azure.core.exceptions.ResourceNotFoundError
709727

0 commit comments

Comments
 (0)