Skip to content

Commit fab9c63

Browse files
authored
Add path sanitization missing step in some DataSources methods. (#2054)
* Add path sanitization missing step in some DataSources methods. * Fix docstring for DataSources.set_result_file_path * Fix docstring for DataSources.set_result_file_path
1 parent acffb5f commit fab9c63

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ansys/dpf/core/data_sources.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,11 @@ def set_result_file_path(self, filepath, key=""):
133133
>>> data_sources = dpf.DataSources()
134134
>>> data_sources.set_result_file_path('/tmp/file.rst')
135135
>>> data_sources.result_files
136-
['/tmp/file.rst']
136+
['...tmp...file.rst']
137137
138138
"""
139-
extension = Path(filepath).suffix
139+
filepath = Path(filepath)
140+
extension = filepath.suffix
140141
# Handle .res files from CFX
141142
if key == "" and extension == ".res":
142143
key = "cas"
@@ -199,6 +200,7 @@ def set_domain_result_file_path(
199200
>>> data_sources.set_domain_result_file_path('/tmp/file1.sub', 1)
200201
201202
"""
203+
path = Path(path)
202204
if key:
203205
self._api.data_sources_set_domain_result_file_path_with_key_utf8(
204206
self, str(path), key, domain_id

0 commit comments

Comments
 (0)