Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/346.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Replace ExampleData with ansys-tools-common utility
2 changes: 1 addition & 1 deletion doc/source/user-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ This client script downloads all files with ``.out`` extensions from the server'
wb.download_file("*.out")

There is a special client method to upload a data file from the Ansys
`example-data <https://github.com/ansys/example-data/raw/master/pyworkbench>`_ repository
`example-data <https://github.com/ansys/example-data/tree/master/pyworkbench>`_ repository
directly to the Workbench server. You should specify the path relative to the
``pyworkbench`` folder in the ``example-data`` repository:

Expand Down
98 changes: 0 additions & 98 deletions src/ansys/workbench/core/example_data.py

This file was deleted.

8 changes: 6 additions & 2 deletions src/ansys/workbench/core/workbench_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from ansys.api.workbench.v0 import workbench_pb2 as wb
from ansys.api.workbench.v0.workbench_pb2_grpc import WorkbenchServiceStub
from ansys.tools.common.cyberchannel import create_channel
from ansys.workbench.core.example_data import ExampleData
from ansys.tools.common.example_download import download_manager


class WorkbenchClient:
Expand Down Expand Up @@ -338,7 +338,11 @@ def upload_file_from_example_repo(self, relative_file_path, show_progress=True):
if not self._is_connected():
logging.error("Workbench client is not yet connected to a server.")
return
downloaded = ExampleData.download(relative_file_path, self.workdir)
dir, fn = os.path.split(relative_file_path)
dir = "pyworkbench/" + dir
downloaded = download_manager.download_file(
filename=fn, directory=dir, destination=self.workdir
)
self.upload_file(downloaded, show_progress=show_progress)

def download_file(self, file_name, show_progress=True, target_dir=None):
Expand Down
54 changes: 0 additions & 54 deletions tests/test_example_data.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_workbench_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_upload_file_from_example_repo(mock_workbench_service_stub):

with patch("ansys.workbench.core.workbench_client.os.path.isfile", return_value=True):
with patch(
"ansys.workbench.core.workbench_client.ExampleData.download",
"ansys.tools.common.example_download.download_manager.download_file",
return_value="/tmp/axisymmetric_model.agdb",
):
client.upload_file_from_example_repo(
Expand Down
Loading