<commit_before># -*- coding: utf-8 -*-

# <NAME>
# Summer 2014
# Univerity of Colorado

import os
import shutil
import copy

_LOC_DIR = "/tmp/cogs/"

class Env(object):

    def __init__(self, run, tst_files, sub_files):

        # Save Files
        self.tst_files = []
        self.sub_files = []

        # Setup Working Directory
        self.wd = os.path.abspath("{:s}/{:s}/".format(_LOC_DIR, repr(run)))
        os.makedirs(self.wd)

        # Copy Submission Files
        for fle in sub_files:
            self.sub_files.append(self.copy_to_wd(fle))

        # Copy Tester Files
        for fle in tst_files:
            self.tst_files.append(self.copy_to_wd(fle))

    def copy_to_wd(self, fle):
        dst = os.path.abspath("{:s}/{:s}".format(self.wd, fle['name']))
        new_fle = fle.copy(dst)
        return new_fle

    def close(self):

        # Delete Submission Files
        for fle in self.sub_files:
            fle.delete(force=True)

        # Delete Tester Files
        for fle in self.tst_files:
            fle.delete(force=True)

        # Delete Directory
        shutil.rmtree(self.wd)<commit_msg>Moved to static dicationary file tracking<commit_after># -*- coding: utf-8 -*-

# <NAME>
# Summer 2014
# Univerity of Colorado

import os
import shutil
import copy

_LOC_DIR = "/tmp/cogs/"

class Env(object):

    def __init__(self, run, tst_files, sub_files):

        # Save Files
        self.tst_files = []
        self.sub_files = []

        # Setup Working Directory
        self.wd = os.path.abspath("{:s}/{:s}/".format(_LOC_DIR, repr(run)))
        os.makedirs(self.wd)

        # Copy Submission Files
        for fle in sub_files:
            self.sub_files.append(self.copy_to_wd(fle))

        # Copy Tester Files
        for fle in tst_files:
            self.tst_files.append(self.copy_to_wd(fle))

    def copy_to_wd(self, fle):
        new_fle = fle.get_dict()
        src = os.path.abspath("{:s}".format(new_fle['path']))
        dst = os.path.abspath("{:s}/{:s}".format(self.wd, fle['name']))
        shutil.copy(src, dst)
        new_fle['path'] = dst
        return new_fle

    def close(self):

        # Delete Submission Files
        for fle in self.sub_files:
            try:
                os.remove(fle['path'])
            except OSError:
                pass

        # Delete Tester Files
        for fle in self.tst_files:
            try:
                os.remove(fle['path'])
            except OSError:
                pass

        # Delete Directory
        shutil.rmtree(self.wd)
{'fraction_non_alphanumeric': 0.1230889847118777, 'fraction_numerical': 0.003920031360250882, 'mean_word_length': 1.9537037037037037, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5480880', 'n_tokens_mistral': 885, 'n_tokens_neox': 831, 'n_words': 182}