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
class HeaderWriteError(MessageError):
[31] Fix | Delete
"""Error while writing headers."""
[32] Fix | Delete
[33] Fix | Delete
[34] Fix | Delete
# These are parsing defects which the parser was able to work around.
[35] Fix | Delete
class MessageDefect(ValueError):
[36] Fix | Delete
"""Base class for a message defect."""
[37] Fix | Delete
[38] Fix | Delete
def __init__(self, line=None):
[39] Fix | Delete
if line is not None:
[40] Fix | Delete
super().__init__(line)
[41] Fix | Delete
self.line = line
[42] Fix | Delete
[43] Fix | Delete
class NoBoundaryInMultipartDefect(MessageDefect):
[44] Fix | Delete
"""A message claimed to be a multipart but had no boundary parameter."""
[45] Fix | Delete
[46] Fix | Delete
class StartBoundaryNotFoundDefect(MessageDefect):
[47] Fix | Delete
"""The claimed start boundary was never found."""
[48] Fix | Delete
[49] Fix | Delete
class CloseBoundaryNotFoundDefect(MessageDefect):
[50] Fix | Delete
"""A start boundary was found, but not the corresponding close boundary."""
[51] Fix | Delete
[52] Fix | Delete
class FirstHeaderLineIsContinuationDefect(MessageDefect):
[53] Fix | Delete
"""A message had a continuation line as its first header line."""
[54] Fix | Delete
[55] Fix | Delete
class MisplacedEnvelopeHeaderDefect(MessageDefect):
[56] Fix | Delete
"""A 'Unix-from' header was found in the middle of a header block."""
[57] Fix | Delete
[58] Fix | Delete
class MissingHeaderBodySeparatorDefect(MessageDefect):
[59] Fix | Delete
"""Found line with no leading whitespace and no colon before blank line."""
[60] Fix | Delete
# XXX: backward compatibility, just in case (it was never emitted).
[61] Fix | Delete
MalformedHeaderDefect = MissingHeaderBodySeparatorDefect
[62] Fix | Delete
[63] Fix | Delete
class MultipartInvariantViolationDefect(MessageDefect):
[64] Fix | Delete
"""A message claimed to be a multipart but no subparts were found."""
[65] Fix | Delete
[66] Fix | Delete
class InvalidMultipartContentTransferEncodingDefect(MessageDefect):
[67] Fix | Delete
"""An invalid content transfer encoding was set on the multipart itself."""
[68] Fix | Delete
[69] Fix | Delete
class UndecodableBytesDefect(MessageDefect):
[70] Fix | Delete
"""Header contained bytes that could not be decoded"""
[71] Fix | Delete
[72] Fix | Delete
class InvalidBase64PaddingDefect(MessageDefect):
[73] Fix | Delete
"""base64 encoded sequence had an incorrect length"""
[74] Fix | Delete
[75] Fix | Delete
class InvalidBase64CharactersDefect(MessageDefect):
[76] Fix | Delete
"""base64 encoded sequence had characters not in base64 alphabet"""
[77] Fix | Delete
[78] Fix | Delete
class InvalidBase64LengthDefect(MessageDefect):
[79] Fix | Delete
"""base64 encoded sequence had invalid length (1 mod 4)"""
[80] Fix | Delete
[81] Fix | Delete
# These errors are specific to header parsing.
[82] Fix | Delete
[83] Fix | Delete
class HeaderDefect(MessageDefect):
[84] Fix | Delete
"""Base class for a header defect."""
[85] Fix | Delete
[86] Fix | Delete
def __init__(self, *args, **kw):
[87] Fix | Delete
super().__init__(*args, **kw)
[88] Fix | Delete
[89] Fix | Delete
class InvalidHeaderDefect(HeaderDefect):
[90] Fix | Delete
"""Header is not valid, message gives details."""
[91] Fix | Delete
[92] Fix | Delete
class HeaderMissingRequiredValue(HeaderDefect):
[93] Fix | Delete
"""A header that must have a value had none"""
[94] Fix | Delete
[95] Fix | Delete
class NonPrintableDefect(HeaderDefect):
[96] Fix | Delete
"""ASCII characters outside the ascii-printable range found"""
[97] Fix | Delete
[98] Fix | Delete
def __init__(self, non_printables):
[99] Fix | Delete
super().__init__(non_printables)
[100] Fix | Delete
self.non_printables = non_printables
[101] Fix | Delete
[102] Fix | Delete
def __str__(self):
[103] Fix | Delete
return ("the following ASCII non-printables found in header: "
[104] Fix | Delete
"{}".format(self.non_printables))
[105] Fix | Delete
[106] Fix | Delete
class ObsoleteHeaderDefect(HeaderDefect):
[107] Fix | Delete
"""Header uses syntax declared obsolete by RFC 5322"""
[108] Fix | Delete
[109] Fix | Delete
class NonASCIILocalPartDefect(HeaderDefect):
[110] Fix | Delete
"""local_part contains non-ASCII characters"""
[111] Fix | Delete
# This defect only occurs during unicode parsing, not when
[112] Fix | Delete
# parsing messages decoded from binary.
[113] Fix | Delete
[114] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function