Skip to content

Commit

Permalink
fix: add 'dict' type annotation to 'request' (#966)
Browse files Browse the repository at this point in the history
* fix: add 'dict' type annotation to request

* Update client.py.j2
  • Loading branch information
busunkim96 authored Aug 4, 2021
1 parent f14ceba commit 49205d9
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
{% for method in service.methods.values() %}
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 @@ -306,7 +306,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):

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 @@ -316,7 +316,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
{% for method in service.methods.values() %}
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 @@ -337,7 +337,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):

Args:
{% if not method.client_streaming %}
request ({{ 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 @@ -351,7 +351,7 @@ def __init__(self, *,
)

def export_assets(self,
request: asset_service.ExportAssetsRequest = None,
request: Union[asset_service.ExportAssetsRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
Expand All @@ -372,7 +372,7 @@ def export_assets(self,
the export operation usually finishes within 5 minutes.
Args:
request (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 @@ -431,7 +431,7 @@ def export_assets(self,
return response

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

def batch_get_assets_history(self,
request: asset_service.BatchGetAssetsHistoryRequest = None,
request: Union[asset_service.BatchGetAssetsHistoryRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
Expand All @@ -535,7 +535,7 @@ def batch_get_assets_history(self,
INVALID_ARGUMENT error.
Args:
request (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 @@ -579,7 +579,7 @@ def batch_get_assets_history(self,
return response

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

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

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

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

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

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 @@ -989,7 +989,7 @@ def search_all_resources(self,
desired scope, otherwise the request will be rejected.
Args:
request (google.cloud.asset_v1.types.SearchAllResourcesRequest):
request (Union[google.cloud.asset_v1.types.SearchAllResourcesRequest, dict]):
The request object. Search all resources request.
scope (str):
Required. A scope can be a project, a folder, or an
Expand Down Expand Up @@ -1154,7 +1154,7 @@ def search_all_resources(self,
return response

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 @@ -1168,7 +1168,7 @@ def search_all_iam_policies(self,
desired scope, otherwise the request will be rejected.
Args:
request (google.cloud.asset_v1.types.SearchAllIamPoliciesRequest):
request (Union[google.cloud.asset_v1.types.SearchAllIamPoliciesRequest, dict]):
The request object. Search all IAM policies request.
scope (str):
Required. A scope can be a project, a folder, or an
Expand Down Expand Up @@ -1313,7 +1313,7 @@ def search_all_iam_policies(self,
return response

def analyze_iam_policy(self,
request: asset_service.AnalyzeIamPolicyRequest = None,
request: Union[asset_service.AnalyzeIamPolicyRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
Expand All @@ -1323,7 +1323,7 @@ def analyze_iam_policy(self,
what accesses on which resources.
Args:
request (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 @@ -1370,7 +1370,7 @@ def analyze_iam_policy(self,
return response

def analyze_iam_policy_longrunning(self,
request: asset_service.AnalyzeIamPolicyLongrunningRequest = None,
request: Union[asset_service.AnalyzeIamPolicyLongrunningRequest, dict] = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
Expand All @@ -1390,7 +1390,7 @@ def analyze_iam_policy_longrunning(self,
to help callers to map responses to requests.
Args:
request (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 @@ -347,7 +347,7 @@ def __init__(self, *,
)

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

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

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

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

0 comments on commit 49205d9

Please sign in to comment.