def assign_participant_addresses(messages, participants, hex_addresses):
        """

        :type participants: list[urh.signalprocessing.Participant.Participant]
        :type hex_addresses: tuple[str]
        :type messages: list[urh.signalprocessing.Message.Message]
        :return:
        """
        try:
            participants.remove(None)
        except ValueError:
            pass

        if len(participants) != len(hex_addresses):
            return

        if len(participants) == 0:
            return #  No chance


        score = {p: {addr: 0 for addr in hex_addresses} for p in participants}

        for i in range(1, len(messages)):
            msg = messages[i]
            prev_msg = messages[i-1]

            if msg.message_type.name == "ack":
                addr = next(addr for addr in hex_addresses if addr in msg.decoded_hex_str)
                if addr in prev_msg.decoded_hex_str:
                    score[prev_msg.participant][addr] += 1

        for p in participants:
            p.address_hex = max(score[p], key=score[p].get)
def assign_participant_addresses ( messages , participants , hex_addresses ) : try : participants . remove ( None ) except ValueError : pass if len ( participants ) != len ( hex_addresses ) : return if len ( participants ) == 0 : return score = { p : { addr : 0 for addr in hex_addresses } for p in participants } for i in range ( 1 , len ( messages ) ) : msg = messages [ i ] prev_msg = messages [ i - 1 ] if msg . message_type . name == "ack" : addr = next ( addr for addr in hex_addresses if addr in msg . decoded_hex_str ) if addr in prev_msg . decoded_hex_str : score [ prev_msg . participant ] [ addr ] += 1 for p in participants : p . address_hex = max ( score [ p ] , key = score [ p ] . get )
:type participants: list[urh.signalprocessing.Participant.Participant]
        :type hex_addresses: tuple[str]
        :type messages: list[urh.signalprocessing.Message.Message]
        :return: