Skip to content

Commit f865ad3

Browse files
changes in the set_result_file_path function
1 parent 976fc45 commit f865ad3

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/ansys/dpf/core/data_sources.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,16 @@ def __init__(
134134
if result_path is not None:
135135
self.set_result_file_path(result_path)
136136

137-
def set_result_file_path(self, filepath, key=""):
138-
"""Add a result file path to the data sources.
137+
def set_result_file_path(
138+
self, filepath: Union[str, os.PathLike], key: Optional[str] = ""
139+
) -> None:
140+
"""et the main result file path to the data sources.
139141
140142
Parameters
141143
----------
142-
filepath : str or os.PathLike object
144+
filepath
143145
Path to the result file.
144-
key : str, optional
146+
key
145147
Extension of the file, which is used as a key for choosing the correct
146148
plugin when a result is requested by an operator. The default is ``""``,
147149
in which case the key is found directly.
@@ -151,9 +153,12 @@ def set_result_file_path(self, filepath, key=""):
151153
Create a data source and set the result file path.
152154
153155
>>> from ansys.dpf import core as dpf
154-
>>> data_sources = dpf.DataSources()
155-
>>> data_sources.set_result_file_path('/tmp/file.rst')
156-
>>> data_sources.result_files
156+
>>> # Create the DataSources object
157+
>>> my_data_sources = dpf.DataSources()
158+
>>> # Define the path where the main result file can be found
159+
>>> my_data_sources.set_result_file_path(filepath='/tmp/file.rst', key='rst')
160+
>>> # Get the path to the main result file
161+
>>> my_data_sources.result_files
157162
['/tmp/file.rst']
158163
159164
"""

0 commit comments

Comments
 (0)