summaryrefslogtreecommitdiff
path: root/modules/language/python/module/email
diff options
context:
space:
mode:
Diffstat (limited to 'modules/language/python/module/email')
-rw-r--r--modules/language/python/module/email/__init__.py62
-rw-r--r--modules/language/python/module/email/__pycache__/__init__.cpython-36.pycbin0 -> 1669 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/_encoded_words.cpython-36.pycbin0 -> 5644 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/_header_value_parser.cpython-36.pycbin0 -> 75987 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/_parseaddr.cpython-36.pycbin0 -> 12440 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/_policybase.cpython-36.pycbin0 -> 14828 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/base64mime.cpython-36.pycbin0 -> 3218 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/charset.cpython-36.pycbin0 -> 11511 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/contentmanager.cpython-36.pycbin0 -> 7288 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/encoders.cpython-36.pycbin0 -> 1640 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/errors.cpython-36.pycbin0 -> 5957 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/feedparser.cpython-36.pycbin0 -> 10644 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/generator.cpython-36.pycbin0 -> 12513 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/header.cpython-36.pycbin0 -> 16480 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/headerregistry.cpython-36.pycbin0 -> 21278 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/iterators.cpython-36.pycbin0 -> 1910 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/message.cpython-36.pycbin0 -> 37992 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/parser.cpython-36.pycbin0 -> 5725 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/policy.cpython-36.pycbin0 -> 9618 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/quoprimime.cpython-36.pycbin0 -> 7680 bytes
-rw-r--r--modules/language/python/module/email/__pycache__/utils.cpython-36.pycbin0 -> 9874 bytes
-rw-r--r--modules/language/python/module/email/architecture.rst216
-rw-r--r--modules/language/python/module/email/mime/#audio.py#76
-rw-r--r--modules/language/python/module/email/mime/#image.py#49
l---------modules/language/python/module/email/mime/.#audio.py1
-rw-r--r--modules/language/python/module/email/mime/__init__.py0
-rw-r--r--modules/language/python/module/email/mime/__pycache__/__init__.cpython-36.pycbin0 -> 124 bytes
-rw-r--r--modules/language/python/module/email/mime/__pycache__/application.cpython-36.pycbin0 -> 1435 bytes
-rw-r--r--modules/language/python/module/email/mime/__pycache__/audio.cpython-36.pycbin0 -> 2594 bytes
-rw-r--r--modules/language/python/module/email/mime/__pycache__/base.cpython-36.pycbin0 -> 1060 bytes
-rw-r--r--modules/language/python/module/email/mime/__pycache__/image.cpython-36.pycbin0 -> 1880 bytes
-rw-r--r--modules/language/python/module/email/mime/__pycache__/message.cpython-36.pycbin0 -> 1309 bytes
-rw-r--r--modules/language/python/module/email/mime/__pycache__/multipart.cpython-36.pycbin0 -> 1531 bytes
-rw-r--r--modules/language/python/module/email/mime/__pycache__/nonmultipart.cpython-36.pycbin0 -> 746 bytes
-rw-r--r--modules/language/python/module/email/mime/__pycache__/text.cpython-36.pycbin0 -> 1293 bytes
-rw-r--r--modules/language/python/module/email/mime/application.py~37
-rw-r--r--modules/language/python/module/email/mime/multipart.py~48
37 files changed, 489 insertions, 0 deletions
diff --git a/modules/language/python/module/email/__init__.py b/modules/language/python/module/email/__init__.py
new file mode 100644
index 0000000..fae8724
--- /dev/null
+++ b/modules/language/python/module/email/__init__.py
@@ -0,0 +1,62 @@
+# Copyright (C) 2001-2007 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""A package for parsing, handling, and generating email messages."""
+
+__all__ = [
+ 'base64mime',
+ 'charset',
+ 'encoders',
+ 'errors',
+ 'feedparser',
+ 'generator',
+ 'header',
+ 'iterators',
+ 'message',
+ 'message_from_file',
+ 'message_from_binary_file',
+ 'message_from_string',
+ 'message_from_bytes',
+ 'mime',
+ 'parser',
+ 'quoprimime',
+ 'utils',
+ ]
+
+
+
+# Some convenience routines. Don't import Parser and Message as side-effects
+# of importing email since those cascadingly import most of the rest of the
+# email package.
+def message_from_string(s, *args, **kws):
+ """Parse a string into a Message object model.
+
+ Optional _class and strict are passed to the Parser constructor.
+ """
+ from email.parser import Parser
+ return Parser(*args, **kws).parsestr(s)
+
+def message_from_bytes(s, *args, **kws):
+ """Parse a bytes string into a Message object model.
+
+ Optional _class and strict are passed to the Parser constructor.
+ """
+ from email.parser import BytesParser
+ return BytesParser(*args, **kws).parsebytes(s)
+
+def message_from_file(fp, *args, **kws):
+ """Read a file and parse its contents into a Message object model.
+
+ Optional _class and strict are passed to the Parser constructor.
+ """
+ from email.parser import Parser
+ return Parser(*args, **kws).parse(fp)
+
+def message_from_binary_file(fp, *args, **kws):
+ """Read a binary file and parse its contents into a Message object model.
+
+ Optional _class and strict are passed to the Parser constructor.
+ """
+ from email.parser import BytesParser
+ return BytesParser(*args, **kws).parse(fp)
diff --git a/modules/language/python/module/email/__pycache__/__init__.cpython-36.pyc b/modules/language/python/module/email/__pycache__/__init__.cpython-36.pyc
new file mode 100644
index 0000000..2c8ef2d
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/__init__.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/_encoded_words.cpython-36.pyc b/modules/language/python/module/email/__pycache__/_encoded_words.cpython-36.pyc
new file mode 100644
index 0000000..16b86db
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/_encoded_words.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/_header_value_parser.cpython-36.pyc b/modules/language/python/module/email/__pycache__/_header_value_parser.cpython-36.pyc
new file mode 100644
index 0000000..18f3d03
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/_header_value_parser.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/_parseaddr.cpython-36.pyc b/modules/language/python/module/email/__pycache__/_parseaddr.cpython-36.pyc
new file mode 100644
index 0000000..08e82d8
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/_parseaddr.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/_policybase.cpython-36.pyc b/modules/language/python/module/email/__pycache__/_policybase.cpython-36.pyc
new file mode 100644
index 0000000..2d0888c
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/_policybase.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/base64mime.cpython-36.pyc b/modules/language/python/module/email/__pycache__/base64mime.cpython-36.pyc
new file mode 100644
index 0000000..00baa62
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/base64mime.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/charset.cpython-36.pyc b/modules/language/python/module/email/__pycache__/charset.cpython-36.pyc
new file mode 100644
index 0000000..3035f1c
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/charset.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/contentmanager.cpython-36.pyc b/modules/language/python/module/email/__pycache__/contentmanager.cpython-36.pyc
new file mode 100644
index 0000000..260fe06
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/contentmanager.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/encoders.cpython-36.pyc b/modules/language/python/module/email/__pycache__/encoders.cpython-36.pyc
new file mode 100644
index 0000000..3e79480
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/encoders.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/errors.cpython-36.pyc b/modules/language/python/module/email/__pycache__/errors.cpython-36.pyc
new file mode 100644
index 0000000..4ee3c07
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/errors.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/feedparser.cpython-36.pyc b/modules/language/python/module/email/__pycache__/feedparser.cpython-36.pyc
new file mode 100644
index 0000000..426ef0a
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/feedparser.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/generator.cpython-36.pyc b/modules/language/python/module/email/__pycache__/generator.cpython-36.pyc
new file mode 100644
index 0000000..d35527f
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/generator.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/header.cpython-36.pyc b/modules/language/python/module/email/__pycache__/header.cpython-36.pyc
new file mode 100644
index 0000000..64773a6
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/header.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/headerregistry.cpython-36.pyc b/modules/language/python/module/email/__pycache__/headerregistry.cpython-36.pyc
new file mode 100644
index 0000000..07e5886
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/headerregistry.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/iterators.cpython-36.pyc b/modules/language/python/module/email/__pycache__/iterators.cpython-36.pyc
new file mode 100644
index 0000000..c34d29a
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/iterators.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/message.cpython-36.pyc b/modules/language/python/module/email/__pycache__/message.cpython-36.pyc
new file mode 100644
index 0000000..942f356
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/message.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/parser.cpython-36.pyc b/modules/language/python/module/email/__pycache__/parser.cpython-36.pyc
new file mode 100644
index 0000000..1b32ef6
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/parser.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/policy.cpython-36.pyc b/modules/language/python/module/email/__pycache__/policy.cpython-36.pyc
new file mode 100644
index 0000000..63f6b6b
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/policy.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/quoprimime.cpython-36.pyc b/modules/language/python/module/email/__pycache__/quoprimime.cpython-36.pyc
new file mode 100644
index 0000000..359281d
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/quoprimime.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/__pycache__/utils.cpython-36.pyc b/modules/language/python/module/email/__pycache__/utils.cpython-36.pyc
new file mode 100644
index 0000000..e309ca5
--- /dev/null
+++ b/modules/language/python/module/email/__pycache__/utils.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/architecture.rst b/modules/language/python/module/email/architecture.rst
new file mode 100644
index 0000000..fcd10bd
--- /dev/null
+++ b/modules/language/python/module/email/architecture.rst
@@ -0,0 +1,216 @@
+:mod:`email` Package Architecture
+=================================
+
+Overview
+--------
+
+The email package consists of three major components:
+
+ Model
+ An object structure that represents an email message, and provides an
+ API for creating, querying, and modifying a message.
+
+ Parser
+ Takes a sequence of characters or bytes and produces a model of the
+ email message represented by those characters or bytes.
+
+ Generator
+ Takes a model and turns it into a sequence of characters or bytes. The
+ sequence can either be intended for human consumption (a printable
+ unicode string) or bytes suitable for transmission over the wire. In
+ the latter case all data is properly encoded using the content transfer
+ encodings specified by the relevant RFCs.
+
+Conceptually the package is organized around the model. The model provides both
+"external" APIs intended for use by application programs using the library,
+and "internal" APIs intended for use by the Parser and Generator components.
+This division is intentionally a bit fuzzy; the API described by this
+documentation is all a public, stable API. This allows for an application
+with special needs to implement its own parser and/or generator.
+
+In addition to the three major functional components, there is a third key
+component to the architecture:
+
+ Policy
+ An object that specifies various behavioral settings and carries
+ implementations of various behavior-controlling methods.
+
+The Policy framework provides a simple and convenient way to control the
+behavior of the library, making it possible for the library to be used in a
+very flexible fashion while leveraging the common code required to parse,
+represent, and generate message-like objects. For example, in addition to the
+default :rfc:`5322` email message policy, we also have a policy that manages
+HTTP headers in a fashion compliant with :rfc:`2616`. Individual policy
+controls, such as the maximum line length produced by the generator, can also
+be controlled individually to meet specialized application requirements.
+
+
+The Model
+---------
+
+The message model is implemented by the :class:`~email.message.Message` class.
+The model divides a message into the two fundamental parts discussed by the
+RFC: the header section and the body. The `Message` object acts as a
+pseudo-dictionary of named headers. Its dictionary interface provides
+convenient access to individual headers by name. However, all headers are kept
+internally in an ordered list, so that the information about the order of the
+headers in the original message is preserved.
+
+The `Message` object also has a `payload` that holds the body. A `payload` can
+be one of two things: data, or a list of `Message` objects. The latter is used
+to represent a multipart MIME message. Lists can be nested arbitrarily deeply
+in order to represent the message, with all terminal leaves having non-list
+data payloads.
+
+
+Message Lifecycle
+-----------------
+
+The general lifecycle of a message is:
+
+ Creation
+ A `Message` object can be created by a Parser, or it can be
+ instantiated as an empty message by an application.
+
+ Manipulation
+ The application may examine one or more headers, and/or the
+ payload, and it may modify one or more headers and/or
+ the payload. This may be done on the top level `Message`
+ object, or on any sub-object.
+
+ Finalization
+ The Model is converted into a unicode or binary stream,
+ or the model is discarded.
+
+
+
+Header Policy Control During Lifecycle
+--------------------------------------
+
+One of the major controls exerted by the Policy is the management of headers
+during the `Message` lifecycle. Most applications don't need to be aware of
+this.
+
+A header enters the model in one of two ways: via a Parser, or by being set to
+a specific value by an application program after the Model already exists.
+Similarly, a header exits the model in one of two ways: by being serialized by
+a Generator, or by being retrieved from a Model by an application program. The
+Policy object provides hooks for all four of these pathways.
+
+The model storage for headers is a list of (name, value) tuples.
+
+The Parser identifies headers during parsing, and passes them to the
+:meth:`~email.policy.Policy.header_source_parse` method of the Policy. The
+result of that method is the (name, value) tuple to be stored in the model.
+
+When an application program supplies a header value (for example, through the
+`Message` object `__setitem__` interface), the name and the value are passed to
+the :meth:`~email.policy.Policy.header_store_parse` method of the Policy, which
+returns the (name, value) tuple to be stored in the model.
+
+When an application program retrieves a header (through any of the dict or list
+interfaces of `Message`), the name and value are passed to the
+:meth:`~email.policy.Policy.header_fetch_parse` method of the Policy to
+obtain the value returned to the application.
+
+When a Generator requests a header during serialization, the name and value are
+passed to the :meth:`~email.policy.Policy.fold` method of the Policy, which
+returns a string containing line breaks in the appropriate places. The
+:meth:`~email.policy.Policy.cte_type` Policy control determines whether or
+not Content Transfer Encoding is performed on the data in the header. There is
+also a :meth:`~email.policy.Policy.binary_fold` method for use by generators
+that produce binary output, which returns the folded header as binary data,
+possibly folded at different places than the corresponding string would be.
+
+
+Handling Binary Data
+--------------------
+
+In an ideal world all message data would conform to the RFCs, meaning that the
+parser could decode the message into the idealized unicode message that the
+sender originally wrote. In the real world, the email package must also be
+able to deal with badly formatted messages, including messages containing
+non-ASCII characters that either have no indicated character set or are not
+valid characters in the indicated character set.
+
+Since email messages are *primarily* text data, and operations on message data
+are primarily text operations (except for binary payloads of course), the model
+stores all text data as unicode strings. Un-decodable binary inside text
+data is handled by using the `surrogateescape` error handler of the ASCII
+codec. As with the binary filenames the error handler was introduced to
+handle, this allows the email package to "carry" the binary data received
+during parsing along until the output stage, at which time it is regenerated
+in its original form.
+
+This carried binary data is almost entirely an implementation detail. The one
+place where it is visible in the API is in the "internal" API. A Parser must
+do the `surrogateescape` encoding of binary input data, and pass that data to
+the appropriate Policy method. The "internal" interface used by the Generator
+to access header values preserves the `surrogateescaped` bytes. All other
+interfaces convert the binary data either back into bytes or into a safe form
+(losing information in some cases).
+
+
+Backward Compatibility
+----------------------
+
+The :class:`~email.policy.Policy.Compat32` Policy provides backward
+compatibility with version 5.1 of the email package. It does this via the
+following implementation of the four+1 Policy methods described above:
+
+header_source_parse
+ Splits the first line on the colon to obtain the name, discards any spaces
+ after the colon, and joins the remainder of the line with all of the
+ remaining lines, preserving the linesep characters to obtain the value.
+ Trailing carriage return and/or linefeed characters are stripped from the
+ resulting value string.
+
+header_store_parse
+ Returns the name and value exactly as received from the application.
+
+header_fetch_parse
+ If the value contains any `surrogateescaped` binary data, return the value
+ as a :class:`~email.header.Header` object, using the character set
+ `unknown-8bit`. Otherwise just returns the value.
+
+fold
+ Uses :class:`~email.header.Header`'s folding to fold headers in the
+ same way the email5.1 generator did.
+
+binary_fold
+ Same as fold, but encodes to 'ascii'.
+
+
+New Algorithm
+-------------
+
+header_source_parse
+ Same as legacy behavior.
+
+header_store_parse
+ Same as legacy behavior.
+
+header_fetch_parse
+ If the value is already a header object, returns it. Otherwise, parses the
+ value using the new parser, and returns the resulting object as the value.
+ `surrogateescaped` bytes get turned into unicode unknown character code
+ points.
+
+fold
+ Uses the new header folding algorithm, respecting the policy settings.
+ surrogateescaped bytes are encoded using the ``unknown-8bit`` charset for
+ ``cte_type=7bit`` or ``8bit``. Returns a string.
+
+ At some point there will also be a ``cte_type=unicode``, and for that
+ policy fold will serialize the idealized unicode message with RFC-like
+ folding, converting any surrogateescaped bytes into the unicode
+ unknown character glyph.
+
+binary_fold
+ Uses the new header folding algorithm, respecting the policy settings.
+ surrogateescaped bytes are encoded using the `unknown-8bit` charset for
+ ``cte_type=7bit``, and get turned back into bytes for ``cte_type=8bit``.
+ Returns bytes.
+
+ At some point there will also be a ``cte_type=unicode``, and for that
+ policy binary_fold will serialize the message according to :rfc:``5335``.
diff --git a/modules/language/python/module/email/mime/#audio.py# b/modules/language/python/module/email/mime/#audio.py#
new file mode 100644
index 0000000..ccd08fe
--- /dev/null
+++ b/modules/language/python/module/email/mime/#audio.py#
@@ -0,0 +1,76 @@
+module(email,mime,audio)
+
+# Copyright (C) 2001-2007 Python Software Foundation
+# Author: Anthony Baxter
+# Contact: email-sig@python.org
+
+"""Class representing audio/* type MIME documents."""
+
+__all__ = ['MIMEAudio']
+
+import sndhdr
+
+from io import BytesIO
+import email.encoders as encoders
+from email.mime.nonmultipart import MIMENonMultipart
+
+
+
+_sndhdr_MIMEmap = {'au' : 'basic',
+ 'wav' :'x-wav',
+ 'aiff':'x-aiff',
+ 'aifc':'x-aiff',
+ }
+
+# There are others in sndhdr that don't have MIME types. :(
+# Additional ones to be added to sndhdr? midi, mp3, realaudio, wma??
+def _whatsnd(data):
+ """Try to identify a sound file type.
+
+ sndhdr.what() has a pretty cruddy interface, unfortunately. This is why
+ we re-do it here. It would be easier to reverse engineer the Unix 'file'
+ command and use the standard 'magic' file, as shipped with a modern Unix.
+ """
+ hdr = data[:512]
+ fakefile = BytesIO(hdr)
+ for testfn in sndhdr.tests:
+ res = testfn(hdr, fakefile)
+ if res is not None:
+ return _sndhdr_MIMEmap.get(res[0])
+ return None
+
+
+
+class MIMEAudio(MIMENonMultipart):
+ """Class for generating audio/* MIME documents."""
+
+ def __init__(self, _audiodata, _subtype=None,
+ _encoder=encoders.encode_base64, *, policy=None, **_params):
+ """Create an audio/* type MIME document.
+
+ _audiodata is a string containing the raw audio data. If this data
+ can be decoded by the standard Python `sndhdr' module, then the
+ subtype will be automatically included in the Content-Type header.
+ Otherwise, you can specify the specific audio subtype via the
+ _subtype parameter. If _subtype is not given, and no subtype can be
+ guessed, a TypeError is raised.
+
+ _encoder is a function which will perform the actual encoding for
+ transport of the image data. It takes one argument, which is this
+ Image instance. It should use get_payload() and set_payload() to
+ change the payload to the encoded form. It should also add any
+ Content-Transfer-Encoding or other headers to the message as
+ necessary. The default encoding is Base64.
+
+ Any additional keyword arguments are passed to the base class
+ constructor, which turns them into parameters on the Content-Type
+ header.
+ """
+ if _subtype is None:
+ _subtype = _whatsnd(_audiodata)
+ if _subtype is None:
+ raise TypeError('Could not find audio MIME subtype')
+ MIMENonMultipart.__init__(self, 'audio', _subtype, policy=policy,
+ **_params)
+ self.set_payload(_audiodata)
+ _encoder(self)
diff --git a/modules/language/python/module/email/mime/#image.py# b/modules/language/python/module/email/mime/#image.py#
new file mode 100644
index 0000000..5346dac
--- /dev/null
+++ b/modules/language/python/module/email/mime/#image.py#
@@ -0,0 +1,49 @@
+module(email,mime,image)
+
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Class representing image/* type MIME documents."""
+
+__all__ = ['MIMEImage']
+
+import imghdr
+
+import email.encoders as encoders
+from email.mime.nonmultipart import MIMENonMultipart
+
+
+
+class MIMEImage(MIMENonMultipart):
+ """Class for generating image/* type MIME documents."""
+
+ def __init__(self, _imagedata, _subtype=None,
+ _encoder=encoders.encode_base64, *, policy=None, **_params):
+ """Create an image/* type MIME document.
+
+ _imagedata is a string containing the raw image data. If this data
+ can be decoded by the standard Python `imghdr' module, then the
+ subtype will be automatically included in the Content-Type header.
+ Otherwise, you can specify the specific image subtype via the _subtype
+ parameter.
+
+ _encoder is a function which will perform the actual encoding for
+ transport of the image data. It takes one argument, which is this
+ Image instance. It should use get_payload() and set_payload() to
+ change the payload to the encoded form. It should also add any
+ Content-Transfer-Encoding or other headers to the message as
+ necessary. The default encoding is Base64.
+
+ Any additional keyword arguments are passed to the base class
+ constructor, which turns them into parameters on the Content-Type
+ header.
+ """
+ if _subtype is None:
+ _subtype = imghdr.what(None, _imagedata)
+ if _subtype is None:
+ raise TypeError('Could not guess image MIME subtype')
+ MIMENonMultipart.__init__(self, 'image', _subtype, policy=policy,
+ **_params)
+ self.set_payload(_imagedata)
+ _encoder(self)
diff --git a/modules/language/python/module/email/mime/.#audio.py b/modules/language/python/module/email/mime/.#audio.py
new file mode 120000
index 0000000..6876c49
--- /dev/null
+++ b/modules/language/python/module/email/mime/.#audio.py
@@ -0,0 +1 @@
+stis@lapwine.3569:1536593089 \ No newline at end of file
diff --git a/modules/language/python/module/email/mime/__init__.py b/modules/language/python/module/email/mime/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/modules/language/python/module/email/mime/__init__.py
diff --git a/modules/language/python/module/email/mime/__pycache__/__init__.cpython-36.pyc b/modules/language/python/module/email/mime/__pycache__/__init__.cpython-36.pyc
new file mode 100644
index 0000000..c9ca4cc
--- /dev/null
+++ b/modules/language/python/module/email/mime/__pycache__/__init__.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/mime/__pycache__/application.cpython-36.pyc b/modules/language/python/module/email/mime/__pycache__/application.cpython-36.pyc
new file mode 100644
index 0000000..cafb6ca
--- /dev/null
+++ b/modules/language/python/module/email/mime/__pycache__/application.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/mime/__pycache__/audio.cpython-36.pyc b/modules/language/python/module/email/mime/__pycache__/audio.cpython-36.pyc
new file mode 100644
index 0000000..5b737e7
--- /dev/null
+++ b/modules/language/python/module/email/mime/__pycache__/audio.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/mime/__pycache__/base.cpython-36.pyc b/modules/language/python/module/email/mime/__pycache__/base.cpython-36.pyc
new file mode 100644
index 0000000..6ece8ab
--- /dev/null
+++ b/modules/language/python/module/email/mime/__pycache__/base.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/mime/__pycache__/image.cpython-36.pyc b/modules/language/python/module/email/mime/__pycache__/image.cpython-36.pyc
new file mode 100644
index 0000000..3ba9d75
--- /dev/null
+++ b/modules/language/python/module/email/mime/__pycache__/image.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/mime/__pycache__/message.cpython-36.pyc b/modules/language/python/module/email/mime/__pycache__/message.cpython-36.pyc
new file mode 100644
index 0000000..5eac587
--- /dev/null
+++ b/modules/language/python/module/email/mime/__pycache__/message.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/mime/__pycache__/multipart.cpython-36.pyc b/modules/language/python/module/email/mime/__pycache__/multipart.cpython-36.pyc
new file mode 100644
index 0000000..d0b31f4
--- /dev/null
+++ b/modules/language/python/module/email/mime/__pycache__/multipart.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/mime/__pycache__/nonmultipart.cpython-36.pyc b/modules/language/python/module/email/mime/__pycache__/nonmultipart.cpython-36.pyc
new file mode 100644
index 0000000..555b295
--- /dev/null
+++ b/modules/language/python/module/email/mime/__pycache__/nonmultipart.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/mime/__pycache__/text.cpython-36.pyc b/modules/language/python/module/email/mime/__pycache__/text.cpython-36.pyc
new file mode 100644
index 0000000..b34d005
--- /dev/null
+++ b/modules/language/python/module/email/mime/__pycache__/text.cpython-36.pyc
Binary files differ
diff --git a/modules/language/python/module/email/mime/application.py~ b/modules/language/python/module/email/mime/application.py~
new file mode 100644
index 0000000..6877e55
--- /dev/null
+++ b/modules/language/python/module/email/mime/application.py~
@@ -0,0 +1,37 @@
+# Copyright (C) 2001-2006 Python Software Foundation
+# Author: Keith Dart
+# Contact: email-sig@python.org
+
+"""Class representing application/* type MIME documents."""
+
+__all__ = ["MIMEApplication"]
+
+from email import encoders
+from email.mime.nonmultipart import MIMENonMultipart
+
+
+class MIMEApplication(MIMENonMultipart):
+ """Class for generating application/* MIME documents."""
+
+ def __init__(self, _data, _subtype='octet-stream',
+ _encoder=encoders.encode_base64, *, policy=None, **_params):
+ """Create an application/* type MIME document.
+
+ _data is a string containing the raw application data.
+
+ _subtype is the MIME content type subtype, defaulting to
+ 'octet-stream'.
+
+ _encoder is a function which will perform the actual encoding for
+ transport of the application data, defaulting to base64 encoding.
+
+ Any additional keyword arguments are passed to the base class
+ constructor, which turns them into parameters on the Content-Type
+ header.
+ """
+ if _subtype is None:
+ raise TypeError('Invalid application MIME subtype')
+ MIMENonMultipart.__init__(self, 'application', _subtype, policy=policy,
+ **_params)
+ self.set_payload(_data)
+ _encoder(self)
diff --git a/modules/language/python/module/email/mime/multipart.py~ b/modules/language/python/module/email/mime/multipart.py~
new file mode 100644
index 0000000..2d3f288
--- /dev/null
+++ b/modules/language/python/module/email/mime/multipart.py~
@@ -0,0 +1,48 @@
+# Copyright (C) 2002-2006 Python Software Foundation
+# Author: Barry Warsaw
+# Contact: email-sig@python.org
+
+"""Base class for MIME multipart/* type messages."""
+
+__all__ = ['MIMEMultipart']
+
+from email.mime.base import MIMEBase
+
+
+
+class MIMEMultipart(MIMEBase):
+ """Base class for MIME multipart/* type messages."""
+
+ def __init__(self, _subtype='mixed', boundary=None, _subparts=None,
+ *, policy=None,
+ **_params):
+ """Creates a multipart/* type message.
+
+ By default, creates a multipart/mixed message, with proper
+ Content-Type and MIME-Version headers.
+
+ _subtype is the subtype of the multipart content type, defaulting to
+ `mixed'.
+
+ boundary is the multipart boundary string. By default it is
+ calculated as needed.
+
+ _subparts is a sequence of initial subparts for the payload. It
+ must be an iterable object, such as a list. You can always
+ attach new subparts to the message by using the attach() method.
+
+ Additional parameters for the Content-Type header are taken from the
+ keyword arguments (or passed into the _params argument).
+ """
+ MIMEBase.__init__(self, 'multipart', _subtype, policy=policy, **_params)
+
+ # Initialise _payload to an empty list as the Message superclass's
+ # implementation of is_multipart assumes that _payload is a list for
+ # multipart messages.
+ self._payload = []
+
+ if _subparts:
+ for p in _subparts:
+ self.attach(p)
+ if boundary:
+ self.set_boundary(boundary)