Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(types): update mypy version #768

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions google/api_core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions google/api_core/grpc_helpers_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_):
Expand Down
2 changes: 1 addition & 1 deletion google/api_core/retry/retry_unary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion google/api_core/retry/retry_unary_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tests/asyncio/test_grpc_helpers_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__")
Expand Down
Loading