diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index c07f148..2567653 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: - image: gcr.io/repo-automation-bots/owlbot-python:latest - digest: sha256:0ffe3bdd6c7159692df5f7744da74e5ef19966288a6bf76023e8e04e0c424d7d + image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest + digest: sha256:87eee22d276554e4e52863ec9b1cb6a7245815dfae20439712bf644348215a5a diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml index 2b672b4..3fc3681 100644 --- a/.github/.OwlBot.yaml +++ b/.github/.OwlBot.yaml @@ -13,7 +13,7 @@ # limitations under the License. docker: - image: gcr.io/repo-automation-bots/owlbot-python:latest + image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest deep-remove-regex: - /owl-bot-staging diff --git a/CHANGELOG.md b/CHANGELOG.md index 347fbdc..01ac32a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.1.1](https://www.github.com/googleapis/python-functions/compare/v1.1.0...v1.1.1) (2021-09-30) + + +### Bug Fixes + +* improper types in pagers generation ([ef050bd](https://www.github.com/googleapis/python-functions/commit/ef050bd15318cd9ca4481502411e16bf5c7f2c2e)) + ## [1.1.0](https://www.github.com/googleapis/python-functions/compare/v1.0.4...v1.1.0) (2021-09-16) diff --git a/google/cloud/functions_v1/services/cloud_functions_service/client.py b/google/cloud/functions_v1/services/cloud_functions_service/client.py index df4e861..ccf5990 100644 --- a/google/cloud/functions_v1/services/cloud_functions_service/client.py +++ b/google/cloud/functions_v1/services/cloud_functions_service/client.py @@ -17,7 +17,7 @@ from distutils import util import os import re -from typing import Callable, Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib # type: ignore @@ -364,7 +364,7 @@ def __init__( def list_functions( self, - request: functions.ListFunctionsRequest = None, + request: Union[functions.ListFunctionsRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -374,7 +374,7 @@ def list_functions( requested project. Args: - request (google.cloud.functions_v1.types.ListFunctionsRequest): + request (Union[google.cloud.functions_v1.types.ListFunctionsRequest, dict]): The request object. Request for the `ListFunctions` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -423,7 +423,7 @@ def list_functions( def get_function( self, - request: functions.GetFunctionRequest = None, + request: Union[functions.GetFunctionRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -434,7 +434,7 @@ def get_function( requested project. Args: - request (google.cloud.functions_v1.types.GetFunctionRequest): + request (Union[google.cloud.functions_v1.types.GetFunctionRequest, dict]): The request object. Request for the `GetFunction` method. name (str): @@ -497,7 +497,7 @@ def get_function( def create_function( self, - request: functions.CreateFunctionRequest = None, + request: Union[functions.CreateFunctionRequest, dict] = None, *, location: str = None, function: functions.CloudFunction = None, @@ -510,7 +510,7 @@ def create_function( operation will return ``ALREADY_EXISTS`` error. Args: - request (google.cloud.functions_v1.types.CreateFunctionRequest): + request (Union[google.cloud.functions_v1.types.CreateFunctionRequest, dict]): The request object. Request for the `CreateFunction` method. location (str): @@ -590,7 +590,7 @@ def create_function( def update_function( self, - request: functions.UpdateFunctionRequest = None, + request: Union[functions.UpdateFunctionRequest, dict] = None, *, function: functions.CloudFunction = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -600,7 +600,7 @@ def update_function( r"""Updates existing function. Args: - request (google.cloud.functions_v1.types.UpdateFunctionRequest): + request (Union[google.cloud.functions_v1.types.UpdateFunctionRequest, dict]): The request object. Request for the `UpdateFunction` method. function (google.cloud.functions_v1.types.CloudFunction): @@ -674,7 +674,7 @@ def update_function( def delete_function( self, - request: functions.DeleteFunctionRequest = None, + request: Union[functions.DeleteFunctionRequest, dict] = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, @@ -687,7 +687,7 @@ def delete_function( function. Args: - request (google.cloud.functions_v1.types.DeleteFunctionRequest): + request (Union[google.cloud.functions_v1.types.DeleteFunctionRequest, dict]): The request object. Request for the `DeleteFunction` method. name (str): @@ -769,7 +769,7 @@ def delete_function( def call_function( self, - request: functions.CallFunctionRequest = None, + request: Union[functions.CallFunctionRequest, dict] = None, *, name: str = None, data: str = None, @@ -783,7 +783,7 @@ def call_function( Limits `__. Args: - request (google.cloud.functions_v1.types.CallFunctionRequest): + request (Union[google.cloud.functions_v1.types.CallFunctionRequest, dict]): The request object. Request for the `CallFunction` method. name (str): @@ -851,7 +851,7 @@ def call_function( def generate_upload_url( self, - request: functions.GenerateUploadUrlRequest = None, + request: Union[functions.GenerateUploadUrlRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -887,7 +887,7 @@ def generate_upload_url( - ``Authorization: Bearer YOUR_TOKEN`` Args: - request (google.cloud.functions_v1.types.GenerateUploadUrlRequest): + request (Union[google.cloud.functions_v1.types.GenerateUploadUrlRequest, dict]): The request object. Request of `GenerateSourceUploadUrl` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -926,7 +926,7 @@ def generate_upload_url( def generate_download_url( self, - request: functions.GenerateDownloadUrlRequest = None, + request: Union[functions.GenerateDownloadUrlRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -941,7 +941,7 @@ def generate_download_url( control/signed-urls Args: - request (google.cloud.functions_v1.types.GenerateDownloadUrlRequest): + request (Union[google.cloud.functions_v1.types.GenerateDownloadUrlRequest, dict]): The request object. Request of `GenerateDownloadUrl` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -980,7 +980,7 @@ def generate_download_url( def set_iam_policy( self, - request: iam_policy_pb2.SetIamPolicyRequest = None, + request: Union[iam_policy_pb2.SetIamPolicyRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -990,7 +990,7 @@ def set_iam_policy( function. Replaces any existing policy. Args: - request (google.iam.v1.iam_policy_pb2.SetIamPolicyRequest): + request (Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]): The request object. Request message for `SetIamPolicy` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -1085,7 +1085,7 @@ def set_iam_policy( def get_iam_policy( self, - request: iam_policy_pb2.GetIamPolicyRequest = None, + request: Union[iam_policy_pb2.GetIamPolicyRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -1096,7 +1096,7 @@ def get_iam_policy( not have a policy set. Args: - request (google.iam.v1.iam_policy_pb2.GetIamPolicyRequest): + request (Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]): The request object. Request message for `GetIamPolicy` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -1191,7 +1191,7 @@ def get_iam_policy( def test_iam_permissions( self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, + request: Union[iam_policy_pb2.TestIamPermissionsRequest, dict] = None, *, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, @@ -1202,7 +1202,7 @@ def test_iam_permissions( return an empty set of permissions, not a NOT_FOUND error. Args: - request (google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest): + request (Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]): The request object. Request message for `TestIamPermissions` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/functions_v1/services/cloud_functions_service/pagers.py b/google/cloud/functions_v1/services/cloud_functions_service/pagers.py index c836a87..72544f3 100644 --- a/google/cloud/functions_v1/services/cloud_functions_service/pagers.py +++ b/google/cloud/functions_v1/services/cloud_functions_service/pagers.py @@ -15,13 +15,13 @@ # from typing import ( Any, - AsyncIterable, + AsyncIterator, Awaitable, Callable, - Iterable, Sequence, Tuple, Optional, + Iterator, ) from google.cloud.functions_v1.types import functions @@ -74,14 +74,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - def pages(self) -> Iterable[functions.ListFunctionsResponse]: + def pages(self) -> Iterator[functions.ListFunctionsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = self._method(self._request, metadata=self._metadata) yield self._response - def __iter__(self) -> Iterable[functions.CloudFunction]: + def __iter__(self) -> Iterator[functions.CloudFunction]: for page in self.pages: yield from page.functions @@ -136,14 +136,14 @@ def __getattr__(self, name: str) -> Any: return getattr(self._response, name) @property - async def pages(self) -> AsyncIterable[functions.ListFunctionsResponse]: + async def pages(self) -> AsyncIterator[functions.ListFunctionsResponse]: yield self._response while self._response.next_page_token: self._request.page_token = self._response.next_page_token self._response = await self._method(self._request, metadata=self._metadata) yield self._response - def __aiter__(self) -> AsyncIterable[functions.CloudFunction]: + def __aiter__(self) -> AsyncIterator[functions.CloudFunction]: async def async_generator(): async for page in self.pages: for response in page.functions: diff --git a/google/cloud/functions_v1/services/cloud_functions_service/transports/base.py b/google/cloud/functions_v1/services/cloud_functions_service/transports/base.py index 494f50f..e649c9f 100644 --- a/google/cloud/functions_v1/services/cloud_functions_service/transports/base.py +++ b/google/cloud/functions_v1/services/cloud_functions_service/transports/base.py @@ -119,7 +119,7 @@ def __init__( **scopes_kwargs, quota_project_id=quota_project_id ) - # If the credentials is service account credentials, then always try to use self signed JWT. + # If the credentials are service account credentials, then always try to use self signed JWT. if ( always_use_jwt_access and isinstance(credentials, service_account.Credentials) diff --git a/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc.py b/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc.py index 5eb9392..b55dfeb 100644 --- a/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc.py +++ b/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc.py @@ -85,16 +85,16 @@ def __init__( api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. If provided, it overrides the ``host`` argument and tries to create a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. + ``client_cert_source`` or application default SSL credentials. client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): Deprecated. A callback to provide client SSL certificate bytes and private key bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. + for the grpc channel. It is ignored if ``channel`` is provided. client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure mutual TLS channel. It is + both in PEM format. It is used to configure a mutual TLS channel. It is ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. diff --git a/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc_asyncio.py b/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc_asyncio.py index 47b1570..65038f8 100644 --- a/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc_asyncio.py +++ b/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc_asyncio.py @@ -132,16 +132,16 @@ def __init__( api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. If provided, it overrides the ``host`` argument and tries to create a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. + ``client_cert_source`` or application default SSL credentials. client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): Deprecated. A callback to provide client SSL certificate bytes and private key bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. + for the grpc channel. It is ignored if ``channel`` is provided. client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): A callback to provide client certificate bytes and private key bytes, - both in PEM format. It is used to configure mutual TLS channel. It is + both in PEM format. It is used to configure a mutual TLS channel. It is ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. diff --git a/scripts/fixup_functions_v1_keywords.py b/scripts/fixup_functions_v1_keywords.py index 5d0c9b2..bffb9e5 100644 --- a/scripts/fixup_functions_v1_keywords.py +++ b/scripts/fixup_functions_v1_keywords.py @@ -39,17 +39,17 @@ def partition( class functionsCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'call_function': ('name', 'data', ), - 'create_function': ('location', 'function', ), - 'delete_function': ('name', ), - 'generate_download_url': ('name', 'version_id', ), - 'generate_upload_url': ('parent', ), - 'get_function': ('name', ), - 'get_iam_policy': ('resource', 'options', ), - 'list_functions': ('parent', 'page_size', 'page_token', ), - 'set_iam_policy': ('resource', 'policy', ), - 'test_iam_permissions': ('resource', 'permissions', ), - 'update_function': ('function', 'update_mask', ), + 'call_function': ('name', 'data', ), + 'create_function': ('location', 'function', ), + 'delete_function': ('name', ), + 'generate_download_url': ('name', 'version_id', ), + 'generate_upload_url': ('parent', ), + 'get_function': ('name', ), + 'get_iam_policy': ('resource', 'options', ), + 'list_functions': ('parent', 'page_size', 'page_token', ), + 'set_iam_policy': ('resource', 'policy', ), + 'test_iam_permissions': ('resource', 'permissions', ), + 'update_function': ('function', 'update_mask', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: @@ -68,7 +68,7 @@ def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: return updated kwargs, ctrl_kwargs = partition( - lambda a: not a.keyword.value in self.CTRL_PARAMS, + lambda a: a.keyword.value not in self.CTRL_PARAMS, kwargs ) diff --git a/setup.py b/setup.py index 61095a7..158a7ed 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ import os import setuptools # type: ignore -version = "1.1.0" +version = "1.1.1" package_root = os.path.abspath(os.path.dirname(__file__))