From 25f2ee88f08d8da048d862876ae0022592dd92f6 Mon Sep 17 00:00:00 2001 From: PProfizi Date: Fri, 29 Nov 2024 12:11:31 +0100 Subject: [PATCH 1/5] Switch to master for download in 00-wrapping_numpy_capabilities.py --- examples/08-python-operators/00-wrapping_numpy_capabilities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/08-python-operators/00-wrapping_numpy_capabilities.py b/examples/08-python-operators/00-wrapping_numpy_capabilities.py index 07ac4c2145e..b9fd9e321fb 100644 --- a/examples/08-python-operators/00-wrapping_numpy_capabilities.py +++ b/examples/08-python-operators/00-wrapping_numpy_capabilities.py @@ -61,7 +61,7 @@ GITHUB_SOURCE_URL = ( - "https://github.com/ansys/pydpf-core/" "raw/examples/first_python_plugins/python_plugins" + "https://github.com/ansys/pydpf-core/raw/master/doc/source/examples/07-python-operators/plugins" ) EXAMPLE_FILE = GITHUB_SOURCE_URL + "/easy_statistics.py" operator_file_path = examples.downloads._retrieve_file( From 13a25b8a7da7367688b5fbe365ede3965def44f7 Mon Sep 17 00:00:00 2001 From: PProfizi Date: Fri, 29 Nov 2024 12:12:33 +0100 Subject: [PATCH 2/5] Switch to master for download in 01-package_python_operators.py --- .../01-package_python_operators.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/08-python-operators/01-package_python_operators.py b/examples/08-python-operators/01-package_python_operators.py index 277ec49b378..05c0921dc78 100644 --- a/examples/08-python-operators/01-package_python_operators.py +++ b/examples/08-python-operators/01-package_python_operators.py @@ -62,18 +62,21 @@ print("\033[1m average_filter_plugin") -file_list = ["__init__.py", "operators.py", "operators_loader.py", "common.py"] +file_list = [ + "average_filter_plugin/__init__.py", + "average_filter_plugin/operators.py", + "average_filter_plugin/operators_loader.py", + "average_filter_plugin/common.py", +] plugin_folder = None GITHUB_SOURCE_URL = ( "https://github.com/ansys/pydpf-core/raw/" - "examples/first_python_plugins/python_plugins/average_filter_plugin" + "master/doc/source/examples/07-python-operators/plugins/" ) for file in file_list: - EXAMPLE_FILE = GITHUB_SOURCE_URL + "/average_filter_plugin/" + file - operator_file_path = examples.downloads._retrieve_file( - EXAMPLE_FILE, file, "python_plugins/average_filter_plugin" - ) + EXAMPLE_FILE = GITHUB_SOURCE_URL + file + operator_file_path = examples.downloads._retrieve_file(EXAMPLE_FILE, file, "python_plugins") plugin_folder = os.path.dirname(operator_file_path) print(f"\033[1m {file}:\n \033[0m") with open(operator_file_path, "r") as f: From d19919bd3021555899cc7e334948212149c7aa33 Mon Sep 17 00:00:00 2001 From: PProfizi Date: Fri, 29 Nov 2024 12:36:43 +0100 Subject: [PATCH 3/5] Change downloads.py/_retrieve_file to not restrict to basename, allowing to define subpaths --- src/ansys/dpf/core/examples/downloads.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/dpf/core/examples/downloads.py b/src/ansys/dpf/core/examples/downloads.py index 8e8d4b1b20b..c58a80a5dd3 100644 --- a/src/ansys/dpf/core/examples/downloads.py +++ b/src/ansys/dpf/core/examples/downloads.py @@ -82,7 +82,7 @@ def _retrieve_file(url, filename, directory): from ansys.dpf.core import LOCAL_DOWNLOADED_EXAMPLES_PATH # First check if file has already been downloaded - local_path = os.path.join(LOCAL_DOWNLOADED_EXAMPLES_PATH, directory, os.path.basename(filename)) + local_path = os.path.join(LOCAL_DOWNLOADED_EXAMPLES_PATH, directory, filename) local_path_no_zip = local_path.replace(".zip", "") if os.path.isfile(local_path_no_zip) or os.path.isdir(local_path_no_zip): return local_path_no_zip From 8ab186e063f3e0ac75684d953994b3594a1d7f68 Mon Sep 17 00:00:00 2001 From: PProfizi Date: Fri, 29 Nov 2024 12:37:08 +0100 Subject: [PATCH 4/5] Remove useless imports --- examples/08-python-operators/00-wrapping_numpy_capabilities.py | 1 - examples/08-python-operators/01-package_python_operators.py | 1 - 2 files changed, 2 deletions(-) diff --git a/examples/08-python-operators/00-wrapping_numpy_capabilities.py b/examples/08-python-operators/00-wrapping_numpy_capabilities.py index b9fd9e321fb..4309cecbd53 100644 --- a/examples/08-python-operators/00-wrapping_numpy_capabilities.py +++ b/examples/08-python-operators/00-wrapping_numpy_capabilities.py @@ -57,7 +57,6 @@ # Download and display the Python script. from ansys.dpf.core import examples -from ansys.dpf import core as dpf GITHUB_SOURCE_URL = ( diff --git a/examples/08-python-operators/01-package_python_operators.py b/examples/08-python-operators/01-package_python_operators.py index 05c0921dc78..7259fa71af3 100644 --- a/examples/08-python-operators/01-package_python_operators.py +++ b/examples/08-python-operators/01-package_python_operators.py @@ -58,7 +58,6 @@ import os from ansys.dpf.core import examples -from ansys.dpf import core as dpf print("\033[1m average_filter_plugin") From dd8b676054ca5699e86ba9825e261c52b9d58caa Mon Sep 17 00:00:00 2001 From: PProfizi Date: Fri, 29 Nov 2024 12:49:01 +0100 Subject: [PATCH 5/5] Switch to master branch for 02-python_operators_with_dependencies.py --- .../02-python_operators_with_dependencies.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/examples/08-python-operators/02-python_operators_with_dependencies.py b/examples/08-python-operators/02-python_operators_with_dependencies.py index f88d9e4a80b..90808f2c152 100644 --- a/examples/08-python-operators/02-python_operators_with_dependencies.py +++ b/examples/08-python-operators/02-python_operators_with_dependencies.py @@ -60,7 +60,6 @@ import os from ansys.dpf.core import examples -from ansys.dpf import core as dpf print("\033[1m gltf_plugin") @@ -73,17 +72,16 @@ "gltf_plugin/texture.png", "gltf_plugin.xml", ] -import os - -folder_root = os.path.join(os.getcwd().rsplit("pydpf-core", 1)[0], "pydpf-core") -source_path_in_repo = r"doc\source\examples\07-python-operators\plugins" -operator_folder = os.path.join(folder_root, source_path_in_repo) -print(operator_folder) plugin_path = None +folder_root = os.path.join(os.getcwd().rsplit("pydpf-core", 1)[0], "pydpf-core") +GITHUB_SOURCE_URL = ( + "https://github.com/ansys/pydpf-core/raw/" + "master/doc/source/examples/07-python-operators/plugins/" +) for file in file_list: - operator_file_path = os.path.join(operator_folder, file) - + EXAMPLE_FILE = GITHUB_SOURCE_URL + file + operator_file_path = examples.downloads._retrieve_file(EXAMPLE_FILE, file, "python_plugins") print(f"\033[1m {file}\n \033[0m") if ( os.path.splitext(file)[1] == ".py" or os.path.splitext(file)[1] == ".xml"