[Python-checkins] bpo-41867: List options for timespec in docstrings of isoformat methods (GH-22418)

Miss Skeleton (bot) webhook-mailer at python.org
Sat Oct 3 07:01:52 EDT 2020


https://github.com/python/cpython/commit/9aa34f1bbbe1ca6376539f9ba436ff75d2141888
commit: 9aa34f1bbbe1ca6376539f9ba436ff75d2141888
branch: 3.8
author: Miss Skeleton (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020年10月03日T04:01:41-07:00
summary:
bpo-41867: List options for timespec in docstrings of isoformat methods (GH-22418)
(cherry picked from commit 52301312bb9de2299b0c42468fd1936d869e651c)
Co-authored-by: Ram Rachum <ram at rachum.com>
files:
M Lib/datetime.py
M Modules/_datetimemodule.c
diff --git a/Lib/datetime.py b/Lib/datetime.py
index 0adf1dd67dfb6..96d112c197069 100644
--- a/Lib/datetime.py
+++ b/Lib/datetime.py
@@ -1418,7 +1418,8 @@ def isoformat(self, timespec='auto'):
 part is omitted if self.microsecond == 0.
 
 The optional argument timespec specifies the number of additional
- terms of the time to include.
+ terms of the time to include. Valid options are 'auto', 'hours',
+ 'minutes', 'seconds', 'milliseconds' and 'microseconds'.
 """
 s = _format_time(self._hour, self._minute, self._second,
 self._microsecond, timespec)
@@ -1902,7 +1903,8 @@ def isoformat(self, sep='T', timespec='auto'):
 time, default 'T'.
 
 The optional argument timespec specifies the number of additional
- terms of the time to include.
+ terms of the time to include. Valid options are 'auto', 'hours',
+ 'minutes', 'seconds', 'milliseconds' and 'microseconds'.
 """
 s = ("%04d-%02d-%02d%c" % (self._year, self._month, self._day, sep) +
 _format_time(self._hour, self._minute, self._second,
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 41c3f34269ddc..d428210542d41 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -4539,7 +4539,10 @@ static PyMethodDef time_methods[] = {
 {"isoformat", (PyCFunction)(void(*)(void))time_isoformat, METH_VARARGS | METH_KEYWORDS,
 PyDoc_STR("Return string in ISO 8601 format, [HH[:MM[:SS[.mmm[uuu]]]]]"
 "[+HH:MM].\n\n"
- "timespec specifies what components of the time to include.\n")},
+ "The optional argument timespec specifies the number "
+ "of additional terms\nof the time to include. Valid "
+ "options are 'auto', 'hours', 'minutes',\n'seconds', "
+ "'milliseconds' and 'microseconds'.\n")},
 
 {"strftime", (PyCFunction)(void(*)(void))time_strftime, METH_VARARGS | METH_KEYWORDS,
 PyDoc_STR("format -> strftime() style string.")},
@@ -6246,9 +6249,10 @@ static PyMethodDef datetime_methods[] = {
 "YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].\n"
 "sep is used to separate the year from the time, and "
 "defaults to 'T'.\n"
- "timespec specifies what components of the time to include"
- " (allowed values are 'auto', 'hours', 'minutes', 'seconds',"
- " 'milliseconds', and 'microseconds').\n")},
+ "The optional argument timespec specifies the number "
+ "of additional terms\nof the time to include. Valid "
+ "options are 'auto', 'hours', 'minutes',\n'seconds', "
+ "'milliseconds' and 'microseconds'.\n")},
 
 {"utcoffset", (PyCFunction)datetime_utcoffset, METH_NOARGS,
 PyDoc_STR("Return self.tzinfo.utcoffset(self).")},


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /