<commit_before># coding: utf-8
"""
:mod:`imaputils` --- Extra IMAPv4 utilities
-------------------------------------------
"""
import email
import imaplib
import re
import ssl
import time
from functools import wraps

from django.utils.translation import ugettext as _

from modoboa.lib import parameters, imap_utf7
from modoboa.lib.connections import ConnectionsManager
from modoboa.lib.exceptions import InternalError

from ..exceptions import ImapError, WebmailInternalError
from .fetch_parser import parse_fetch_response


# workaround for the "got more than 10000 bytes" exception. MAXLINE
# value set to 1M, as on latest python versions.
MAXLINE = 1000000
if hasattr(imaplib, "_MAXLINE") and getattr(imaplib, "_MAXLINE") < MAXLINE:
    setattr(imaplib, "_MAXLINE", MAXLINE)


class capability(object):

    """
    Simple decorator to check if the server presents the required
    capability. If not, a fallback method is called instead.

    :param name: the capability name (upper case)
    :param fallback_method: a method's name
    """<commit_msg>add a line deleted by error<commit_after># coding: utf-8
"""
:mod:`imaputils` --- Extra IMAPv4 utilities
-------------------------------------------
"""
import email
import imaplib
import re
import ssl
import time
from functools import wraps

from django.utils.translation import ugettext as _

from modoboa.lib import parameters, imap_utf7
from modoboa.lib.connections import ConnectionsManager
from modoboa.lib.exceptions import InternalError

from ..exceptions import ImapError, WebmailInternalError
from .fetch_parser import parse_fetch_response

# imaplib.Debug = 4

# workaround for the "got more than 10000 bytes" exception. MAXLINE
# value set to 1M, as on latest python versions.
MAXLINE = 1000000
if hasattr(imaplib, "_MAXLINE") and getattr(imaplib, "_MAXLINE") < MAXLINE:
    setattr(imaplib, "_MAXLINE", MAXLINE)


class capability(object):

    """
    Simple decorator to check if the server presents the required
    capability. If not, a fallback method is called instead.

    :param name: the capability name (upper case)
    :param fallback_method: a method's name
    """
{'fraction_non_alphanumeric': 0.11219739292364991, 'fraction_numerical': 0.015363128491620111, 'mean_word_length': 3.764966740576497, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5194684', 'n_tokens_mistral': 642, 'n_tokens_neox': 602, 'n_words': 231}