<commit_before>#!/usr/bin/env python
from utils import file_templates


def main():
    user_input = raw_input("Setup GPIO serial for data? (Y/N): ")
    if user_input == 'Y':
        update_file('/etc/inittab')
        update_file('/boot/cmdline.txt')
    else:
        print("Skipping GPIO serial...")


def update_file(path):
    template_name = path.split('/')[-1]
    new_file_data = file_templates.load(template_name)
    with open(path, 'w') as f:
        f.write(new_file_data)


if __name__ == '__main__':
	main()<commit_msg>Refactor serial script<commit_after>#!/usr/bin/env python
from utils import file_templates
from utils.installation import OptionalInstall


def main():
    prompt_txt = "Setup GPIO serial for data? (Y/N): "
    skip_txt = "Skipping GPIO serial..."

    def action():
        update_file('/etc/inittab')
        update_file('/boot/cmdline.txt')

    OptionalInstall(prompt_txt, skip_txt, action).run()


def update_file(path):
    template_name = path.split('/')[-1]
    new_file_data = file_templates.load(template_name)
    with open(path, 'w') as f:
        f.write(new_file_data)


if __name__ == '__main__':
	main()
{'fraction_non_alphanumeric': 0.14050303555941024, 'fraction_numerical': 0.0017346053772766695, 'mean_word_length': 3.4555984555984556, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7513678', 'n_tokens_mistral': 393, 'n_tokens_neox': 386, 'n_words': 87}