<commit_before># Under MIT License, see LICENSE.txt

from PyQt4.QtCore import QTimer
from Communication.UDPCommunication import UDPSending
from Model.DataModel.SendingData.SendingStrategy import SendingStrategy
from Model.DataModel.SendingData.SendingToggleHumanCtrl import SendingToggleHumanCtrl
from Model.DataModel.SendingData.SendingTactic import SendingTactic

__author__ = 'RoboCupULaval'


class DataOutModel:
    def __init__(self, controller=None):
        self._controller = controller
        self._udp_sender = UDPSending()
        self.target = 0, 0

        self.frame_timer = QTimer()
        self.frame_timer.timeout.connect(self.update_screen)
        self.frame_timer.start(20)

    def update_screen(self):
        self._controller.update_target_on_screen()

    def send_tactic(self, id_bot, tactic, target=(0, 0), goal=(0, 0)):
        pkg = SendingTactic().set_data(tactic=tactic,
                                       id=id_bot,
                                       target=target,
                                       goal=goal)
        self._udp_sender.send_message(pkg.get_binary())

    def send_strategy(self, strat):
        pkg = SendingStrategy().set_data(strategy=strat)
        self._udp_sender.send_message(pkg.get_binary())

    def send_toggle_human_control(self, result):
        pkg = SendingToggleHumanCtrl().set_data(is_human_control=result)
        self._udp_sender.send_message(pkg.get_binary())<commit_msg>fix tactic target checking<commit_after># Under MIT License, see LICENSE.txt

from PyQt4.QtCore import QTimer
from Communication.UDPCommunication import UDPSending
from Model.DataModel.SendingData.SendingStrategy import SendingStrategy
from Model.DataModel.SendingData.SendingToggleHumanCtrl import SendingToggleHumanCtrl
from Model.DataModel.SendingData.SendingTactic import SendingTactic

__author__ = 'RoboCupULaval'


class DataOutModel:
    def __init__(self, controller=None):
        self._controller = controller
        self._udp_sender = UDPSending()
        self.target = 0, 0

        self.frame_timer = QTimer()
        self.frame_timer.timeout.connect(self.update_screen)
        self.frame_timer.start(20)

    def update_screen(self):
        self._controller.update_target_on_screen()

    def send_tactic(self, id_bot, tactic, target=(0, 0), goal=(0, 0)):
        target = int(target[0]), int(target[1])
        goal = int(goal[0]), int(goal[1])
        pkg = SendingTactic().set_data(tactic=tactic,
                                       id=id_bot,
                                       target=target,
                                       goal=goal)
        self._udp_sender.send_message(pkg.get_binary())

    def send_strategy(self, strat):
        pkg = SendingStrategy().set_data(strategy=strat)
        self._udp_sender.send_message(pkg.get_binary())

    def send_toggle_human_control(self, result):
        pkg = SendingToggleHumanCtrl().set_data(is_human_control=result)
        self._udp_sender.send_message(pkg.get_binary())
{'fraction_non_alphanumeric': 0.0910601528747092, 'fraction_numerical': 0.007311399135925557, 'mean_word_length': 2.960526315789474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7517981', 'n_tokens_mistral': 933, 'n_tokens_neox': 881, 'n_words': 154}