results correctly added to NamedTuple
This commit is contained in:
parent
873d7181bf
commit
4e79b53ffd
|
@ -366,17 +366,15 @@ class SolutionBase:
|
||||||
# Create a NamedTuple object where the field names are mapping to the graph
|
# Create a NamedTuple object where the field names are mapping to the graph
|
||||||
# output stream names.
|
# output stream names.
|
||||||
solution_outputs = collections.namedtuple(
|
solution_outputs = collections.namedtuple(
|
||||||
'SolutionOutputs', self._output_stream_type_info.keys())
|
'SolutionOutputs', self._output_stream_type_info.keys())
|
||||||
|
empty_list = [[] for _ in range(len(solution_outputs._fields))]
|
||||||
|
results = solution_outputs(*(empty_list))
|
||||||
for stream_name in self._output_stream_type_info.keys():
|
for stream_name in self._output_stream_type_info.keys():
|
||||||
if stream_name in self._graph_outputs:
|
if stream_name in self._graph_outputs:
|
||||||
setattr(
|
results = results._replace(**{stream_name: self._get_packet_content(
|
||||||
solution_outputs, stream_name,
|
self._output_stream_type_info[stream_name], self._graph_outputs[stream_name])})
|
||||||
self._get_packet_content(self._output_stream_type_info[stream_name],
|
|
||||||
self._graph_outputs[stream_name]))
|
return results
|
||||||
else:
|
|
||||||
setattr(solution_outputs, stream_name, None)
|
|
||||||
|
|
||||||
return solution_outputs
|
|
||||||
|
|
||||||
def close(self) -> None:
|
def close(self) -> None:
|
||||||
"""Closes all the input sources and the graph."""
|
"""Closes all the input sources and the graph."""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user