Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Use syntax compatible with Python 3.8 and 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
erdewit committed Aug 24, 2023
1 parent dac9252 commit 4c42463
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 7 additions & 6 deletions eventkit/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def aiterate(ait: AsyncIterable) -> "Aiterate":
@staticmethod
def sequence(
values: Iterable, interval: float = 0,
times: Iterable[float] | None = None) -> "Sequence":
times: Union[Iterable[float], None] = None) -> "Sequence":
"""
Create a new event that emits the given values.
Supply at most one ``interval`` or ``times``.
Expand All @@ -552,7 +552,7 @@ def sequence(
@staticmethod
def repeat(
value=NO_VALUE, count=1, interval: float = 0,
times: Iterable[float] | None = None) -> "Repeat":
times: Union[Iterable[float], None] = None) -> "Repeat":
"""
Create a new event that repeats ``value`` a number of ``count`` times.
Expand All @@ -568,7 +568,7 @@ def repeat(
@staticmethod
def range(
*args, interval: float = 0,
times: Iterable[float] | None = None) -> "Range":
times: Union[Iterable[float], None] = None) -> "Range":
"""
Create a new event that emits the values from a range.
Expand Down Expand Up @@ -604,7 +604,7 @@ def timerange(start=0, end=None, step=1) -> "Timerange":
return Timerange(start, end, step)

@staticmethod
def timer(interval: float, count: int | None = None) -> "Timer":
def timer(interval: float, count: Union[int, None] = None) -> "Timer":
"""
Create a new timer event that emits at regularly paced intervals
the number of seconds since starting it.
Expand All @@ -618,7 +618,7 @@ def timer(interval: float, count: int | None = None) -> "Timer":
@staticmethod
def marble(
s: str, interval: float = 0,
times: Iterable[float] | None = None) -> "Marble":
times: Union[Iterable[float], None] = None) -> "Marble":
"""
Create a new event that emits the values from a Rx-type marble string.
Expand Down Expand Up @@ -1001,7 +1001,8 @@ def all(self) -> "All":
"""
return All(self)

def ema(self, n: int | None = None, weight: float | None = None) -> "Ema":
def ema(self, n: Union[int, None] = None,
weight: Union[float, None] = None) -> "Ema":
"""
Exponential moving average.
Expand Down
4 changes: 3 additions & 1 deletion eventkit/ops/op.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Union

from ..event import Event


Expand All @@ -17,7 +19,7 @@ class Op(Event):

__slots__ = ()

def __init__(self, source: Event | None = None):
def __init__(self, source: Union[Event, None] = None):
Event.__init__(self)
if source is not None:
self.set_source(source)
Expand Down

0 comments on commit 4c42463

Please sign in to comment.