Skip to content

Commit 15f3b81

Browse files
committed
feat: add DataSources.streams_container
1 parent 5702622 commit 15f3b81

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/ansys/dpf/core/data_sources.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,21 @@ def namespace(self, result_key: str) -> str:
701701
"""
702702
return self._api.data_sources_get_namespace(self, result_key)
703703

704+
@property
705+
def streams_container(self) -> dpf.StreamsContainer:
706+
"""Get the streams container representation of the data sources.
707+
708+
.. warning:: Only available with an InProcess server.
709+
710+
Returns
711+
-------
712+
streams_container:
713+
StreamsContainer representation of the data sources.
714+
"""
715+
from ansys.dpf.core.operators.metadata.streams_provider import streams_provider
716+
717+
return streams_provider(data_sources=self, server=self._server).outputs.streams_container()
718+
704719
def __str__(self):
705720
"""Describe the entity.
706721

tests/test_datasources.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,10 @@ def test_namespace(allkindofcomplexity, server_type):
185185
data_sources = dpf.core.DataSources(server=server_type)
186186
data_sources.set_result_file_path(cas_h5_file)
187187
assert data_sources.namespace(data_sources.result_key) == "cff"
188+
189+
190+
def test_as_stream(allkindofcomplexity, server_in_process):
191+
ds = dpf.core.DataSources(allkindofcomplexity, server=server_in_process)
192+
stream = ds.streams_container
193+
assert isinstance(stream, dpf.core.StreamsContainer)
194+
assert stream.datasources.result_files == ds.result_files

0 commit comments

Comments
 (0)