Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:

- name: Install dependencies
run: |
pip install --upgrade pip
pip install poetry
poetry install

Expand Down Expand Up @@ -73,7 +74,7 @@ jobs:
python-version: "3.12"

- name: Cache Poetry
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
Expand Down
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,33 @@ repos:
- --remove-all-unused-imports
- --in-place
id: autoflake
repo: https://github.com/humitos/mirrors-autoflake
rev: v1.1
repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
- hooks:
- id: isort
repo: https://github.com/timothycrosley/isort
rev: 5.10.1
rev: 5.13.2
- hooks:
- id: black
repo: https://github.com/psf/black
rev: 22.3.0
rev: 24.10.0
- hooks:
- id: flake8
exclude: (^docs/|^examples/|^notebooks/|^tests/)
repo: https://github.com/PyCQA/flake8
rev: 3.9.2
rev: 7.1.1
- hooks:
- id: pyright
name: pyright
entry: pyright
language: node
pass_filenames: false
types: [python]
additional_dependencies: ["[email protected].286"]
additional_dependencies: ["[email protected].388"]
repo: local
- hooks:
- id: mypy
exclude: (^docs/|^examples/|^notebooks/|^tests/|^reactivex/operators/_\w.*\.py$)
repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.942
rev: v1.13.0

2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ReactiveX for Python v4
For v3.X please go to the `v3 branch
<https://github.com/ReactiveX/RxPY/tree/release/v3.2.x>`_.

ReactiveX for Python v4.x runs on `Python <http://www.python.org/>`_ 3.7 or above. To
ReactiveX for Python v4.x runs on `Python <http://www.python.org/>`_ 3.8 or above. To
install:

.. code:: console
Expand Down
1 change: 1 addition & 0 deletions examples/autocomplete/bottle_autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Requires besides bottle and gevent also the geventwebsocket pip package
- Instead of a future we create the inner stream for flat_map_latest manually
"""

import json

import gevent
Expand Down
1,080 changes: 544 additions & 536 deletions poetry.lock

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -28,10 +27,11 @@ packages = [
]

[tool.poetry.dependencies]
python = ">= 3.7, < 4.0"
python = ">= 3.8, < 4.0"
typing-extensions = "^4.1.1"

[tool.poetry.dev-dependencies]
[tool.poetry.group.test.dependencies]
pyyaml = "6.0.2"
pytest-asyncio = "^0.18.1"
pytest = "^7.0.1"
coverage = "^6.3.2"
Expand Down Expand Up @@ -75,4 +75,3 @@ asyncio_mode = "strict"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

31 changes: 13 additions & 18 deletions reactivex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,22 +185,19 @@ def create(subscribe: typing.Subscription[_T]) -> Observable[_T]:
@overload
def combine_latest(
__a: Observable[_A], __b: Observable[_B]
) -> Observable[Tuple[_A, _B]]:
...
) -> Observable[Tuple[_A, _B]]: ...


@overload
def combine_latest(
__a: Observable[_A], __b: Observable[_B], __c: Observable[_C]
) -> Observable[Tuple[_A, _B, _C]]:
...
) -> Observable[Tuple[_A, _B, _C]]: ...


@overload
def combine_latest(
__a: Observable[_A], __b: Observable[_B], __c: Observable[_C], __d: Observable[_D]
) -> Observable[Tuple[_A, _B, _C, _D]]:
...
) -> Observable[Tuple[_A, _B, _C, _D]]: ...


def combine_latest(*__sources: Observable[Any]) -> Observable[Any]:
Expand Down Expand Up @@ -289,7 +286,7 @@ def concat_with_iterable(sources: Iterable[Observable[_T]]) -> Observable[_T]:


def defer(
factory: Callable[[abc.SchedulerBase], Union[Observable[_T], "Future[_T]"]]
factory: Callable[[abc.SchedulerBase], Union[Observable[_T], "Future[_T]"]],
) -> Observable[_T]:
"""Returns an observable sequence that invokes the specified
factory function whenever a new observer subscribes.
Expand Down Expand Up @@ -382,22 +379,21 @@ def for_in(


@overload
def fork_join(__a: Observable[_A], __b: Observable[_B]) -> Observable[Tuple[_A, _B]]:
...
def fork_join(
__a: Observable[_A], __b: Observable[_B]
) -> Observable[Tuple[_A, _B]]: ...


@overload
def fork_join(
__a: Observable[_A], __b: Observable[_B], __c: Observable[_C]
) -> Observable[Tuple[_A, _B, _C]]:
...
) -> Observable[Tuple[_A, _B, _C]]: ...


@overload
def fork_join(
__a: Observable[_A], __b: Observable[_B], __c: Observable[_C], __d: Observable[_D]
) -> Observable[Tuple[_A, _B, _C, _D]]:
...
) -> Observable[Tuple[_A, _B, _C, _D]]: ...


@overload
Expand All @@ -407,8 +403,7 @@ def fork_join(
__c: Observable[_C],
__d: Observable[_D],
__e: Observable[_E],
) -> Observable[Tuple[_A, _B, _C, _D, _E]]:
...
) -> Observable[Tuple[_A, _B, _C, _D, _E]]: ...


