Skip to content

Commit 094c5e3

Browse files
committed
fix compatibility
1 parent 44cce6e commit 094c5e3

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

meshmode/mesh/__init__.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,23 @@ class BTAG_PARTITION(BTAG_NO_BOUNDARY): # noqa: N801
117117
118118
.. versionadded:: 2017.1
119119
"""
120-
def __init__(self, part_id: PartitionID):
121-
self.part_id = part_id
120+
def __init__(self, part_id: PartitionID, part_nr=None):
121+
if part_nr is not None:
122+
from warnings import warn
123+
warn("part_nr is deprecated and will stop working in March 2023. "
124+
"Use part_id instead.",
125+
DeprecationWarning, stacklevel=2)
126+
self.part_id = int(part_nr)
127+
else:
128+
self.part_id = part_id
129+
130+
@property
131+
def part_nr(self):
132+
from warnings import warn
133+
warn("part_nr is deprecated and will stop working in March 2023. "
134+
"Use part_id instead.",
135+
DeprecationWarning, stacklevel=2)
136+
return self.part_id
122137

123138
def __hash__(self):
124139
return hash((type(self), self.part_id))

0 commit comments

Comments
 (0)