Skip to content

Commit 6dfc93f

Browse files
committed
chore: version bump (fixes #1267)
1 parent 5259224 commit 6dfc93f

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

CHANGELOG.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
11
# Changelog
22

3+
## 42.1.0 [#1273](https://github.com/openfisca/openfisca-core/pull/1273)
4+
5+
#### New features
6+
7+
- Introduce `indexed_enums.EnumType`
8+
- Allows for actually fancy indexing `indexed_enums.Enum`
9+
10+
#### Technical changes
11+
12+
- Fix doctests
13+
- Now `pytest openfisca_core/indexed_enums` runs without errors
14+
- Fix bug in `Enum.encode` when passing a scalar
15+
- Still raises `TypeError` but with an explanation of why it fails
16+
- Fix bug in `Enum.encode` when encoding values not present in the enum
17+
- When encoding values not present in an enum, `Enum.encode` always encoded
18+
the first item of the enum
19+
- Now, it correctly encodes only the values requested that exist in the enum
20+
21+
##### Before
22+
23+
```python
24+
from openfisca_core import indexed_enums as enum
25+
26+
class TestEnum(enum.Enum):
27+
ONE = "one"
28+
TWO = "two"
29+
30+
TestEnum.encode([2])
31+
# EnumArray([0])
32+
```
33+
34+
##### After
35+
36+
```python
37+
from openfisca_core import indexed_enums as enum
38+
39+
class TestEnum(enum.Enum):
40+
ONE = "one"
41+
TWO = "two"
42+
43+
TestEnum.encode([2])
44+
# EnumArray([])
45+
46+
TestEnum.encode([0,1,2,5])
47+
# EnumArray([<TestEnum.ONE: 'one'> <TestEnum.TWO: 'two'>])
48+
```
49+
350
### 42.0.8 [#1272](https://github.com/openfisca/openfisca-core/pull/1272)
451

552
#### Documentation

openfisca_core/indexed_enums/_enum_type.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,6 @@ def __new__(
111111

112112
def __dir__(cls) -> list[str]:
113113
return sorted({"items", "indices", "names", "enums", *super().__dir__()})
114+
115+
116+
__all__ = ["EnumType"]

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070

7171
setup(
7272
name="OpenFisca-Core",
73-
version="42.0.8",
73+
version="42.1.0",
7474
author="OpenFisca Team",
7575
author_email="[email protected]",
7676
classifiers=[

0 commit comments

Comments
 (0)