diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-06-15 19:24:52 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-06-15 19:24:52 (GMT) |
commit | b39a0c242d8fcefbc38be76aee4d0ec27ccffdf4 (patch) | |
tree | 86e1dd634426db9b63938fecb7352a90bf3b3e22 | |
parent | 05cc2030e56a76f7f1a7b513132fd19c03909cb9 (diff) | |
download | cpython-b39a0c242d8fcefbc38be76aee4d0ec27ccffdf4.zip cpython-b39a0c242d8fcefbc38be76aee4d0ec27ccffdf4.tar.gz cpython-b39a0c242d8fcefbc38be76aee4d0ec27ccffdf4.tar.bz2 |
Issue 5094: minor documentation fixes
-rw-r--r-- | Doc/library/datetime.rst | 44 | ||||
-rw-r--r-- | Modules/datetimemodule.c | 6 |
2 files changed, 25 insertions, 25 deletions
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst index a46203e..cb55afb 100644 --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1351,7 +1351,7 @@ methods. Exactly which methods are needed depends on the uses made of aware :mod:`datetime` objects. If in doubt, simply implement all of them. -.. method:: tzinfo.utcoffset(self, dt) +.. method:: tzinfo.utcoffset(dt) Return offset of local time from UTC, in minutes east of UTC. If local time is west of UTC, this should be negative. Note that this is intended to be the @@ -1373,7 +1373,7 @@ methods. Exactly which methods are needed depends on the uses made of aware :exc:`NotImplementedError`. -.. method:: tzinfo.dst(self, dt) +.. method:: tzinfo.dst(dt) Return the daylight saving time (DST) adjustment, in minutes east of UTC, or ``None`` if DST information isn't known. Return ``timedelta(0)`` if DST is not @@ -1421,7 +1421,7 @@ methods. Exactly which methods are needed depends on the uses made of aware The default implementation of :meth:`dst` raises :exc:`NotImplementedError`. -.. method:: tzinfo.tzname(self, dt) +.. method:: tzinfo.tzname(dt) Return the time zone name corresponding to the :class:`datetime` object *dt*, as a string. Nothing about string names is defined by the :mod:`datetime` module, @@ -1457,7 +1457,7 @@ time, and not need worry about objects in other timezones. There is one more :class:`tzinfo` method that a subclass may wish to override: -.. method:: tzinfo.fromutc(self, dt) +.. method:: tzinfo.fromutc(dt) This is called from the default :class:`datetime.astimezone()` implementation. When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time members @@ -1553,46 +1553,46 @@ changes have been made to civil time. .. class:: timezone(offset[, name]) - The ``offset`` argument must be specified as a :class:`timedelta` + The *offset* argument must be specified as a :class:`timedelta` object representing the difference between the local time and UTC. It must - be within the range [``-timedelta(hours=23, minutes=59), - ``timedelta(hours=23, minutes=59)``] and represent whole number of minutes, + be strictly between ``-timedelta(hours=24)`` and + ``timedelta(hours=24)`` and represent a whole number of minutes, otherwise :exc:`ValueError` is raised. - The ``name`` argument is optional. If specified it must be a string that - used as the value returned by the ``tzname(dt)`` method. Otherwise, + The *name* argument is optional. If specified it must be a string that + is used as the value returned by the ``tzname(dt)`` method. Otherwise, ``tzname(dt)`` returns a string 'UTCsHH:MM', where s is the sign of - ``offset``, HH and MM are two digits of ``offset.hours`` and + *offset*, HH and MM are two digits of ``offset.hours`` and ``offset.minutes`` respectively. -.. method:: timezone.utcoffset(self, dt) +.. method:: timezone.utcoffset(dt) - Returns the fixed value specified when the :class:`timezone` instance is - constructed. The ``dt`` argument is ignored. The return value is a + Return the fixed value specified when the :class:`timezone` instance is + constructed. The *dt* argument is ignored. The return value is a :class:`timedelta` instance equal to the difference between the local time and UTC. -.. method:: timezone.tzname(self, dt) +.. method:: timezone.tzname(dt) - Returns the fixed value specified when the :class:`timezone` instance is + Return the fixed value specified when the :class:`timezone` instance is constructed or a string 'UTCsHH:MM', where s is the sign of - ``offset``, HH and MM are two digits of ``offset.hours`` and - ``offset.minutes`` respectively. The ``dt`` argument is ignored. + *offset*, HH and MM are two digits of ``offset.hours`` and + ``offset.minutes`` respectively. -.. method:: timezone.dst(self, dt) +.. method:: timezone.dst(dt) Always returns ``None``. -.. method:: timezone.fromutc(self, dt) +.. method:: timezone.fromutc(dt) - Returns ``dt + offset``. The ``dt`` argument must be aware with ``tzinfo`` - set to ``self``. + Return ``dt + offset``. The *dt* argument must be an aware + :class:`datetime` instance, with ``tzinfo`` set to ``self``. Class attributes: .. attribute:: timezone.utc - The UTC timezone, ``timezone(0, 'UTC')``. + The UTC timezone, ``timezone(timedelta(0))``. .. _strftime-strptime-behavior: diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c index de9db6b..71c5cf5 100644 --- a/Modules/datetimemodule.c +++ b/Modules/datetimemodule.c @@ -3472,13 +3472,13 @@ timezone_fromutc(PyDateTime_TimeZone *self, PyDateTime_DateTime *dt) static PyMethodDef timezone_methods[] = { {"tzname", (PyCFunction)timezone_tzname, METH_O, PyDoc_STR("If name is specified when timezone is created, returns the name." - " Otherwise returns offset as 'UTC(+|-)HHMM'.")}, + " Otherwise returns offset as 'UTC(+|-)HH:MM'.")}, {"utcoffset", (PyCFunction)timezone_utcoffset, METH_O, - PyDoc_STR("Returns fixed offset. Ignores its argument.")}, + PyDoc_STR("Return fixed offset.")}, {"dst", (PyCFunction)timezone_dst, METH_O, - PyDoc_STR("Returns None. Ignores its argument.")}, + PyDoc_STR("Return None.")}, {"fromutc", (PyCFunction)timezone_fromutc, METH_O, PyDoc_STR("datetime in UTC -> datetime in local time.")}, |