How to use the pyisemail.utils.enum function in pyIsEmail

To help you get started, we’ve selected a few pyIsEmail examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github michaelherold / pyIsEmail / pyisemail / validators / parser_validator.py View on Github external
import re
import sys
from pyisemail import EmailValidator
from pyisemail.diagnosis import BaseDiagnosis, CFWSDiagnosis
from pyisemail.diagnosis import DeprecatedDiagnosis
from pyisemail.diagnosis import InvalidDiagnosis, RFC5321Diagnosis
from pyisemail.diagnosis import RFC5322Diagnosis, ValidDiagnosis
from pyisemail.utils import enum

__all__ = ["ParserValidator"]

Char = enum(AT='@',
            BACKSLASH='\\',
            DOT='.',
            DQUOTE='"',
            OPENPARENTHESIS='(',
            CLOSEPARENTHESIS=')',
            OPENSQBRACKET='[',
            CLOSESQBRACKET=']',
            HYPHEN='-',
            COLON=':',
            DOUBLECOLON='::',
            SP=' ',
            HTAB="\t",
            CR="\r",
            LF="\n",
            IPV6TAG='IPv6:',
            # US-ASCII visible characters not valid for atext
github michaelherold / pyIsEmail / pyisemail / validators / parser_validator.py View on Github external
CLOSEPARENTHESIS=')',
            OPENSQBRACKET='[',
            CLOSESQBRACKET=']',
            HYPHEN='-',
            COLON=':',
            DOUBLECOLON='::',
            SP=' ',
            HTAB="\t",
            CR="\r",
            LF="\n",
            IPV6TAG='IPv6:',
            # US-ASCII visible characters not valid for atext
            # (http:#tools.ietf.org/html/rfc5322#section-3.2.3)
            SPECIALS='()<>[]:;@\\,."')

Context = enum(LOCALPART=0,
               DOMAIN=1,
               LITERAL=2,
               COMMENT=3,
               FWS=4,
               QUOTEDSTRING=5,
               QUOTEDPAIR=6)

if sys.version_info[0] == 3:
    _unichr = chr
    _range = range
elif sys.version_info[0] == 2:
    _unichr = unichr
    _range = xrange


def to_char(token):