Skip to content

Commit ed9759d

Browse files
Merge branch 'master' into set_delete
2 parents 90daf44 + bdf02ce commit ed9759d

File tree

7 files changed

+73
-43
lines changed

7 files changed

+73
-43
lines changed

.github/FUNDING.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
ko_fi: corenting
2-
custom: ["https://www.buymeacoffee.com/corenting"]
1+
custom: ["https://corenting.fr/donate"]

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Version 3.1.0
2+
3+
- Replace `__init__` by `__new__`. Thanks to [@spacether](https://github.com/spacether) for the [PR #263](https://github.com/corenting/immutabledict/pull/263)
4+
- Add explicit items()/keys()/values() methods to speedup these methods. Thanks to [@matthiasdiener](https://github.com/matthiasdiener) for the [PR #265](https://github.com/corenting/immutabledict/pull/265)
5+
16
# Version 3.0.0
27

38
- `copy()` (**breaking change**): remove the option to pass keyword arguments (which were present as key/value pairs in the copy). Now the method doesn't take any arguments (it behaves the same as a normal `dict`).

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,4 @@ print(my_item["a"]) # Print "value"
3737

3838
## Donations
3939

40-
If you wish to support the project, donations are possible on the following platforms:
41-
- [ko-fi](https://ko-fi.com/corenting)
42-
- [buymeacoffee](https://www.buymeacoffee.com/corenting)
40+
If you wish to support the app, donations are possible [here](https://corenting.fr/donate).

immutabledict/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ def fromkeys(
3939
) -> immutabledict[_K, _V]:
4040
return cls(cls.dict_cls.fromkeys(seq, value))
4141

42-
def __new__(cls, *args: Any) -> immutabledict[_K, _V]:
42+
def __new__(cls, *args: Any, **kwargs: Any) -> immutabledict[_K, _V]:
4343
inst = super().__new__(cls)
44-
setattr(inst, "_dict", cls.dict_cls(*args))
44+
setattr(inst, "_dict", cls.dict_cls(*args, **kwargs))
4545
setattr(inst, "_hash", None)
4646
return inst
4747

poetry.lock

+59-36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ include = [
1818
[tool.poetry.urls]
1919
"Changelog" = "https://github.com/corenting/immutabledict/blob/master/CHANGELOG.md"
2020
"Bug Tracker" = "https://github.com/corenting/immutabledict/issues"
21+
"Donation" = "https://corenting.fr/donate"
2122

2223
[tool.poetry.dependencies]
2324
python = "^3.8"

tests/test_immutabledict.py

+4
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ def test_set_delete_update(self) -> None:
233233
# Make sure d doesn't change
234234
assert d == immutabledict(a=1, b=2) == dict(a=1, b=2)
235235

236+
def test_new_kwargs(self) -> None:
237+
immutable_dict: immutabledict[str, int] = immutabledict(a=1, b=2)
238+
assert immutable_dict == {"a": 1, "b": 2} == dict(a=1, b=2)
239+
236240

237241
class TestImmutableOrderedDict:
238242
def test_ordered(self) -> None:

0 commit comments

Comments
 (0)