Skip to content

Commit

Permalink
update mypy and bugbear
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshix-1 committed Dec 23, 2024
1 parent 8454210 commit f3511ab
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ coverage==7.*
# typechecking
# pyre-check==0.9.*
# pyright==1.*
mypy==1.13.*
mypy==1.14.*
typing-extensions==4.*
pytype==2024.10.11

Expand All @@ -21,7 +21,7 @@ bandit[toml]==1.*
pylint==3.3.*
flake8==7.1.*
flake8-builtins==2.5.*
flake8-bugbear==24.10.31
flake8-bugbear==24.12.12
flake8-comprehensions==3.*
flake8-docstrings==1.*
flake8-no-pep420==2.*
Expand Down
11 changes: 8 additions & 3 deletions typed_stream/_impl/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ def __getitem__(self, item: int, /) -> T:
"""Nobody inspects the spammish repetition."""

@typing.overload
def __getitem__(self, item: slice, /) -> streamable.StreamableSequence[T]:
def __getitem__(
self, item: slice[int | None, int | None, int | None], / # noqa: W504
) -> streamable.StreamableSequence[T]:
"""Nobody inspects the spammish repetition."""

def __getitem__(
self, item: slice | int, / # noqa: W504
self,
item: slice[int | None, int | None, int | None] | int,
/, # noqa: W504
) -> streamable.StreamableSequence[T] | T:
"""Finish the stream by collecting.
Expand Down Expand Up @@ -396,7 +400,8 @@ def chunk(self, size: int) -> Stream[tuple[T, ...]]:
"""
return self._finish(
Stream(
itertools.batched(self._data, size),
# add strict=False if min version is 3.13 (is the default)
itertools.batched(self._data, size), # noqa: B911
)
)

Expand Down
8 changes: 6 additions & 2 deletions typed_stream/streamable.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,16 @@ def __getitem__(self, item: SupportsIndex, /) -> T:
"""Nobody inspects the spammish repetition."""

@overload
def __getitem__(self, item: slice, /) -> StreamableSequence[T]:
def __getitem__(
self, item: slice[int | None, int | None, int | None], / # noqa: W504
) -> StreamableSequence[T]:
"""Nobody inspects the spammish repetition."""

@override
def __getitem__(
self, item: slice | SupportsIndex, / # noqa: W504
self,
item: slice[int | None, int | None, int | None] | SupportsIndex,
/, # noqa: W504
) -> StreamableSequence[T] | T:
"""Finish the stream by collecting."""
if isinstance(item, slice):
Expand Down

0 comments on commit f3511ab

Please sign in to comment.