Skip to content

Commit

Permalink
type __init__s
Browse files Browse the repository at this point in the history
  • Loading branch information
ebonnal committed Mar 9, 2024
1 parent 560dfe3 commit 3dc3095
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
6 changes: 3 additions & 3 deletions streamable/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class ExceptionContainer:
def __init__(
self,
iterator: Iterator[Union[T, ExceptionContainer]],
):
) -> None:
self.iterator = iterator

def __next__(self) -> T:
Expand All @@ -267,7 +267,7 @@ def __init__(
func: Callable[[T], U],
concurrency: int,
buffer_size: int,
):
) -> None:
self.iterator = iterator
self.func = func
self.concurrency = concurrency
Expand Down Expand Up @@ -302,7 +302,7 @@ def __init__(
iterables_iterator: Iterator[Iterable[T]],
concurrency: int,
buffer_size: int,
):
) -> None:
self.iterables_iterator = iterables_iterator
self.concurrency = concurrency
self.buffer_size = buffer_size
Expand Down
20 changes: 12 additions & 8 deletions streamable/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class DownStream(Stream[U], Generic[T, U]):
Stream that has an upstream.
"""

def __init__(self, upstream: Stream[T]):
def __init__(self, upstream: Stream[T]) -> None:
Stream.__init__(self, upstream.source)
self._upstream: Stream[T] = upstream

Expand All @@ -331,7 +331,7 @@ def __init__(
upstream: Stream[T],
predicate: Callable[[Exception], Any],
raise_at_exhaustion: bool,
):
) -> None:
super().__init__(upstream)
self.predicate = predicate
self.raise_at_exhaustion = raise_at_exhaustion
Expand All @@ -341,7 +341,7 @@ def accept(self, visitor: "Visitor[V]") -> V:


class FilterStream(DownStream[T, T]):
def __init__(self, upstream: Stream[T], predicate: Callable[[T], Any]):
def __init__(self, upstream: Stream[T], predicate: Callable[[T], Any]) -> None:
super().__init__(upstream)
self.predicate = predicate

Expand All @@ -359,7 +359,9 @@ def accept(self, visitor: "Visitor[V]") -> V:


class ForeachStream(DownStream[T, T]):
def __init__(self, upstream: Stream[T], func: Callable[[T], Any], concurrency: int):
def __init__(
self, upstream: Stream[T], func: Callable[[T], Any], concurrency: int
) -> None:
super().__init__(upstream)
self.func = func
self.concurrency = concurrency
Expand All @@ -375,7 +377,7 @@ def __init__(
size: Optional[int],
seconds: float,
by: Optional[Callable[[T], Any]],
):
) -> None:
super().__init__(upstream)
self.size = size
self.seconds = seconds
Expand All @@ -395,7 +397,9 @@ def accept(self, visitor: "Visitor[V]") -> V:


class MapStream(DownStream[T, U]):
def __init__(self, upstream: Stream[T], func: Callable[[T], U], concurrency: int):
def __init__(
self, upstream: Stream[T], func: Callable[[T], U], concurrency: int
) -> None:
super().__init__(upstream)
self.func = func
self.concurrency = concurrency
Expand All @@ -405,7 +409,7 @@ def accept(self, visitor: "Visitor[V]") -> V:


class ObserveStream(DownStream[T, T]):
def __init__(self, upstream: Stream[T], what: str, colored: bool):
def __init__(self, upstream: Stream[T], what: str, colored: bool) -> None:
super().__init__(upstream)
self.what = what
self.colored = colored
Expand All @@ -415,7 +419,7 @@ def accept(self, visitor: "Visitor[V]") -> V:


class SlowStream(DownStream[T, T]):
def __init__(self, upstream: Stream[T], frequency: float):
def __init__(self, upstream: Stream[T], frequency: float) -> None:
super().__init__(upstream)
self.frequency = frequency

Expand Down
2 changes: 1 addition & 1 deletion streamable/visitors/explanation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __init__(
colored: bool = False,
margin_step: int = 2,
header: str = "Stream's plan:",
):
) -> None:
self.colored = colored
self.header = header
self.margin_step = margin_step
Expand Down
2 changes: 1 addition & 1 deletion tests/test_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def test_flatten_with_exception(
concurrency: int,
) -> None:
class odd_iterable(Iterable[int]):
def __init__(self, i, pair_exception: Type[Exception]):
def __init__(self, i, pair_exception: Type[Exception]) -> None:
self.i = i
self.pair_exception = pair_exception

Expand Down

0 comments on commit 3dc3095

Please sign in to comment.