<commit_before>import logging
import os
import shutil
import subprocess
from dcbenvironment import DCBEnvironment
from compoundloader import CompoundLoader
from jinja2 import FileSystemLoader
from string import join

# inspired by http://blog.endpoint.com/2015/01/getting-realtime-output-using-python.html
def run_it(cmd):
  log = logging.getLogger("dcb.run_it")
  process = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE)
  while True:
    output = process.stdout.readline()
    if output == '' and process.poll() is not None:
      break
    if output:
      log.info(output.strip())
  rc = process.poll()
  if rc != 0:
    raise subprocess.CalledProcessException(rc, cmd=cmd)
  return rc

def resolve_arg(arg, envname, dflt = None) :
  return os.environ.get(envname, dflt) if arg is None else arg

# descend through a list of environment variables in search of a hit...
def resolve_arg_list(arg, envnames, dflt = None):<commit_msg>its CalledProcessError not CalledProcessException<commit_after>import logging
import os
import shutil
import subprocess
from dcbenvironment import DCBEnvironment
from compoundloader import CompoundLoader
from jinja2 import FileSystemLoader
from string import join

# inspired by http://blog.endpoint.com/2015/01/getting-realtime-output-using-python.html
def run_it(cmd):
  log = logging.getLogger("dcb.run_it")
  process = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE)
  while True:
    output = process.stdout.readline()
    if output == '' and process.poll() is not None:
      break
    if output:
      log.info(output.strip())
  rc = process.poll()
  if rc != 0:
    raise subprocess.CalledProcessError(rc, cmd=cmd)
  return rc

def resolve_arg(arg, envname, dflt = None) :
  return os.environ.get(envname, dflt) if arg is None else arg

# descend through a list of environment variables in search of a hit...
def resolve_arg_list(arg, envnames, dflt = None):
{'fraction_non_alphanumeric': 0.09365244536940687, 'fraction_numerical': 0.008324661810613945, 'mean_word_length': 4.432203389830509, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1295630', 'n_tokens_mistral': 606, 'n_tokens_neox': 589, 'n_words': 184}