Skip to content

Commit ca59669

Browse files
authored
fix(retro): fix retro-compatibility following move of class locations (#2384)
1 parent a5dbf84 commit ca59669

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/ansys/dpf/gate/common.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import abc
22

3+
def __getattr__(name):
4+
if name == "locations":
5+
from ansys.dpf.core.common import locations
6+
import warnings
7+
warnings.warn(message="Use ansys.dpf.core.common.locations", category=DeprecationWarning)
8+
return locations
9+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
10+
311
elemental_property_type_dict = {
412
"eltype": "ELEMENT_TYPE",
513
"elshape": "ELEMENT_SHAPE",

tests/test_scoping.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,3 +365,9 @@ def test_scoping_dont_start_server(server_type):
365365
assert not dpf.core.server.has_local_server()
366366
assert np.allclose(scop.ids, ids)
367367
dpf.core.SERVER = s
368+
369+
370+
def test_locations_redirect_retro_compatibility(server_type):
371+
from ansys.dpf.gate.common import locations
372+
373+
_ = locations.faces

0 commit comments

Comments
 (0)