<commit_before>$(document).ready(function() {
	cpu_usage_fn();
});

function cpu_usage_fn() {
	$('#cpu_usage').highcharts({
		chart: {
            type: 'spline',
            events: {
                load: function() {
                    var series = this.series[0];

                    setInterval(function () {
                        var data = load_cpu_usage_graph_ajax();
                        series.addPoint([data[0][0], data[0][1]], true, true);
                    }, 2000);
                }
            }
        },
		title: {
			text: 'CPU Usage'
		},
		subtitle: {
			text: ''
		},
		xAxis: {
			type: 'datetime',
			title: {
				text: 'Datetime'
			}
		},
		yAxis: {
			title: {
				text: 'CPU %'
			},
		},
		min: 0,
		tooltip: {
			headerFormat: '<b>{series.name}:</b> {point.y:.2f}<br>',
			      pointFormat: '{point.x:%Y-%m-%d %H:%M:%S}'
			 },
        series: [{
            name: 'CPU Used',
            data: (load_cpu_usage_graph_ajax())()
        }]
    });
}

function load_cpu_usage_graph_ajax() {
	var server = $('input[name="hwaddr"]').val();
	var csrf = $('input[name="csrfmiddlewaretoken"]').val();
	var secret = $('input[name="secret"]').val();

	var address = '/ajax/server/' + server + '/metrics/cpu_usage/';

	$.ajax({
		url: address,
		type: 'POST',
		dataType: 'json',
		headers: {
			'X-CSRFToken': csrf
		},
		cache: false,
		data: {
			'server': server,
			'secret': secret
		},
		success: function(data) {
			return data;
		},
		error: function(data) {
			return data;
		}
	});

	return true;
}
<commit_msg>Fix creating jQuery function error<commit_after>$(document).ready(function() {
	cpu_usage_fn();
});

function cpu_usage_fn() {
	$('#cpu_usage').highcharts({
		chart: {
            type: 'spline',
            events: {
                load: function() {
                    var series = this.series[0];

                    setInterval(function () {
                        var data = load_cpu_usage_graph_ajax();
                        series.addPoint([data[0][0], data[0][1]], true, true);
                    }, 2000);
                }
            }
        },
		title: {
			text: 'CPU Usage'
		},
		subtitle: {
			text: ''
		},
		xAxis: {
			type: 'datetime',
			title: {
				text: 'Datetime'
			}
		},
		yAxis: {
			title: {
				text: 'CPU %'
			},
		},
		min: 0,
		tooltip: {
			headerFormat: '<b>{series.name}:</b> {point.y:.2f}<br>',
			      pointFormat: '{point.x:%Y-%m-%d %H:%M:%S}'
			 },
        series: [{
            name: 'CPU Used',
            data: load_cpu_usage_graph_ajax()
        }]
    });
}

function load_cpu_usage_graph_ajax() {
	var server = $('input[name="hwaddr"]').val();
	var csrf = $('input[name="csrfmiddlewaretoken"]').val();
	var secret = $('input[name="secret"]').val();

	var address = '/ajax/server/' + server + '/metrics/cpu_usage/';

	$.ajax({
		url: address,
		type: 'POST',
		dataType: 'json',
		headers: {
			'X-CSRFToken': csrf
		},
		cache: false,
		data: {
			'server': server,
			'secret': secret
		},
		success: function(data) {
			return data;
		},
		error: function(data) {
			return data;
		}
	});

	return true;
}

{'fraction_non_alphanumeric': 0.18904197372636974, 'fraction_numerical': 0.007049022749118872, 'mean_word_length': 1.9932885906040267, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '482715', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1072, 'n_words': 198}