Skip to content

Commit

Permalink
fix: add 'dict' type annotation to 'request' for async_client (#1051)
Browse files Browse the repository at this point in the history
  • Loading branch information
parthea authored Oct 29, 2021
1 parent 8f213ad commit 08cc2c4
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class {{ service.async_client_name }}:
{% for method in service.methods.values() %}
{%+ if not method.server_streaming %}async {% endif %}def {{ method.name|snake_case }}(self,
{% if not method.client_streaming %}
request: {{ method.input.ident }} = None,
request: Union[{{ method.input.ident }}, dict] = None,
*,
{% for field in method.flattened_fields.values() %}
{{ field.name }}: {{ field.ident }} = None,
Expand All @@ -170,7 +170,7 @@ class {{ service.async_client_name }}:

Args:
{% if not method.client_streaming %}
request (:class:`{{ method.input.ident.sphinx }}`):
request (Union[{{ method.input.ident.sphinx }}, dict]):
The request object.{{ " " }}
{{- method.input.meta.doc|wrap(width=72, offset=36, indent=16) }}
{% for key, field in method.flattened_fields.items() %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def __init__(self, *,
)

async def export_assets(self,
request: asset_service.ExportAssetsRequest = None,
request: Union[asset_service.ExportAssetsRequest, dict] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
Expand All @@ -174,7 +174,7 @@ async def export_assets(self,
the export operation usually finishes within 5 minutes.
Args:
request (:class:`google.cloud.asset_v1.types.ExportAssetsRequest`):
request (Union[google.cloud.asset_v1.types.ExportAssetsRequest, dict]):
The request object. Export asset request.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
Expand Down Expand Up @@ -232,7 +232,7 @@ async def export_assets(self,
return response

async def list_assets(self,
request: asset_service.ListAssetsRequest = None,
request: Union[asset_service.ListAssetsRequest, dict] = None,
*,
parent: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
Expand All @@ -243,7 +243,7 @@ async def list_assets(self,
paged results in response.
Args:
request (:class:`google.cloud.asset_v1.types.ListAssetsRequest`):
request (Union[google.cloud.asset_v1.types.ListAssetsRequest, dict]):
The request object. ListAssets request.
parent (:class:`str`):
Required. Name of the organization or project the assets
Expand Down Expand Up @@ -321,7 +321,7 @@ async def list_assets(self,
return response

async def batch_get_assets_history(self,
request: asset_service.BatchGetAssetsHistoryRequest = None,
request: Union[asset_service.BatchGetAssetsHistoryRequest, dict] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
Expand All @@ -336,7 +336,7 @@ async def batch_get_assets_history(self,
INVALID_ARGUMENT error.
Args:
request (:class:`google.cloud.asset_v1.types.BatchGetAssetsHistoryRequest`):
request (Union[google.cloud.asset_v1.types.BatchGetAssetsHistoryRequest, dict]):
The request object. Batch get assets history request.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
Expand Down Expand Up @@ -386,7 +386,7 @@ async def batch_get_assets_history(self,
return response

async def create_feed(self,
request: asset_service.CreateFeedRequest = None,
request: Union[asset_service.CreateFeedRequest, dict] = None,
*,
parent: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
Expand All @@ -398,7 +398,7 @@ async def create_feed(self,
updates.
Args:
request (:class:`google.cloud.asset_v1.types.CreateFeedRequest`):
request (Union[google.cloud.asset_v1.types.CreateFeedRequest, dict]):
The request object. Create asset feed request.
parent (:class:`str`):
Required. The name of the
Expand Down Expand Up @@ -474,7 +474,7 @@ async def create_feed(self,
return response

async def get_feed(self,
request: asset_service.GetFeedRequest = None,
request: Union[asset_service.GetFeedRequest, dict] = None,
*,
name: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
Expand All @@ -484,7 +484,7 @@ async def get_feed(self,
r"""Gets details about an asset feed.
Args:
request (:class:`google.cloud.asset_v1.types.GetFeedRequest`):
request (Union[google.cloud.asset_v1.types.GetFeedRequest, dict]):
The request object. Get asset feed request.
name (:class:`str`):
Required. The name of the Feed and it must be in the
Expand Down Expand Up @@ -562,7 +562,7 @@ async def get_feed(self,
return response

async def list_feeds(self,
request: asset_service.ListFeedsRequest = None,
request: Union[asset_service.ListFeedsRequest, dict] = None,
*,
parent: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
Expand All @@ -573,7 +573,7 @@ async def list_feeds(self,
project/folder/organization.
Args:
request (:class:`google.cloud.asset_v1.types.ListFeedsRequest`):
request (Union[google.cloud.asset_v1.types.ListFeedsRequest, dict]):
The request object. List asset feeds request.
parent (:class:`str`):
Required. The parent
Expand Down Expand Up @@ -646,7 +646,7 @@ async def list_feeds(self,
return response

async def update_feed(self,
request: asset_service.UpdateFeedRequest = None,
request: Union[asset_service.UpdateFeedRequest, dict] = None,
*,
feed: asset_service.Feed = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
Expand All @@ -656,7 +656,7 @@ async def update_feed(self,
r"""Updates an asset feed configuration.
Args:
request (:class:`google.cloud.asset_v1.types.UpdateFeedRequest`):
request (Union[google.cloud.asset_v1.types.UpdateFeedRequest, dict]):
The request object. Update asset feed request.
feed (:class:`google.cloud.asset_v1.types.Feed`):
Required. The new values of feed details. It must match
Expand Down Expand Up @@ -728,7 +728,7 @@ async def update_feed(self,
return response

async def delete_feed(self,
request: asset_service.DeleteFeedRequest = None,
request: Union[asset_service.DeleteFeedRequest, dict] = None,
*,
name: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
Expand All @@ -738,7 +738,7 @@ async def delete_feed(self,
r"""Deletes an asset feed.
Args:
request (:class:`google.cloud.asset_v1.types.DeleteFeedRequest`):
request (Union[google.cloud.asset_v1.types.DeleteFeedRequest, dict]):
The request object.
name (:class:`str`):
Required. The name of the feed and it must be in the
Expand Down Expand Up @@ -802,7 +802,7 @@ async def delete_feed(self,
)

async def search_all_resources(self,
request: asset_service.SearchAllResourcesRequest = None,
request: Union[asset_service.SearchAllResourcesRequest, dict] = None,
*,
scope: str = None,
query: str = None,
Expand All @@ -817,7 +817,7 @@ async def search_all_resources(self,
desired scope, otherwise the request will be rejected.
Args:
request (:class:`google.cloud.asset_v1.types.SearchAllResourcesRequest`):
request (Union[google.cloud.asset_v1.types.SearchAllResourcesRequest, dict]):
The request object. Search all resources request.
scope (:class:`str`):
Required. A scope can be a project, a folder, or an
Expand Down Expand Up @@ -989,7 +989,7 @@ async def search_all_resources(self,
return response

async def search_all_iam_policies(self,
request: asset_service.SearchAllIamPoliciesRequest = None,
request: Union[asset_service.SearchAllIamPoliciesRequest, dict] = None,
*,
scope: str = None,
query: str = None,
Expand All @@ -1003,7 +1003,7 @@ async def search_all_iam_policies(self,
desired scope, otherwise the request will be rejected.
Args:
request (:class:`google.cloud.asset_v1.types.SearchAllIamPoliciesRequest`):
request (Union[google.cloud.asset_v1.types.SearchAllIamPoliciesRequest, dict]):
The request object. Search all IAM policies request.
scope (:class:`str`):
Required. A scope can be a project, a folder, or an
Expand Down Expand Up @@ -1155,7 +1155,7 @@ async def search_all_iam_policies(self,
return response

async def analyze_iam_policy(self,
request: asset_service.AnalyzeIamPolicyRequest = None,
request: Union[asset_service.AnalyzeIamPolicyRequest, dict] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
Expand All @@ -1165,7 +1165,7 @@ async def analyze_iam_policy(self,
what accesses on which resources.
Args:
request (:class:`google.cloud.asset_v1.types.AnalyzeIamPolicyRequest`):
request (Union[google.cloud.asset_v1.types.AnalyzeIamPolicyRequest, dict]):
The request object. A request message for
[AssetService.AnalyzeIamPolicy][google.cloud.asset.v1.AssetService.AnalyzeIamPolicy].
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down Expand Up @@ -1217,7 +1217,7 @@ async def analyze_iam_policy(self,
return response

async def analyze_iam_policy_longrunning(self,
request: asset_service.AnalyzeIamPolicyLongrunningRequest = None,
request: Union[asset_service.AnalyzeIamPolicyLongrunningRequest, dict] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
Expand All @@ -1237,7 +1237,7 @@ async def analyze_iam_policy_longrunning(self,
to help callers to map responses to requests.
Args:
request (:class:`google.cloud.asset_v1.types.AnalyzeIamPolicyLongrunningRequest`):
request (Union[google.cloud.asset_v1.types.AnalyzeIamPolicyLongrunningRequest, dict]):
The request object. A request message for
[AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning].
retry (google.api_core.retry.Retry): Designation of what errors, if any,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def __init__(self, *,
)

async def generate_access_token(self,
request: common.GenerateAccessTokenRequest = None,
request: Union[common.GenerateAccessTokenRequest, dict] = None,
*,
name: str = None,
delegates: Sequence[str] = None,
Expand All @@ -172,7 +172,7 @@ async def generate_access_token(self,
account.
Args:
request (:class:`google.iam.credentials_v1.types.GenerateAccessTokenRequest`):
request (Union[google.iam.credentials_v1.types.GenerateAccessTokenRequest, dict]):
The request object.
name (:class:`str`):
Required. The resource name of the service account for
Expand Down Expand Up @@ -291,7 +291,7 @@ async def generate_access_token(self,
return response

async def generate_id_token(self,
request: common.GenerateIdTokenRequest = None,
request: Union[common.GenerateIdTokenRequest, dict] = None,
*,
name: str = None,
delegates: Sequence[str] = None,
Expand All @@ -305,7 +305,7 @@ async def generate_id_token(self,
account.
Args:
request (:class:`google.iam.credentials_v1.types.GenerateIdTokenRequest`):
request (Union[google.iam.credentials_v1.types.GenerateIdTokenRequest, dict]):
The request object.
name (:class:`str`):
Required. The resource name of the service account for
Expand Down Expand Up @@ -418,7 +418,7 @@ async def generate_id_token(self,
return response

async def sign_blob(self,
request: common.SignBlobRequest = None,
request: Union[common.SignBlobRequest, dict] = None,
*,
name: str = None,
delegates: Sequence[str] = None,
Expand All @@ -431,7 +431,7 @@ async def sign_blob(self,
private key.
Args:
request (:class:`google.iam.credentials_v1.types.SignBlobRequest`):
request (Union[google.iam.credentials_v1.types.SignBlobRequest, dict]):
The request object.
name (:class:`str`):
Required. The resource name of the service account for
Expand Down Expand Up @@ -531,7 +531,7 @@ async def sign_blob(self,
return response

async def sign_jwt(self,
request: common.SignJwtRequest = None,
request: Union[common.SignJwtRequest, dict] = None,
*,
name: str = None,
delegates: Sequence[str] = None,
Expand All @@ -544,7 +544,7 @@ async def sign_jwt(self,
private key.
Args:
request (:class:`google.iam.credentials_v1.types.SignJwtRequest`):
request (Union[google.iam.credentials_v1.types.SignJwtRequest, dict]):
The request object.
name (:class:`str`):
Required. The resource name of the service account for
Expand Down
Loading

0 comments on commit 08cc2c4

Please sign in to comment.