parameters: (source_port, _traversed=None)
return_statement: return list(chain(*source_ports_per_virtual_connection))
docstring: Recursively resolve source ports over the virtual connections.
      Keep track of traversed sources to avoid recursive loops.
docstring_summary: Recursively resolve source ports over the virtual connections.
      Keep track of traversed sources to avoid recursive loops.
docstring_tokens: Recursively resolve source ports over the virtual connections . Keep track of traversed sources to avoid recursive loops .
function: def _sources_from_virtual_source_port(source_port, _traversed=None):
      """
      Recursively resolve source ports over the virtual connections.
      Keep track of traversed sources to avoid recursive loops.
      """
      _traversed = set(_traversed or [])  # a new set!
      if source_port in _traversed:
          raise LoopError('Loop found when resolving port type')
      _traversed.add(source_port)
  
      block = source_port.parent_block
      flow_graph = source_port.parent_flowgraph
  
      if not isinstance(block, blocks.VirtualSource):
          return [source_port]  # nothing to resolve, we're done
  
      stream_id = block.params['stream_id'].value
  
      # currently the validation does not allow multiple virtual sinks and one virtual source
      # but in the future it may...
      connected_virtual_sink_blocks = (
          b for b in flow_graph.iter_enabled_blocks()
          if isinstance(b, blocks.VirtualSink) and b.params['stream_id'].value == stream_id
      )
      source_ports_per_virtual_connection = (
          _sources_from_virtual_sink_port(b.sinks[0], _traversed)  # type: list
          for b in connected_virtual_sink_blocks
      )
      # concatenate generated lists of ports
      return list(chain(*source_ports_per_virtual_connection))
function_tokens: def _sources_from_virtual_source_port ( source_port , _traversed = None ) : _traversed = set ( _traversed or [ ] ) # a new set! if source_port in _traversed : raise LoopError ( 'Loop found when resolving port type' ) _traversed . add ( source_port ) block = source_port . parent_block flow_graph = source_port . parent_flowgraph if not isinstance ( block , blocks . VirtualSource ) : return [ source_port ] # nothing to resolve, we're done stream_id = block . params [ 'stream_id' ] . value # currently the validation does not allow multiple virtual sinks and one virtual source # but in the future it may... connected_virtual_sink_blocks = ( b for b in flow_graph . iter_enabled_blocks ( ) if isinstance ( b , blocks . VirtualSink ) and b . params [ 'stream_id' ] . value == stream_id ) source_ports_per_virtual_connection = ( _sources_from_virtual_sink_port ( b . sinks [ 0 ] , _traversed ) # type: list for b in connected_virtual_sink_blocks ) # concatenate generated lists of ports return list ( chain ( * source_ports_per_virtual_connection ) )