<commit_before>
"""
Little tools.
"""

import json

__author__ = 'josearrecio'

def is_json(myjson):
    """
    verify if string is in json format
    """
    try:
        json_object = json.loads(myjson)
        del json_object
    except Exception as e:
        print("is_json e:%s" % e)
        return False
    return True

def generate_ssh_keys():
    from cryptography.hazmat.primitives import serialization as crypto_serialization
    from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
    key = Ed25519PrivateKey.generate()
    privkey = key.private_bytes(
        crypto_serialization.Encoding.PEM,
        crypto_serialization.PrivateFormat.PKCS8,
        crypto_serialization.NoEncryption()
    )
    pubkey = key.public_key().public_bytes(
        crypto_serialization.Encoding.OpenSSH,
        crypto_serialization.PublicFormat.OpenSSH
    )
    return pubkey, privkey<commit_msg>[modules/demoinfo] change format for the private key<commit_after>
"""
Little tools.
"""

import json

__author__ = 'josearrecio'

def is_json(myjson):
    """
    verify if string is in json format
    """
    try:
        json_object = json.loads(myjson)
        del json_object
    except Exception as e:
        print("is_json e:%s" % e)
        return False
    return True

def generate_ssh_keys():
    from cryptography.hazmat.primitives import serialization as crypto_serialization
    from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
    key = Ed25519PrivateKey.generate()
    privkey = key.private_bytes(
        crypto_serialization.Encoding.PEM,
        crypto_serialization.PrivateFormat.OpenSSH,
        crypto_serialization.NoEncryption()
    )
    pubkey = key.public_key().public_bytes(
        crypto_serialization.Encoding.OpenSSH,
        crypto_serialization.PublicFormat.OpenSSH
    )
    return pubkey, privkey
{'fraction_non_alphanumeric': 0.0800211976682565, 'fraction_numerical': 0.016428192898781134, 'mean_word_length': 3.1769911504424777, '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': '4805205', 'n_tokens_mistral': 598, 'n_tokens_neox': 570, 'n_words': 121}