diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index acabea6..99ba088 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.12", "3.13"] + python-version: ["3.12", "3.13", "3.14"] os: [ubuntu-latest, windows-latest, macos-latest] steps: - uses: actions/checkout@v4 diff --git a/pyproject.toml b/pyproject.toml index b6d8913..526b96a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "itrx" -version = "0.1.5" +version = "0.1.6" description = "A chainable iterator adapter" readme = "README.md" authors = [ @@ -8,6 +8,13 @@ authors = [ ] license-files = ["LICENCE.md"] requires-python = ">=3.12" +classifiers = [ + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] dependencies = [] [project.urls] @@ -39,7 +46,7 @@ addopts = "--cov=src/itrx --cov-report html --cov-fail-under=100 --doctest-modul line-length = 120 [tool.ruff.lint] -select = ["B", "C", "D103", "E", "F", "I", "SIM"] +select = ["ARG", "B", "C", "D103", "E", "F", "I", "N", "PERF", "PTH", "RET", "RUF", "SIM", "UP", "W"] ignore = ["E501"] [tool.ruff.lint.per-file-ignores] diff --git a/src/itrx/itr.py b/src/itrx/itr.py index 49608b4..8232eae 100644 --- a/src/itrx/itr.py +++ b/src/itrx/itr.py @@ -1,6 +1,6 @@ import itertools -from collections.abc import Generator, Iterable -from typing import Callable, Iterator, TypeVar, overload +from collections.abc import Callable, Generator, Iterable, Iterator +from typing import TypeVar, overload T = TypeVar("T") _CollectT = TypeVar("_CollectT") # General item type for collected containers @@ -629,7 +629,7 @@ def unzip[U, V](self) -> tuple["Itr[U]", "Itr[V]"]: """ # TODO express that T is tuple[U, V] it1, it2 = itertools.tee(self._it, 2) - return Itr((x[0] for x in it1)), Itr((x[1] for x in it2)) # type: ignore[index] + return Itr(x[0] for x in it1), Itr(x[1] for x in it2) # type: ignore[index] def value_counts(self) -> "Itr[tuple[T, int]]": """ diff --git a/src/scripts/introspect.py b/src/scripts/introspect.py index 0837a08..e228e69 100644 --- a/src/scripts/introspect.py +++ b/src/scripts/introspect.py @@ -21,7 +21,7 @@ def generate_apidoc(cls: type, file: Path) -> None: .map(lambda m: (m, getattr(Itr, m).__doc__)) ) - with open(file, "w") as fd: + with file.open("w") as fd: fd.write(f"# `Itr` v{itrx_version} class documentation\n") fd.write(Itr.__doc__ or "") fd.write("## Public methods\n") diff --git a/src/test/test_combine_split.py b/src/test/test_combine_split.py index 30d5bf3..33fa155 100644 --- a/src/test/test_combine_split.py +++ b/src/test/test_combine_split.py @@ -127,7 +127,7 @@ def test_partition_all_false() -> None: def test_partition_empty() -> None: it: Itr[int] = Itr([]) - a, b = it.partition(lambda x: True) + a, b = it.partition(lambda _: True) assert a.collect() == () assert b.collect() == () diff --git a/src/test/test_transform_filter.py b/src/test/test_transform_filter.py index a776919..2fbcf1d 100644 --- a/src/test/test_transform_filter.py +++ b/src/test/test_transform_filter.py @@ -77,7 +77,7 @@ def test_skip_while_all_skipped() -> None: def test_skip_while_empty_iterable() -> None: - it = Itr[str]([]).skip_while(lambda x: True) + it = Itr[str]([]).skip_while(lambda _: True) assert it.collect() == () @@ -106,7 +106,7 @@ def test_take_while_none_true() -> None: def test_take_while_empty_iterable() -> None: it = Itr[float]([]) - taken = it.take_while(lambda x: True) + taken = it.take_while(lambda _: True) assert taken.collect() == ()