Skip to content

Commit

Permalink
Add coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrattli committed Feb 22, 2022
1 parent 57d8aad commit 388a237
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pythonpackage.yml
Expand Up @@ -60,11 +60,11 @@ jobs:
- name: Run coverage tests
run: |
coverage run -m pytest
poetry run coverage run -m pytest
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
run: |
coveralls
poetry run coveralls
20 changes: 12 additions & 8 deletions examples/asyncio/toasyncgenerator.py
@@ -1,19 +1,21 @@
import asyncio
from asyncio import Future
from typing import Coroutine, TypeVar, Any, List

import rx
from rx import operators as ops
from rx.scheduler.eventloop import AsyncIOScheduler
from rx.core import Observable
from rx.core import Observable, Notification

_T = TypeVar("_T")

def to_async_generator(sentinel=None):
loop = asyncio.get_event_loop()
future = Future()
notifications = []

def _to_async_generator(source: Observable):
def to_async_generator(sentinel: Any = None) -> Coroutine[Any, Any, Future[Any]]:
loop = asyncio.get_event_loop()
future = loop.create_future()
notifications: List[Notification[Any]] = []

def _to_async_generator(source: Observable[_T]):
def feeder():
nonlocal future

Expand All @@ -29,7 +31,7 @@ def feeder():
else:
future.set_result(notification.value)

def on_next(value):
def on_next(value: _T) -> None:
"""Takes on_next values and appends them to the notification queue"""

notifications.append(value)
Expand All @@ -45,7 +47,9 @@ async def gen():
future = Future()

return future

return gen

return _to_async_generator


Expand All @@ -69,5 +73,5 @@ def main():
loop.run_until_complete(go(loop))


if __name__ == '__main__':
if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions examples/asyncio/toasynciterator.py
Expand Up @@ -6,6 +6,7 @@
from rx import Observable
from rx.scheduler.eventloop import AsyncIOScheduler

from typing import Awaitable

def to_async_iterable():
def _to_async_iterable(source: Observable):
Expand Down
111 changes: 110 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Expand Up @@ -40,6 +40,7 @@ isort = "^5.10.1"
pyright = "^0.0.13"
mypy = "^0.931"
flake8 = "^4.0.1"
coveralls = "^3.3.1"

[tool.black]
line-length = 88
Expand Down

0 comments on commit 388a237

Please sign in to comment.