Skip to content

Commit a713af2

Browse files
authored
Make all previously packaged examples attributes retro-compatible (#475)
1 parent c0dc0ff commit a713af2

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/ansys/dpf/post/examples/__init__.py

+45
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,48 @@
1515

1616
# must copy files over when using docker
1717
# running_docker = os.environ.get('DPF_DOCKER', False)
18+
19+
20+
# called if module.<name> fails
21+
def __getattr__(name):
22+
if name == "simple_bar":
23+
global simple_bar
24+
simple_bar = find_simple_bar()
25+
return simple_bar
26+
elif name == "static_rst":
27+
global static_rst
28+
static_rst = find_static_rst()
29+
return static_rst
30+
elif name == "complex_rst":
31+
global complex_rst
32+
complex_rst = find_complex_rst()
33+
return complex_rst
34+
elif name == "multishells_rst":
35+
global multishells_rst
36+
multishells_rst = find_multishells_rst()
37+
return multishells_rst
38+
elif name == "electric_therm":
39+
global electric_therm
40+
electric_therm = find_electric_therm()
41+
return electric_therm
42+
elif name == "steady_therm":
43+
global steady_therm
44+
steady_therm = find_steady_therm()
45+
return steady_therm
46+
elif name == "transient_therm":
47+
global transient_therm
48+
transient_therm = find_transient_therm()
49+
return transient_therm
50+
elif name == "msup_transient":
51+
global msup_transient
52+
msup_transient = find_msup_transient()
53+
return msup_transient
54+
elif name == "simple_cyclic":
55+
global simple_cyclic
56+
simple_cyclic = find_simple_cyclic()
57+
return simple_cyclic
58+
elif name == "distributed_msup_folder":
59+
global distributed_msup_folder
60+
distributed_msup_folder = find_distributed_msup_folder()
61+
return distributed_msup_folder
62+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

0 commit comments

Comments
 (0)