Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
e2524465
Kaydet (Commit)
e2524465
authored
May 07, 2014
tarafından
R David Murray
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#21300: Clean up the docs for the email "policy" arguments.
üst
3d139d8e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
23 deletions
+37
-23
email.generator.rst
Doc/library/email.generator.rst
+6
-4
email.parser.rst
Doc/library/email.parser.rst
+25
-16
generator.py
Lib/email/generator.py
+6
-3
No files found.
Doc/library/email.generator.rst
Dosyayı görüntüle @
e2524465
...
@@ -112,7 +112,7 @@ formatted string representation of a message object. For more detail, see
...
@@ -112,7 +112,7 @@ formatted string representation of a message object. For more detail, see
:mod:`email.message`.
:mod:`email.message`.
.. class:: BytesGenerator(outfp, mangle_from_=True, maxheaderlen=78, *, \
.. class:: BytesGenerator(outfp, mangle_from_=True, maxheaderlen=78, *, \
policy=
policy.default
)
policy=
None
)
The constructor for the :class:`BytesGenerator` class takes a binary
The constructor for the :class:`BytesGenerator` class takes a binary
:term:`file-like object` called *outfp* for an argument. *outfp* must
:term:`file-like object` called *outfp* for an argument. *outfp* must
...
@@ -134,9 +134,11 @@ formatted string representation of a message object. For more detail, see
...
@@ -134,9 +134,11 @@ formatted string representation of a message object. For more detail, see
wrapping. The default is 78, as recommended (but not required) by
wrapping. The default is 78, as recommended (but not required) by
:rfc:`2822`.
:rfc:`2822`.
The *policy* keyword specifies a :mod:`~email.policy` object that controls a
The *policy* keyword specifies a :mod:`~email.policy` object that controls a
number of aspects of the generator's operation. The default policy
number of aspects of the generator's operation. If no *policy* is specified,
maintains backward compatibility.
then the *policy* attached to the message object passed to :attr:`flatten`
is used.
.. versionchanged:: 3.3 Added the *policy* keyword.
.. versionchanged:: 3.3 Added the *policy* keyword.
...
@@ -174,7 +176,7 @@ formatted string representation of a message object. For more detail, see
...
@@ -174,7 +176,7 @@ formatted string representation of a message object. For more detail, see
Optional *linesep* specifies the line separator character used to
Optional *linesep* specifies the line separator character used to
terminate lines in the output. If specified it overrides the value
terminate lines in the output. If specified it overrides the value
specified by the ``Generator``\ 's ``policy``.
specified by the ``Generator``\
or *msg*\
's ``policy``.
.. method:: clone(fp)
.. method:: clone(fp)
...
...
Doc/library/email.parser.rst
Dosyayı görüntüle @
e2524465
...
@@ -60,15 +60,18 @@ list of defects that it can find.
...
@@ -60,15 +60,18 @@ list of defects that it can find.
Here is the API for the :class:`FeedParser`:
Here is the API for the :class:`FeedParser`:
.. class:: FeedParser(_factory=email.message.Message, *, policy=policy.
default
)
.. class:: FeedParser(_factory=email.message.Message, *, policy=policy.
compat32
)
Create a :class:`FeedParser` instance. Optional *_factory* is a no-argument
Create a :class:`FeedParser` instance. Optional *_factory* is a no-argument
callable that will be called whenever a new message object is needed. It
callable that will be called whenever a new message object is needed. It
defaults to the :class:`email.message.Message` class.
defaults to the :class:`email.message.Message` class.
The *policy* keyword specifies a :mod:`~email.policy` object that controls a
If *policy* is specified (it must be an instance of a :mod:`~email.policy`
number of aspects of the parser's operation. The default policy maintains
class) use the rules it specifies to udpate the representation of the
backward compatibility.
message. If *policy* is not set, use the :class:`compat32
<email.policy.Compat32>` policy, which maintains backward compatibility with
the Python 3.2 version of the email package. For more information see the
:mod:`~email.policy` documentation.
.. versionchanged:: 3.3 Added the *policy* keyword.
.. versionchanged:: 3.3 Added the *policy* keyword.
...
@@ -113,7 +116,7 @@ have the same API as the :class:`Parser` and :class:`BytesParser` classes.
...
@@ -113,7 +116,7 @@ have the same API as the :class:`Parser` and :class:`BytesParser` classes.
The BytesHeaderParser class.
The BytesHeaderParser class.
.. class:: Parser(_class=email.message.Message, *, policy=policy.
default
)
.. class:: Parser(_class=email.message.Message, *, policy=policy.
compat32
)
The constructor for the :class:`Parser` class takes an optional argument
The constructor for the :class:`Parser` class takes an optional argument
*_class*. This must be a callable factory (such as a function or a class), and
*_class*. This must be a callable factory (such as a function or a class), and
...
@@ -121,9 +124,12 @@ have the same API as the :class:`Parser` and :class:`BytesParser` classes.
...
@@ -121,9 +124,12 @@ have the same API as the :class:`Parser` and :class:`BytesParser` classes.
:class:`~email.message.Message` (see :mod:`email.message`). The factory will
:class:`~email.message.Message` (see :mod:`email.message`). The factory will
be called without arguments.
be called without arguments.
The *policy* keyword specifies a :mod:`~email.policy` object that controls a
If *policy* is specified (it must be an instance of a :mod:`~email.policy`
number of aspects of the parser's operation. The default policy maintains
class) use the rules it specifies to udpate the representation of the
backward compatibility.
message. If *policy* is not set, use the :class:`compat32
<email.policy.Compat32>` policy, which maintains backward compatibility with
the Python 3.2 version of the email package. For more information see the
:mod:`~email.policy` documentation.
.. versionchanged:: 3.3
.. versionchanged:: 3.3
Removed the *strict* argument that was deprecated in 2.4. Added the
Removed the *strict* argument that was deprecated in 2.4. Added the
...
@@ -159,15 +165,18 @@ have the same API as the :class:`Parser` and :class:`BytesParser` classes.
...
@@ -159,15 +165,18 @@ have the same API as the :class:`Parser` and :class:`BytesParser` classes.
Optional *headersonly* is as with the :meth:`parse` method.
Optional *headersonly* is as with the :meth:`parse` method.
.. class:: BytesParser(_class=email.message.Message, *, policy=policy.
default
)
.. class:: BytesParser(_class=email.message.Message, *, policy=policy.
compat32
)
This class is exactly parallel to :class:`Parser`, but handles bytes input.
This class is exactly parallel to :class:`Parser`, but handles bytes input.
The *_class* and *strict* arguments are interpreted in the same way as for
The *_class* and *strict* arguments are interpreted in the same way as for
the :class:`Parser` constructor.
the :class:`Parser` constructor.
The *policy* keyword specifies a :mod:`~email.policy` object that
If *policy* is specified (it must be an instance of a :mod:`~email.policy`
controls a number of aspects of the parser's operation. The default
class) use the rules it specifies to udpate the representation of the
policy maintains backward compatibility.
message. If *policy* is not set, use the :class:`compat32
<email.policy.Compat32>` policy, which maintains backward compatibility with
the Python 3.2 version of the email package. For more information see the
:mod:`~email.policy` documentation.
.. versionchanged:: 3.3
.. versionchanged:: 3.3
Removed the *strict* argument. Added the *policy* keyword.
Removed the *strict* argument. Added the *policy* keyword.
...
@@ -209,7 +218,7 @@ in the top-level :mod:`email` package namespace.
...
@@ -209,7 +218,7 @@ in the top-level :mod:`email` package namespace.
.. currentmodule:: email
.. currentmodule:: email
.. function:: message_from_string(s, _class=email.message.Message, *, \
.. function:: message_from_string(s, _class=email.message.Message, *, \
policy=policy.
default
)
policy=policy.
compat32
)
Return a message object structure from a string. This is exactly equivalent to
Return a message object structure from a string. This is exactly equivalent to
``Parser().parsestr(s)``. *_class* and *policy* are interpreted as
``Parser().parsestr(s)``. *_class* and *policy* are interpreted as
...
@@ -219,7 +228,7 @@ in the top-level :mod:`email` package namespace.
...
@@ -219,7 +228,7 @@ in the top-level :mod:`email` package namespace.
Removed the *strict* argument. Added the *policy* keyword.
Removed the *strict* argument. Added the *policy* keyword.
.. function:: message_from_bytes(s, _class=email.message.Message, *, \
.. function:: message_from_bytes(s, _class=email.message.Message, *, \
policy=policy.
default
)
policy=policy.
compat32
)
Return a message object structure from a byte string. This is exactly
Return a message object structure from a byte string. This is exactly
equivalent to ``BytesParser().parsebytes(s)``. Optional *_class* and
equivalent to ``BytesParser().parsebytes(s)``. Optional *_class* and
...
@@ -231,7 +240,7 @@ in the top-level :mod:`email` package namespace.
...
@@ -231,7 +240,7 @@ in the top-level :mod:`email` package namespace.
Removed the *strict* argument. Added the *policy* keyword.
Removed the *strict* argument. Added the *policy* keyword.
.. function:: message_from_file(fp, _class=email.message.Message, *, \
.. function:: message_from_file(fp, _class=email.message.Message, *, \
policy=policy.
default
)
policy=policy.
compat32
)
Return a message object structure tree from an open :term:`file object`.
Return a message object structure tree from an open :term:`file object`.
This is exactly equivalent to ``Parser().parse(fp)``. *_class*
This is exactly equivalent to ``Parser().parse(fp)``. *_class*
...
@@ -242,7 +251,7 @@ in the top-level :mod:`email` package namespace.
...
@@ -242,7 +251,7 @@ in the top-level :mod:`email` package namespace.
Removed the *strict* argument. Added the *policy* keyword.
Removed the *strict* argument. Added the *policy* keyword.
.. function:: message_from_binary_file(fp, _class=email.message.Message, *, \
.. function:: message_from_binary_file(fp, _class=email.message.Message, *, \
policy=policy.
default
)
policy=policy.
compat32
)
Return a message object structure tree from an open binary :term:`file
Return a message object structure tree from an open binary :term:`file
object`. This is exactly equivalent to ``BytesParser().parse(fp)``.
object`. This is exactly equivalent to ``BytesParser().parse(fp)``.
...
...
Lib/email/generator.py
Dosyayı görüntüle @
e2524465
...
@@ -51,8 +51,9 @@ class Generator:
...
@@ -51,8 +51,9 @@ class Generator:
by RFC 2822.
by RFC 2822.
The policy keyword specifies a policy object that controls a number of
The policy keyword specifies a policy object that controls a number of
aspects of the generator's operation. The default policy maintains
aspects of the generator's operation. If no policy is specified,
backward compatibility.
the policy associated with the Message object passed to the
flatten method is used.
"""
"""
self
.
_fp
=
outfp
self
.
_fp
=
outfp
...
@@ -76,7 +77,9 @@ class Generator:
...
@@ -76,7 +77,9 @@ class Generator:
Note that for subobjects, no From_ line is printed.
Note that for subobjects, no From_ line is printed.
linesep specifies the characters used to indicate a new line in
linesep specifies the characters used to indicate a new line in
the output. The default value is determined by the policy.
the output. The default value is determined by the policy specified
when the Generator instance was created or, if none was specified,
from the policy associated with the msg.
"""
"""
# We use the _XXX constants for operating on data that comes directly
# We use the _XXX constants for operating on data that comes directly
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment