<commit_before># coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function

import socket


class SignatureError(Exception):

    """
    An exception when validating a signature
    """

    pass


class AsymmetricKeyError(Exception):

    """
    An exception when a key is invalid or unsupported
    """

    pass


class CACertsError(Exception):

    """
    An exception when exporting CA certs from the OS trust store
    """

    pass


class TLSError(socket.error):

    """
    An exception related to TLS functionality
    """

    pass


class TLSVerificationError(TLSError):

    """
    A server certificate verification error happened during a TLS handshake
    """

    certificate = None

    def __init__(self, message, certificate):
        self.certificate = certificate
        TLSError.__init__(self, message)<commit_msg>TLS exceptions now have explicit __str__()/__unicode__() methods<commit_after># coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function

import sys
import socket


class SignatureError(Exception):

    """
    An exception when validating a signature
    """

    pass


class AsymmetricKeyError(Exception):

    """
    An exception when a key is invalid or unsupported
    """

    pass


class CACertsError(Exception):

    """
    An exception when exporting CA certs from the OS trust store
    """

    pass


class TLSError(socket.error):

    """
    An exception related to TLS functionality
    """

    message = None

    def __init__(self, message):  #pylint: disable=W0231
        self.args = (message,)
        self.message = message

    def __str__(self):
        output = self.__unicode__()
        if sys.version_info < (3,):
            output = output.encode('utf-8')
        return output

    def __unicode__(self):
        return self.message


class TLSVerificationError(TLSError):

    """
    A server certificate verification error happened during a TLS handshake
    """

    certificate = None

    def __init__(self, message, certificate):
        TLSError.__init__(self, message)
        self.certificate = certificate
        self.args = (message, certificate)
{'fraction_non_alphanumeric': 0.08261851015801354, 'fraction_numerical': 0.0036117381489841984, 'mean_word_length': 2.9082892416225747, 'pattern_counts': {'":': 0, '<': 4, '<?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': '5130138', 'n_tokens_mistral': 636, 'n_tokens_neox': 576, 'n_words': 191}