<commit_before>'''
Created on 19 Jun 2013

@author: <NAME>
'''

from PyQt4 import QtGui, QtCore

#def identifier(parent):
#	return QtGui.QRegExpValidator(QtCore.QRegExp("[A-Z]+[A-Z_]*[0-9]*"), parent);

def _show(parent, errors):
	msg = ["The following errors were detected:"]

	for e in errors.items():
		msg.append("\n")
		msg.append("* %s" % e[0])
		msg.append(":\n")
		msg.append("\n".join(e[1]))

	QtGui.QMessageBox.about(parent, "Errors", "".join(msg))

def _is_empty(text):
	if len(text): return False

	return True

def priority(project, item):
	errors = {}

	if _is_empty(item.name):
		errors['Name'] = {"This field cannot be empty"}

	#if _is_unique(item.name, list_of_elements_to_check):<commit_msg>add an example of function that may be used for validation<commit_after>'''
Created on 19 Jun 2013

@author: <NAME>
'''

from PyQt4 import QtGui, QtCore

#def identifier(parent):
#	return QtGui.QRegExpValidator(QtCore.QRegExp("[A-Z]+[A-Z_]*[0-9]*"), parent);

def _show(parent, errors):
	msg = ["The following errors were detected:"]

	for e in errors.items():
		msg.append("\n")
		msg.append("* %s" % e[0])
		msg.append(":\n")
		msg.append("\n".join(e[1]))

	QtGui.QMessageBox.about(parent, "Errors", "".join(msg))

def _is_empty(text):
	if len(text): return False

	return True

def _is_identifier(text):
	# pattern [A-Z]+[A-Z_]*[0-9]*

	return True

def priority(project, item):
	errors = {}

	if _is_empty(item.name):
		errors['Name'] = {"This field cannot be empty"}

	#if _is_unique(item.name, list_of_elements_to_check):
{'fraction_non_alphanumeric': 0.18477553675992192, 'fraction_numerical': 0.015614834092387769, 'mean_word_length': 4.938223938223938, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, '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': '5360698', 'n_tokens_mistral': 612, 'n_tokens_neox': 582, 'n_words': 143}