From 10924839517c91e1f5dc52d9692357ff4e016024 Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Tue, 16 Apr 2024 19:06:32 +0800 Subject: [PATCH] fix(type): allow non-mapping types --- pyproject.toml | 2 +- src/literal_dict.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 75bae71..b1aacfe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "literal-dict" -version = "1.0.1" +version = "1.0.1.1" description = "Use JavaScript-like object definition syntax in Python" authors = [{ name = "Muspi Merol", email = "me@muspimerol.site" }] dependencies = [] diff --git a/src/literal_dict.py b/src/literal_dict.py index 21718e6..359abba 100644 --- a/src/literal_dict.py +++ b/src/literal_dict.py @@ -1,13 +1,13 @@ from inspect import currentframe -from typing import Callable, Generic, Mapping, Sequence, TypeVar, Union, cast +from typing import Callable, Generic, Sequence, TypeVar, Union, cast T = TypeVar("T") -D = TypeVar("D", bound=Mapping) +D = TypeVar("D") class DictBuilder(Generic[D]): - def __init__(self, mapping_constructor: Callable[[dict], D] = dict): - self.constructor = mapping_constructor + def __init__(self, constructor: Callable[[dict], D] = dict): + self.constructor = constructor def __getitem__(self, args: Union[slice, T, Sequence[Union[slice, T]]]) -> D: if not isinstance(args, tuple):