Skip to content

Commit 80204f7

Browse files
hugovkuatacherlend-aaslandStanFromIreland
authored
[3.13] gh-140715: Improve class reference links on datetime.rst (GH-123980) (#145389)
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 f10a1d8 commit 80204f7

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
@@ -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

@@ -438,9 +438,9 @@ objects (see below).
438438

439439
.. versionchanged:: 3.2
440440
Floor division and true division of a :class:`timedelta` object by another
441-
:class:`timedelta` object are now supported, as are remainder operations and
441+
:class:`!timedelta` object are now supported, as are remainder operations and
442442
the :func:`divmod` function. True division and multiplication of a
443-
:class:`timedelta` object by a :class:`float` object are now supported.
443+
:class:`!timedelta` object by a :class:`float` object are now supported.
444444

445445
:class:`timedelta` objects support equality and order comparisons.
446446

@@ -670,7 +670,7 @@ Notes:
670670
In other words, ``date1 < date2`` if and only if ``date1.toordinal() <
671671
date2.toordinal()``.
672672

673-
Order comparison between a :class:`!date` object that is not also a
673+
Order comparison between a :class:`date` object that is not also a
674674
:class:`.datetime` instance and a :class:`!datetime` object raises
675675
:exc:`TypeError`.
676676

@@ -883,7 +883,7 @@ from a :class:`date` object and a :class:`.time` object.
883883

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

888888
Constructor:
889889

@@ -1049,7 +1049,7 @@ Other constructors, all class methods:
10491049
are equal to the given :class:`.time` object's. If the *tzinfo*
10501050
argument is provided, its value is used to set the :attr:`.tzinfo` attribute
10511051
of the result, otherwise the :attr:`~.time.tzinfo` attribute of the *time* argument
1052-
is used. If the *date* argument is a :class:`.datetime` object, its time components
1052+
is used. If the *date* argument is a :class:`!datetime` object, its time components
10531053
and :attr:`.tzinfo` attributes are ignored.
10541054

10551055
For any :class:`.datetime` object ``d``,
@@ -1253,7 +1253,7 @@ Supported operations:
12531253
datetime, and no time zone adjustments are done even if the input is aware.
12541254

12551255
(3)
1256-
Subtraction of a :class:`.datetime` from a :class:`.datetime` is defined only if
1256+
Subtraction of a :class:`.datetime` from a :class:`!datetime` is defined only if
12571257
both operands are naive, or if both are aware. If one is aware and the other is
12581258
naive, :exc:`TypeError` is raised.
12591259

@@ -1271,15 +1271,15 @@ Supported operations:
12711271
:class:`.datetime` objects are equal if they represent the same date
12721272
and time, taking into account the time zone.
12731273

1274-
Naive and aware :class:`!datetime` objects are never equal.
1274+
Naive and aware :class:`.datetime` objects are never equal.
12751275

12761276
If both comparands are aware, and have the same :attr:`!tzinfo` attribute,
12771277
the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and
12781278
the base datetimes are compared.
12791279
If both comparands are aware and have different :attr:`~.datetime.tzinfo`
12801280
attributes, the comparison acts as comparands were first converted to UTC
12811281
datetimes except that the implementation never overflows.
1282-
:class:`!datetime` instances in a repeated interval are never equal to
1282+
:class:`.datetime` instances in a repeated interval are never equal to
12831283
:class:`!datetime` instances in other time zone.
12841284

12851285
(5)
@@ -1476,7 +1476,7 @@ Instance methods:
14761476

14771477
Naive :class:`.datetime` instances are assumed to represent local
14781478
time and this method relies on the platform C :c:func:`mktime`
1479-
function to perform the conversion. Since :class:`.datetime`
1479+
function to perform the conversion. Since :class:`!datetime`
14801480
supports wider range of values than :c:func:`mktime` on many
14811481
platforms, this method may raise :exc:`OverflowError` or :exc:`OSError`
14821482
for times far in the past or far in the future.
@@ -1917,7 +1917,7 @@ Instance methods:
19171917
19181918
Return a new :class:`.time` with the same values, but with specified
19191919
parameters updated. Note that ``tzinfo=None`` can be specified to create a
1920-
naive :class:`.time` from an aware :class:`.time`, without conversion of the
1920+
naive :class:`!time` from an aware :class:`!time`, without conversion of the
19211921
time data.
19221922

19231923
:class:`.time` objects are also supported by generic function
@@ -2059,14 +2059,14 @@ Examples of working with a :class:`.time` object::
20592059

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

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

@@ -2129,11 +2129,11 @@ Examples of working with a :class:`.time` object::
21292129
``tz.utcoffset(dt) - tz.dst(dt)``
21302130

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

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

21802180
The default implementation of :meth:`tzname` raises :exc:`NotImplementedError`.
21812181

21822182

21832183
These methods are called by a :class:`.datetime` or :class:`.time` object, in
2184-
response to their methods of the same names. A :class:`.datetime` object passes
2185-
itself as the argument, and a :class:`.time` object passes ``None`` as the
2184+
response to their methods of the same names. A :class:`!datetime` object passes
2185+
itself as the argument, and a :class:`!time` object passes ``None`` as the
21862186
argument. A :class:`tzinfo` subclass's methods should therefore be prepared to
2187-
accept a *dt* argument of ``None``, or of class :class:`.datetime`.
2187+
accept a *dt* argument of ``None``, or of class :class:`!datetime`.
21882188

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

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

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

23152315
.. seealso::

0 commit comments

Comments
 (0)