Skip to content

Commit ed2df30

Browse files
hugovkuatacherlend-aaslandStanFromIreland
authored
[3.14] gh-140715: Improve class reference links on datetime.rst (GH-123980) (#145388)
Co-authored-by: edson duarte <eduarte.uatach@gmail.com> Co-authored-by: Erlend E. Aasland <erlend@python.org> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
1 parent bd26ed3 commit ed2df30

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

Doc/library/datetime.rst

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

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

@@ -442,9 +442,9 @@ objects (see below).
442442

443443
.. versionchanged:: 3.2
444444
Floor division and true division of a :class:`timedelta` object by another
445-
:class:`timedelta` object are now supported, as are remainder operations and
445+
:class:`!timedelta` object are now supported, as are remainder operations and
446446
the :func:`divmod` function. True division and multiplication of a
447-
:class:`timedelta` object by a :class:`float` object are now supported.
447+
:class:`!timedelta` object by a :class:`float` object are now supported.
448448

449449
:class:`timedelta` objects support equality and order comparisons.
450450

@@ -712,7 +712,7 @@ Notes:
712712
In other words, ``date1 < date2`` if and only if ``date1.toordinal() <
713713
date2.toordinal()``.
714714

715-
Order comparison between a :class:`!date` object that is not also a
715+
Order comparison between a :class:`date` object that is not also a
716716
:class:`.datetime` instance and a :class:`!datetime` object raises
717717
:exc:`TypeError`.
718718

@@ -928,7 +928,7 @@ from a :class:`date` object and a :class:`.time` object.
928928

929929
Like a :class:`date` object, :class:`.datetime` assumes the current Gregorian
930930
calendar extended in both directions; like a :class:`.time` object,
931-
:class:`.datetime` assumes there are exactly 3600\*24 seconds in every day.
931+
:class:`!datetime` assumes there are exactly 3600\*24 seconds in every day.
932932

933933
Constructor:
934934

@@ -1100,7 +1100,7 @@ Other constructors, all class methods:
11001100
are equal to the given :class:`.time` object's. If the *tzinfo*
11011101
argument is provided, its value is used to set the :attr:`.tzinfo` attribute
11021102
of the result, otherwise the :attr:`~.time.tzinfo` attribute of the *time* argument
1103-
is used. If the *date* argument is a :class:`.datetime` object, its time components
1103+
is used. If the *date* argument is a :class:`!datetime` object, its time components
11041104
and :attr:`.tzinfo` attributes are ignored.
11051105

11061106
For any :class:`.datetime` object ``d``,
@@ -1306,7 +1306,7 @@ Supported operations:
13061306
datetime, and no time zone adjustments are done even if the input is aware.
13071307

13081308
(3)
1309-
Subtraction of a :class:`.datetime` from a :class:`.datetime` is defined only if
1309+
Subtraction of a :class:`.datetime` from a :class:`!datetime` is defined only if
13101310
both operands are naive, or if both are aware. If one is aware and the other is
13111311
naive, :exc:`TypeError` is raised.
13121312

@@ -1324,15 +1324,15 @@ Supported operations:
13241324
:class:`.datetime` objects are equal if they represent the same date
13251325
and time, taking into account the time zone.
13261326

1327-
Naive and aware :class:`!datetime` objects are never equal.
1327+
Naive and aware :class:`.datetime` objects are never equal.
13281328

13291329
If both comparands are aware, and have the same :attr:`!tzinfo` attribute,
13301330
the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and
13311331
the base datetimes are compared.
13321332
If both comparands are aware and have different :attr:`~.datetime.tzinfo`
13331333
attributes, the comparison acts as comparands were first converted to UTC
13341334
datetimes except that the implementation never overflows.
1335-
:class:`!datetime` instances in a repeated interval are never equal to
1335+
:class:`.datetime` instances in a repeated interval are never equal to
13361336
:class:`!datetime` instances in other time zone.
13371337

13381338
(5)
@@ -1532,7 +1532,7 @@ Instance methods:
15321532

15331533
Naive :class:`.datetime` instances are assumed to represent local
15341534
time and this method relies on the platform C :c:func:`mktime`
1535-
function to perform the conversion. Since :class:`.datetime`
1535+
function to perform the conversion. Since :class:`!datetime`
15361536
supports wider range of values than :c:func:`mktime` on many
15371537
platforms, this method may raise :exc:`OverflowError` or :exc:`OSError`
15381538
for times far in the past or far in the future.
@@ -1994,7 +1994,7 @@ Instance methods:
19941994
19951995
Return a new :class:`.time` with the same values, but with specified
19961996
parameters updated. Note that ``tzinfo=None`` can be specified to create a
1997-
naive :class:`.time` from an aware :class:`.time`, without conversion of the
1997+
naive :class:`!time` from an aware :class:`!time`, without conversion of the
19981998
time data.
19991999

20002000
:class:`.time` objects are also supported by generic function
@@ -2138,14 +2138,14 @@ Examples of working with a :class:`.time` object::
21382138

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

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

@@ -2208,11 +2208,11 @@ Examples of working with a :class:`.time` object::
22082208
``tz.utcoffset(dt) - tz.dst(dt)``
22092209

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

@@ -2253,28 +2253,28 @@ Examples of working with a :class:`.time` object::
22532253
valid replies. Return ``None`` if a string name isn't known. Note that this is
22542254
a method rather than a fixed string primarily because some :class:`tzinfo`
22552255
subclasses will wish to return different names depending on the specific value
2256-
of *dt* passed, especially if the :class:`tzinfo` class is accounting for
2256+
of *dt* passed, especially if the :class:`!tzinfo` class is accounting for
22572257
daylight time.
22582258

22592259
The default implementation of :meth:`tzname` raises :exc:`NotImplementedError`.
22602260

22612261

22622262
These methods are called by a :class:`.datetime` or :class:`.time` object, in
2263-
response to their methods of the same names. A :class:`.datetime` object passes
2264-
itself as the argument, and a :class:`.time` object passes ``None`` as the
2263+
response to their methods of the same names. A :class:`!datetime` object passes
2264+
itself as the argument, and a :class:`!time` object passes ``None`` as the
22652265
argument. A :class:`tzinfo` subclass's methods should therefore be prepared to
2266-
accept a *dt* argument of ``None``, or of class :class:`.datetime`.
2266+
accept a *dt* argument of ``None``, or of class :class:`!datetime`.
22672267

22682268
When ``None`` is passed, it's up to the class designer to decide the best
22692269
response. For example, returning ``None`` is appropriate if the class wishes to
22702270
say that time objects don't participate in the :class:`tzinfo` protocols. It
22712271
may be more useful for ``utcoffset(None)`` to return the standard UTC offset, as
22722272
there is no other convention for discovering the standard offset.
22732273

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

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

23942394
.. seealso::

0 commit comments

Comments
 (0)