<commit_before>import os
import tempfile
import subprocess

import webcfg

def encrypt(msg, recipient):
    temp_fd, temp = tempfile.mkstemp()
    os.write(temp_fd, msg)
    os.close(temp_fd)
    proc = subprocess.Popen([webcfg.gpg, '--quiet', '--armor', '--no-tty',
        '--batch', '--trust-model', 'always', '--output', '-', '--encrypt',
        '--keyserver-options', 'timeout=3', '--recipient', recipient, temp],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stderr = proc.communicate()
    failed = stderr.strip() != '' # Very rough approximation.
    os.remove(temp)
    return stdout, failed

def import_key(pubkey):
    temp_fd, temp = tempfile.mkstemp()
    os.write(temp_fd, pubkey)
    os.close(temp_fd)
    proc = subprocess.Popen([webcfg.gpg, '--quiet', '--no-tty', '--batch',
        '--import', temp], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stderr = proc.communicate()
    return stderr.strip()
<commit_msg>Forgot to remove temp file with public key.<commit_after>import os
import tempfile
import subprocess

import webcfg

def encrypt(msg, recipient):
    temp_fd, temp = tempfile.mkstemp()
    os.write(temp_fd, msg)
    os.close(temp_fd)
    proc = subprocess.Popen([webcfg.gpg, '--quiet', '--armor', '--no-tty',
        '--batch', '--trust-model', 'always', '--output', '-', '--encrypt',
        '--keyserver-options', 'timeout=3', '--recipient', recipient, temp],
        stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stderr = proc.communicate()
    failed = stderr.strip() != '' # Very rough approximation.
    os.remove(temp)
    return stdout, failed

def import_key(pubkey):
    temp_fd, temp = tempfile.mkstemp()
    os.write(temp_fd, pubkey)
    os.close(temp_fd)
    proc = subprocess.Popen([webcfg.gpg, '--quiet', '--no-tty', '--batch',
        '--import', temp], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stderr = proc.communicate()
    os.remove(temp)
    return stderr.strip()

{'fraction_non_alphanumeric': 0.1732124874118832, 'fraction_numerical': 0.0010070493454179255, 'mean_word_length': 3.3479212253829322, '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': '6994124', 'n_tokens_mistral': 706, 'n_tokens_neox': 688, 'n_words': 144}