Skip to content

Commit b82789d

Browse files
committed
Review tzinfo class references
1 parent daca111 commit b82789d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Doc/library/datetime.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ understand and to work with, at the cost of ignoring some aspects of reality.
6565

6666
For applications requiring aware objects, :class:`.datetime` and :class:`.time`
6767
objects have an optional time zone information attribute, :attr:`!tzinfo`, that
68-
can be set to an instance of a subclass of the abstract :class:`tzinfo` class.
68+
can be set to an instance of a subclass of the abstract :class:`!tzinfo` class.
6969
These :class:`tzinfo` objects capture information about the offset from UTC
7070
time, the time zone name, and whether daylight saving time is in effect.
7171

@@ -1282,15 +1282,15 @@ Supported operations:
12821282
:class:`.datetime` objects are equal if they represent the same date
12831283
and time, taking into account the time zone.
12841284

1285-
Naive and aware :class:`!datetime` objects are never equal.
1285+
Naive and aware :class:`.datetime` objects are never equal.
12861286

12871287
If both comparands are aware, and have the same :attr:`!tzinfo` attribute,
12881288
the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and
12891289
the base datetimes are compared.
12901290
If both comparands are aware and have different :attr:`~.datetime.tzinfo`
12911291
attributes, the comparison acts as comparands were first converted to UTC
12921292
datetimes except that the implementation never overflows.
1293-
:class:`!datetime` instances in a repeated interval are never equal to
1293+
:class:`.datetime` instances in a repeated interval are never equal to
12941294
:class:`!datetime` instances in other time zone.
12951295

12961296
(5)
@@ -2086,14 +2086,14 @@ Examples of working with a :class:`.time` object::
20862086

20872087
An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the
20882088
constructors for :class:`.datetime` and :class:`.time` objects. The latter objects
2089-
view their attributes as being in local time, and the :class:`tzinfo` object
2089+
view their attributes as being in local time, and the :class:`!tzinfo` object
20902090
supports methods revealing offset of local time from UTC, the name of the time
20912091
zone, and DST offset, all relative to a date or time object passed to them.
20922092

20932093
You need to derive a concrete subclass, and (at least)
20942094
supply implementations of the standard :class:`tzinfo` methods needed by the
20952095
:class:`.datetime` methods you use. The :mod:`!datetime` module provides
2096-
:class:`timezone`, a simple concrete subclass of :class:`tzinfo` which can
2096+
:class:`timezone`, a simple concrete subclass of :class:`!tzinfo` which can
20972097
represent time zones with fixed offset from UTC such as UTC itself or North
20982098
American EST and EDT.
20992099

@@ -2156,11 +2156,11 @@ Examples of working with a :class:`.time` object::
21562156
``tz.utcoffset(dt) - tz.dst(dt)``
21572157

21582158
must return the same result for every :class:`.datetime` *dt* with ``dt.tzinfo ==
2159-
tz``. For sane :class:`tzinfo` subclasses, this expression yields the time
2159+
tz``. For sane :class:`!tzinfo` subclasses, this expression yields the time
21602160
zone's "standard offset", which should not depend on the date or the time, but
21612161
only on geographic location. The implementation of :meth:`datetime.astimezone`
21622162
relies on this, but cannot detect violations; it's the programmer's
2163-
responsibility to ensure it. If a :class:`tzinfo` subclass cannot guarantee
2163+
responsibility to ensure it. If a :class:`!tzinfo` subclass cannot guarantee
21642164
this, it may be able to override the default implementation of
21652165
:meth:`tzinfo.fromutc` to work correctly with :meth:`~.datetime.astimezone` regardless.
21662166

@@ -2197,7 +2197,7 @@ Examples of working with a :class:`.time` object::
21972197
valid replies. Return ``None`` if a string name isn't known. Note that this is
21982198
a method rather than a fixed string primarily because some :class:`tzinfo`
21992199
subclasses will wish to return different names depending on the specific value
2200-
of *dt* passed, especially if the :class:`tzinfo` class is accounting for
2200+
of *dt* passed, especially if the :class:`!tzinfo` class is accounting for
22012201
daylight time.
22022202

22032203
The default implementation of :meth:`tzname` raises :exc:`NotImplementedError`.
@@ -2217,8 +2217,8 @@ there is no other convention for discovering the standard offset.
22172217

22182218
When a :class:`.datetime` object is passed in response to a :class:`!datetime`
22192219
method, ``dt.tzinfo`` is the same object as *self*. :class:`tzinfo` methods can
2220-
rely on this, unless user code calls :class:`tzinfo` methods directly. The
2221-
intent is that the :class:`tzinfo` methods interpret *dt* as being in local
2220+
rely on this, unless user code calls :class:`!tzinfo` methods directly. The
2221+
intent is that the :class:`!tzinfo` methods interpret *dt* as being in local
22222222
time, and not need worry about objects in other time zones.
22232223

22242224
There is one more :class:`tzinfo` method that a subclass may wish to override:
@@ -2328,7 +2328,7 @@ Note that the :class:`.datetime` instances that differ only by the value of the
23282328
Applications that can't bear wall-time ambiguities should explicitly check the
23292329
value of the :attr:`~.datetime.fold` attribute or avoid using hybrid
23302330
:class:`tzinfo` subclasses; there are no ambiguities when using :class:`timezone`,
2331-
or any other fixed-offset :class:`tzinfo` subclass (such as a class representing
2331+
or any other fixed-offset :class:`!tzinfo` subclass (such as a class representing
23322332
only EST (fixed offset -5 hours), or only EDT (fixed offset -4 hours)).
23332333

23342334
.. seealso::

0 commit comments

Comments
 (0)