@@ -85,7 +85,7 @@ The :mod:`!datetime` module exports the following constants:
85
85
.. data :: MINYEAR
86
86
87
87
The smallest year number allowed in a :class: `date ` or :class: `.datetime ` object.
88
- :const: `MINYEAR ` is `` 1 `` .
88
+ :const: `MINYEAR ` is 1 .
89
89
90
90
91
91
.. data :: MAXYEAR
@@ -207,7 +207,7 @@ A :class:`timedelta` object represents a duration, the difference between two
207
207
208
208
.. class :: timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)
209
209
210
- All arguments are optional and default to `` 0 `` . Arguments may be integers
210
+ All arguments are optional and default to 0 . Arguments may be integers
211
211
or floats, and may be positive or negative.
212
212
213
213
Only *days *, *seconds * and *microseconds * are stored internally.
@@ -280,7 +280,7 @@ Class attributes:
280
280
The smallest possible difference between non-equal :class: `timedelta ` objects,
281
281
``timedelta(microseconds=1) ``.
282
282
283
- Note that, because of normalization, ``timedelta.max `` > ``-timedelta.min ``.
283
+ Note that, because of normalization, ``timedelta.max `` is greater than ``-timedelta.min ``.
284
284
``-timedelta.max `` is not representable as a :class: `timedelta ` object.
285
285
286
286
Instance attributes (read-only):
@@ -302,26 +302,27 @@ Supported operations:
302
302
+--------------------------------+-----------------------------------------------+
303
303
| Operation | Result |
304
304
+================================+===============================================+
305
- | ``t1 = t2 + t3 `` | Sum of *t2 * and *t3 *. Afterwards *t1 *-*t2 * == |
306
- | | *t3 * and *t1 *-*t3 * == *t2 * are true. (1) |
305
+ | ``t1 = t2 + t3 `` | Sum of ``t2 `` and ``t3 ``. |
306
+ | | Afterwards ``t1 - t2 == t3 `` and |
307
+ | | ``t1 - t3 == t2 `` are true. (1) |
307
308
+--------------------------------+-----------------------------------------------+
308
- | ``t1 = t2 - t3 `` | Difference of * t2 * and * t3 * . Afterwards * t1 * |
309
- | | == * t2 * - * t3 * and * t2 * == * t1 * + * t3 * are |
309
+ | ``t1 = t2 - t3 `` | Difference of `` t2 `` and `` t3 `` . Afterwards |
310
+ | | `` t1 == t2 - t3 `` and `` t2 == t1 + t3 `` are |
310
311
| | true. (1)(6) |
311
312
+--------------------------------+-----------------------------------------------+
312
313
| ``t1 = t2 * i or t1 = i * t2 `` | Delta multiplied by an integer. |
313
- | | Afterwards * t1 * // i == * t2 * is true, |
314
+ | | Afterwards `` t1 // i == t2 `` is true, |
314
315
| | provided ``i != 0 ``. |
315
316
+--------------------------------+-----------------------------------------------+
316
- | | In general, * t1 * \ * i == * t1 * \ * (i-1) + * t1 * |
317
+ | | In general, `` t1 * i == t1 * (i-1) + t1 `` |
317
318
| | is true. (1) |
318
319
+--------------------------------+-----------------------------------------------+
319
320
| ``t1 = t2 * f or t1 = f * t2 `` | Delta multiplied by a float. The result is |
320
321
| | rounded to the nearest multiple of |
321
322
| | timedelta.resolution using round-half-to-even.|
322
323
+--------------------------------+-----------------------------------------------+
323
- | ``f = t2 / t3 `` | Division (3) of overall duration * t2 * by |
324
- | | interval unit * t3 * . Returns a :class: `float ` |
324
+ | ``f = t2 / t3 `` | Division (3) of overall duration `` t2 `` by |
325
+ | | interval unit ``t3`` . Returns a :class:`float`|
325
326
| | object. |
326
327
+--------------------------------+-----------------------------------------------+
327
328
| ``t1 = t2 / f or t1 = t2 / i `` | Delta divided by a float or an int. The result|
@@ -343,13 +344,12 @@ Supported operations:
343
344
| ``+t1 `` | Returns a :class: `timedelta ` object with the |
344
345
| | same value. (2) |
345
346
+--------------------------------+-----------------------------------------------+
346
- | ``-t1 `` | equivalent to |
347
- | | :class: `timedelta `\ (-*t1.days *, |
348
- | | -*t1.seconds *, -*t1.microseconds *), |
349
- | | and to *t1 *\* -1. (1)(4) |
347
+ | ``-t1 `` | Equivalent to ``timedelta(-t1.days, |
348
+ | | -t1.seconds*, -t1.microseconds)``, |
349
+ | | and to ``t1 * -1 ``. (1)(4) |
350
350
+--------------------------------+-----------------------------------------------+
351
- | ``abs(t) `` | equivalent to + \ * t * when ``t.days >= 0 ``, |
352
- | | and to -* t * when ``t.days < 0 ``. (2) |
351
+ | ``abs(t) `` | Equivalent to `` +t `` when ``t.days >= 0 ``, |
352
+ | | and to `` -t `` when ``t.days < 0 ``. (2) |
353
353
+--------------------------------+-----------------------------------------------+
354
354
| ``str(t) `` | Returns a string in the form |
355
355
| | ``[D day[s], ][H]H:MM:SS[.UUUUUU] ``, where D |
@@ -370,10 +370,10 @@ Notes:
370
370
This is exact and cannot overflow.
371
371
372
372
(3)
373
- Division by 0 raises :exc: `ZeroDivisionError `.
373
+ Division by zero raises :exc: `ZeroDivisionError `.
374
374
375
375
(4)
376
- -* timedelta.max * is not representable as a :class: `timedelta ` object.
376
+ `` - timedelta.max`` is not representable as a :class: `timedelta ` object.
377
377
378
378
(5)
379
379
String representations of :class: `timedelta ` objects are normalized
@@ -583,10 +583,10 @@ Supported operations:
583
583
+-------------------------------+----------------------------------------------+
584
584
| Operation | Result |
585
585
+===============================+==============================================+
586
- | ``date2 = date1 + timedelta `` | * date2 * will be ``timedelta.days `` days |
587
- | | after * date1 * . (1) |
586
+ | ``date2 = date1 + timedelta `` | `` date2 `` will be ``timedelta.days `` days |
587
+ | | after `` date1 `` . (1) |
588
588
+-------------------------------+----------------------------------------------+
589
- | ``date2 = date1 - timedelta `` | Computes * date2 * such that ``date2 + |
589
+ | ``date2 = date1 - timedelta `` | Computes `` date2 `` such that ``date2 + |
590
590
| | timedelta == date1``. (2) |
591
591
+-------------------------------+----------------------------------------------+
592
592
| ``timedelta = date1 - date2 `` | \( 3) |
@@ -613,8 +613,8 @@ Notes:
613
613
``timedelta.seconds `` and ``timedelta.microseconds `` are ignored.
614
614
615
615
(3)
616
- This is exact, and cannot overflow. timedelta.seconds and
617
- timedelta.microseconds are 0, and date2 + timedelta == date1 after.
616
+ This is exact, and cannot overflow. `` timedelta.seconds `` and
617
+ `` timedelta.microseconds `` are 0, and `` date2 + timedelta == date1 `` after.
618
618
619
619
(4)
620
620
:class: `date ` objects are equal if they represent the same date.
@@ -652,7 +652,7 @@ Instance methods:
652
652
time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))
653
653
654
654
where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1 ``
655
- is the day number within the current year starting with `` 1 `` for January 1st.
655
+ is the day number within the current year starting with 1 for January 1st.
656
656
657
657
658
658
.. method :: date.toordinal()
@@ -972,8 +972,8 @@ Other constructors, all class methods:
972
972
.. classmethod :: datetime.fromordinal(ordinal)
973
973
974
974
Return the :class: `.datetime ` corresponding to the proleptic Gregorian ordinal,
975
- where January 1 of year 1 has ordinal 1. :exc: `ValueError ` is raised unless `` 1
976
- <= ordinal <= datetime.max.toordinal() ``. The hour, minute, second and
975
+ where January 1 of year 1 has ordinal 1. :exc: `ValueError ` is raised unless
976
+ `` 1 <= ordinal <= datetime.max.toordinal() ``. The hour, minute, second and
977
977
microsecond of the result are all 0, and :attr: `.tzinfo ` is ``None ``.
978
978
979
979
@@ -1130,8 +1130,8 @@ Instance attributes (read-only):
1130
1130
In ``[0, 1] ``. Used to disambiguate wall times during a repeated interval. (A
1131
1131
repeated interval occurs when clocks are rolled back at the end of daylight saving
1132
1132
time or when the UTC offset for the current zone is decreased for political reasons.)
1133
- The value 0 (1) represents the earlier ( later) of the two moments with the same wall
1134
- time representation.
1133
+ The values 0 and 1 represent, respectively, the earlier and later of the two
1134
+ moments with the same wall time representation.
1135
1135
1136
1136
.. versionadded :: 3.6
1137
1137
@@ -1156,16 +1156,16 @@ Supported operations:
1156
1156
+---------------------------------------+--------------------------------+
1157
1157
1158
1158
(1)
1159
- datetime2 is a duration of timedelta removed from datetime1, moving forward in
1160
- time if ``timedelta.days `` > 0, or backward if ``timedelta.days `` < 0. The
1159
+ `` datetime2 `` is a duration of `` timedelta `` removed from `` datetime1 `` , moving forward in
1160
+ time if ``timedelta.days > 0 `` , or backward if ``timedelta.days < 0 `` . The
1161
1161
result has the same :attr: `~.datetime.tzinfo ` attribute as the input datetime, and
1162
- datetime2 - datetime1 == timedelta after. :exc: `OverflowError ` is raised if
1163
- datetime2.year would be smaller than :const: `MINYEAR ` or larger than
1162
+ `` datetime2 - datetime1 == timedelta `` after. :exc: `OverflowError ` is raised if
1163
+ `` datetime2.year `` would be smaller than :const: `MINYEAR ` or larger than
1164
1164
:const: `MAXYEAR `. Note that no time zone adjustments are done even if the
1165
1165
input is an aware object.
1166
1166
1167
1167
(2)
1168
- Computes the datetime2 such that datetime2 + timedelta == datetime1. As for
1168
+ Computes the `` datetime2 `` such that `` datetime2 + timedelta == datetime1 `` . As for
1169
1169
addition, the result has the same :attr: `~.datetime.tzinfo ` attribute as the input
1170
1170
datetime, and no time zone adjustments are done even if the input is aware.
1171
1171
@@ -1343,12 +1343,12 @@ Instance methods:
1343
1343
d.weekday(), yday, dst))
1344
1344
1345
1345
where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1 ``
1346
- is the day number within the current year starting with `` 1 `` for January
1346
+ is the day number within the current year starting with 1 for January
1347
1347
1st. The :attr: `~time.struct_time.tm_isdst ` flag of the result is set according to the
1348
1348
:meth: `dst ` method: :attr: `.tzinfo ` is ``None `` or :meth: `dst ` returns
1349
1349
``None ``, :attr: `!tm_isdst ` is set to ``-1 ``; else if :meth: `dst ` returns a
1350
- non-zero value, :attr: `!tm_isdst ` is set to `` 1 `` ; else :attr: `!tm_isdst ` is
1351
- set to `` 0 `` .
1350
+ non-zero value, :attr: `!tm_isdst ` is set to 1 ; else :attr: `!tm_isdst ` is
1351
+ set to 0 .
1352
1352
1353
1353
1354
1354
.. method :: datetime.utctimetuple()
@@ -1360,7 +1360,7 @@ Instance methods:
1360
1360
If *d * is aware, *d * is normalized to UTC time, by subtracting
1361
1361
``d.utcoffset() ``, and a :class: `time.struct_time ` for the
1362
1362
normalized time is returned. :attr: `!tm_isdst ` is forced to 0. Note
1363
- that an :exc: `OverflowError ` may be raised if * d * .year was
1363
+ that an :exc: `OverflowError ` may be raised if `` d .year`` was
1364
1364
``MINYEAR `` or ``MAXYEAR `` and UTC adjustment spills over a year
1365
1365
boundary.
1366
1366
@@ -1691,7 +1691,7 @@ day, and subject to adjustment via a :class:`tzinfo` object.
1691
1691
* ``fold in [0, 1] ``.
1692
1692
1693
1693
If an argument outside those ranges is given, :exc: `ValueError ` is raised. All
1694
- default to `` 0 `` except *tzinfo *, which defaults to :const: `None `.
1694
+ default to 0 except *tzinfo *, which defaults to :const: `None `.
1695
1695
1696
1696
Class attributes:
1697
1697
@@ -1746,8 +1746,8 @@ Instance attributes (read-only):
1746
1746
In ``[0, 1] ``. Used to disambiguate wall times during a repeated interval. (A
1747
1747
repeated interval occurs when clocks are rolled back at the end of daylight saving
1748
1748
time or when the UTC offset for the current zone is decreased for political reasons.)
1749
- The value 0 (1) represents the earlier ( later) of the two moments with the same wall
1750
- time representation.
1749
+ The values 0 and 1 represent, respectively, the earlier and later of the two
1750
+ moments with the same wall time representation.
1751
1751
1752
1752
.. versionadded :: 3.6
1753
1753
@@ -2036,7 +2036,7 @@ Examples of working with a :class:`.time` object::
2036
2036
``tz.utcoffset(dt) - tz.dst(dt) ``
2037
2037
2038
2038
must return the same result for every :class: `.datetime ` *dt * with ``dt.tzinfo ==
2039
- tz `` For sane :class: `tzinfo ` subclasses, this expression yields the time
2039
+ tz ``. For sane :class: `tzinfo ` subclasses, this expression yields the time
2040
2040
zone's "standard offset", which should not depend on the date or the time, but
2041
2041
only on geographic location. The implementation of :meth: `datetime.astimezone `
2042
2042
relies on this, but cannot detect violations; it's the programmer's
@@ -2073,7 +2073,7 @@ Examples of working with a :class:`.time` object::
2073
2073
Return the time zone name corresponding to the :class: `.datetime ` object *dt *, as
2074
2074
a string. Nothing about string names is defined by the :mod: `!datetime ` module,
2075
2075
and there's no requirement that it mean anything in particular. For example,
2076
- "GMT", "UTC", "-500", "-5:00", "EDT", "US/Eastern", "America/New York" are all
2076
+ `` "GMT" ``, `` "UTC" ``, `` "-500" ``, `` "-5:00" ``, `` "EDT" ``, `` "US/Eastern" ``, `` "America/New York" `` are all
2077
2077
valid replies. Return ``None `` if a string name isn't known. Note that this is
2078
2078
a method rather than a fixed string primarily because some :class: `tzinfo `
2079
2079
subclasses will wish to return different names depending on the specific value
@@ -2514,11 +2514,11 @@ information, which are supported in ``datetime.strptime`` but are discarded by
2514
2514
2515
2515
For :class: `.time ` objects, the format codes for year, month, and day should not
2516
2516
be used, as :class: `!time ` objects have no such values. If they're used anyway,
2517
- ``1900 `` is substituted for the year, and `` 1 `` for the month and day.
2517
+ ``1900 `` is substituted for the year, and 1 for the month and day.
2518
2518
2519
2519
For :class: `date ` objects, the format codes for hours, minutes, seconds, and
2520
2520
microseconds should not be used, as :class: `date ` objects have no such
2521
- values. If they're used anyway, `` 0 `` is substituted for them.
2521
+ values. If they're used anyway, 0 is substituted for them.
2522
2522
2523
2523
For the same reason, handling of format strings containing Unicode code points
2524
2524
that can't be represented in the charset of the current locale is also
0 commit comments