Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../lib64/python3..../email
File: errors.py
# Copyright (C) 2001-2006 Python Software Foundation
[0] Fix | Delete
# Author: Barry Warsaw
[1] Fix | Delete
# Contact: email-sig@python.org
[2] Fix | Delete
[3] Fix | Delete
"""email package exception classes."""
[4] Fix | Delete
[5] Fix | Delete
[6] Fix | Delete
class MessageError(Exception):
[7] Fix | Delete
"""Base class for errors in the email package."""
[8] Fix | Delete
[9] Fix | Delete
[10] Fix | Delete
class MessageParseError(MessageError):
[11] Fix | Delete
"""Base class for message parsing errors."""
[12] Fix | Delete
[13] Fix | Delete
[14] Fix | Delete
class HeaderParseError(MessageParseError):
[15] Fix | Delete
"""Error while parsing headers."""
[16] Fix | Delete
[17] Fix | Delete
[18] Fix | Delete
class BoundaryError(MessageParseError):
[19] Fix | Delete
"""Couldn't find terminating boundary."""
[20] Fix | Delete
[21] Fix | Delete
[22] Fix | Delete
class MultipartConversionError(MessageError, TypeError):
[23] Fix | Delete
"""Conversion to a multipart is prohibited."""
[24] Fix | Delete
[25] Fix | Delete
[26] Fix | Delete
class CharsetError(MessageError):
[27] Fix | Delete
"""An illegal charset was given."""
[28] Fix | Delete
[29] Fix | Delete
[30] Fix | Delete
# These are parsing defects which the parser was able to work around.
[31] Fix | Delete
class MessageDefect(ValueError):
[32] Fix | Delete
"""Base class for a message defect."""
[33] Fix | Delete
[34] Fix | Delete
def __init__(self, line=None):
[35] Fix | Delete
if line is not None:
[36] Fix | Delete
super().__init__(line)
[37] Fix | Delete
self.line = line
[38] Fix | Delete
[39] Fix | Delete
class NoBoundaryInMultipartDefect(MessageDefect):
[40] Fix | Delete
"""A message claimed to be a multipart but had no boundary parameter."""
[41] Fix | Delete
[42] Fix | Delete
class StartBoundaryNotFoundDefect(MessageDefect):
[43] Fix | Delete
"""The claimed start boundary was never found."""
[44] Fix | Delete
[45] Fix | Delete
class CloseBoundaryNotFoundDefect(MessageDefect):
[46] Fix | Delete
"""A start boundary was found, but not the corresponding close boundary."""
[47] Fix | Delete
[48] Fix | Delete
class FirstHeaderLineIsContinuationDefect(MessageDefect):
[49] Fix | Delete
"""A message had a continuation line as its first header line."""
[50] Fix | Delete
[51] Fix | Delete
class MisplacedEnvelopeHeaderDefect(MessageDefect):
[52] Fix | Delete
"""A 'Unix-from' header was found in the middle of a header block."""
[53] Fix | Delete
[54] Fix | Delete
class MissingHeaderBodySeparatorDefect(MessageDefect):
[55] Fix | Delete
"""Found line with no leading whitespace and no colon before blank line."""
[56] Fix | Delete
# XXX: backward compatibility, just in case (it was never emitted).
[57] Fix | Delete
MalformedHeaderDefect = MissingHeaderBodySeparatorDefect
[58] Fix | Delete
[59] Fix | Delete
class MultipartInvariantViolationDefect(MessageDefect):
[60] Fix | Delete
"""A message claimed to be a multipart but no subparts were found."""
[61] Fix | Delete
[62] Fix | Delete
class InvalidMultipartContentTransferEncodingDefect(MessageDefect):
[63] Fix | Delete
"""An invalid content transfer encoding was set on the multipart itself."""
[64] Fix | Delete
[65] Fix | Delete
class UndecodableBytesDefect(MessageDefect):
[66] Fix | Delete
"""Header contained bytes that could not be decoded"""
[67] Fix | Delete
[68] Fix | Delete
class InvalidBase64PaddingDefect(MessageDefect):
[69] Fix | Delete
"""base64 encoded sequence had an incorrect length"""
[70] Fix | Delete
[71] Fix | Delete
class InvalidBase64CharactersDefect(MessageDefect):
[72] Fix | Delete
"""base64 encoded sequence had characters not in base64 alphabet"""
[73] Fix | Delete
[74] Fix | Delete
class InvalidBase64LengthDefect(MessageDefect):
[75] Fix | Delete
"""base64 encoded sequence had invalid length (1 mod 4)"""
[76] Fix | Delete
[77] Fix | Delete
# These errors are specific to header parsing.
[78] Fix | Delete
[79] Fix | Delete
class HeaderDefect(MessageDefect):
[80] Fix | Delete
"""Base class for a header defect."""
[81] Fix | Delete
[82] Fix | Delete
def __init__(self, *args, **kw):
[83] Fix | Delete
super().__init__(*args, **kw)
[84] Fix | Delete
[85] Fix | Delete
class InvalidHeaderDefect(HeaderDefect):
[86] Fix | Delete
"""Header is not valid, message gives details."""
[87] Fix | Delete
[88] Fix | Delete
class HeaderMissingRequiredValue(HeaderDefect):
[89] Fix | Delete
"""A header that must have a value had none"""
[90] Fix | Delete
[91] Fix | Delete
class NonPrintableDefect(HeaderDefect):
[92] Fix | Delete
"""ASCII characters outside the ascii-printable range found"""
[93] Fix | Delete
[94] Fix | Delete
def __init__(self, non_printables):
[95] Fix | Delete
super().__init__(non_printables)
[96] Fix | Delete
self.non_printables = non_printables
[97] Fix | Delete
[98] Fix | Delete
def __str__(self):
[99] Fix | Delete
return ("the following ASCII non-printables found in header: "
[100] Fix | Delete
"{}".format(self.non_printables))
[101] Fix | Delete
[102] Fix | Delete
class ObsoleteHeaderDefect(HeaderDefect):
[103] Fix | Delete
"""Header uses syntax declared obsolete by RFC 5322"""
[104] Fix | Delete
[105] Fix | Delete
class NonASCIILocalPartDefect(HeaderDefect):
[106] Fix | Delete
"""local_part contains non-ASCII characters"""
[107] Fix | Delete
# This defect only occurs during unicode parsing, not when
[108] Fix | Delete
# parsing messages decoded from binary.
[109] Fix | Delete
[110] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function