<commit_before>#!/usr/bin/python3
#Fork compiler toolchain script
import argparse
import re, os
from sys import exit

def main():
  #Parse arguments
  parser = argparse.ArgumentParser(description='Fork toolchain command line parser...')
  parser.add_argument('-v',action='store_true',help='Use valgrind')
  parser.add_argument('files',metavar='filename',type=str,nargs='+',help='files to process')
  regex_delete = re.compile("(^\s*//.*)|(^\s*$)")
  args = parser.parse_args()
  files = args.files
  #Check that parser exists
  if not os.path.exists("./parser"):
    print("Parser binary not found in current directory.")
    exit(1)
  #Preprocessing
  temp_files = [x + '.wrapper_tmp_file' for x in files]
  for file_in,file_out in zip(files,temp_files):
    try:
      f_in = open(file_in,'r')
      f_out = open(file_out,'w')
    except (FileNotFoundError,PermissionError) as e:
      print(e)
      exit(2)
    for line in f_in:
      if not regex_delete.match(line):
        f_out.write(line)
    f_in.close()
    f_out.close()
  #Call parser on temp_files
  for file in temp_files:
    if args.v:
      print("Please ignore GC_INIT() uninitialized memory.")
      os.system("valgrind --vgdb=no ./parser {}".format(file))
    else:
      os.system("""echo "./parser {0} 3>&1 1>&2 2>&3 | tee {1}.llvm" | /bin/bash """.format(file,file[0:-20]))
  #Postprocessing
  for file in temp_files:
    os.remove(file)

if __name__=='__main__':
  print('Running Fork Compiler...')
  main()<commit_msg>No need to refer to bash by its full pathname<commit_after>#!/usr/bin/python3
#Fork compiler toolchain script
import argparse
import re, os
from sys import exit

def main():
  #Parse arguments
  parser = argparse.ArgumentParser(description='Fork toolchain command line parser...')
  parser.add_argument('-v',action='store_true',help='Use valgrind')
  parser.add_argument('files',metavar='filename',type=str,nargs='+',help='files to process')
  regex_delete = re.compile("(^\s*//.*)|(^\s*$)")
  args = parser.parse_args()
  files = args.files
  #Check that parser exists
  if not os.path.exists("./parser"):
    print("Parser binary not found in current directory.")
    exit(1)
  #Preprocessing
  temp_files = [x + '.wrapper_tmp_file' for x in files]
  for file_in,file_out in zip(files,temp_files):
    try:
      f_in = open(file_in,'r')
      f_out = open(file_out,'w')
    except (FileNotFoundError,PermissionError) as e:
      print(e)
      exit(2)
    for line in f_in:
      if not regex_delete.match(line):
        f_out.write(line)
    f_in.close()
    f_out.close()
  #Call parser on temp_files
  for file in temp_files:
    if args.v:
      print("Please ignore GC_INIT() uninitialized memory.")
      os.system("valgrind --vgdb=no ./parser {}".format(file))
    else:
      os.system("""echo "./parser {0} 3>&1 1>&2 2>&3 | tee {1}.llvm" | bash """.format(file,file[0:-20]))
  #Postprocessing
  for file in temp_files:
    os.remove(file)

if __name__=='__main__':
  print('Running Fork Compiler...')
  main()
{'fraction_non_alphanumeric': 0.15389718076285241, 'fraction_numerical': 0.009286898839137645, 'mean_word_length': 3.7125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '266385', 'n_tokens_mistral': 1051, 'n_tokens_neox': 1035, 'n_words': 258}