<commit_before>import webnotes

def execute():
	webnotes.reload_doc("utilities", "doctype", "note")
	webnotes.reload_doc("utilities", "doctype", "note_user")
	
	for question in webnotes.conn.sql("""select * from tabQuestion""", as_dict=True):
		name = question.question[:180]
		if webnotes.conn.exists("Note", name):
			webnotes.delete_doc("Note", name)
		note = webnotes.bean({
			"doctype":"Note",
			"title": name,
			"content": "<hr>".join(webnotes.conn.sql_list("""select answer from tabAnswer 
				where question=%s""", question.name)),
			"owner": question.owner,
			"creation": question.creation,
			"public": 1
		}).insert()
		
	webnotes.delete_doc("DocType", "Question")
	webnotes.delete_doc("DocType", "Answer")
	webnotes.bean("Style Settings").save()
	
	# update comment delete
	webnotes.conn.sql("""update tabDocPerm \
		set cancel=1 where parent='Comment' and role='System Manager'""")
<commit_msg>[notes] [fix] fix in note patch<commit_after>import webnotes

def execute():
	webnotes.reload_doc("utilities", "doctype", "note")
	webnotes.reload_doc("utilities", "doctype", "note_user")
	
	for question in webnotes.conn.sql("""select * from tabQuestion""", as_dict=True):
		if question.question:
			name = question.question[:180]
			if webnotes.conn.exists("Note", name):
				webnotes.delete_doc("Note", name)
			note = webnotes.bean({
				"doctype":"Note",
				"title": name,
				"content": "<hr>".join(webnotes.conn.sql_list("""select answer 
					from tabAnswer where question=%s""", question.name)),
				"owner": question.owner,
				"creation": question.creation,
				"public": 1
			}).insert()
		
	webnotes.delete_doc("DocType", "Question")
	webnotes.delete_doc("DocType", "Answer")
	webnotes.bean("Style Settings").save()
	
	# update comment delete
	webnotes.conn.sql("""update tabDocPerm \
		set cancel=1 where parent='Comment' and role='System Manager'""")

{'fraction_non_alphanumeric': 0.17465388711395102, 'fraction_numerical': 0.005324813631522897, 'mean_word_length': 5.120521172638436, 'pattern_counts': {'":': 12, '<': 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': '4719850', 'n_tokens_mistral': 694, 'n_tokens_neox': 605, 'n_words': 131}