Skip to content

Commit

Permalink
Merge f623c40 into 430cfab
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrattli committed Jun 18, 2022
2 parents 430cfab + f623c40 commit 9e85169
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Expand Up @@ -26,7 +26,7 @@ repos:
language: node
pass_filenames: false
types: [python]
additional_dependencies: ["pyright@1.1.235"]
additional_dependencies: ["pyright@1.1.254"]
repo: local
- hooks:
- id: mypy
Expand Down
2 changes: 1 addition & 1 deletion reactivex/internal/utils.py
Expand Up @@ -45,7 +45,7 @@ def alias(name: str, doc: str, fun: Callable[_P, _T]) -> Callable[_P, _T]:
alias_.__kwdefaults__ = _fun.__kwdefaults__
alias_.__doc__ = doc
alias_.__annotations__ = _fun.__annotations__
return alias_
return cast(Callable[_P, _T], alias_)


class NotSet:
Expand Down
2 changes: 1 addition & 1 deletion reactivex/observable/fromfuture.py
Expand Up @@ -38,7 +38,7 @@ def done(future: "Future[_T]") -> None:
future.add_done_callback(done)

def dispose() -> None:
if future and future.cancel:
if future:
future.cancel()

return Disposable(dispose)
Expand Down
2 changes: 1 addition & 1 deletion reactivex/operators/__init__.py
Expand Up @@ -2559,7 +2559,7 @@ def scan(

@overload
def scan(
accumulator: Accumulator[_TState, _T], seed: _TState
accumulator: Accumulator[_TState, _T], seed: Union[_TState, Type[NotSet]]
) -> Callable[[Observable[_T]], Observable[_TState]]:
...

Expand Down
10 changes: 5 additions & 5 deletions reactivex/operators/_groupbyuntil.py
Expand Up @@ -119,7 +119,7 @@ def on_next(x: _T) -> None:
sad = SingleAssignmentDisposable()
group_disposable.add(sad)

def expire():
def expire() -> None:
if writers[key]:
del writers[key]
writer.on_completed()
Expand All @@ -134,12 +134,12 @@ def on_error(exn: Exception) -> None:
wrt.on_error(exn)
observer.on_error(exn)

def on_completed():
def on_completed() -> None:
expire()

sad.disposable = duration.pipe(ops.take(1)).subscribe(
on_next, on_error, on_completed, scheduler=scheduler
)
sad.disposable = duration.pipe(
ops.take(1),
).subscribe(on_next, on_error, on_completed, scheduler=scheduler)

try:
element = element_mapper_(x)
Expand Down
4 changes: 2 additions & 2 deletions reactivex/operators/_max.py
@@ -1,4 +1,4 @@
from typing import Callable, Optional, TypeVar
from typing import Callable, Optional, TypeVar, cast

from reactivex import Observable, compose
from reactivex import operators as ops
Expand Down Expand Up @@ -29,7 +29,7 @@ def max_(
maximum element in the source sequence.
"""
return compose(
ops.max_by(identity, comparer),
ops.max_by(cast(Callable[[_T], _T], identity), comparer),
ops.map(first_only),
)

Expand Down
4 changes: 2 additions & 2 deletions reactivex/operators/_min.py
@@ -1,4 +1,4 @@
from typing import Callable, List, Optional, TypeVar
from typing import Callable, List, Optional, TypeVar, cast

from reactivex import Observable, compose
from reactivex import operators as ops
Expand Down Expand Up @@ -36,7 +36,7 @@ def min_(
with the minimum element in the source sequence.
"""
return compose(
ops.min_by(identity, comparer),
ops.min_by(cast(Callable[[_T], _T], identity), comparer),
ops.map(first_only),
)

Expand Down
2 changes: 1 addition & 1 deletion reactivex/operators/_reduce.py
Expand Up @@ -43,7 +43,7 @@ def reduce_(
)

return compose(
ops.scan(accumulator),
ops.scan(cast(Accumulator[_T, _T], accumulator)),
ops.last(),
)

Expand Down
2 changes: 1 addition & 1 deletion reactivex/operators/_throttlefirst.py
Expand Up @@ -13,7 +13,7 @@ def throttle_first_(
def throttle_first(source: Observable[_T]) -> Observable[_T]:
"""Returns an observable that emits only the first item emitted
by the source Observable during sequential time windows of a
specifiedduration.
specified duration.
Args:
source: Source observable to throttle.
Expand Down
3 changes: 1 addition & 2 deletions reactivex/scheduler/mainloop/qtscheduler.py
Expand Up @@ -28,8 +28,7 @@ def __init__(self, qtcore: Any):
"""
super().__init__()
self._qtcore = qtcore
timer_class: Any = self._qtcore.QTimer
self._periodic_timers: Set[timer_class] = set()
self._periodic_timers: Set[Any] = set()

def schedule(
self, action: typing.ScheduledAction[_TState], state: Optional[_TState] = None
Expand Down

0 comments on commit 9e85169

Please sign in to comment.