<commit_before># coding: utf-8
from ElementBase import ElementBase
from ElementParameter import ElementParameter
from ElementValue import ElementValue
import console 
import copy

class AppendtoVariable(ElementBase):
	def __init__(self):
		self.status = 'running'
		self.output = None 
		self.params = []
		self.type = 'Standard'
		self.setup_params()
	
	def can_handle_list(self):
		return True
	
	def setup_params(self):
		self.params.append(ElementParameter(name='fm:runtime_variables',type='*'))
		self.params.append(ElementParameter(name='VariableName',displayName='Variable Name',display=True,type='string'))
	
	def get_status(self):
		return self.status
		
	def get_input_type(self):
		return '*'
	
	def get_output(self):
		return self.output
		
	def get_output_type(self):
		return None
		
	def get_params(self):
		return self.params
		
	def set_params(self, params = []):
		self.params = params
		
	def get_description(self):
		return 'Appends input to a set variable'
	
	def get_title(self):
		return 'Append to Variable'
		
	def get_icon(self):
		return 'iob:gear_a_32'
		
	def get_category(self):
		return 'Utility'
		
	def get_type(self):
		return self.type
		
	def run(self, input=''):
		np = self.get_param_by_name('VariableName')
		if np.value == None:
			name = console.input_alert('Please enter Variable name')
		else:
			name = np.value
		rv = self.get_param_by_name('fm:runtime_variables')
		if not name in rv.value.keys():
			rv.value[name] = None
		if rv.value[name] == None:
			rv.value[name] = copy.deepcopy(input)
		else:
			if input.type == rv.value[name].type:
				if not rv.value[name].isList:
					t = copy.deepcopy(rv.value[name].value)
					rv.value[name].value = []
					rv.value[name].value.append(copy.deepcopy(t))
				if input.isList:
					for i in input.value:
						rv.value[name].value.append(copy.deepcopy(i))
				else:
					rv.value[name].value.append(copy.deepcopy(input.value))
			else:
				console.alert('Error','Incorrect type to append to variable',button1='Ok',hide_cancel_button=True)
				
		self.status = 'complete'<commit_msg>fixed logic error in appendtovariable<commit_after># coding: utf-8
from ElementBase import ElementBase
from ElementParameter import ElementParameter
from ElementValue import ElementValue
import console 
import copy

class AppendtoVariable(ElementBase):
	def __init__(self):
		self.status = 'running'
		self.output = None 
		self.params = []
		self.type = 'Standard'
		self.setup_params()
	
	def can_handle_list(self):
		return True
	
	def setup_params(self):
		self.params.append(ElementParameter(name='fm:runtime_variables',type='*'))
		self.params.append(ElementParameter(name='VariableName',displayName='Variable Name',display=True,type='string'))
	
	def get_status(self):
		return self.status
		
	def get_input_type(self):
		return '*'
	
	def get_output(self):
		return self.output
		
	def get_output_type(self):
		return None
		
	def get_params(self):
		return self.params
		
	def set_params(self, params = []):
		self.params = params
		
	def get_description(self):
		return 'Appends input to a set variable'
	
	def get_title(self):
		return 'Append to Variable'
		
	def get_icon(self):
		return 'iob:gear_a_32'
		
	def get_category(self):
		return 'Utility'
		
	def get_type(self):
		return self.type
		
	def run(self, input=''):
		np = self.get_param_by_name('VariableName')
		if np.value == None:
			name = console.input_alert('Please enter Variable name')
		else:
			name = np.value
		rv = self.get_param_by_name('fm:runtime_variables')
		if not name in rv.value.keys():
			rv.value[name] = None
		if rv.value[name] == None:
			rv.value[name] = copy.deepcopy(input)
		else:
			if input.type == rv.value[name].type:
				if not isinstance(rv.value[name].value,list):
					t = copy.deepcopy(rv.value[name].value)
					rv.value[name].value = []
					rv.value[name].value.append(copy.deepcopy(t))
				if input.isList:
					for i in input.value:
						rv.value[name].value.append(copy.deepcopy(i))
				else:
					rv.value[name].value.append(copy.deepcopy(input.value))
			else:
				console.alert('Error','Incorrect type to append to variable',button1='Ok',hide_cancel_button=True)
				
		self.status = 'complete'
{'fraction_non_alphanumeric': 0.12625298329355608, 'fraction_numerical': 0.0019093078758949881, 'mean_word_length': 4.167694204685573, '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': '941739', 'n_tokens_mistral': 1612, 'n_tokens_neox': 1390, 'n_words': 303}