Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

Commit 45a7397

Browse files
fix: MyPy type checking errors and update Mypy version
1 parent ff4d53e commit 45a7397

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

google/cloud/pubsub_v1/publisher/_batch/thread.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(
9090
client: "PublisherClient",
9191
topic: str,
9292
settings: "types.BatchSettings",
93-
batch_done_callback: Callable[[bool], Any] = None,
93+
batch_done_callback: Optional[Callable[[bool], Any]] = None,
9494
commit_when_full: bool = True,
9595
commit_retry: "OptionalRetry" = gapic_v1.method.DEFAULT,
9696
commit_timeout: "types.OptionalTimeout" = gapic_v1.method.DEFAULT,

google/cloud/pubsub_v1/publisher/futures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def cancelled(self) -> bool:
4545
"""
4646
return False
4747

48-
def result(self, timeout: Union[int, float] = None) -> str:
48+
def result(self, timeout: Union[int, float, None] = None) -> str:
4949
"""Return the message ID or raise an exception.
5050
5151
This blocks until the message has been published successfully and

google/cloud/pubsub_v1/subscriber/_protocol/helper_threads.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import logging
1616
import queue
1717
import time
18-
from typing import Any, Callable, List, Sequence
18+
from typing import Any, Callable, List, Sequence, Optional
1919
import uuid
2020

2121

@@ -32,7 +32,7 @@
3232

3333

3434
def _get_many(
35-
queue_: queue.Queue, max_items: int = None, max_latency: float = 0
35+
queue_: queue.Queue, max_items: Optional[int] = None, max_latency: float = 0
3636
) -> List[Any]:
3737
"""Get multiple items from a Queue.
3838

google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def __init__(
267267
client: "subscriber.Client",
268268
subscription: str,
269269
flow_control: types.FlowControl = types.FlowControl(),
270-
scheduler: ThreadScheduler = None,
270+
scheduler: Optional[ThreadScheduler] = None,
271271
use_legacy_flow_control: bool = False,
272272
await_callbacks_on_shutdown: bool = False,
273273
):

google/cloud/pubsub_v1/subscriber/futures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def cancelled(self) -> bool:
104104
"""
105105
return False
106106

107-
def result(self, timeout: Union[int, float] = None) -> AcknowledgeStatus:
107+
def result(self, timeout: Union[int, float, None] = None) -> AcknowledgeStatus:
108108
"""Return a success code or raise an exception.
109109
110110
This blocks until the operation completes successfully and

google/cloud/pubsub_v1/subscriber/scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def shutdown(
162162
work_item = self._executor._work_queue.get(block=False)
163163
if work_item is None: # Exceutor in shutdown mode.
164164
continue
165-
dropped_messages.append(work_item.args[0])
165+
dropped_messages.append(work_item.args[0]) #type: ignore[index]
166166
except queue.Empty:
167167
pass
168168

0 commit comments

Comments
 (0)