public static function removeFlagFromCommands($text, $command, $full_flag) { foreach (BashInterpreter::matchCommand($text, $command) as $match) { $text = BashInterpreter::removeFlagFromCommand($text, $match, $full_flag); } return $text; }
private function optimize() { $commands = BashInterpreter::matchCommand($this->task, "python execute.py"); foreach ($commands as $command) { // Any execute without benchmarks don't need to get run. if (count(BashInterpreter::matchFlag($command, "-b")) == 0) { $this->task = BashInterpreter::removeCommand($this->task, $command); } } }
public function benchmarks() { $benchmarks = array(); $commands = BashInterpreter::matchCommand($this->task, "python execute.py"); foreach ($commands as $command) { $benchmark_matches = BashInterpreter::matchFlag($command, "-b"); foreach ($benchmark_matches as $match) { $benchmarks[] = $match; } } return array_values(array_unique($benchmarks)); }