<commit_before>#! /usr/bin/env python3
from __future__ import print_function

import datetime
import os
import sys
import json
import uuid

def get_year():
    now = datetime.datetime.now()
    return now.year

def get_iso_date():
    now = datetime.datetime.now()
    return now.strftime('%Y-%m-%d')

def get_username():
    try:
        # POSIX only
        import pwd
        gecos_field =  pwd.getpwuid(os.getuid()).pw_gecos
        full_name = gecos_field.split(',')[0]
        return full_name
    except ImportError:
        import getpass
        return getpass.getuser()

def main():
    if len(sys.argv) > 1:
        sys.stderr.write("Usage: python "+sys.argv[0]+" 'command-invocation'"+'\n')
        sys.exit(1)

    new_uuid = str(uuid.uuid4())

    equajson = \
    {
        "copying": {
            "authors": [
                get_username()
            ],
            "license-name": "MIT (Expat) License",
            "license-url": "http://opensource.org/licenses/MIT",
            "year": get_year(),
        },
        "description": {
            "verbose": "<FIXME>",
            "terse": "<FIXME>",
        },
        "markup-languages": {
            "LaTeX": [
                {
                    "markup": "<FIXME>",
                }
            ]
        },
        "relevant-urls": [
            {
                "date-known-good": get_iso_date(),
                "url": "<FIXME>",<commit_msg>Use argparse and logging.<commit_after>#! /usr/bin/env python3
from __future__ import print_function

import datetime
import os
import sys
import json
import uuid
import argparse
import logging

def get_year():
    now = datetime.datetime.now()
    return now.year

def get_iso_date():
    now = datetime.datetime.now()
    return now.strftime('%Y-%m-%d')

def get_username():
    try:
        # POSIX only
        import pwd
        gecos_field =  pwd.getpwuid(os.getuid()).pw_gecos
        full_name = gecos_field.split(',')[0]
        return full_name
    except ImportError:
        import getpass
        return getpass.getuser()

def main():
    parser = argparse.ArgumentParser(
        description='Create new equajson file.')
    parser.add_argument(
        '-v',
        '--verbose',
        help='More verbose logging',
        dest="loglevel",
        default=logging.WARNING,
        action="store_const",
        const=logging.INFO,
    )
    parser.add_argument(
        '-d',
        '--debug',
        help='Enable debugging logs',
        action="store_const",
        dest="loglevel",
        const=logging.DEBUG,
    )
    # TODO: pass argument for equation.
    args = parser.parse_args()
    logging.basicConfig(level=args.loglevel)

    new_uuid = str(uuid.uuid4())

    equajson = \
    {
        "copying": {
            "authors": [
                get_username()
            ],
            "license-name": "MIT (Expat) License",
            "license-url": "http://opensource.org/licenses/MIT",
            "year": get_year(),
        },
        "description": {
            "verbose": "<FIXME>",
            "terse": "<FIXME>",
        },
        "markup-languages": {
            "LaTeX": [
                {
                    "markup": "<FIXME>",
                }
            ]
        },
        "relevant-urls": [
            {
                "date-known-good": get_iso_date(),
                "url": "<FIXME>",
{'fraction_non_alphanumeric': 0.13904536021345984, 'fraction_numerical': 0.0026682478505781204, 'mean_word_length': 1.6905901116427433, 'pattern_counts': {'":': 28, '<': 11, '<?xml version=': 0, '>': 12, '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': '1495799', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1012, 'n_words': 203}