diff --git a/google/api_core/exceptions.py b/google/api_core/exceptions.py index 5b25d124..e3eb696c 100644 --- a/google/api_core/exceptions.py +++ b/google/api_core/exceptions.py @@ -517,14 +517,14 @@ def format_http_response_error( errors = payload.get("error", {}).get("errors", ()) # In JSON, details are already formatted in developer-friendly way. details = payload.get("error", {}).get("details", ()) - error_info = list( + error_info_list = list( filter( lambda detail: detail.get("@type", "") == "type.googleapis.com/google.rpc.ErrorInfo", details, ) ) - error_info = error_info[0] if error_info else None + error_info = error_info_list[0] if error_info_list else None message = _format_rest_error_message(error_message, method, url) exception = from_http_status( diff --git a/google/api_core/grpc_helpers_async.py b/google/api_core/grpc_helpers_async.py index 6feb2229..26960456 100644 --- a/google/api_core/grpc_helpers_async.py +++ b/google/api_core/grpc_helpers_async.py @@ -152,9 +152,9 @@ class _WrappedStreamStreamCall( # public type alias denoting the return type of async streaming gapic calls -GrpcAsyncStream = _WrappedStreamResponseMixin[P] +GrpcAsyncStream = _WrappedStreamResponseMixin # public type alias denoting the return type of unary gapic calls -AwaitableGrpcCall = _WrappedUnaryResponseMixin[P] +AwaitableGrpcCall = _WrappedUnaryResponseMixin def _wrap_unary_errors(callable_): diff --git a/google/api_core/retry/retry_unary.py b/google/api_core/retry/retry_unary.py index ab1b4030..d5dff663 100644 --- a/google/api_core/retry/retry_unary.py +++ b/google/api_core/retry/retry_unary.py @@ -83,7 +83,7 @@ def check_if_exists(): def retry_target( - target: Callable[_P, _R], + target: Callable[[], _R], predicate: Callable[[Exception], bool], sleep_generator: Iterable[float], timeout: float | None = None, diff --git a/google/api_core/retry/retry_unary_async.py b/google/api_core/retry/retry_unary_async.py index 3bdf6c71..e76a37bb 100644 --- a/google/api_core/retry/retry_unary_async.py +++ b/google/api_core/retry/retry_unary_async.py @@ -94,7 +94,7 @@ async def check_if_exists(): async def retry_target( - target: Callable[_P, Awaitable[_R]], + target: Callable[[], Awaitable[_R]], predicate: Callable[[Exception], bool], sleep_generator: Iterable[float], timeout: float | None = None, diff --git a/noxfile.py b/noxfile.py index ada6f330..cffef972 100644 --- a/noxfile.py +++ b/noxfile.py @@ -275,9 +275,7 @@ def pytype(session): @nox.session(python=DEFAULT_PYTHON_VERSION) def mypy(session): """Run type-checking.""" - # TODO(https://github.com/googleapis/python-api-core/issues/682): - # Use the latest version of mypy instead of mypy<1.11.0 - session.install(".[grpc,async_rest]", "mypy<1.11.0") + session.install(".[grpc,async_rest]", "mypy") session.install( "types-setuptools", "types-requests", diff --git a/tests/asyncio/test_grpc_helpers_async.py b/tests/asyncio/test_grpc_helpers_async.py index d8f20ae4..aa8d5d10 100644 --- a/tests/asyncio/test_grpc_helpers_async.py +++ b/tests/asyncio/test_grpc_helpers_async.py @@ -319,7 +319,7 @@ def test_awaitable_grpc_call(): """ AwaitableGrpcCall type should be an Awaitable and a grpc.aio.Call. """ - instance = grpc_helpers_async.AwaitableGrpcCall[int]() + instance = grpc_helpers_async.AwaitableGrpcCall() assert isinstance(instance, grpc.aio.Call) # should implement __await__ assert hasattr(instance, "__await__")