Skip to content

Commit

Permalink
Move the remaining setup.cfg configuration to pyproject.toml (PR #103)
Browse files Browse the repository at this point in the history
  • Loading branch information
vxgmichel authored May 6, 2024
2 parents 408b348 + 540cdf1 commit 68ee532
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 39 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length = 88
ignore = F401, F403, E731, W503, E501, E203, E704
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/ambv/black
rev: 23.3.0
rev: 24.3.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
Expand All @@ -33,4 +33,4 @@ repos:
rev: v0.0.272
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix, --ignore, "E501,F403" ]
args: [ --fix, --exit-non-zero-on-fix]
1 change: 1 addition & 0 deletions aiostream/aiter_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for asynchronous iteration."""

from __future__ import annotations

import sys
Expand Down
16 changes: 6 additions & 10 deletions aiostream/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Core objects for stream operators."""

from __future__ import annotations

import inspect
Expand Down Expand Up @@ -258,28 +259,23 @@ def streamcontext(aiterable: AsyncIterable[T]) -> Streamer[T]:


class OperatorType(Protocol[P, T]):
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> Stream[T]:
...
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> Stream[T]: ...

def raw(self, *args: P.args, **kwargs: P.kwargs) -> AsyncIterator[T]:
...
def raw(self, *args: P.args, **kwargs: P.kwargs) -> AsyncIterator[T]: ...


class PipableOperatorType(Protocol[A, P, T]):
def __call__(
self, source: AsyncIterable[A], /, *args: P.args, **kwargs: P.kwargs
) -> Stream[T]:
...
) -> Stream[T]: ...

def raw(
self, source: AsyncIterable[A], /, *args: P.args, **kwargs: P.kwargs
) -> AsyncIterator[T]:
...
) -> AsyncIterator[T]: ...

def pipe(
self, *args: P.args, **kwargs: P.kwargs
) -> Callable[[AsyncIterable[A]], Stream[T]]:
...
) -> Callable[[AsyncIterable[A]], Stream[T]]: ...


# Operator decorator
Expand Down
1 change: 1 addition & 0 deletions aiostream/manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Provide a context to easily manage several streamers running
concurrently.
"""

from __future__ import annotations

import asyncio
Expand Down
1 change: 1 addition & 0 deletions aiostream/pipe.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Gather the pipe operators."""

from __future__ import annotations

from . import stream
Expand Down
7 changes: 4 additions & 3 deletions aiostream/stream/advanced.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Advanced operators (to deal with streams of higher order) ."""

from __future__ import annotations

from typing import AsyncIterator, AsyncIterable, TypeVar, Union, cast
Expand Down Expand Up @@ -46,9 +47,9 @@ async def base_combine(

# Safe context
async with StreamerManager[Union[AsyncIterable[T], T]]() as manager:
main_streamer: Streamer[
AsyncIterable[T] | T
] | None = await manager.enter_and_create_task(source)
main_streamer: Streamer[AsyncIterable[T] | T] | None = (
await manager.enter_and_create_task(source)
)

# Loop over events
while manager.tasks:
Expand Down
1 change: 1 addition & 0 deletions aiostream/stream/aggregate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Aggregation operators."""

from __future__ import annotations

import asyncio
Expand Down
10 changes: 4 additions & 6 deletions aiostream/stream/combine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Combination operators."""

from __future__ import annotations

import asyncio
Expand Down Expand Up @@ -93,18 +94,15 @@ async def zip(


class SmapCallable(Protocol[X, Y]):
def __call__(self, arg: X, /, *args: X) -> Y:
...
def __call__(self, arg: X, /, *args: X) -> Y: ...


class AmapCallable(Protocol[X, Y]):
async def __call__(self, arg: X, /, *args: X) -> Y:
...
async def __call__(self, arg: X, /, *args: X) -> Y: ...


class MapCallable(Protocol[X, Y]):
def __call__(self, arg: X, /, *args: X) -> Awaitable[Y] | Y:
...
def __call__(self, arg: X, /, *args: X) -> Awaitable[Y] | Y: ...


@pipable_operator
Expand Down
7 changes: 3 additions & 4 deletions aiostream/stream/create.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Non-pipable creation operators."""

from __future__ import annotations

import sys
Expand Down Expand Up @@ -96,13 +97,11 @@ async def just(value: T) -> AsyncIterator[T]:


class SyncCallable(Protocol[P, Y]):
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> Y:
...
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> Y: ...


class AsyncCallable(Protocol[P, Y]):
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> Awaitable[Y]:
...
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> Awaitable[Y]: ...


@operator
Expand Down
1 change: 1 addition & 0 deletions aiostream/stream/misc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Extra operators."""

from __future__ import annotations

import asyncio
Expand Down
1 change: 1 addition & 0 deletions aiostream/stream/select.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Selection operators."""

from __future__ import annotations

import asyncio
Expand Down
1 change: 1 addition & 0 deletions aiostream/stream/time.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Time-specific operators."""

from __future__ import annotations
import asyncio

Expand Down
6 changes: 2 additions & 4 deletions aiostream/stream/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ async def enumerate(


class AsyncStarmapCallable(Protocol[X, Y]):
def __call__(self, arg: X, /, *args: X) -> Awaitable[Y]:
...
def __call__(self, arg: X, /, *args: X) -> Awaitable[Y]: ...


class SyncStarmapCallable(Protocol[X, Y]):
def __call__(self, arg: X, /, *args: X) -> Y:
...
def __call__(self, arg: X, /, *args: X) -> Y: ...


@pipable_operator
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@ ignore = ["aiostream/test_utils.py"]
[tool.mypy]
strict = true
packages = ["aiostream", "examples"]

[tool.black]
line-length = 88
target_version = ["py38", "py39", "py310", "py311", "py312"]

[tool.coverage.report]
exclude_also = ["if TYPE_CHECKING:"]

[tool.ruff]
ignore = ["E501", "F403"]
9 changes: 0 additions & 9 deletions setup.cfg

This file was deleted.

0 comments on commit 68ee532

Please sign in to comment.