diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 86b836c..496014e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: test: strategy: matrix: - py_ver: ['3.8', '3.9', '3.10', '3.11'] + py_ver: ['3.8', '3.9', '3.10', '3.11', '3.12'] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/pyproject.toml b/pyproject.toml index 5a7d7bf..10a37c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "tarina" -version = "0.4.4" +version = "0.5.0" description = "A collection of common utils for Arclet" authors = [ {name = "RF-Tar-Railt", email = "rf_tar_railt@qq.com"}, diff --git a/src/tarina/_lru_c.pyi b/src/tarina/_lru_c.pyi index 3099d6e..368d3b3 100644 --- a/src/tarina/_lru_c.pyi +++ b/src/tarina/_lru_c.pyi @@ -5,7 +5,10 @@ _VT = TypeVar("_VT") _T = TypeVar("_T") class LRU(Generic[_KT, _VT]): - def __init__(self, size: int, callback: Callable[[_KT, _VT], Any] | None = ...) -> None: ... + @overload + def __init__(self, size: int, callback: None = None) -> None: ... + @overload + def __init__(self, size: int, callback: Callable[[_KT, _VT], Any]) -> None: ... def clear(self) -> None: ... @overload def get(self, key: _KT) -> _VT | None: ... diff --git a/src/tarina/_lru_py.py b/src/tarina/_lru_py.py index 8eb7683..c820279 100644 --- a/src/tarina/_lru_py.py +++ b/src/tarina/_lru_py.py @@ -28,7 +28,7 @@ def get(self, key: _KT) -> _VT | None: ... @overload def get(self, key: _KT, instead: _VT | _T) -> _VT | _T: ... - def get(self, key: _KT, instead: _VT | _T | None = None): + def get(self, key: _KT, instead: _VT | _T | None = None)-> _VT | _T | None: if key in self.__cache: self.__cache.move_to_end(key, last=False) return self.__cache[key] @@ -61,7 +61,7 @@ def pop(self, key: _KT) -> _VT | None: ... @overload def pop(self, key: _KT, default: _VT | _T) -> _VT | _T: ... - def pop(self, key: _KT, default: _VT | _T | None = None): + def pop(self, key: _KT, default: _VT | _T | None = None)-> _VT | _T: return self.__cache.pop(key, default) def popitem(self, least_recent: bool = True) -> tuple[_KT, _VT]: diff --git a/src/tarina/lang/__main__.py b/src/tarina/lang/__main__.py index 679deab..ccae5a2 100644 --- a/src/tarina/lang/__main__.py +++ b/src/tarina/lang/__main__.py @@ -186,7 +186,7 @@ def delete(args): def main(): - parser = ArgumentParser(description="tarina.lang CLI tool") + parser = ArgumentParser(description="tarina-lang CLI tool") subparsers = parser.add_subparsers(dest="command") diff --git a/src/tarina/lru.pyi b/src/tarina/lru.pyi index edabedd..f630e1e 100644 --- a/src/tarina/lru.pyi +++ b/src/tarina/lru.pyi @@ -5,7 +5,10 @@ _VT = TypeVar("_VT") _T = TypeVar("_T") class LRU(Generic[_KT, _VT]): - def __init__(self, size: int, callback: Callable[[_KT, _VT], Any] | None = ...) -> None: ... + @overload + def __init__(self, size: int, callback: None = None) -> None: ... + @overload + def __init__(self, size: int, callback: Callable[[_KT, _VT], Any]) -> None: ... def clear(self) -> None: ... @overload def get(self, key: _KT) -> _VT: ...