<commit_before>#!/usr/bin/python
import sys, argparse
from genpiepie import gen_key, gen_masterpwd

def main(argv=None):
    parser = argparse.ArgumentParser(description="Generate RSA keys and a masterkey encrypted with the publickey")

    parser.add_argument('--output', help='The prefix of private keys', default='key')
    parser.add_argument('--length', help='The length of the key', default=2048)
    parser.add_argument('--masterkey', help='A randomly generated masterkey, encoded in b64')

    args = parser.parse_args()

    gen_key(args.output, args.length)

    if args.masterkey != None:
        key = gen_masterpwd(public="{}_pub.pem".format(args.output))
        try:
            master_key = open(args.masterkey, 'wb')

        except Exception as err:
            print("There was a problem: {}", err)
            print("Here is your key anyway : {}".format(key))

        else:
            master_key.write(key)
            master_key.write(b'\n')
            master_key.close()

if __name__ == "__main__":
    sys.exit(main(sys.argv))
<commit_msg>more consistency in the naming of masterpwd<commit_after>#!/usr/bin/python
import sys, argparse
from genpiepie import gen_key, gen_masterpwd

def main(argv=None):
    parser = argparse.ArgumentParser(description="Generate RSA keys and a masterkey encrypted with the publickey")

    parser.add_argument('--output', help='The prefix of private keys', default='key')
    parser.add_argument('--length', help='The length of the key', default=2048)
    parser.add_argument('--masterpwd', help='A randomly generated master password, encoded in b64')

    args = parser.parse_args()

    gen_key(args.output, args.length)

    if args.masterpwd != None:
        key = gen_masterpwd(public="{}_pub.pem".format(args.output))
        try:
            master_key = open(args.masterpwd, 'wb')

        except Exception as err:
            print("There was a problem: {}", err)
            print("Here is your key anyway : {}".format(key))

        else:
            master_key.write(key)
            master_key.write(b'\n')
            master_key.close()

if __name__ == "__main__":
    sys.exit(main(sys.argv))

{'fraction_non_alphanumeric': 0.12742382271468145, 'fraction_numerical': 0.00554016620498615, 'mean_word_length': 3.1041666666666665, 'pattern_counts': {'":': 2, '<': 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': '7074591', 'n_tokens_mistral': 665, 'n_tokens_neox': 641, 'n_words': 167}