From 1d8c123b4f25fb3dbcea3b7c61b5e61c2294b155 Mon Sep 17 00:00:00 2001 From: Yalin Li Date: Mon, 9 Sep 2024 17:40:41 -0700 Subject: [PATCH 1/6] Unify kwargs type hint in public APIs --- .../_anonymous_exchange_client.py | 6 ++-- .../azure/containerregistry/_base_client.py | 2 +- .../_container_registry_client.py | 34 +++++++++---------- .../containerregistry/_exchange_client.py | 8 ++--- .../aio/_async_anonymous_exchange_client.py | 6 ++-- .../aio/_async_base_client.py | 2 +- .../aio/_async_container_registry_client.py | 34 +++++++++---------- .../aio/_async_exchange_client.py | 8 ++--- 8 files changed, 50 insertions(+), 50 deletions(-) diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_anonymous_exchange_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_anonymous_exchange_client.py index fcef7c52652b..1963936fde9f 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_anonymous_exchange_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_anonymous_exchange_client.py @@ -17,7 +17,7 @@ class AnonymousAccessCredential(TokenCredential): def get_token( - self, *scopes: str, claims: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs + self, *scopes: str, claims: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any ) -> AccessToken: raise ValueError("This credential cannot be used to obtain access tokens.") @@ -46,7 +46,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential ) def get_acr_access_token( # pylint:disable=client-method-missing-tracing-decorator - self, challenge: str, **kwargs + self, challenge: str, **kwargs: Any ) -> Optional[str]: parsed_challenge = _parse_challenge(challenge) return self.exchange_refresh_token_for_access_token( @@ -58,7 +58,7 @@ def get_acr_access_token( # pylint:disable=client-method-missing-tracing-decora ) def exchange_refresh_token_for_access_token( # pylint:disable=client-method-missing-tracing-decorator - self, refresh_token: str, service: str, scope: str, grant_type: Union[str, TokenGrantType], **kwargs + self, refresh_token: str, service: str, scope: str, grant_type: Union[str, TokenGrantType], **kwargs: Any ) -> Optional[str]: auth_operation = cast(AuthenticationOperations, self._client.authentication) access_token = auth_operation.exchange_acr_refresh_token_for_acr_access_token( diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_base_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_base_client.py index 6008f02e04da..042b3474e3b2 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_base_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_base_client.py @@ -71,7 +71,7 @@ class TransportWrapper(HttpTransport): def __init__(self, transport): self._transport = transport - def send(self, request, **kwargs): + def send(self, request, **kwargs: Any): return self._transport.send(request, **kwargs) def open(self): diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py index a8156d38c7f3..89d8f4753fb1 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py @@ -117,7 +117,7 @@ def _get_digest_from_tag(self, repository: str, tag: str) -> str: return tag_props.digest @distributed_trace - def delete_repository(self, repository: str, **kwargs) -> None: + def delete_repository(self, repository: str, **kwargs: Any) -> None: """Delete a repository. If the repository cannot be found or a response status code of 404 is returned an error will not be raised. @@ -138,7 +138,7 @@ def delete_repository(self, repository: str, **kwargs) -> None: self._client.container_registry.delete_repository(repository, **kwargs) @distributed_trace - def list_repository_names(self, *, results_per_page: Optional[int] = None, **kwargs) -> ItemPaged[str]: + def list_repository_names(self, *, results_per_page: Optional[int] = None, **kwargs: Any) -> ItemPaged[str]: """List all repositories :keyword results_per_page: Number of repositories to return per page @@ -244,7 +244,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def get_repository_properties(self, repository: str, **kwargs) -> RepositoryProperties: + def get_repository_properties(self, repository: str, **kwargs: Any) -> RepositoryProperties: """Get the properties of a repository :param str repository: Name of the repository @@ -263,7 +263,7 @@ def list_manifest_properties( *, order_by: Optional[Union["ArtifactManifestOrder", str]] = None, results_per_page: Optional[int] = None, - **kwargs, + **kwargs: Any, ) -> ItemPaged[ArtifactManifestProperties]: """List the artifacts for a repository @@ -380,7 +380,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def delete_tag(self, repository: str, tag: str, **kwargs) -> None: + def delete_tag(self, repository: str, tag: str, **kwargs: Any) -> None: """Delete a tag from a repository. If the tag cannot be found or a response status code of 404 is returned an error will not be raised. @@ -404,7 +404,7 @@ def delete_tag(self, repository: str, tag: str, **kwargs) -> None: self._client.container_registry.delete_tag(repository, tag, **kwargs) @distributed_trace - def get_manifest_properties(self, repository: str, tag_or_digest: str, **kwargs) -> ArtifactManifestProperties: + def get_manifest_properties(self, repository: str, tag_or_digest: str, **kwargs: Any) -> ArtifactManifestProperties: """Get the properties of a registry artifact :param str repository: Name of the repository @@ -437,7 +437,7 @@ def get_manifest_properties(self, repository: str, tag_or_digest: str, **kwargs) ) @distributed_trace - def get_tag_properties(self, repository: str, tag: str, **kwargs) -> ArtifactTagProperties: + def get_tag_properties(self, repository: str, tag: str, **kwargs: Any) -> ArtifactTagProperties: """Get the properties for a tag :param str repository: Name of the repository @@ -470,7 +470,7 @@ def list_tag_properties( *, order_by: Optional[Union["ArtifactTagOrder", str]] = None, results_per_page: Optional[int] = None, - **kwargs, + **kwargs: Any, ) -> ItemPaged[ArtifactTagProperties]: """List the tags for a repository @@ -679,7 +679,7 @@ def update_manifest_properties( @distributed_trace def update_manifest_properties( - self, *args: Union[str, ArtifactManifestProperties], **kwargs + self, *args: Union[str, ArtifactManifestProperties], **kwargs: Any ) -> ArtifactManifestProperties: repository = str(args[0]) tag_or_digest = str(args[1]) @@ -782,7 +782,7 @@ def update_tag_properties( """ @distributed_trace - def update_tag_properties(self, *args: Union[str, ArtifactTagProperties], **kwargs) -> ArtifactTagProperties: + def update_tag_properties(self, *args: Union[str, ArtifactTagProperties], **kwargs: Any) -> ArtifactTagProperties: repository = str(args[0]) tag = str(args[1]) properties = None @@ -845,7 +845,7 @@ def update_repository_properties( """ @distributed_trace - def update_repository_properties(self, *args: Union[str, RepositoryProperties], **kwargs) -> RepositoryProperties: + def update_repository_properties(self, *args: Union[str, RepositoryProperties], **kwargs: Any) -> RepositoryProperties: repository = str(args[0]) properties = None if len(args) == 2: @@ -872,7 +872,7 @@ def set_manifest( *, tag: Optional[str] = None, media_type: str = OCI_IMAGE_MANIFEST, - **kwargs, + **kwargs: Any, ) -> str: """Set a manifest for an artifact. @@ -919,7 +919,7 @@ def set_manifest( return digest @distributed_trace - def get_manifest(self, repository: str, tag_or_digest: str, **kwargs) -> GetManifestResult: + def get_manifest(self, repository: str, tag_or_digest: str, **kwargs: Any) -> GetManifestResult: """Get the manifest for an artifact. :param str repository: Name of the repository. @@ -965,7 +965,7 @@ def get_manifest(self, repository: str, tag_or_digest: str, **kwargs) -> GetMani return GetManifestResult(digest=digest, manifest=manifest_json, media_type=media_type) @distributed_trace - def upload_blob(self, repository: str, data: IO[bytes], **kwargs) -> Tuple[str, int]: + def upload_blob(self, repository: str, data: IO[bytes], **kwargs: Any) -> Tuple[str, int]: """Upload an artifact blob. :param str repository: Name of the repository. @@ -1017,7 +1017,7 @@ def _upload_blob_chunk(self, location: str, data: IO[bytes], **kwargs) -> Tuple[ return f"sha256:{hasher.hexdigest()}", location, blob_size @distributed_trace - def download_blob(self, repository: str, digest: str, **kwargs) -> DownloadBlobStream: + def download_blob(self, repository: str, digest: str, **kwargs: Any) -> DownloadBlobStream: """Download a blob that is part of an artifact to a stream. :param str repository: Name of the repository. @@ -1052,7 +1052,7 @@ def download_blob(self, repository: str, digest: str, **kwargs) -> DownloadBlobS ) @distributed_trace - def delete_manifest(self, repository: str, tag_or_digest: str, **kwargs) -> None: + def delete_manifest(self, repository: str, tag_or_digest: str, **kwargs: Any) -> None: """Delete a manifest. If the manifest cannot be found or a response status code of 404 is returned an error will not be raised. @@ -1077,7 +1077,7 @@ def delete_manifest(self, repository: str, tag_or_digest: str, **kwargs) -> None self._client.container_registry.delete_manifest(repository, tag_or_digest, **kwargs) @distributed_trace - def delete_blob(self, repository: str, digest: str, **kwargs) -> None: + def delete_blob(self, repository: str, digest: str, **kwargs: Any) -> None: """Delete a blob. If the blob cannot be found or a response status code of 404 is returned an error will not be raised. diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_exchange_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_exchange_client.py index 7da05961bee9..3fd6d3047a43 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_exchange_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_exchange_client.py @@ -57,7 +57,7 @@ def __init__(self, endpoint: str, credential: TokenCredential, **kwargs: Any) -> self._expiration_time: float = 0 def get_acr_access_token( # pylint:disable=client-method-missing-tracing-decorator - self, challenge: str, **kwargs + self, challenge: str, **kwargs: Any ) -> Optional[str]: parsed_challenge = _parse_challenge(challenge) refresh_token = self.get_refresh_token(parsed_challenge["service"], **kwargs) @@ -66,7 +66,7 @@ def get_acr_access_token( # pylint:disable=client-method-missing-tracing-decora ) def get_refresh_token( # pylint:disable=client-method-missing-tracing-decorator - self, service: str, **kwargs + self, service: str, **kwargs: Any ) -> str: if not self._refresh_token or self._expiration_time - time.time() > 300: self._refresh_token = self.exchange_aad_token_for_refresh_token(service, **kwargs) @@ -74,7 +74,7 @@ def get_refresh_token( # pylint:disable=client-method-missing-tracing-decorator return self._refresh_token def exchange_aad_token_for_refresh_token( # pylint:disable=client-method-missing-tracing-decorator - self, service: str, **kwargs + self, service: str, **kwargs: Any ) -> str: auth_operation = cast(AuthenticationOperations, self._client.authentication) refresh_token = auth_operation.exchange_aad_access_token_for_acr_refresh_token( @@ -86,7 +86,7 @@ def exchange_aad_token_for_refresh_token( # pylint:disable=client-method-missin return refresh_token.refresh_token if refresh_token.refresh_token is not None else "" def exchange_refresh_token_for_access_token( # pylint:disable=client-method-missing-tracing-decorator - self, refresh_token: str, service: str, scope: str, **kwargs + self, refresh_token: str, service: str, scope: str, **kwargs: Any ) -> Optional[str]: auth_operation = cast(AuthenticationOperations, self._client.authentication) access_token = auth_operation.exchange_acr_refresh_token_for_acr_access_token( diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_anonymous_exchange_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_anonymous_exchange_client.py index 08a8ac3d302a..3543382b9a28 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_anonymous_exchange_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_anonymous_exchange_client.py @@ -19,7 +19,7 @@ class AsyncAnonymousAccessCredential(AsyncTokenCredential): async def get_token( - self, *scopes: str, claims: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs + self, *scopes: str, claims: Optional[str] = None, tenant_id: Optional[str] = None, **kwargs: Any ) -> AccessToken: raise ValueError("This credential cannot be used to obtain access tokens.") @@ -62,7 +62,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential ) async def get_acr_access_token( # pylint:disable=client-method-missing-tracing-decorator-async - self, challenge: str, **kwargs + self, challenge: str, **kwargs: Any ) -> Optional[str]: parsed_challenge = _parse_challenge(challenge) return await self.exchange_refresh_token_for_access_token( @@ -74,7 +74,7 @@ async def get_acr_access_token( # pylint:disable=client-method-missing-tracing- ) async def exchange_refresh_token_for_access_token( # pylint:disable=client-method-missing-tracing-decorator-async - self, refresh_token: str, service: str, scope: str, grant_type: Union[str, TokenGrantType], **kwargs + self, refresh_token: str, service: str, scope: str, grant_type: Union[str, TokenGrantType], **kwargs: Any ) -> Optional[str]: auth_operation = cast(AuthenticationOperations, self._client.authentication) access_token = await auth_operation.exchange_acr_refresh_token_for_acr_access_token( diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_base_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_base_client.py index 502f68249cdf..fd260cdfa3fb 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_base_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_base_client.py @@ -75,7 +75,7 @@ class AsyncTransportWrapper(AsyncHttpTransport): def __init__(self, async_transport): self._transport = async_transport - async def send(self, request, **kwargs): + async def send(self, request, **kwargs: Any): return await self._transport.send(request, **kwargs) async def open(self): diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py index 24fdaecd542f..b0006de3fc90 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py @@ -119,7 +119,7 @@ async def _get_digest_from_tag(self, repository: str, tag: str) -> str: return tag_props.digest @distributed_trace_async - async def delete_repository(self, repository: str, **kwargs) -> None: + async def delete_repository(self, repository: str, **kwargs: Any) -> None: """Delete a repository. If the repository cannot be found or a response status code of 404 is returned an error will not be raised. @@ -140,7 +140,7 @@ async def delete_repository(self, repository: str, **kwargs) -> None: await self._client.container_registry.delete_repository(repository, **kwargs) @distributed_trace - def list_repository_names(self, *, results_per_page: Optional[int] = None, **kwargs) -> AsyncItemPaged[str]: + def list_repository_names(self, *, results_per_page: Optional[int] = None, **kwargs: Any) -> AsyncItemPaged[str]: """List all repositories :keyword results_per_page: Number of repositories to return per page @@ -246,7 +246,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def get_repository_properties(self, repository: str, **kwargs) -> RepositoryProperties: + async def get_repository_properties(self, repository: str, **kwargs: Any) -> RepositoryProperties: """Get the properties of a repository :param str repository: Name of the repository @@ -265,7 +265,7 @@ def list_manifest_properties( *, order_by: Optional[Union["ArtifactManifestOrder", str]] = None, results_per_page: Optional[int] = None, - **kwargs, + **kwargs: Any, ) -> AsyncItemPaged[ArtifactManifestProperties]: """List the manifests of a repository @@ -382,7 +382,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def delete_tag(self, repository: str, tag: str, **kwargs) -> None: + async def delete_tag(self, repository: str, tag: str, **kwargs: Any) -> None: """Delete a tag from a repository. If the tag cannot be found or a response status code of 404 is returned an error will not be raised. @@ -407,7 +407,7 @@ async def delete_tag(self, repository: str, tag: str, **kwargs) -> None: @distributed_trace_async async def get_manifest_properties( - self, repository: str, tag_or_digest: str, **kwargs + self, repository: str, tag_or_digest: str, **kwargs: Any ) -> ArtifactManifestProperties: """Get the properties of a registry artifact @@ -441,7 +441,7 @@ async def get_manifest_properties( ) @distributed_trace_async - async def get_tag_properties(self, repository: str, tag: str, **kwargs) -> ArtifactTagProperties: + async def get_tag_properties(self, repository: str, tag: str, **kwargs: Any) -> ArtifactTagProperties: """Get the properties for a tag :param str repository: Repository the tag belongs to @@ -475,7 +475,7 @@ def list_tag_properties( *, order_by: Optional[Union["ArtifactTagOrder", str]] = None, results_per_page: Optional[int] = None, - **kwargs, + **kwargs: Any, ) -> AsyncItemPaged[ArtifactTagProperties]: """List the tags for a repository @@ -645,7 +645,7 @@ async def update_repository_properties( @distributed_trace_async async def update_repository_properties( - self, *args: Union[str, RepositoryProperties], **kwargs + self, *args: Union[str, RepositoryProperties], **kwargs: Any ) -> RepositoryProperties: repository = str(args[0]) properties = None @@ -747,7 +747,7 @@ async def update_manifest_properties( @distributed_trace_async async def update_manifest_properties( - self, *args: Union[str, ArtifactManifestProperties], **kwargs + self, *args: Union[str, ArtifactManifestProperties], **kwargs: Any ) -> ArtifactManifestProperties: repository = str(args[0]) tag_or_digest = str(args[1]) @@ -852,7 +852,7 @@ async def update_tag_properties( """ @distributed_trace_async - async def update_tag_properties(self, *args: Union[str, ArtifactTagProperties], **kwargs) -> ArtifactTagProperties: + async def update_tag_properties(self, *args: Union[str, ArtifactTagProperties], **kwargs: Any) -> ArtifactTagProperties: repository = str(args[0]) tag = str(args[1]) properties = None @@ -882,7 +882,7 @@ async def set_manifest( *, tag: Optional[str] = None, media_type: str = OCI_IMAGE_MANIFEST, - **kwargs, + **kwargs: Any, ) -> str: """Set a manifest for an artifact. @@ -928,7 +928,7 @@ async def set_manifest( return digest @distributed_trace_async - async def get_manifest(self, repository: str, tag_or_digest: str, **kwargs) -> GetManifestResult: + async def get_manifest(self, repository: str, tag_or_digest: str, **kwargs: Any) -> GetManifestResult: """Get the manifest for an artifact. :param str repository: Name of the repository. @@ -974,7 +974,7 @@ async def get_manifest(self, repository: str, tag_or_digest: str, **kwargs) -> G return GetManifestResult(digest=digest, manifest=manifest_json, media_type=media_type) @distributed_trace_async - async def upload_blob(self, repository: str, data: IO[bytes], **kwargs) -> Tuple[str, int]: + async def upload_blob(self, repository: str, data: IO[bytes], **kwargs: Any) -> Tuple[str, int]: """Upload an artifact blob. :param str repository: Name of the repository. @@ -1033,7 +1033,7 @@ async def _upload_blob_chunk(self, location: str, data: IO[bytes], **kwargs) -> return f"sha256:{hasher.hexdigest()}", location, blob_size @distributed_trace_async - async def download_blob(self, repository: str, digest: str, **kwargs) -> AsyncDownloadBlobStream: + async def download_blob(self, repository: str, digest: str, **kwargs: Any) -> AsyncDownloadBlobStream: """Download a blob that is part of an artifact to a stream. :param str repository: Name of the repository. @@ -1068,7 +1068,7 @@ async def download_blob(self, repository: str, digest: str, **kwargs) -> AsyncDo ) @distributed_trace_async - async def delete_manifest(self, repository: str, tag_or_digest: str, **kwargs) -> None: + async def delete_manifest(self, repository: str, tag_or_digest: str, **kwargs: Any) -> None: """Delete a manifest. If the manifest cannot be found or a response status code of 404 is returned an error will not be raised. @@ -1094,7 +1094,7 @@ async def delete_manifest(self, repository: str, tag_or_digest: str, **kwargs) - await self._client.container_registry.delete_manifest(repository, tag_or_digest, **kwargs) @distributed_trace_async - async def delete_blob(self, repository: str, digest: str, **kwargs) -> None: + async def delete_blob(self, repository: str, digest: str, **kwargs: Any) -> None: """Delete a blob. If the blob cannot be found or a response status code of 404 is returned an error will not be raised. diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_exchange_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_exchange_client.py index 06ad14701c9d..4bd6085e5be9 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_exchange_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_exchange_client.py @@ -57,7 +57,7 @@ def __init__(self, endpoint: str, credential: AsyncTokenCredential, **kwargs: An self._expiration_time: float = 0 async def get_acr_access_token( # pylint:disable=client-method-missing-tracing-decorator-async - self, challenge: str, **kwargs + self, challenge: str, **kwargs: Any ) -> Optional[str]: parsed_challenge = _parse_challenge(challenge) refresh_token = await self.get_refresh_token(parsed_challenge["service"], **kwargs) @@ -66,7 +66,7 @@ async def get_acr_access_token( # pylint:disable=client-method-missing-tracing- ) async def get_refresh_token( # pylint:disable=client-method-missing-tracing-decorator-async - self, service: str, **kwargs + self, service: str, **kwargs: Any ) -> str: if not self._refresh_token or self._expiration_time - time.time() > 300: self._refresh_token = await self.exchange_aad_token_for_refresh_token(service, **kwargs) @@ -74,7 +74,7 @@ async def get_refresh_token( # pylint:disable=client-method-missing-tracing-dec return self._refresh_token async def exchange_aad_token_for_refresh_token( # pylint:disable=client-method-missing-tracing-decorator-async - self, service: str, **kwargs + self, service: str, **kwargs: Any ) -> str: auth_operation = cast(AuthenticationOperations, self._client.authentication) token = await self._credential.get_token(*self.credential_scopes) @@ -84,7 +84,7 @@ async def exchange_aad_token_for_refresh_token( # pylint:disable=client-method- return refresh_token.refresh_token if refresh_token.refresh_token is not None else "" async def exchange_refresh_token_for_access_token( # pylint:disable=client-method-missing-tracing-decorator-async - self, refresh_token: str, service: str, scope: str, **kwargs + self, refresh_token: str, service: str, scope: str, **kwargs: Any ) -> Optional[str]: auth_operation = cast(AuthenticationOperations, self._client.authentication) access_token = await auth_operation.exchange_acr_refresh_token_for_acr_access_token( From 3e9b0fcb004948cd9085596a5f8f9f272bff8c51 Mon Sep 17 00:00:00 2001 From: Yalin Li Date: Mon, 9 Sep 2024 17:43:05 -0700 Subject: [PATCH 2/6] Fix anchor links --- .../azure-containerregistry/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/containerregistry/azure-containerregistry/README.md b/sdk/containerregistry/azure-containerregistry/README.md index 584300d7803e..ca2c3c2c6db4 100644 --- a/sdk/containerregistry/azure-containerregistry/README.md +++ b/sdk/containerregistry/azure-containerregistry/README.md @@ -65,15 +65,15 @@ For more information please see [Container Registry Concepts](https://docs.micro The following sections provide several code snippets covering some of the most common ACR Service tasks, including: - Registry operations: - - [List repositories](#list-repositories) - - [List tags with anonymous access](#list-tags-with-anonymous-access) - - [Set artifact properties](#set-artifact-properties) - - [Delete images](#delete-images) + - [List repositories](#list-repositories "List repositories") + - [List tags with anonymous access](#list-tags-with-anonymous-access "List tags with anonymous access") + - [Set artifact properties](#set-artifact-properties "Set artifact properties") + - [Delete images](#delete-images "Delete images") - Blob and manifest operations: - - [Upload images](#upload-images) - - [Download images](#download-images) - - [Delete manifest](#delete-manifest) - - [Delete blob](#delete-blob) + - [Upload images](#upload-images "Upload images") + - [Download images](#download-images "Download images") + - [Delete manifest](#delete-manifest "Delete manifest") + - [Delete blob](#delete-blob "Delete blob") Please note that each sample assumes there is a `CONTAINERREGISTRY_ENDPOINT` environment variable set to a string containing the `https://` prefix and the name of the login server, for example "https://myregistry.azurecr.io". Anonymous access samples are getting endpoint value from environment variable`CONTAINERREGISTRY_ANONREGISTRY_ENDPOINT`. From 85848a7904fa8734950a66d9e8a55a9d0fcf2fba Mon Sep 17 00:00:00 2001 From: Yalin Li Date: Mon, 9 Sep 2024 18:04:00 -0700 Subject: [PATCH 3/6] Fix links on "Error"s --- .../_container_registry_client.py | 30 +++++++++---------- .../_generated/aio/operations/_patch.py | 4 +-- .../_generated/operations/_patch.py | 4 +-- .../aio/_async_container_registry_client.py | 30 +++++++++---------- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py index 89d8f4753fb1..95bebc6fea71 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py @@ -124,7 +124,7 @@ def delete_repository(self, repository: str, **kwargs: Any) -> None: :param str repository: The repository to delete :returns: None :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises: :class:`azure.core.exceptions.HttpResponseError` .. admonition:: Example: @@ -145,7 +145,7 @@ def list_repository_names(self, *, results_per_page: Optional[int] = None, **kwa :paramtype results_per_page: int :returns: An iterable of strings :rtype: ~azure.core.paging.ItemPaged[str] - :raises: ~azure.core.exceptions.HttpResponseError + :raises: :class:`azure.core.exceptions.HttpResponseError` .. admonition:: Example: @@ -250,7 +250,7 @@ def get_repository_properties(self, repository: str, **kwargs: Any) -> Repositor :param str repository: Name of the repository :rtype: ~azure.containerregistry.RepositoryProperties :return: The properties of a repository - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` """ return RepositoryProperties._from_generated( # pylint: disable=protected-access self._client.container_registry.get_properties(repository, **kwargs) @@ -274,7 +274,7 @@ def list_manifest_properties( :paramtype results_per_page: int :returns: An iterable of :class:`~azure.containerregistry.ArtifactManifestProperties` :rtype: ~azure.core.paging.ItemPaged[~azure.containerregistry.ArtifactManifestProperties] - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` """ name = repository last = kwargs.pop("last", None) @@ -388,7 +388,7 @@ def delete_tag(self, repository: str, tag: str, **kwargs: Any) -> None: :param str tag: The tag to be deleted :returns: None :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises: :class:`azure.core.exceptions.HttpResponseError` Example @@ -411,7 +411,7 @@ def get_manifest_properties(self, repository: str, tag_or_digest: str, **kwargs: :param str tag_or_digest: Tag or digest of the manifest :return: The properties of a registry artifact :rtype: ~azure.containerregistry.ArtifactManifestProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -444,7 +444,7 @@ def get_tag_properties(self, repository: str, tag: str, **kwargs: Any) -> Artifa :param str tag: The tag to get tag properties for :return: The properties for a tag :rtype: ~azure.containerregistry.ArtifactTagProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -481,7 +481,7 @@ def list_tag_properties( :paramtype results_per_page: int :returns: An iterable of :class:`~azure.containerregistry.ArtifactTagProperties` :rtype: ~azure.core.paging.ItemPaged[~azure.containerregistry.ArtifactTagProperties] - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -612,7 +612,7 @@ def update_manifest_properties( parameter. Please provide either this or individual keyword parameters. :type properties: ~azure.containerregistry.ArtifactManifestProperties :rtype: ~azure.containerregistry.ArtifactManifestProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -656,7 +656,7 @@ def update_manifest_properties( :keyword bool can_read: Read permissions for a manifest. :keyword bool can_write: Write permissions for a manifest. :rtype: ~azure.containerregistry.ArtifactManifestProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -720,7 +720,7 @@ def update_tag_properties( parameter. Please provide either this or individual keyword parameters. :type properties: ~azure.containerregistry.ArtifactTagProperties :rtype: ~azure.containerregistry.ArtifactTagProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -761,7 +761,7 @@ def update_tag_properties( :keyword bool can_read: Read permissions for a tag. :keyword bool can_write: Write permissions for a tag. :rtype: ~azure.containerregistry.ArtifactTagProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -817,7 +817,7 @@ def update_repository_properties( parameter. Please provide either this or individual keyword parameters. :type properties: ~azure.containerregistry.RepositoryProperties :rtype: ~azure.containerregistry.RepositoryProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` """ @overload @@ -841,7 +841,7 @@ def update_repository_properties( :keyword bool can_read: Read permissions for a repository. :keyword bool can_write: Write permissions for a repository. :rtype: ~azure.containerregistry.RepositoryProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` """ @distributed_trace @@ -1059,7 +1059,7 @@ def delete_manifest(self, repository: str, tag_or_digest: str, **kwargs: Any) -> :param str repository: Name of the repository the manifest belongs to :param str tag_or_digest: Tag or digest of the manifest to be deleted :returns: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises: :class:`azure.core.exceptions.HttpResponseError` Example diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/aio/operations/_patch.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/aio/operations/_patch.py index a2da554aba84..3afad6ee9da2 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/aio/operations/_patch.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/aio/operations/_patch.py @@ -60,7 +60,7 @@ async def exchange_aad_access_token_for_acr_refresh_token( :keyword callable cls: A custom type or function that will be passed the direct response :return: AcrRefreshToken, or the result of cls(response) :rtype: ~container_registry.models.AcrRefreshToken - :raises: ~azure.core.exceptions.HttpResponseError + :raises: :class:`azure.core.exceptions.HttpResponseError` """ error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) @@ -134,7 +134,7 @@ async def exchange_acr_refresh_token_for_acr_access_token( :keyword callable cls: A custom type or function that will be passed the direct response :return: AcrAccessToken, or the result of cls(response) :rtype: ~container_registry.models.AcrAccessToken - :raises: ~azure.core.exceptions.HttpResponseError + :raises: :class:`azure.core.exceptions.HttpResponseError` """ error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/operations/_patch.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/operations/_patch.py index 9ddb4b7649e2..f55345dea082 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/operations/_patch.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/operations/_patch.py @@ -130,7 +130,7 @@ def exchange_aad_access_token_for_acr_refresh_token( :keyword callable cls: A custom type or function that will be passed the direct response :return: AcrRefreshToken, or the result of cls(response) :rtype: ~container_registry.models.AcrRefreshToken - :raises: ~azure.core.exceptions.HttpResponseError + :raises: :class:`azure.core.exceptions.HttpResponseError` """ error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) @@ -205,7 +205,7 @@ def exchange_acr_refresh_token_for_acr_access_token( :keyword callable cls: A custom type or function that will be passed the direct response :return: AcrAccessToken, or the result of cls(response) :rtype: ~container_registry.models.AcrAccessToken - :raises: ~azure.core.exceptions.HttpResponseError + :raises: :class:`azure.core.exceptions.HttpResponseError` """ error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py index b0006de3fc90..f3bfccc61ad6 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py @@ -126,7 +126,7 @@ async def delete_repository(self, repository: str, **kwargs: Any) -> None: :param str repository: The repository to delete :returns: None :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises: :class:`azure.core.exceptions.HttpResponseError` .. admonition:: Example: @@ -147,7 +147,7 @@ def list_repository_names(self, *, results_per_page: Optional[int] = None, **kwa :paramtype results_per_page: int :returns: An iterable of strings :rtype: ~azure.core.async_paging.AsyncItemPaged[str] - :raises: ~azure.core.exceptions.HttpResponseError + :raises: :class:`azure.core.exceptions.HttpResponseError` .. admonition:: Example: @@ -252,7 +252,7 @@ async def get_repository_properties(self, repository: str, **kwargs: Any) -> Rep :param str repository: Name of the repository :return: The properties of a repository. :rtype: ~azure.containerregistry.RepositoryProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` """ return RepositoryProperties._from_generated( # pylint: disable=protected-access await self._client.container_registry.get_properties(repository, **kwargs) @@ -276,7 +276,7 @@ def list_manifest_properties( :paramtype results_per_page: int :returns: An iterable of :class:`~azure.containerregistry.ArtifactManifestProperties` :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.containerregistry.ArtifactManifestProperties] - :raises: ~azure.core.exceptions.HttpResponseError + :raises: :class:`azure.core.exceptions.HttpResponseError` """ name = repository last = kwargs.pop("last", None) @@ -390,7 +390,7 @@ async def delete_tag(self, repository: str, tag: str, **kwargs: Any) -> None: :param str tag: The tag to be deleted :returns: None :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises: :class:`azure.core.exceptions.HttpResponseError` Example @@ -415,7 +415,7 @@ async def get_manifest_properties( :param str tag_or_digest: The tag or digest of the manifest :return: The properties of a registry artifact :rtype: ~azure.containerregistry.ArtifactManifestProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -449,7 +449,7 @@ async def get_tag_properties(self, repository: str, tag: str, **kwargs: Any) -> :type tag: str :return: The properties for a tag. :rtype: ~azure.containerregistry.ArtifactTagProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -486,7 +486,7 @@ def list_tag_properties( :paramtype results_per_page: int :returns: An iterable of :class:`~azure.containerregistry.ArtifactTagProperties` :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.containerregistry.ArtifactTagProperties] - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -616,7 +616,7 @@ async def update_repository_properties( parameter. Please provide either this or individual keyword parameters. :type properties: ~azure.containerregistry.RepositoryProperties :rtype: ~azure.containerregistry.RepositoryProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` """ @overload @@ -640,7 +640,7 @@ async def update_repository_properties( :keyword bool can_read: Read permissions for a repository. :keyword bool can_write: Write permissions for a repository. :rtype: ~azure.containerregistry.RepositoryProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` """ @distributed_trace_async @@ -679,7 +679,7 @@ async def update_manifest_properties( parameter. Please provide either this or individual keyword parameters. :type properties: ~azure.containerregistry.ArtifactManifestProperties :rtype: ~azure.containerregistry.ArtifactManifestProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -724,7 +724,7 @@ async def update_manifest_properties( :keyword bool can_read: Read permissions for a manifest. :keyword bool can_write: Write permissions for a manifest. :rtype: ~azure.containerregistry.ArtifactManifestProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -788,7 +788,7 @@ async def update_tag_properties( parameter. Please provide either this or individual keyword parameters. :type properties: ~azure.containerregistry.ArtifactTagProperties :rtype: ~azure.containerregistry.ArtifactTagProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -830,7 +830,7 @@ async def update_tag_properties( :keyword bool can_read: Read permissions for a tag. :keyword bool can_write: Write permissions for a tag. :rtype: ~azure.containerregistry.ArtifactTagProperties - :raises: ~azure.core.exceptions.ResourceNotFoundError + :raises: :class:`azure.core.exceptions.ResourceNotFoundError` Example @@ -1076,7 +1076,7 @@ async def delete_manifest(self, repository: str, tag_or_digest: str, **kwargs: A :param str tag_or_digest: Tag or digest of the manifest to be deleted. :returns: None :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError + :raises: :class:`azure.core.exceptions.HttpResponseError` Example From 57bd0a6417773f830ef08d4e48c2b27bad05c801 Mon Sep 17 00:00:00 2001 From: Yalin Li Date: Mon, 9 Sep 2024 18:10:32 -0700 Subject: [PATCH 4/6] Update README.md --- sdk/containerregistry/azure-containerregistry/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/containerregistry/azure-containerregistry/README.md b/sdk/containerregistry/azure-containerregistry/README.md index ca2c3c2c6db4..d4561e0729c5 100644 --- a/sdk/containerregistry/azure-containerregistry/README.md +++ b/sdk/containerregistry/azure-containerregistry/README.md @@ -72,8 +72,8 @@ The following sections provide several code snippets covering some of the most c - Blob and manifest operations: - [Upload images](#upload-images "Upload images") - [Download images](#download-images "Download images") - - [Delete manifest](#delete-manifest "Delete manifest") - - [Delete blob](#delete-blob "Delete blob") + - [Delete manifests](#delete-manifest "Delete manifests") + - [Delete blobs](#delete-blob "Delete blobs") Please note that each sample assumes there is a `CONTAINERREGISTRY_ENDPOINT` environment variable set to a string containing the `https://` prefix and the name of the login server, for example "https://myregistry.azurecr.io". Anonymous access samples are getting endpoint value from environment variable`CONTAINERREGISTRY_ANONREGISTRY_ENDPOINT`. @@ -238,7 +238,7 @@ with ContainerRegistryClient(self.endpoint, self.credential) as client: -### Delete manifest +### Delete manifests @@ -251,7 +251,7 @@ with ContainerRegistryClient(self.endpoint, self.credential) as client: -### Delete blob +### Delete blobs From d4ff11d8462f996eb23b9a6bcf9a841e04b990ef Mon Sep 17 00:00:00 2001 From: Yalin Li Date: Mon, 9 Sep 2024 18:32:12 -0700 Subject: [PATCH 5/6] Address --- .../azure-containerregistry/README.md | 4 +-- .../_container_registry_client.py | 30 +++++++++---------- .../_generated/aio/operations/_patch.py | 4 +-- .../_generated/operations/_patch.py | 4 +-- .../aio/_async_container_registry_client.py | 30 +++++++++---------- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/sdk/containerregistry/azure-containerregistry/README.md b/sdk/containerregistry/azure-containerregistry/README.md index d4561e0729c5..e70242a5cde1 100644 --- a/sdk/containerregistry/azure-containerregistry/README.md +++ b/sdk/containerregistry/azure-containerregistry/README.md @@ -72,8 +72,8 @@ The following sections provide several code snippets covering some of the most c - Blob and manifest operations: - [Upload images](#upload-images "Upload images") - [Download images](#download-images "Download images") - - [Delete manifests](#delete-manifest "Delete manifests") - - [Delete blobs](#delete-blob "Delete blobs") + - [Delete manifests](#delete-manifests "Delete manifests") + - [Delete blobs](#delete-blobs "Delete blobs") Please note that each sample assumes there is a `CONTAINERREGISTRY_ENDPOINT` environment variable set to a string containing the `https://` prefix and the name of the login server, for example "https://myregistry.azurecr.io". Anonymous access samples are getting endpoint value from environment variable`CONTAINERREGISTRY_ANONREGISTRY_ENDPOINT`. diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py index 95bebc6fea71..cbedf47aa840 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py @@ -124,7 +124,7 @@ def delete_repository(self, repository: str, **kwargs: Any) -> None: :param str repository: The repository to delete :returns: None :rtype: None - :raises: :class:`azure.core.exceptions.HttpResponseError` + :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -145,7 +145,7 @@ def list_repository_names(self, *, results_per_page: Optional[int] = None, **kwa :paramtype results_per_page: int :returns: An iterable of strings :rtype: ~azure.core.paging.ItemPaged[str] - :raises: :class:`azure.core.exceptions.HttpResponseError` + :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -250,7 +250,7 @@ def get_repository_properties(self, repository: str, **kwargs: Any) -> Repositor :param str repository: Name of the repository :rtype: ~azure.containerregistry.RepositoryProperties :return: The properties of a repository - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: """ return RepositoryProperties._from_generated( # pylint: disable=protected-access self._client.container_registry.get_properties(repository, **kwargs) @@ -274,7 +274,7 @@ def list_manifest_properties( :paramtype results_per_page: int :returns: An iterable of :class:`~azure.containerregistry.ArtifactManifestProperties` :rtype: ~azure.core.paging.ItemPaged[~azure.containerregistry.ArtifactManifestProperties] - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: """ name = repository last = kwargs.pop("last", None) @@ -388,7 +388,7 @@ def delete_tag(self, repository: str, tag: str, **kwargs: Any) -> None: :param str tag: The tag to be deleted :returns: None :rtype: None - :raises: :class:`azure.core.exceptions.HttpResponseError` + :raises ~azure.core.exceptions.HttpResponseError: Example @@ -411,7 +411,7 @@ def get_manifest_properties(self, repository: str, tag_or_digest: str, **kwargs: :param str tag_or_digest: Tag or digest of the manifest :return: The properties of a registry artifact :rtype: ~azure.containerregistry.ArtifactManifestProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -444,7 +444,7 @@ def get_tag_properties(self, repository: str, tag: str, **kwargs: Any) -> Artifa :param str tag: The tag to get tag properties for :return: The properties for a tag :rtype: ~azure.containerregistry.ArtifactTagProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -481,7 +481,7 @@ def list_tag_properties( :paramtype results_per_page: int :returns: An iterable of :class:`~azure.containerregistry.ArtifactTagProperties` :rtype: ~azure.core.paging.ItemPaged[~azure.containerregistry.ArtifactTagProperties] - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -612,7 +612,7 @@ def update_manifest_properties( parameter. Please provide either this or individual keyword parameters. :type properties: ~azure.containerregistry.ArtifactManifestProperties :rtype: ~azure.containerregistry.ArtifactManifestProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -656,7 +656,7 @@ def update_manifest_properties( :keyword bool can_read: Read permissions for a manifest. :keyword bool can_write: Write permissions for a manifest. :rtype: ~azure.containerregistry.ArtifactManifestProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -720,7 +720,7 @@ def update_tag_properties( parameter. Please provide either this or individual keyword parameters. :type properties: ~azure.containerregistry.ArtifactTagProperties :rtype: ~azure.containerregistry.ArtifactTagProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -761,7 +761,7 @@ def update_tag_properties( :keyword bool can_read: Read permissions for a tag. :keyword bool can_write: Write permissions for a tag. :rtype: ~azure.containerregistry.ArtifactTagProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -817,7 +817,7 @@ def update_repository_properties( parameter. Please provide either this or individual keyword parameters. :type properties: ~azure.containerregistry.RepositoryProperties :rtype: ~azure.containerregistry.RepositoryProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: """ @overload @@ -841,7 +841,7 @@ def update_repository_properties( :keyword bool can_read: Read permissions for a repository. :keyword bool can_write: Write permissions for a repository. :rtype: ~azure.containerregistry.RepositoryProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: """ @distributed_trace @@ -1059,7 +1059,7 @@ def delete_manifest(self, repository: str, tag_or_digest: str, **kwargs: Any) -> :param str repository: Name of the repository the manifest belongs to :param str tag_or_digest: Tag or digest of the manifest to be deleted :returns: None - :raises: :class:`azure.core.exceptions.HttpResponseError` + :raises ~azure.core.exceptions.HttpResponseError: Example diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/aio/operations/_patch.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/aio/operations/_patch.py index 3afad6ee9da2..28f7b7d642e0 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/aio/operations/_patch.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/aio/operations/_patch.py @@ -60,7 +60,7 @@ async def exchange_aad_access_token_for_acr_refresh_token( :keyword callable cls: A custom type or function that will be passed the direct response :return: AcrRefreshToken, or the result of cls(response) :rtype: ~container_registry.models.AcrRefreshToken - :raises: :class:`azure.core.exceptions.HttpResponseError` + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) @@ -134,7 +134,7 @@ async def exchange_acr_refresh_token_for_acr_access_token( :keyword callable cls: A custom type or function that will be passed the direct response :return: AcrAccessToken, or the result of cls(response) :rtype: ~container_registry.models.AcrAccessToken - :raises: :class:`azure.core.exceptions.HttpResponseError` + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/operations/_patch.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/operations/_patch.py index f55345dea082..1cdf038ca534 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/operations/_patch.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_generated/operations/_patch.py @@ -130,7 +130,7 @@ def exchange_aad_access_token_for_acr_refresh_token( :keyword callable cls: A custom type or function that will be passed the direct response :return: AcrRefreshToken, or the result of cls(response) :rtype: ~container_registry.models.AcrRefreshToken - :raises: :class:`azure.core.exceptions.HttpResponseError` + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) @@ -205,7 +205,7 @@ def exchange_acr_refresh_token_for_acr_access_token( :keyword callable cls: A custom type or function that will be passed the direct response :return: AcrAccessToken, or the result of cls(response) :rtype: ~container_registry.models.AcrAccessToken - :raises: :class:`azure.core.exceptions.HttpResponseError` + :raises ~azure.core.exceptions.HttpResponseError: """ error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop("error_map", {}) or {}) diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py index f3bfccc61ad6..af6074868eea 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py @@ -126,7 +126,7 @@ async def delete_repository(self, repository: str, **kwargs: Any) -> None: :param str repository: The repository to delete :returns: None :rtype: None - :raises: :class:`azure.core.exceptions.HttpResponseError` + :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -147,7 +147,7 @@ def list_repository_names(self, *, results_per_page: Optional[int] = None, **kwa :paramtype results_per_page: int :returns: An iterable of strings :rtype: ~azure.core.async_paging.AsyncItemPaged[str] - :raises: :class:`azure.core.exceptions.HttpResponseError` + :raises ~azure.core.exceptions.HttpResponseError: .. admonition:: Example: @@ -252,7 +252,7 @@ async def get_repository_properties(self, repository: str, **kwargs: Any) -> Rep :param str repository: Name of the repository :return: The properties of a repository. :rtype: ~azure.containerregistry.RepositoryProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: """ return RepositoryProperties._from_generated( # pylint: disable=protected-access await self._client.container_registry.get_properties(repository, **kwargs) @@ -276,7 +276,7 @@ def list_manifest_properties( :paramtype results_per_page: int :returns: An iterable of :class:`~azure.containerregistry.ArtifactManifestProperties` :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.containerregistry.ArtifactManifestProperties] - :raises: :class:`azure.core.exceptions.HttpResponseError` + :raises ~azure.core.exceptions.HttpResponseError: """ name = repository last = kwargs.pop("last", None) @@ -390,7 +390,7 @@ async def delete_tag(self, repository: str, tag: str, **kwargs: Any) -> None: :param str tag: The tag to be deleted :returns: None :rtype: None - :raises: :class:`azure.core.exceptions.HttpResponseError` + :raises ~azure.core.exceptions.HttpResponseError: Example @@ -415,7 +415,7 @@ async def get_manifest_properties( :param str tag_or_digest: The tag or digest of the manifest :return: The properties of a registry artifact :rtype: ~azure.containerregistry.ArtifactManifestProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -449,7 +449,7 @@ async def get_tag_properties(self, repository: str, tag: str, **kwargs: Any) -> :type tag: str :return: The properties for a tag. :rtype: ~azure.containerregistry.ArtifactTagProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -486,7 +486,7 @@ def list_tag_properties( :paramtype results_per_page: int :returns: An iterable of :class:`~azure.containerregistry.ArtifactTagProperties` :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.containerregistry.ArtifactTagProperties] - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -616,7 +616,7 @@ async def update_repository_properties( parameter. Please provide either this or individual keyword parameters. :type properties: ~azure.containerregistry.RepositoryProperties :rtype: ~azure.containerregistry.RepositoryProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: """ @overload @@ -640,7 +640,7 @@ async def update_repository_properties( :keyword bool can_read: Read permissions for a repository. :keyword bool can_write: Write permissions for a repository. :rtype: ~azure.containerregistry.RepositoryProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: """ @distributed_trace_async @@ -679,7 +679,7 @@ async def update_manifest_properties( parameter. Please provide either this or individual keyword parameters. :type properties: ~azure.containerregistry.ArtifactManifestProperties :rtype: ~azure.containerregistry.ArtifactManifestProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -724,7 +724,7 @@ async def update_manifest_properties( :keyword bool can_read: Read permissions for a manifest. :keyword bool can_write: Write permissions for a manifest. :rtype: ~azure.containerregistry.ArtifactManifestProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -788,7 +788,7 @@ async def update_tag_properties( parameter. Please provide either this or individual keyword parameters. :type properties: ~azure.containerregistry.ArtifactTagProperties :rtype: ~azure.containerregistry.ArtifactTagProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -830,7 +830,7 @@ async def update_tag_properties( :keyword bool can_read: Read permissions for a tag. :keyword bool can_write: Write permissions for a tag. :rtype: ~azure.containerregistry.ArtifactTagProperties - :raises: :class:`azure.core.exceptions.ResourceNotFoundError` + :raises ~azure.core.exceptions.ResourceNotFoundError: Example @@ -1076,7 +1076,7 @@ async def delete_manifest(self, repository: str, tag_or_digest: str, **kwargs: A :param str tag_or_digest: Tag or digest of the manifest to be deleted. :returns: None :rtype: None - :raises: :class:`azure.core.exceptions.HttpResponseError` + :raises ~azure.core.exceptions.HttpResponseError: Example From 1f922e11b68124e83792d1d189a11b48f93242c4 Mon Sep 17 00:00:00 2001 From: Yalin Li Date: Mon, 9 Sep 2024 19:34:20 -0700 Subject: [PATCH 6/6] Run black --- .../azure/containerregistry/_container_registry_client.py | 4 +++- .../containerregistry/aio/_async_container_registry_client.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py index cbedf47aa840..97a1d66e95dc 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/_container_registry_client.py @@ -845,7 +845,9 @@ def update_repository_properties( """ @distributed_trace - def update_repository_properties(self, *args: Union[str, RepositoryProperties], **kwargs: Any) -> RepositoryProperties: + def update_repository_properties( + self, *args: Union[str, RepositoryProperties], **kwargs: Any + ) -> RepositoryProperties: repository = str(args[0]) properties = None if len(args) == 2: diff --git a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py index af6074868eea..1da360b7f75e 100644 --- a/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py +++ b/sdk/containerregistry/azure-containerregistry/azure/containerregistry/aio/_async_container_registry_client.py @@ -852,7 +852,9 @@ async def update_tag_properties( """ @distributed_trace_async - async def update_tag_properties(self, *args: Union[str, ArtifactTagProperties], **kwargs: Any) -> ArtifactTagProperties: + async def update_tag_properties( + self, *args: Union[str, ArtifactTagProperties], **kwargs: Any + ) -> ArtifactTagProperties: repository = str(args[0]) tag = str(args[1]) properties = None