<commit_before>import subprocess, sys

def run2(command):
   run = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

   # Wait for the process to return
   out, err = [ e.splitlines() for e in run.communicate() ]

   return run.returncode, out, err

drac_path='/usr/sbin/racadm'
def DRAC( power_on_ip, user, password):
    cmd='%s -r %s -u %s -p %s serveraction powerup' % (drac_path, power_on_ip, user, password)
    retcode,out,err=run2(cmd)
    if(len(err)==0):
        return str(True)
    else:
        return str(False)
    


def main():
    if len(sys.argv)<3:
        exit(0)
    ip=sys.argv[1]
    user=sys.argv[2]
    password=sys.argv[3]
    print DRAC(ip,user,password)
   



if __name__ == "__main__":
    main()<commit_msg>Add exceptions to DRAC plugin<commit_after>import subprocess, sys, os.path

class DRAC_NO_SUPP_PACK(Exception):
    """Base Exception class for all transfer plugin errors."""
    def __init__(self, *args):
        Exception.__init__(self, *args)
        
class DRAC_POWERON_FAILED(Exception):
    """Base Exception class for all transfer plugin errors."""
    def __init__(self, *args):
        Exception.__init__(self, *args)

def run2(command):
   run = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

   # Wait for the process to return
   out, err = [ e.splitlines() for e in run.communicate() ]

   return run.returncode, out, err

drac_path='/usr/sbin/racadm'
def DRAC( power_on_ip, user, password):
    if( not os.path.exists(drac_path)):
        raise DRAC_NO_SUPP_PACK()
    cmd='%s -r %s -u %s -p %s serveraction powerup' % (drac_path, power_on_ip, user, password)
    retcode,out,err=run2(cmd)
    if(len(err)==0):
        return str(True)
    else:
        raise DRAC_POWERON_FAILED()
    


def main():
    if len(sys.argv)<3:
        exit(0)
    ip=sys.argv[1]
    user=sys.argv[2]
    password=sys.argv[3]
    print DRAC(ip,user,password)
   



if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.13462493790362642, 'fraction_numerical': 0.007948335817188276, 'mean_word_length': 3.3034188034188032, 'pattern_counts': {'":': 2, '<': 5, '<?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': '4975951', 'n_tokens_mistral': 740, 'n_tokens_neox': 731, 'n_words': 173}