def fork_join(*sources: Observable[Any]) -> Observable[Any]:
Expand Down Expand Up @@ -920,7 +915,7 @@ def of(*args: _T) -> Observable[_T]:
def on_error_resume_next(
*sources: Union[
Observable[_T], "Future[_T]", Callable[[Optional[Exception]], Observable[_T]]
]
],
) -> Observable[_T]:
"""Continues an observable sequence that is terminated normally or
by an exception with the next observable sequence.
Expand Down Expand Up @@ -1213,8 +1208,8 @@ def to_async(


def using(
resource_factory: Callable[[], abc.DisposableBase],
observable_factory: Callable[[abc.DisposableBase], Observable[_T]],
resource_factory: Callable[[], Optional[abc.DisposableBase]],
observable_factory: Callable[[Optional[abc.DisposableBase]], Observable[_T]],
) -> Observable[_T]:
"""Constructs an observable sequence that depends on a resource
object, whose lifetime is tied to the resulting observable
Expand Down
2 changes: 1 addition & 1 deletion reactivex/disposable/multipleassignmentdisposable.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def set_disposable(self, value: DisposableBase) -> None:
if not should_dispose:
self.current = value

if should_dispose and value is not None:
if should_dispose:
value.dispose()

disposable = property(get_disposable, set_disposable)
Expand Down
2 changes: 1 addition & 1 deletion reactivex/disposable/serialdisposable.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def set_disposable(self, value: abc.DisposableBase) -> None:
if old is not None:
old.dispose()

if should_dispose and value is not None:
if should_dispose:
value.dispose()

disposable = property(get_disposable, set_disposable)
Expand Down
4 changes: 2 additions & 2 deletions reactivex/internal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def alias(name: str, doc: str, fun: Callable[_P, _T]) -> Callable[_P, _T]:
args = (_fun.__code__, _fun.__globals__)
kwargs = {"name": name, "argdefs": _fun.__defaults__, "closure": _fun.__closure__}
alias_ = FunctionType(*args, **kwargs) # type: ignore
alias_ = update_wrapper(alias_, _fun)
alias_.__kwdefaults__ = _fun.__kwdefaults__
alias_ = update_wrapper(alias_, _fun) # type: ignore
alias_.__kwdefaults__ = _fun.__kwdefaults__ # type: ignore
alias_.__doc__ = doc
alias_.__annotations__ = _fun.__annotations__
return cast(Callable[_P, _T], alias_)
Expand Down
2 changes: 1 addition & 1 deletion reactivex/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Notification(Generic[_T]):
def __init__(self) -> None:
"""Default constructor used by derived types."""
self.has_value = False
self.value: Optional[_T] = None
self.value: _T
self.kind: str = ""

def accept(
Expand Down
1 change: 0 additions & 1 deletion reactivex/observable/catch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


def catch_with_iterable_(sources: Iterable[Observable[_T]]) -> Observable[_T]:

"""Continues an observable sequence that is terminated by an
exception with the next observable sequence.

Expand Down
2 changes: 1 addition & 1 deletion reactivex/observable/groupedobservable.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def subscribe(
underlying_observable.subscribe(observer, scheduler=scheduler),
)

self.underlying_observable = (
self.underlying_observable: Observable[_T] = (
underlying_observable if not merged_disposable else Observable(subscribe)
)

Expand Down
21 changes: 7 additions & 14 deletions reactivex/observable/observable.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,22 @@ def set_disposable(
return Disposable(auto_detach_observer.dispose)

@overload
def pipe(self, __op1: Callable[[Observable[_T_out]], _A]) -> _A:
...
def pipe(self, __op1: Callable[[Observable[_T_out]], _A]) -> _A: ...

@overload
def pipe(
self,
__op1: Callable[[Observable[_T_out]], _A],
__op2: Callable[[_A], _B],
) -> _B:
...
) -> _B: ...

@overload
def pipe(
self,
__op1: Callable[[Observable[_T_out]], _A],
__op2: Callable[[_A], _B],
__op3: Callable[[_B], _C],
) -> _C:
...
) -> _C: ...

@overload
def pipe(
Expand All @@ -174,8 +171,7 @@ def pipe(
__op2: Callable[[_A], _B],
__op3: Callable[[_B], _C],
__op4: Callable[[_C], _D],
) -> _D:
...
) -> _D: ...

@overload
def pipe(
Expand All @@ -185,8 +181,7 @@ def pipe(
__op3: Callable[[_B], _C],
__op4: Callable[[_C], _D],
__op5: Callable[[_D], _E],
) -> _E:
...
) -> _E: ...

@overload
def pipe(
Expand All @@ -197,8 +192,7 @@ def pipe(
__op4: Callable[[_C], _D],
__op5: Callable[[_D], _E],
__op6: Callable[[_E], _F],
) -> _F:
...
) -> _F: ...

@overload
def pipe(
Expand All @@ -210,8 +204,7 @@ def pipe(
__op5: Callable[[_D], _E],
__op6: Callable[[_E], _F],
__op7: Callable[[_F], _G],
) -> _G:
...
) -> _G: ...

def pipe(self, *operators: Callable[[Any], Any]) -> Any:
"""Compose multiple operators left to right.
Expand Down
4 changes: 2 additions & 2 deletions reactivex/observable/using.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@


def using_(
resource_factory: Callable[[], abc.DisposableBase],
observable_factory: Callable[[abc.DisposableBase], Observable[_T]],
resource_factory: Callable[[], Optional[abc.DisposableBase]],
observable_factory: Callable[[Optional[abc.DisposableBase]], Observable[_T]],
) -> Observable[_T]:
"""Constructs an observable sequence that depends on a resource
object, whose lifetime is tied to the resulting observable
Expand Down
Loading
Loading