<commit_before>import tables as tb
import pathlib2 as pl

class JobDataBase(object):
    def __init__(self, path, mode='a'):
        super(JobDataBase, self).__init__()
        self.db = Database(path, mode='a')

    def close(self):
        self.db.close()

    def open(self):
        self.db.open()

    def create_groups(self):
        '''Creates the default groups in the database.
        '''
        self.db._create_group('energies', self.db._handle.root)
        self.db._create_group('distances', self.db._handle.root)
        self.db._create_group('start_trajectories', self.db._handle.root)
        self.db._create_group('end_trajectories', self.db._handle.root)
        self.db._create_group('meta', self.db._handle.root)
        self.db._create_group('trajectory', '/meta')
        self.db._create_group('trajectories', self.db._handle.root)
<commit_msg>Added an error message for the case that a Job.setup_job_save() tries to create groups for its database if it already exists!<commit_after>import tables as tb
import pathlib2 as pl

class JobDataBase(object):
    def __init__(self, path, mode='a'):
        super(JobDataBase, self).__init__()
        self.db = Database(path, mode='a')

    def close(self):
        self.db.close()

    def open(self):
        self.db.open()

    def create_groups(self):
        '''Creates the default groups in the database.
        '''
        try:
            self.db._create_group('energies', self.db._handle.root)
            self.db._create_group('distances', self.db._handle.root)
            self.db._create_group('start_trajectories', self.db._handle.root)
            self.db._create_group('end_trajectories', self.db._handle.root)
            self.db._create_group('meta', self.db._handle.root)
            self.db._create_group('trajectory', '/meta')
            self.db._create_group('trajectories', self.db._handle.root)
        except tb.NodeError:
            raise tb.NodeError('Trying to create groups for a database that already contains them, i.e. the database already exists! Be cautious not to overwrite a database containing valuable data. If it is not needed anymore, delete it!')

{'fraction_non_alphanumeric': 0.12192860454334724, 'fraction_numerical': 0.0009272137227630969, 'mean_word_length': 2.930783242258652, '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': '3546337', 'n_tokens_mistral': 651, 'n_tokens_neox': 642, 'n_words': 154}