<commit_before>import os

from sugar import profile
from sugar import util
from sugar.activity import activity
import shutil

from color import Color
import record

class Instance:
	key = profile.get_pubkey()
	keyHash = util._sha_data(key)
	keyHashPrintable = util.printable_hash(keyHash)
	nickName = profile.get_nick_name()

	colorFill = Color()
	colorFill.init_hex( profile.get_color().get_fill_color() )
	colorStroke = Color()
	colorStroke.init_hex( profile.get_color().get_stroke_color() )

	instanceId = None
	tmpPath = None
	instancePath = None

	def __init__(self, ca):
		self.__class__.instanceId = ca._activity_id
		tmpPath = os.path.join( ca.get_activity_root(), "tmp" )
		self.__class__.tmpPath = os.path.join( tmpPath, str(self.__class__.instanceId))
		recreateTmp()

		self.__class__.instancePath = os.path.join( ca.get_activity_root(), "instance" )
		recreateInstance()


def recreateTmp():
	#todo: figure out how to have multiple spaces for my media
	#problem is, if new instance is created, with this code, it clears the whole tmp directory!
	if (os.path.exists(Instance.tmpPath)):
		shutil.rmtree(Instance.tmpPath)
	if (not os.path.exists(Instance.tmpPath)):
		os.makedirs(Instance.tmpPath)


def recreateInstance():
	#todo: figure out how to have multiple spaces for my media
	#problem is, if new instance is created, with this code, it clears the whole tmp directory!
	if (os.path.exists(Instance.tmpPath)):
		shutil.rmtree(Instance.tmpPath)
	if (not os.path.exists(Instance.instancePath)):
		os.makedirs(Instance.instancePath)<commit_msg>tmp / instance mix up<commit_after>import os

from sugar import profile
from sugar import util
from sugar.activity import activity
import shutil

from color import Color
import record

class Instance:
	key = profile.get_pubkey()
	keyHash = util._sha_data(key)
	keyHashPrintable = util.printable_hash(keyHash)
	nickName = profile.get_nick_name()

	colorFill = Color()
	colorFill.init_hex( profile.get_color().get_fill_color() )
	colorStroke = Color()
	colorStroke.init_hex( profile.get_color().get_stroke_color() )

	instanceId = None
	tmpPath = None
	instancePath = None

	def __init__(self, ca):
		self.__class__.instanceId = ca._activity_id
		tmpPath = os.path.join( ca.get_activity_root(), "tmp" )
		self.__class__.tmpPath = os.path.join( tmpPath, str(self.__class__.instanceId))
		recreateTmp()

		self.__class__.instancePath = os.path.join( ca.get_activity_root(), "instance" )
		recreateInstance()


def recreateTmp():
	#todo: figure out how to have multiple spaces for my media
	#problem is, if new instance is created, with this code, it clears the whole tmp directory!
	if (os.path.exists(Instance.tmpPath)):
		shutil.rmtree(Instance.tmpPath)
	if (not os.path.exists(Instance.tmpPath)):
		os.makedirs(Instance.tmpPath)


def recreateInstance():
	#todo: figure out how to have multiple spaces for my media
	#problem is, if new instance is created, with this code, it clears the whole tmp directory!
	if (os.path.exists(Instance.instancePath)):
		shutil.rmtree(Instance.instancePath)
	if (not os.path.exists(Instance.instancePath)):
		os.makedirs(Instance.instancePath)
{'fraction_non_alphanumeric': 0.104977664326739, 'fraction_numerical': 0.0, 'mean_word_length': 5.147058823529412, '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': '854405', 'n_tokens_mistral': 1043, 'n_tokens_neox': 1003, 'n_words': 276}