diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index abd3990..0fde4a5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,9 +6,10 @@ jobs: test: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.10", "3.11", "3.12", "pypy3.10"] + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.6", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10"] steps: - uses: actions/checkout@v4 diff --git a/pyproject.toml b/pyproject.toml index 413147e..84c61dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [project] name = "literal-dict" -version = "0.0.1.dev1" +version = "1.0.0" description = "Use JavaScript-like object definition syntax in Python" authors = [{ name = "Muspi Merol", email = "me@muspimerol.site" }] dependencies = [] -requires-python = ">=3.10" +requires-python = ">=3.6" readme = "README.md" license = { text = "MIT" } diff --git a/src/literal_dict/__init__.py b/src/literal_dict.py similarity index 76% rename from src/literal_dict/__init__.py rename to src/literal_dict.py index 8af9a7d..94e5ec9 100644 --- a/src/literal_dict/__init__.py +++ b/src/literal_dict.py @@ -1,15 +1,15 @@ from inspect import currentframe -from typing import Generic, Mapping, Sequence, TypeVar, cast +from typing import Generic, Mapping, Sequence, Type, TypeVar, Union, cast T = TypeVar("T") D = TypeVar("D", bound=Mapping) class DictBuilder(Generic[D]): - def __init__(self, mapping_type: type[D] = dict): + def __init__(self, mapping_type: Type[D] = dict): self.mapping_type = mapping_type - def __getitem__(self, args: slice | T | Sequence[slice | T]) -> D: + def __getitem__(self, args: Union[slice, T, Sequence[Union[slice, T]]]) -> D: if not isinstance(args, tuple): args = (args,) # type: ignore @@ -20,7 +20,7 @@ def __getitem__(self, args: slice | T | Sequence[slice | T]) -> D: assert caller_frame, "Unable to get the caller's frame." obj = {} - for arg in cast(Sequence[slice | T], args): + for arg in cast(Sequence[Union[slice, T]], args): if isinstance(arg, slice): assert isinstance(arg.start, str), "Key must be a string" obj[arg.start] = arg.stop