<commit_before>import { doSubscribe } from '../redux/store';
import { StateProperty, TextElement, UpdateFunction } from '../types/types';
import { getTextElement } from './interface-elements';

export const getProgressIndicator = (): TextElement => {
	const progressIndicator: TextElement = getTextElement({
		left: 0,
		name: 'progressIndicator',
	});

	doSubscribe(
		[StateProperty.index, StateProperty.indexesWithSHAs],
		progressIndicator,
		updateProgressIndicator,
	);

	return progressIndicator;
};

const updateProgressIndicator: UpdateFunction<TextElement> = async ({
	element: progressIndicator,
	state,
}) => {
	const { index, indexesWithSHAs } = state;

	progressIndicator.setText(
		constructProgressText(index, indexesWithSHAs.length),
	);

	return true;
};

const constructProgressText = (index: number = 0, total: number = 0): string =>
	`Commit ${index + 1}/${total}`;<commit_msg>inline useless abstraction<commit_after>import { doSubscribe } from '../redux/store';
import { StateProperty, TextElement, UpdateFunction } from '../types/types';
import { getTextElement } from './interface-elements';

export const getProgressIndicator = (): TextElement => {
	const progressIndicator: TextElement = getTextElement({
		left: 0,
		name: 'progressIndicator',
	});

	doSubscribe(
		[StateProperty.index, StateProperty.indexesWithSHAs],
		progressIndicator,
		updateProgressIndicator,
	);

	return progressIndicator;
};

const updateProgressIndicator: UpdateFunction<TextElement> = async ({
	element: progressIndicator,
	state,
}) => {
	const { index, indexesWithSHAs } = state;

	progressIndicator.setText(`Commit ${index + 1}/${indexesWithSHAs.length}`);

	return true;
};
{'fraction_non_alphanumeric': 0.13064133016627077, 'fraction_numerical': 0.0035629453681710215, 'mean_word_length': 5.660079051383399, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '7641637', 'n_tokens_mistral': 502, 'n_tokens_neox': 488, 'n_words': 111}