<commit_before>from asinstaller.utils import *
from asinstaller.config import usr_cfg, setup_logger

logger = setup_logger(__name__)

def format():
    if usr_cfg['swap_space']:
        system('echo -e "o\nn\np\n1\n\n+100M\nn\np\n3\n\n' \
            +'+{0}\nt\n\n82\nn\np\n2\n\n\nw"'.format(usr_cfg['swap_space']) \
            +' | fdisk {0}'.format(usr_cfg['drive']))
        SWAP = system_output("lsblk | grep {0}".format(usr_cfg['drive'][-3:]) \
                    + " |  awk '{ if (NR==4) print substr ($1,3) }'")
        system("wipefs -afq /dev/{0}".format(SWAP))
        system("mkswap /dev/{0}".format(SWAP))
        system("swapon /dev/{0}".format(SWAP))
        usr_cfg['swap'] = SWAP
    else:
        system('echo -e "o\nn\np\n1\n\n+100M\nn\np\n2\n\n\nw" | ' \
               + 'fdisk {0}'.format(usr_cfg['drive']))

    usr_cfg['boot'] = system_output("lsblk | " \
                + "grep {0} | ".format(usr_cfg['drive'][-3:]) \
                + "awk '{ if (NR==2) print substr ($1,3) }' ")
    usr_cfg['root'] = system_output("lsblk | " \
                + "grep {0} |  ".format(usr_cfg['drive'][-3:]) \
                + "awk '{ if (NR==3) print substr ($1,3) }' ")<commit_msg>more consistant partitions<commit_after>from asinstaller.utils import *
from asinstaller.config import usr_cfg, setup_logger

logger = setup_logger(__name__)

def format():
    if usr_cfg['swap_space']:
        system('echo -e "o\nn\np\n1\n\n+100M\nn\np\n3\n\n' \
            +'+{0}\nt\n\n82\nn\np\n2\n\n\nw"'.format(usr_cfg['swap_space']) \
            +' | fdisk {0}'.format(usr_cfg['drive']))
        SWAP = system_output("fdisk -l | " \
                    + " grep {0}".format(usr_cfg['drive'][-3:]) \
                    + " |  awk '{ if (NR==4) print substr ($1,6) }'")
        system("wipefs -afq /dev/{0}".format(SWAP))
        system("mkswap /dev/{0}".format(SWAP))
        system("swapon /dev/{0}".format(SWAP))
        usr_cfg['swap'] = SWAP
    else:
        system('echo -e "o\nn\np\n1\n\n+100M\nn\np\n2\n\n\nw" | ' \
               + 'fdisk {0}'.format(usr_cfg['drive']))

    usr_cfg['boot'] = system_output("fdisk -l | " \
                + "grep {0} | ".format(usr_cfg['drive'][-3:]) \
                + "awk '{ if (NR==2) print substr ($1,6) }' ")
    usr_cfg['root'] = system_output("fdisk -l | " \
                + "grep {0} |  ".format(usr_cfg['drive'][-3:]) \
                + "awk '{ if (NR==3) print substr ($1,6) }' ")
{'fraction_non_alphanumeric': 0.223996723996724, 'fraction_numerical': 0.027846027846027847, 'mean_word_length': 2.172727272727273, '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': '4420644', 'n_tokens_mistral': 982, 'n_tokens_neox': 949, 'n_words': 139}