<commit_before>#!/usr/bin/env python2

import os
import re


def main():
    m = meminfo()
    freemem = (int(m['MemFree']) + int(m['Buffers']) + int(m['Cached'])) / 1024
    swap = (int(m['SwapTotal']) - int(m['SwapFree'])) / 1024
    freespace, fs_suffix = humanise_bytes(int(diskfree('/')))
    capacity, cap_suffix = humanise_bytes(int(diskcap('/')))
    print('Memory:')
    print("\t" + str(freemem) + ' MB of free memory available.')
    print("\t" + str(swap) + '/' + str(int(m['SwapTotal'])/1024) + ' MB of swap used.')
    print('Disk:')
    print("\t" + str(int(freespace)) + ' ' + fs_suffix + ' out of ' + str(int(capacity)) + ' ' + cap_suffix + ' disk space available.')

def diskfree(path):
    """
    Returns the number of free bytes on the drive that path is on.
    """
    s = os.statvfs(path)
    return s.f_bsize * s.f_bavail

def diskcap(path):
    """
    Returns the total number of bytes on the drive that paht is on.
    """
    s = os.statvfs(path)
    return s.f_bsize * s.f_blocks

def meminfo():
    """
    Returns meminfo in dictionary (kB omitted).
    """<commit_msg>Standardised variable names and showing usage.<commit_after>#!/usr/bin/env python2

import os
import re


def main():
    m = meminfo()
    mem_total = int(m['MemTotal']) / 1024
    mem_free = int(m['MemFree']) + int(m['Buffers']) + int(m['Cached'])
    mem_usage = (int(m['MemTotal']) - mem_free) / 1024
    swap_total = int(m['SwapTotal']) / 1024
    swap_usage = (int(m['SwapTotal']) - int(m['SwapFree'])) / 1024
    disk_total_bytes = int(diskcap('/'))
    disk_free = int(diskfree('/'))
    disk_total, dt_suffix = humanise_bytes(disk_total_bytes)
    disk_usage, du_suffix = humanise_bytes(disk_total_bytes - disk_free)
    print('Memory usage')
    print("\t{0}/{1} MB of used memory.".format(mem_usage, mem_total))
    print('Swap usage')
    print("\t{0}/{1} MB of used swap.".format(swap_usage, swap_total))
    print('Disk usage:')
    print("\t{0:.2f} {1}/{2:.2f} {3} of used disk space.".format(disk_usage, du_suffix, disk_total, dt_suffix))

def diskfree(path):
    """
    Returns the number of free bytes on the drive that path is on.
    """
    s = os.statvfs(path)
    return s.f_bsize * s.f_bavail

def diskcap(path):
    """
    Returns the total number of bytes on the drive that paht is on.
    """
    s = os.statvfs(path)
    return s.f_bsize * s.f_blocks

def meminfo():
    """
    Returns meminfo in dictionary (kB omitted).
    """
{'fraction_non_alphanumeric': 0.17066233238520925, 'fraction_numerical': 0.016253555465258026, 'mean_word_length': 3.304195804195804, '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': '6087110', 'n_tokens_mistral': 925, 'n_tokens_neox': 879, 'n_words': 219}