<commit_before># Copyright (C) 2016 g10 Code GmbH
#
# This file is part of GPGME.
#
# GPGME is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# GPGME is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals

import contextlib
import shutil
import sys
import os
import tempfile
import time
import gpg

def assert_gpg_version(version=(2, 1, 0)):
    with gpg.Context() as c:
        if tuple(map(int, c.engine_info.version.split('.'))) < version:
            print("GnuPG too old: have {0}, need {1}.".format(
                c.engine_info.version, '.'.join(version)))
            sys.exit(77)

# known keys
alpha = "A0FF4590BB6122EDEF6E3C542D727CC768697734"
bob = "<KEY>"
encrypt_only = "<KEY>"
sign_only = "7CCA20CCDE5394CEE71C9F0BFED153F12F18F45D"
no_such_key = "A" * 40

def make_filename(name):
    return os.path.join(os.environ['top_srcdir'], 'tests', 'gpg', name)

def in_srcdir(name):
    return os.path.join(os.environ['srcdir'], name)

verbose = int(os.environ.get('verbose', 0)) > 1
def print_data(data):
    if verbose:
        try:
            # See if it is a file-like object.
            data.seek(0, os.SEEK_SET)
            data = data.read()
        except:
            # Hope for the best.
            pass

        if hasattr(sys.stdout, "buffer"):<commit_msg>python: Fix version check.<commit_after># Copyright (C) 2016 g10 Code GmbH
#
# This file is part of GPGME.
#
# GPGME is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# GPGME is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <http://www.gnu.org/licenses/>.

from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals

import contextlib
import shutil
import sys
import os
import re
import tempfile
import time
import gpg

def assert_gpg_version(version=(2, 1, 0)):
    with gpg.Context() as c:
        clean_version = re.match(r'\d+\.\d+\.\d+', c.engine_info.version).group(0)
        if tuple(map(int, clean_version.split('.'))) < version:
            print("GnuPG too old: have {0}, need {1}.".format(
                c.engine_info.version, '.'.join(version)))
            sys.exit(77)

# known keys
alpha = "A0FF4590BB6122EDEF6E3C542D727CC768697734"
bob = "<KEY>"
encrypt_only = "F52770D5C4DB41408D918C9F920572769B9FE19C"
sign_only = "7CCA20CCDE5394CEE71C9F0BFED153F12F18F45D"
no_such_key = "A" * 40

def make_filename(name):
    return os.path.join(os.environ['top_srcdir'], 'tests', 'gpg', name)

def in_srcdir(name):
    return os.path.join(os.environ['srcdir'], name)

verbose = int(os.environ.get('verbose', 0)) > 1
def print_data(data):
    if verbose:
        try:
            # See if it is a file-like object.
            data.seek(0, os.SEEK_SET)
            data = data.read()
        except:
            # Hope for the best.
            pass

        if hasattr(sys.stdout, "buffer"):
{'fraction_non_alphanumeric': 0.10229276895943562, 'fraction_numerical': 0.0400604686318972, 'mean_word_length': 3.420935412026726, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1180645', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1268, 'n_words': 431}