<commit_before>#!/usr/bin/env python

import os
import sys
import json
import BaseHTTPServer
from subprocess import Popen, PIPE, call
import logging
from apicommands import build_command
from voluptuous import Invalid, MultipleInvalid

class ValidationError(Exception):

    def __init__(self, message):
        self.message=message
        
    def __str__(self):
        return self.message

class Shell:
    
    def execute(self, command):
        log.info(command)

        proc = Popen(command, stdout=PIPE, stderr=PIPE, shell=True)
        out, err = proc.communicate()
        exitcode = proc.returncode
        
        log.info('[' + str(exitcode) + ']')
        if out:
            log.info(out)

        if err:
            log.info(err)
        
        return exitcode, out, err
        
    def execute_and_return_status(self, command):
        exit_code=call(command, shell=True)
        log.info('"' + command + '" returned ' + str(exit_code))
        return exit_code

ALL_PARAMETER_KEYS=['name', 'type', 'direction', 'from', 'to_port', 'to', 'protocol', 'timeout', 'delay', 'variance', 'correlation', 'distribution', 'probability']
REQUIRED_KEYS=['name', 'type', 'direction']
ALL_FAULT_TYPES=['NETWORK_FAILURE', 'SERVICE_FAILURE', 'FIREWALL_TIMEOUT', 'DELAY', 'PACKET_LOSS']

DIRECTIONS={ 'IN': 'INPUT', 'OUT': 'OUTPUT' }
ACTIONS={ 'add': '-A',  'delete': '-D' }
FAULT_TYPES={ "NETWORK_FAILURE": "DROP", "SERVICE_FAILURE": "REJECT --reject-with tcp-reset", 'FIREWALL_TIMEOUT': 'DROP' }
IPTABLES_COMMAND='sudo /sbin/iptables'
<commit_msg>Removed more dead code<commit_after>#!/usr/bin/env python

import os
import sys
import json
import BaseHTTPServer
from subprocess import Popen, PIPE, call
import logging
from apicommands import build_command
from voluptuous import Invalid, MultipleInvalid

class Shell:
    
    def execute(self, command):
        log.info(command)

        proc = Popen(command, stdout=PIPE, stderr=PIPE, shell=True)
        out, err = proc.communicate()
        exitcode = proc.returncode
        
        log.info('[' + str(exitcode) + ']')
        if out:
            log.info(out)

        if err:
            log.info(err)
        
        return exitcode, out, err
        
    def execute_and_return_status(self, command):
        exit_code=call(command, shell=True)
        log.info('"' + command + '" returned ' + str(exit_code))
        return exit_code

{'fraction_non_alphanumeric': 0.125987525987526, 'fraction_numerical': 0.0, 'mean_word_length': 3.057335581787521, 'pattern_counts': {'":': 2, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2710533', 'n_tokens_mistral': 763, 'n_tokens_neox': 765, 'n_words': 187}