<commit_before>#!/usr/bin/python

import time
import uuid
import sqlite3
import os

from copy import deepcopy
import cPickle

from .ngpop import Population
from . import ngmeth
import additional.custom_func as custom_func
import additional.custom_graph as custom_graph
from additional.sqlite_storage import add_data,read_data,xz_compress,xz_decompress

import matplotlib.animation as animation
import matplotlib.pyplot as plt

import subprocess

class Poplist(object):
	def __init__(self,path,priority='decompressed'):
		self.priority = priority
		self.filepath = path
		#if os.path.isfile(self.filepath+'.xz') and os.path.isfile(self.filepath): # Old Policy: if both compressed and uncompressed versions present, erase uncompressed
			#os.remove(self.filepath)
		self.pop = None
		self.init_db()
		#self.conn = sqlite3.connect(self.filepath)
		#self.cursor = self.conn.cursor()

	def init_db(self):
		init_db(filepath=self.filepath)

	def append(self,pop,T,priority=None):
		if priority is None:
			priority = self.priority
		add_data(filepath=self.filepath,data=pop,label=T,priority=priority)
		#add_data_conn(cursor=self.cursor,data=pop,label=T)

	def get(self,T,priority=None):
		if priority is None:<commit_msg>init population object only when computation needed<commit_after>#!/usr/bin/python

import time
import uuid
import sqlite3
import os

from copy import deepcopy
import cPickle

from .ngpop import Population
from . import ngmeth
import additional.custom_func as custom_func
import additional.custom_graph as custom_graph
from additional.sqlite_storage import add_data,read_data,xz_compress,xz_decompress,init_db

import matplotlib.animation as animation
import matplotlib.pyplot as plt

import subprocess

class Poplist(object):
	def __init__(self,path,priority='decompressed'):
		self.priority = priority
		self.filepath = path
		#if os.path.isfile(self.filepath+'.xz') and os.path.isfile(self.filepath): # Old Policy: if both compressed and uncompressed versions present, erase uncompressed
			#os.remove(self.filepath)
		self.pop = None
		self.init_db()
		#self.conn = sqlite3.connect(self.filepath)
		#self.cursor = self.conn.cursor()

	def init_db(self):
		init_db(filepath=self.filepath)

	def append(self,pop,T,priority=None):
		if priority is None:
			priority = self.priority
		add_data(filepath=self.filepath,data=pop,label=T,priority=priority)
		#add_data_conn(cursor=self.cursor,data=pop,label=T)

	def get(self,T,priority=None):
		if priority is None:
{'fraction_non_alphanumeric': 0.09644874899112187, 'fraction_numerical': 0.0016142050040355124, 'mean_word_length': 5.867036011080333, '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': '2063749', 'n_tokens_mistral': 859, 'n_tokens_neox': 798, 'n_words': 193}