def _handle_temporary_connection(self, old_sink, new_sink, of_target=True):
        """Connect connection to new_sink

        If new_sink is set, the connection origin or target will be set to new_sink. The connection to old_sink is
        being removed.

        :param gaphas.aspect.ConnectionSink old_sink: Old sink (if existing)
        :param gaphas.aspect.ConnectionSink new_sink: New sink (if existing)
        :param bool of_target: Whether the origin or target will be reconnected
        :return:
        """

        def sink_set_and_differs(sink_a, sink_b):
            if not sink_a:
                return False
            if not sink_b:
                return True
            if sink_a.port != sink_b.port:
                return True
            return False

        if sink_set_and_differs(old_sink, new_sink):
            sink_port_v = old_sink.port.port_v
            self._disconnect_temporarily(sink_port_v, target=of_target)

        if sink_set_and_differs(new_sink, old_sink):
            sink_port_v = new_sink.port.port_v
            self._connect_temporarily(sink_port_v, target=of_target)
def _handle_temporary_connection ( self , old_sink , new_sink , of_target = True ) : def sink_set_and_differs ( sink_a , sink_b ) : if not sink_a : return False if not sink_b : return True if sink_a . port != sink_b . port : return True return False if sink_set_and_differs ( old_sink , new_sink ) : sink_port_v = old_sink . port . port_v self . _disconnect_temporarily ( sink_port_v , target = of_target ) if sink_set_and_differs ( new_sink , old_sink ) : sink_port_v = new_sink . port . port_v self . _connect_temporarily ( sink_port_v , target = of_target )
Connect connection to new_sink

        If new_sink is set, the connection origin or target will be set to new_sink. The connection to old_sink is
        being removed.

        :param gaphas.aspect.ConnectionSink old_sink: Old sink (if existing)
        :param gaphas.aspect.ConnectionSink new_sink: New sink (if existing)
        :param bool of_target: Whether the origin or target will be reconnected
        :return: