<commit_before>from __future__ import unicode_literals
import frappe
from frappe.core.doctype.user.user import create_contact
import re

def execute():
	""" Create Contact for each User if not present """
	frappe.reload_doc('contacts', 'doctype', 'contact')

	users = frappe.get_all('User', filters={"name": ('not in', 'Administrator, Guest')}, fields=["*"])
	special_characters = "<>"
	for user in users:
		if re.findall("[{0}]+".format(special_characters), user.full_name):
			continue
		create_contact(user)<commit_msg>[fix] creates contact even in presence of bad char (#5618)<commit_after>from __future__ import unicode_literals
import frappe
from frappe.core.doctype.user.user import create_contact
import re

def execute():
	""" Create Contact for each User if not present """
	frappe.reload_doc('contacts', 'doctype', 'contact')

	users = frappe.get_all('User', filters={"name": ('not in', 'Administrator, Guest')}, fields=["*"])
	special_characters = "<>"
	for user in users:
		user.first_name = re.sub("[{0}]+".format(special_characters), '', str(user.first_name))
		user.last_name  = re.sub("[{0}]+".format(special_characters), '', str(user.last_name))
		create_contact(user)
{'fraction_non_alphanumeric': 0.16104553119730186, 'fraction_numerical': 0.005902192242833052, 'mean_word_length': 6.372670807453416, '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': '4221753', 'n_tokens_mistral': 403, 'n_tokens_neox': 385, 'n_words': 96}