Skip to content
Merged
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
11 changes: 5 additions & 6 deletions sdks/python/apache_beam/io/watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ def poll(prefix) -> PollResult[str]:
import inspect
import time
import typing
from collections.abc import Iterable
from typing import Any
from typing import Callable
from typing import Generic
from typing import Iterable
from typing import Optional
from typing import Tuple
from typing import TypeVar

from apache_beam import coders
Expand Down Expand Up @@ -111,15 +110,15 @@ class PollResult(Generic[OutputT]):
The ``OutputT`` type parameter can annotate a poll function's return type,
as in ``-> PollResult[str]``; the transform infers the output coder from it.
"""
outputs: Tuple[TimestampedValue, ...]
outputs: tuple[TimestampedValue, ...]
watermark: Optional[Timestamp] = None

@property
def is_complete(self) -> bool:
return self.watermark == MAX_TIMESTAMP

@staticmethod
def _normalize(outputs, timestamp) -> Tuple[TimestampedValue, ...]:
def _normalize(outputs, timestamp) -> tuple[TimestampedValue, ...]:
if timestamp is None:
default_ts = Timestamp.now()
else:
Expand Down Expand Up @@ -428,7 +427,7 @@ def _hash(self, value: Any) -> bytes:
def current_restriction(self) -> _GrowthState:
return self._restriction

def try_claim(self, position: Tuple[PollResult, Any]) -> bool:
def try_claim(self, position: tuple[PollResult, Any]) -> bool:
"""Claims one poll round; at most one claim succeeds per ``process()``.

The claim is rejected after a checkpoint already stopped this invocation,
Expand Down Expand Up @@ -723,7 +722,7 @@ def expand(self, pcoll):
output_coder,
key_fn,
key_coder,
self._now)).with_output_types(Tuple[input_type, value_type])
self._now)).with_output_types(tuple[input_type, value_type])


def _as_duration(value) -> Duration:
Expand Down
Loading