Skip to content

Commit

Permalink
typing ext
Browse files Browse the repository at this point in the history
  • Loading branch information
kszucs committed Jul 30, 2024
1 parent 6dfe7dc commit 0671426
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
poetry-version: ["1.2.2", "1.7.1"]
python-version: ["3.10", "3.11", "3.12"]
poetry-version: ["1.8"]
os: [ubuntu-22.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ Python Pattern Matching
-----------------------


Python support follows https://numpy.org/neps/nep-0029-deprecation_policy.html
3 changes: 1 addition & 2 deletions koerce/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
Callable,
Optional,
)
from typing_extensions import GenericMeta
from typing_extensions import GenericMeta, get_original_bases
from .utils import (
get_type_origin,
get_type_boundvars,
get_type_args,
get_type_params,
get_original_bases,
RewindableIterator,
)
from abc import abstractmethod
Expand Down
4 changes: 1 addition & 3 deletions koerce/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from __future__ import annotations
import pytest

from typing import ForwardRef, Generic, Optional, Union, List, Dict

from typing_extensions import TypeVar
from typing import ForwardRef, Generic, Optional, Union, List, Dict, TypeVar
from koerce.utils import get_type_params, get_type_boundvars, get_type_hints


Expand Down
8 changes: 4 additions & 4 deletions koerce/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import sys
import typing
import itertools
from typing import Any, TypeVar, Optional
from typing_extensions import get_original_bases
from itertools import tee


get_type_args = typing.get_args
get_type_origin = typing.get_origin
Expand Down Expand Up @@ -171,8 +171,8 @@ def rewind(self):
"""Rewind the iterator to the last checkpoint."""
if self._checkpoint is None:
raise ValueError("No checkpoint to rewind to.")
self._iterator, self._checkpoint = tee(self._checkpoint)
self._iterator, self._checkpoint = itertools.tee(self._checkpoint)

def checkpoint(self):
"""Create a checkpoint of the current iterator state."""
self._iterator, self._checkpoint = tee(self._iterator)
self._iterator, self._checkpoint = itertools.tee(self._iterator)
13 changes: 12 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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ exclude = ["koerce/**/*.py"]

[tool.poetry.dependencies]
python = ">=3.8"
typing-extensions = "^4.12.2"


[tool.poetry.dev-dependencies]
Expand Down

0 comments on commit 0671426

Please sign in to comment.