@@ -14,7 +14,7 @@ module:
1414.. function :: localtime(dt=None)
1515
1616 Return local time as an aware datetime object. If called without
17- arguments, return current time. Otherwise *dt * argument should be a
17+ arguments, return the current time. Otherwise the *dt * argument should be a
1818 :class: `~datetime.datetime ` instance, and it is converted to the local time
1919 zone according to the system time zone database. If *dt * is naive (that
2020 is, ``dt.tzinfo `` is ``None ``), it is assumed to be in local time.
@@ -27,11 +27,11 @@ module:
2727.. function :: make_msgid(idstring=None, domain=None)
2828
2929 Returns a string suitable for an :rfc: `2822 `\ -compliant
30- :mailheader: `Message-ID ` header. Optional *idstring * if given, is a string
31- used to strengthen the uniqueness of the message id. Optional *domain * if
32- given provides the portion of the msgid after the '@'. The default is the
33- local hostname. It is not normally necessary to override this default, but
34- may be useful certain cases, such as a constructing distributed system that
30+ :mailheader: `Message-ID ` header. Optional *idstring *, if given, is a string
31+ used to strengthen the uniqueness of the message id. Optional *domain *, if
32+ given, provides the portion of the msgid after the '@'. The default is the
33+ local hostname. It is normally not necessary to override this default, but
34+ may be useful in certain cases, such as constructing a distributed system that
3535 uses a consistent domain name across multiple hosts.
3636
3737 .. versionchanged :: 3.2
@@ -72,7 +72,7 @@ of the new API.
7272
7373.. function :: formataddr(pair, charset='utf-8')
7474
75- The inverse of :meth : `parseaddr `, this takes a 2-tuple of the form ``(realname,
75+ The inverse of :func : `parseaddr `, this takes a 2-tuple of the form ``(realname,
7676 email_address) `` and returns the string value suitable for a :mailheader: `To ` or
7777 :mailheader: `Cc ` header. If the first element of *pair * is false, then the
7878 second element is returned unmodified.
@@ -88,9 +88,9 @@ of the new API.
8888
8989.. function :: getaddresses(fieldvalues, *, strict=True)
9090
91- This method returns a list of 2-tuples of the form returned by `` parseaddr() ` `.
91+ This function returns a list of 2-tuples of the form returned by :func: ` parseaddr `.
9292 *fieldvalues * is a sequence of header field values as might be returned by
93- :meth: `Message.get_all <email.message.Message.get_all> `.
93+ :meth: `Message.get_all() <email.message.Message.get_all> `.
9494
9595 If *strict * is true, use a strict parser which rejects malformed inputs.
9696
@@ -110,10 +110,10 @@ of the new API.
110110
111111.. function :: parsedate(date)
112112
113- Attempts to parse a date according to the rules in :rfc: `2822 `. however, some
114- mailers don't follow that format as specified, so :func: `parsedate ` tries to
113+ Attempts to parse a date according to the rules in :rfc: `2822#section-3.3 `. However,
114+ some mailers don't follow that format as specified, so :func: `parsedate ` tries to
115115 guess correctly in such cases. *date * is a string containing an :rfc: `2822 `
116- date, such as ``"Mon, 20 Nov 1995 19:12:08 -0500" ``. If it succeeds in parsing
116+ date, such as ``"Mon, 20 Nov 1995 19:12:08 -0500" ``. If it succeeds in parsing
117117 the date, :func: `parsedate ` returns a 9-tuple that can be passed directly to
118118 :func: `time.mktime `; otherwise ``None `` will be returned. Note that indexes 6,
119119 7, and 8 of the result tuple are not usable.
@@ -132,15 +132,16 @@ of the new API.
132132.. function :: parsedate_to_datetime(date)
133133
134134 The inverse of :func: `format_datetime `. Performs the same function as
135- :func: `parsedate `, but on success returns a :mod : `~datetime.datetime `;
136- otherwise `` ValueError ` ` is raised if *date * contains an invalid value such
135+ :func: `parsedate `, but on success returns a :class : `~datetime.datetime `;
136+ otherwise :exc: ` ValueError ` is raised if *date * contains an invalid value such
137137 as an hour greater than 23 or a timezone offset not between -24 and 24 hours.
138138 If the input date has a timezone of ``-0000 ``, the ``datetime `` will be a naive
139- ``datetime ``, and if the date is conforming to the RFCs it will represent a
139+ ``datetime ``, and if the date conforms to the RFCs it will represent a
140140 time in UTC but with no indication of the actual source timezone of the
141141 message the date comes from. If the input date has any other valid timezone
142- offset, the ``datetime `` will be an aware ``datetime `` with the
143- corresponding a :class: `~datetime.timezone ` :class: `~datetime.tzinfo `.
142+ offset, the ``datetime `` will be an aware ``datetime `` whose corresponding
143+ :attr: `~datetime.datetime.tzinfo ` attribute is a :class: `~datetime.timezone `
144+ object.
144145
145146 .. versionadded :: 3.3
146147
@@ -154,34 +155,34 @@ of the new API.
154155
155156.. function :: formatdate(timeval=None, localtime=False, usegmt=False)
156157
157- Returns a date string as per :rfc: `2822 `, e.g. ::
158+ Returns a date string as per :rfc: `2822 `, for example ::
158159
159160 Fri, 09 Nov 2001 01:08:47 -0000
160161
161- Optional *timeval * if given is a floating-point time value as accepted by
162+ Optional *timeval *, if given, is a floating-point time value as accepted by
162163 :func: `time.gmtime ` and :func: `time.localtime `, otherwise the current time is
163164 used.
164165
165166 Optional *localtime * is a flag that when ``True ``, interprets *timeval *, and
166167 returns a date relative to the local timezone instead of UTC, properly taking
167- daylight savings time into account. The default is ``False `` meaning UTC is
168+ daylight saving time into account. The default is ``False `` meaning UTC is
168169 used.
169170
170- Optional *usegmt * is a flag that when ``True ``, outputs a date string with the
171- timezone as an ascii string ``GMT ``, rather than a numeric ``-0000 ``. This is
171+ Optional *usegmt * is a flag that when ``True ``, outputs a date string with the
172+ timezone as an ASCII string ``GMT ``, rather than a numeric ``-0000 ``. This is
172173 needed for some protocols (such as HTTP). This only applies when *localtime * is
173174 ``False ``. The default is ``False ``.
174175
175176
176177.. function :: format_datetime(dt, usegmt=False)
177178
178- Like `` formatdate `` , but the input is a :mod: ` datetime ` instance. If it is
179- a naive datetime, it is assumed to be "UTC with no information about the
179+ Like :func: ` formatdate `, but the input is a :class: ` ~ datetime.datetime ` instance.
180+ If it is a naive datetime, it is assumed to be "UTC with no information about the
180181 source timezone", and the conventional ``-0000 `` is used for the timezone.
181182 If it is an aware ``datetime ``, then the numeric timezone offset is used.
182183 If it is an aware timezone with offset zero, then *usegmt * may be set to
183184 ``True ``, in which case the string ``GMT `` is used instead of the numeric
184- timezone offset. This provides a way to generate standards conformant HTTP
185+ timezone offset. This provides a way to generate standards- conformant HTTP
185186 date headers.
186187
187188 .. versionadded :: 3.3
@@ -195,19 +196,19 @@ of the new API.
195196.. function :: encode_rfc2231(s, charset=None, language=None)
196197
197198 Encode the string *s * according to :rfc: `2231 `. Optional *charset * and
198- *language *, if given is the character set name and language name to use. If
199+ *language *, if given, are the character set name and language name to use. If
199200 neither is given, *s * is returned as-is. If *charset * is given but *language *
200201 is not, the string is encoded using the empty string for *language *.
201202
202203
203204.. function :: collapse_rfc2231_value(value, errors='replace', fallback_charset='us-ascii')
204205
205206 When a header parameter is encoded in :rfc: `2231 ` format,
206- :meth: `Message.get_param <email.message.Message.get_param> ` may return a
207+ :meth: `Message.get_param() <email.message.Message.get_param> ` may return a
207208 3-tuple containing the character set,
208209 language, and value. :func: `collapse_rfc2231_value ` turns this into a
209210 string. Optional *errors * is passed to the *errors * argument of :class: `str `'s
210- :func : `~str.encode ` method; it defaults to ``'replace' ``. Optional
211+ :meth : `~str.encode ` method; it defaults to ``'replace' ``. Optional
211212 *fallback_charset * specifies the character set to use if the one in the
212213 :rfc: `2231 ` header is not known by Python; it defaults to ``'us-ascii' ``.
213214
@@ -224,5 +225,5 @@ of the new API.
224225.. rubric :: Footnotes
225226
226227.. [# ] Note that the sign of the timezone offset is the opposite of the sign of the
227- `` time.timezone ` ` variable for the same timezone; the latter variable follows
228+ :data: ` time.timezone ` variable for the same timezone; the latter variable follows
228229 the POSIX standard while this module follows :rfc: `2822 `.
0 commit comments