<commit_before># -*- coding: utf-8 -*-
"""
Created on Sun Aug 14 20:37:02 2016

@author: lancehermes
"""

import h5py
import sys
import os
import datetime
import shutil
import glob
from pandas import DataFrame, HDFStore



class CansimPY:
    def  __init__(self, user=None, setup=True):
        #initial dictionaires
        self.mtype_dict = self.mes_dict = {}
        self.loadmessages()
        self.cwd = os.getcwd()
        self.matrices_updated = []
        self.sessionarchive = None
        try:
            self.Central_data.close()
        except:
            pass
        try:
            self.Central_data = HDFStore("Central_data.h5", "r+")
        except:
            self.Central_data = HDFStore("Central_data.h5", "w")
        self.theuser = user
        self.status = None
        # as a string
        self.thedate = "{:%B_%d_%Y}".format(datetime.datetime.now())
        # so calculations can be done
        self.starttime = datetime.datetime.now()
        try:
            self.centrallog = open('centrallog.txt', 'r+')
        except Exception:
            self.centrallog = open('centrallog.txt','w')
            print(self.mes_dict['Sys_NA'])
        self.startlog()
        print('*** past start log in initialization')
        if setup == True:
            self.addsessionarchive()
        self.dirdict = {'thearch':'archive',
                        'raw':'rawdump'}
    def info(self):
        """Lists diagnostic information about the session"""
        retstr = "Session started at hour " + str(self.starttime.hour)
        retstr = retstr + " minute " + str(self.starttime.minute)
        print(retstr)
        retstr = "The current working directory is " + self.cwd
        print(retstr)
    def __del__(self):
        """need to perform some cleanup at end of session as
        well as ensure that all files are closed"""
        try:
            self.centrallog.close()
        except:
            print("Could not close log file")
        try:
            self.Central_data.close()
        except:
            print("Could not close central_data")
        self.archiveloadedmatrices()
        self.archivelogfile()
        print("*** in the delete function")
        #delete from workspace
    def __repr__(self):<commit_msg>Add files via upload<commit_after># -*- coding: utf-8 -*-
"""
Created on Sun Aug 14 20:37:02 2016

@author: lancehermes
"""


import sys
import os
import datetime
import shutil
import glob
from pandas import DataFrame, HDFStore



class CansimPY:
    def  __init__(self, user=None, setup=True):
        #initial dictionaires
        self.mtype_dict = self.mes_dict = {}
        self.loadmessages()
        self.cwd = os.getcwd()
        #establish log file for the session in the working directory
        self.ses_log = open('Session_log.txt','w')
        self.matrices_updated = []
        self.sessionarchive = None
        try:
            self.Central_data.close()
        except:
            pass
        try:
            self.Central_data = HDFStore("Central_data.h5", "r+")
        except:
            self.Central_data = HDFStore("Central_data.h5", "w")
        self.theuser = user
        self.status = None
        # as a string
        self.thedate = "{:%B_%d_%Y}".format(datetime.datetime.now())
        # so calculations can be done
        self.starttime = datetime.datetime.now()
        try:
            self.centrallog = open('centrallog.txt', 'r+')
        except Exception:
            self.centrallog = open('centrallog.txt','w')
            print(self.mes_dict['Sys_NA'])
        self.startlog()
        print('*** past start log in initialization')
        if setup == True:
            self.addsessionarchive()
        self.dirdict = {'thearch':'archive',
                        'raw':'rawdump'}
    def info(self):
        """Lists diagnostic information about the session"""
        retstr = "Session started at hour " + str(self.starttime.hour)
        retstr = retstr + " minute " + str(self.starttime.minute)
        print(retstr)
        retstr = "The current working directory is " + self.cwd
        print(retstr)
    def __del__(self):
        """need to perform some cleanup at end of session as
        well as ensure that all files are closed"""
        try:
            self.centrallog.close()
        except:
            print("Could not close log file")
        try:
            self.Central_data.close()
        except:
            print("Could not close central_data")
        self.ses_log.close()
        self.archiveloadedmatrices()
        self.archivelogfile()
        print("*** in the delete function")
        #delete from workspace
    def __repr__(self):
{'fraction_non_alphanumeric': 0.1112540192926045, 'fraction_numerical': 0.006645230439442658, 'mean_word_length': 2.047681254082299, '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': '1938892', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1335, 'n_words': 353}