Skip to content

Commit

Permalink
Make all example files downloadable (#1126)
Browse files Browse the repository at this point in the history
* Use pydpf/update_examples branch on examples_data repo

* Delete all example files kept in the repo

* Switch all find_* methods in examples.py to using downloads._download_file

* Adapt tests

* Solve circular import

* Fix style

* Fix examples_data branch

* Fix .rth

* Update conftest.py

* Fix examples _module_path

* update test_delete_downloaded_files

* Support examples.static_rst and the like lazy evaluation

* Update test_examples.py

* examples.find_* methods now work the same as download_*

* Switch to equivalent pydpf-post branch

* Try update test_multi_server.py

* Try update test_multi_server.py

* Switch back to master branch for example_repo

* Switch back to master branch for PyDPF-Post

* Clean-up examples.py
  • Loading branch information
PProfizi authored Sep 14, 2023
1 parent aafd8a0 commit b11cdbf
Show file tree
Hide file tree
Showing 22 changed files with 425 additions and 375 deletions.
Binary file removed src/ansys/dpf/core/examples/ASimpleBar.rst
Binary file not shown.
45 changes: 45 additions & 0 deletions src/ansys/dpf/core/examples/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,47 @@
from .examples import *
from .downloads import *


# called if module.<name> fails
def __getattr__(name):
if name == "simple_bar":
global simple_bar
simple_bar = find_simple_bar()
return simple_bar
elif name == "static_rst":
global static_rst
static_rst = find_static_rst()
return static_rst
elif name == "complex_rst":
global complex_rst
complex_rst = find_complex_rst()
return complex_rst
elif name == "multishells_rst":
global multishells_rst
multishells_rst = find_multishells_rst()
return multishells_rst
elif name == "electric_therm":
global electric_therm
electric_therm = find_electric_therm()
return electric_therm
elif name == "steady_therm":
global steady_therm
steady_therm = find_steady_therm()
return steady_therm
elif name == "transient_therm":
global transient_therm
transient_therm = find_transient_therm()
return transient_therm
elif name == "msup_transient":
global msup_transient
msup_transient = find_msup_transient()
return msup_transient
elif name == "simple_cyclic":
global simple_cyclic
simple_cyclic = find_simple_cyclic()
return simple_cyclic
elif name == "distributed_msup_folder":
global distributed_msup_folder
distributed_msup_folder = find_distributed_msup_folder()
return distributed_msup_folder
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
Binary file removed src/ansys/dpf/core/examples/complex.rst
Binary file not shown.
Loading

0 comments on commit b11cdbf

Please sign in to comment.