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

Mypy Latest Version Update #1069

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion google/cloud/pubsub_v1/publisher/_batch/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(
client: "PublisherClient",
topic: str,
settings: "types.BatchSettings",
batch_done_callback: Callable[[bool], Any] = None,
batch_done_callback: Callable[[bool], Any],
commit_when_full: bool = True,
commit_retry: "OptionalRetry" = gapic_v1.method.DEFAULT,
commit_timeout: "types.OptionalTimeout" = gapic_v1.method.DEFAULT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import typing
from typing import Optional
from typing import Optional, Callable

from google.api_core import gapic_v1

Expand Down Expand Up @@ -93,6 +93,7 @@ def _create_batch(
self,
commit_retry: "OptionalRetry" = gapic_v1.method.DEFAULT,
commit_timeout: "types.OptionalTimeout" = gapic_v1.method.DEFAULT,
batch_done_callback = Callable[[bool], any],
) -> "_batch.thread.Batch":
"""Create a new batch using the client's batch class and other stored
settings.
Expand All @@ -107,7 +108,7 @@ def _create_batch(
client=self._client,
topic=self._topic,
settings=self._client.batch_settings,
batch_done_callback=None,
batch_done_callback = batch_done_callback,
commit_when_full=True,
commit_retry=commit_retry,
commit_timeout=commit_timeout,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import logging
import queue
import time
from typing import Any, Callable, List, Sequence
from typing import Any, Callable, List, Sequence, Optional
import uuid


Expand All @@ -32,7 +32,7 @@


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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def __init__(
client: "subscriber.Client",
subscription: str,
flow_control: types.FlowControl = types.FlowControl(),
scheduler: ThreadScheduler = None,
scheduler = None,
use_legacy_flow_control: bool = False,
await_callbacks_on_shutdown: bool = False,
):
Expand Down
8 changes: 4 additions & 4 deletions google/cloud/pubsub_v1/subscriber/futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from __future__ import absolute_import

import typing
from typing import Any
from typing import Union
from typing import Any, Union
from typing import Optional, Callable

from google.cloud.pubsub_v1 import futures
from google.cloud.pubsub_v1.subscriber.exceptions import AcknowledgeStatus
Expand All @@ -42,7 +42,7 @@ def __init__(self, manager: "StreamingPullManager"):
self.__manager.add_close_callback(self._on_close_callback)
self.__cancelled = False

def _on_close_callback(self, manager: "StreamingPullManager", result: Any):
def _on_close_callback(self, manager: "StreamingPullManager", result: Optional[BaseException]):
if self.done():
# The future has already been resolved in a different thread,
# nothing to do on the streaming pull manager shutdown.
Expand Down Expand Up @@ -104,7 +104,7 @@ def cancelled(self) -> bool:
"""
return False

def result(self, timeout: Union[int, float] = None) -> AcknowledgeStatus:
def result(self, timeout:Optional[float] = '') -> AcknowledgeStatus:
"""Return a success code or raise an exception.

This blocks until the operation completes successfully and
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/pubsub_v1/subscriber/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import concurrent.futures
import queue
import typing
from typing import Callable, List, Optional
from typing import Callable, List, Optional, Iterable
import warnings

if typing.TYPE_CHECKING: # pragma: NO COVER
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
ISORT_VERSION = "isort==5.11.0"
LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]

MYPY_VERSION = "mypy==0.910"
MYPY_VERSION = "mypy==1.8.0"

DEFAULT_PYTHON_VERSION = "3.8"

Expand Down