<commit_before>import { ValidateResult } from "aurelia-validation";

export class MaterializeFormValidationRenderer {

	className = "md-input-validation";
	classNameFirst = "md-input-validation-first";

	pushElementResult(elementResults: Map<Element, ValidateResult[]>, element: Element, result: ValidateResult) {
		if (elementResults.has(element)) {
			elementResults.get(element).push(result);
		} else {
			elementResults.set(element, [result]);
		}
	}

	render(instruction) {
		let elementResultsToUnrender = new Map();
		// group validation results to unrender by elements
		for (let { result, elements } of instruction.unrender) {
			for (let element of elements) {
				this.pushElementResult(elementResultsToUnrender, element, result);
			}
		}
		for (let [element, results] of elementResultsToUnrender) {
			if (element.mdUnrenderValidateResults) {
				element.mdUnrenderValidateResults(results, this);
			} else {
				this.defaultUnrenderValidateResults(element, results);
			}
		}

		// group validation results to render by elements
		let elementResultsToRender = new Map();<commit_msg>Clean up<commit_after>import { ValidateResult } from "aurelia-validation";

export class MaterializeFormValidationRenderer {

	className = "md-input-validation";
	classNameFirst = "md-input-validation-first";

	pushElementResult(elementResults: Map<Element, ValidateResult[]>, element: Element, result: ValidateResult) {
		if (elementResults.has(element)) {
			elementResults.get(element).push(result);
		} else {
			elementResults.set(element, [result]);
		}
	}

	render(instruction) {
		let elementResultsToUnrender = new Map<Element, ValidateResult[]>();
		// group validation results to unrender by elements
		for (let { result, elements } of instruction.unrender) {
			for (let element of elements) {
				this.pushElementResult(elementResultsToUnrender, element, result);
			}
		}
		for (let [element, results] of elementResultsToUnrender) {
			if (element.mdUnrenderValidateResults) {
				element.mdUnrenderValidateResults(results, this);
			} else {
				this.defaultUnrenderValidateResults(element, results);
			}
		}

		// group validation results to render by elements
		let elementResultsToRender = new Map<Element, ValidateResult[]>();
{'fraction_non_alphanumeric': 0.10878288007133304, 'fraction_numerical': 0.0, 'mean_word_length': 5.0, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1065053', 'n_tokens_mistral': 698, 'n_tokens_neox': 633, 'n_words': 150}