Skip to content

Commit 1aab13d

Browse files
committed
Dataclass tweaks to support Python 3.11 breaking changes
See python/cpython#88840 Fixes #84
1 parent b1449ce commit 1aab13d

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.1.10 (2022-12-20)
2+
3+
- Dataclass tweaks to support Python 3.11 breaking changes.
4+
15
# 0.1.9 (2022-12-15)
26

37
- Create a dedicated `Tie` class for ties. Both it and `Slur` now inherit from a shared `AbstractSlur` class which provides common drawing functionality. `Tie` is a nice convenience class in that it is automatically kept horizontal; in the future it may also be shaped slightly differently than a slur. (by @craigvear)

neoscore/core/paper.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ class Paper:
1313

1414
width: Unit
1515
height: Unit
16-
margin_top: Unit = ZERO
17-
margin_right: Unit = ZERO
18-
margin_bottom: Unit = ZERO
19-
margin_left: Unit = ZERO
20-
gutter: Unit = ZERO
16+
margin_top: Unit = field(default_factory=lambda: ZERO)
17+
margin_right: Unit = field(default_factory=lambda: ZERO)
18+
margin_bottom: Unit = field(default_factory=lambda: ZERO)
19+
margin_left: Unit = field(default_factory=lambda: ZERO)
20+
gutter: Unit = field(default_factory=lambda: ZERO)
2121
live_width: Unit = field(init=False)
2222
live_height: Unit = field(init=False)
2323

neoscore/western/staff_fringe_layout.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from dataclasses import dataclass
1+
from dataclasses import dataclass, field
22

33
from neoscore.core.units import ZERO, Unit
44

@@ -35,7 +35,7 @@ class StaffFringeLayout:
3535
If there is no key signature this will be ``ZERO``.
3636
"""
3737

38-
time_signature: Unit = ZERO
38+
time_signature: Unit = field(default_factory=lambda: ZERO)
3939
"""The time signature's position, if any.
4040
4141
If there is no time signature this will be ``ZERO``.

0 commit comments

Comments
 (0)