<commit_before>from misc import *
import datetime
import subprocess
import shlex

class RobotController(object):
    """ You have to implement this class """
    def init(starting_position, steering_noise, distance_noise, sonar_noise, forward_steering_drift,
                     measurement_noise, speed, turning_speed, gps_delay, execution_cpu_time_limit):
        """ @param starting_position - (x,y) tuple representing current_position """
        raise NotImplementedError()

    def act(self):
        """ Return next action """
        raise NotImplementedError()

    def on_sense_sonar(self, dist):
        """ React to sensory data """
        raise NotImplementedError()

    def on_sense_field(self, field_type, field_parameter):
        """ React to sensory data """
        raise NotImplementedError()

    def on_sense_gps(self, x, y):
        """ React to sensory data """
        raise NotImplementedError()

    def terminate(self):
        pass

class CmdLineRobotController(RobotController):
    def __init__(self, cmd, init_kwargs=None):
        self.cmd = cmd
        self.init_kwargs = init_kwargs

    def clone(self):
        return CmdLineRobotController(self.cmd, self.init_kwargs)

    def init(self, **kwargs):
        self.p = subprocess.Popen(shlex.split(self.cmd), shell=True, stdout=subprocess.PIPE, \
                                  stdin=subprocess.PIPE)
        assert len(kwargs) == 11, "Expected 11 parameters for constructor"
        for key, value in kwargs.iteritems():<commit_msg>Revert to shell=False in Popen call<commit_after>from misc import *
import datetime
import subprocess
import shlex

class RobotController(object):
    """ You have to implement this class """
    def init(starting_position, steering_noise, distance_noise, sonar_noise, forward_steering_drift,
                     measurement_noise, speed, turning_speed, gps_delay, execution_cpu_time_limit):
        """ @param starting_position - (x,y) tuple representing current_position """
        raise NotImplementedError()

    def act(self):
        """ Return next action """
        raise NotImplementedError()

    def on_sense_sonar(self, dist):
        """ React to sensory data """
        raise NotImplementedError()

    def on_sense_field(self, field_type, field_parameter):
        """ React to sensory data """
        raise NotImplementedError()

    def on_sense_gps(self, x, y):
        """ React to sensory data """
        raise NotImplementedError()

    def terminate(self):
        pass

class CmdLineRobotController(RobotController):
    def __init__(self, cmd, init_kwargs=None):
        self.cmd = cmd
        self.init_kwargs = init_kwargs

    def clone(self):
        return CmdLineRobotController(self.cmd, self.init_kwargs)

    def init(self, **kwargs):
        self.p = subprocess.Popen(shlex.split(self.cmd), shell=False, stdout=subprocess.PIPE, \
                                  stdin=subprocess.PIPE)
        assert len(kwargs) == 11, "Expected 11 parameters for constructor"
        for key, value in kwargs.iteritems():
{'fraction_non_alphanumeric': 0.09605991533702377, 'fraction_numerical': 0.0026050146532074245, 'mean_word_length': 2.9896103896103896, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1183320', 'n_tokens_mistral': 895, 'n_tokens_neox': 844, 'n_words': 226}