<commit_before>"""
JSON Web Token implementation

Minimum implementation based on this spec:
http://self-issued.info/docs/draft-jones-json-web-token-01.html
"""

import binascii
import sys

from calendar import timegm
from collections import Mapping
from datetime import datetime, timedelta

from jwt.algorithms import Algorithm, _register_default_algorithms
from jwt.utils import base64url_decode, base64url_encode

from .compat import (json, string_types, text_type, constant_time_compare,
                     timedelta_total_seconds)


__version__ = '0.4.1'
__all__ = [
    # Functions
    'encode',
    'decode',
    'register_algorithm',

    # Exceptions
    'InvalidTokenError',
    'DecodeError',
    'ExpiredSignatureError',
    'InvalidAudienceError',
    'InvalidIssuerError',

    # Deprecated aliases
    'ExpiredSignature',
    'InvalidAudience',
    'InvalidIssuer'
]

_algorithms = {}


def register_algorithm(alg_id, alg_obj):
    if alg_id in _algorithms:
        raise ValueError('Algorithm already has a handler.')

    if not isinstance(alg_obj, Algorithm):
        raise TypeError('Object is not of type `Algorithm`')

    _algorithms[alg_id] = alg_obj

_register_default_algorithms()

class InvalidTokenError(Exception):<commit_msg>Moved jwt.algorithms imports back to their original location<commit_after>"""
JSON Web Token implementation

Minimum implementation based on this spec:
http://self-issued.info/docs/draft-jones-json-web-token-01.html
"""

import binascii
import sys

from calendar import timegm
from collections import Mapping
from datetime import datetime, timedelta

from jwt.utils import base64url_decode, base64url_encode

from .compat import (json, string_types, text_type, constant_time_compare,
                     timedelta_total_seconds)


__version__ = '0.4.1'
__all__ = [
    # Functions
    'encode',
    'decode',
    'register_algorithm',

    # Exceptions
    'InvalidTokenError',
    'DecodeError',
    'ExpiredSignatureError',
    'InvalidAudienceError',
    'InvalidIssuerError',

    # Deprecated aliases
    'ExpiredSignature',
    'InvalidAudience',
    'InvalidIssuer'
]

_algorithms = {}


def register_algorithm(alg_id, alg_obj):
    if alg_id in _algorithms:
        raise ValueError('Algorithm already has a handler.')

    if not isinstance(alg_obj, Algorithm):
        raise TypeError('Object is not of type `Algorithm`')

    _algorithms[alg_id] = alg_obj

from jwt.algorithms import Algorithm, _register_default_algorithms  # NOQA
_register_default_algorithms()

class InvalidTokenError(Exception):
{'fraction_non_alphanumeric': 0.08570315543435918, 'fraction_numerical': 0.007012076353720296, 'mean_word_length': 4.136, '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': '2705882', 'n_tokens_mistral': 784, 'n_tokens_neox': 752, 'n_words': 197}