Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5e55b3e

Browse files
committed
Merged revisions 77484,77487,77561,77570,77593,77603,77608,77667,77702-77703,77739,77858,77887,77889 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r77484 | skip.montanaro | 2010-01-13 19:12:34 -0600 (Wed, 13 Jan 2010) | 4 lines Update PyEval_EvalFrame to PyEval_EvalFrameEx. This looks to have been done partially before. Also add a comment describing how this might have to work with different versions of the interpreter. ........ r77487 | ezio.melotti | 2010-01-14 05:34:10 -0600 (Thu, 14 Jan 2010) | 1 line Fixed typo ........ r77561 | georg.brandl | 2010-01-17 02:42:30 -0600 (Sun, 17 Jan 2010) | 1 line #7699: improve datetime docs: straightforward linking to strftime/strptime section, mark classmethods as such. ........ r77570 | georg.brandl | 2010-01-17 06:14:42 -0600 (Sun, 17 Jan 2010) | 1 line Add note about usage of STRINGLIB_EMPTY. ........ r77593 | georg.brandl | 2010-01-17 17:33:53 -0600 (Sun, 17 Jan 2010) | 1 line Fix internal reference. ........ r77603 | benjamin.peterson | 2010-01-18 17:07:56 -0600 (Mon, 18 Jan 2010) | 8 lines data descriptors do not override the class dictionary if __get__ is not defined Adjust documentation and add a test to verify this behavior. See http://mail.python.org/pipermail/python-dev/2010-January/095637.html for discussion. ........ r77608 | gregory.p.smith | 2010-01-19 02:19:03 -0600 (Tue, 19 Jan 2010) | 6 lines Do not compile stubs for the sha2 series hashes in the openssl hashlib module when the openssl version is too old to support them. That leads both compiled code bloat and to unittests attempting to test implementations that don't exist for comparison purposes on such platforms. ........ r77667 | mark.dickinson | 2010-01-21 12:32:27 -0600 (Thu, 21 Jan 2010) | 1 line Add two more test_strtod test values. ........ r77702 | georg.brandl | 2010-01-23 02:43:31 -0600 (Sat, 23 Jan 2010) | 1 line #7762: fix refcount annotation of PyUnicode_Tailmatch(). ........ r77703 | georg.brandl | 2010-01-23 02:47:54 -0600 (Sat, 23 Jan 2010) | 1 line #7725: fix referencing issue. ........ r77739 | benjamin.peterson | 2010-01-24 21:52:52 -0600 (Sun, 24 Jan 2010) | 1 line mention from_float() in error message ........ r77858 | georg.brandl | 2010-01-30 11:57:48 -0600 (Sat, 30 Jan 2010) | 1 line #7802: fix invalid example (heh). ........ r77887 | georg.brandl | 2010-01-31 12:51:49 -0600 (Sun, 31 Jan 2010) | 5 lines Fix-up ftplib documentation: move exception descriptions to toplevel, not inside a class remove attribution in "versionadded" spell and grammar check docstring of FTP_TLS ........ r77889 | michael.foord | 2010-01-31 13:59:26 -0600 (Sun, 31 Jan 2010) | 1 line Minor modification to unittest documentation. ........
1 parent 895aa5e commit 5e55b3e

14 files changed

Lines changed: 162 additions & 93 deletions

File tree

Doc/data/refcounts.dat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,7 @@ PyUnicode_Join:PyObject*::+1:
16371637
PyUnicode_Join:PyObject*:separator:0:
16381638
PyUnicode_Join:PyObject*:seq:0:
16391639

1640-
PyUnicode_Tailmatch:PyObject*::+1:
1640+
PyUnicode_Tailmatch:int:::
16411641
PyUnicode_Tailmatch:PyObject*:str:0:
16421642
PyUnicode_Tailmatch:PyObject*:substr:0:
16431643
PyUnicode_Tailmatch:int:start::

Doc/distutils/examples.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,11 @@ by using the `docutils` parser::
285285
warning: check: Title underline too short. (line 2)
286286
warning: check: Could not finish the parsing.
287287

288+
289+
.. _reading-metadata:
290+
288291
Reading the metadata
289-
=====================
292+
====================
290293

291294
The :func:`distutils.core.setup` function provides a command-line interface
292295
that allows you to query the metadata fields of a project through the

Doc/library/datetime.rst

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ than rational, and there is no standard suitable for every application.
3636

3737
The :mod:`datetime` module exports the following constants:
3838

39-
4039
.. data:: MINYEAR
4140

4241
The smallest year number allowed in a :class:`date` or :class:`datetime` object.
@@ -61,7 +60,6 @@ The :mod:`datetime` module exports the following constants:
6160
Available Types
6261
---------------
6362

64-
6563
.. class:: date
6664
:noindex:
6765

@@ -131,7 +129,6 @@ Subclass relationships::
131129
A :class:`timedelta` object represents a duration, the difference between two
132130
dates or times.
133131

134-
135132
.. class:: timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)
136133

137134
All arguments are optional and default to ``0``. Arguments may be integers
@@ -168,8 +165,8 @@ dates or times.
168165
>>> (d.days, d.seconds, d.microseconds)
169166
(-1, 86399, 999999)
170167

171-
Class attributes are:
172168

169+
Class attributes are:
173170

174171
.. attribute:: timedelta.min
175172

@@ -326,16 +323,16 @@ systems.
326323

327324
If an argument outside those ranges is given, :exc:`ValueError` is raised.
328325

329-
Other constructors, all class methods:
330326

327+
Other constructors, all class methods:
331328

332-
.. method:: date.today()
329+
.. classmethod:: date.today()
333330

334331
Return the current local date. This is equivalent to
335332
``date.fromtimestamp(time.time())``.
336333

337334

338-
.. method:: date.fromtimestamp(timestamp)
335+
.. classmethod:: date.fromtimestamp(timestamp)
339336

340337
Return the local date corresponding to the POSIX timestamp, such as is returned
341338
by :func:`time.time`. This may raise :exc:`ValueError`, if the timestamp is out
@@ -345,15 +342,15 @@ Other constructors, all class methods:
345342
timestamp, leap seconds are ignored by :meth:`fromtimestamp`.
346343

347344

348-
.. method:: date.fromordinal(ordinal)
345+
.. classmethod:: date.fromordinal(ordinal)
349346

350347
Return the date corresponding to the proleptic Gregorian ordinal, where January
351348
1 of year 1 has ordinal 1. :exc:`ValueError` is raised unless ``1 <= ordinal <=
352349
date.max.toordinal()``. For any date *d*, ``date.fromordinal(d.toordinal()) ==
353350
d``.
354351

355-
Class attributes:
356352

353+
Class attributes:
357354

358355
.. attribute:: date.min
359356

@@ -370,8 +367,8 @@ Class attributes:
370367
The smallest possible difference between non-equal date objects,
371368
``timedelta(days=1)``.
372369

373-
Instance attributes (read-only):
374370

371+
Instance attributes (read-only):
375372

376373
.. attribute:: date.year
377374

@@ -387,6 +384,7 @@ Instance attributes (read-only):
387384

388385
Between 1 and the number of days in the given month of the given year.
389386

387+
390388
Supported operations:
391389

392390
+-------------------------------+----------------------------------------------+
@@ -439,7 +437,6 @@ objects are considered to be true.
439437

440438
Instance methods:
441439

442-
443440
.. method:: date.replace(year, month, day)
444441

445442
Return a date with the same value, except for those members given new values by
@@ -519,7 +516,8 @@ Instance methods:
519516

520517
Return a string representing the date, controlled by an explicit format string.
521518
Format codes referring to hours, minutes or seconds will see 0 values. See
522-
section :ref:`strftime-behavior`.
519+
section :ref:`strftime-strptime-behavior`.
520+
523521

524522
Example of counting days to an event::
525523

@@ -586,7 +584,6 @@ both directions; like a time object, :class:`datetime` assumes there are exactly
586584

587585
Constructor:
588586

589-
590587
.. class:: datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None)
591588

592589
The year, month and day arguments are required. *tzinfo* may be ``None``, or an
@@ -605,15 +602,14 @@ Constructor:
605602

606603
Other constructors, all class methods:
607604

608-
609-
.. method:: datetime.today()
605+
.. classmethod:: datetime.today()
610606

611607
Return the current local datetime, with :attr:`tzinfo` ``None``. This is
612608
equivalent to ``datetime.fromtimestamp(time.time())``. See also :meth:`now`,
613609
:meth:`fromtimestamp`.
614610

615611

616-
.. method:: datetime.now(tz=None)
612+
.. classmethod:: datetime.now(tz=None)
617613

618614
Return the current local date and time. If optional argument *tz* is ``None``
619615
or not specified, this is like :meth:`today`, but, if possible, supplies more
@@ -627,14 +623,14 @@ Other constructors, all class methods:
627623
See also :meth:`today`, :meth:`utcnow`.
628624

629625

630-
.. method:: datetime.utcnow()
626+
.. classmethod:: datetime.utcnow()
631627

632628
Return the current UTC date and time, with :attr:`tzinfo` ``None``. This is like
633629
:meth:`now`, but returns the current UTC date and time, as a naive
634630
:class:`datetime` object. See also :meth:`now`.
635631

636632

637-
.. method:: datetime.fromtimestamp(timestamp, tz=None)
633+
.. classmethod:: datetime.fromtimestamp(timestamp, tz=None)
638634

639635
Return the local date and time corresponding to the POSIX timestamp, such as is
640636
returned by :func:`time.time`. If optional argument *tz* is ``None`` or not
@@ -655,7 +651,7 @@ Other constructors, all class methods:
655651
identical :class:`datetime` objects. See also :meth:`utcfromtimestamp`.
656652

657653

658-
.. method:: datetime.utcfromtimestamp(timestamp)
654+
.. classmethod:: datetime.utcfromtimestamp(timestamp)
659655

660656
Return the UTC :class:`datetime` corresponding to the POSIX timestamp, with
661657
:attr:`tzinfo` ``None``. This may raise :exc:`ValueError`, if the timestamp is
@@ -664,15 +660,15 @@ Other constructors, all class methods:
664660
:meth:`fromtimestamp`.
665661

666662

667-
.. method:: datetime.fromordinal(ordinal)
663+
.. classmethod:: datetime.fromordinal(ordinal)
668664

669665
Return the :class:`datetime` corresponding to the proleptic Gregorian ordinal,
670666
where January 1 of year 1 has ordinal 1. :exc:`ValueError` is raised unless ``1
671667
<= ordinal <= datetime.max.toordinal()``. The hour, minute, second and
672668
microsecond of the result are all 0, and :attr:`tzinfo` is ``None``.
673669

674670

675-
.. method:: datetime.combine(date, time)
671+
.. classmethod:: datetime.combine(date, time)
676672

677673
Return a new :class:`datetime` object whose date members are equal to the given
678674
:class:`date` object's, and whose time and :attr:`tzinfo` members are equal to
@@ -681,17 +677,17 @@ Other constructors, all class methods:
681677
object, its time and :attr:`tzinfo` members are ignored.
682678

683679

684-
.. method:: datetime.strptime(date_string, format)
680+
.. classmethod:: datetime.strptime(date_string, format)
685681

686682
Return a :class:`datetime` corresponding to *date_string*, parsed according to
687683
*format*. This is equivalent to ``datetime(*(time.strptime(date_string,
688684
format)[0:6]))``. :exc:`ValueError` is raised if the date_string and format
689685
can't be parsed by :func:`time.strptime` or if it returns a value which isn't a
690-
time tuple.
686+
time tuple. See section :ref:`strftime-strptime-behavior`.
691687

692688

693-
Class attributes:
694689

690+
Class attributes:
695691

696692
.. attribute:: datetime.min
697693

@@ -710,8 +706,8 @@ Class attributes:
710706
The smallest possible difference between non-equal :class:`datetime` objects,
711707
``timedelta(microseconds=1)``.
712708

713-
Instance attributes (read-only):
714709

710+
Instance attributes (read-only):
715711

716712
.. attribute:: datetime.year
717713

@@ -753,6 +749,7 @@ Instance attributes (read-only):
753749
The object passed as the *tzinfo* argument to the :class:`datetime` constructor,
754750
or ``None`` if none was passed.
755751

752+
756753
Supported operations:
757754

758755
+---------------------------------------+-------------------------------+
@@ -826,7 +823,6 @@ all :class:`datetime` objects are considered to be true.
826823

827824
Instance methods:
828825

829-
830826
.. method:: datetime.date()
831827

832828
Return :class:`date` object with same year, month and day.
@@ -1004,7 +1000,8 @@ Instance methods:
10041000
.. method:: datetime.strftime(format)
10051001

10061002
Return a string representing the date and time, controlled by an explicit format
1007-
string. See section :ref:`strftime-behavior`.
1003+
string. See section :ref:`strftime-strptime-behavior`.
1004+
10081005

10091006
Examples of working with datetime objects:
10101007

@@ -1117,7 +1114,6 @@ Using datetime with tzinfo:
11171114
A time object represents a (local) time of day, independent of any particular
11181115
day, and subject to adjustment via a :class:`tzinfo` object.
11191116

1120-
11211117
.. class:: time(hour=0, minute=0, second=0, microsecond=0, tzinfo=None)
11221118

11231119
All arguments are optional. *tzinfo* may be ``None``, or an instance of a
@@ -1151,8 +1147,8 @@ Class attributes:
11511147
``timedelta(microseconds=1)``, although note that arithmetic on :class:`time`
11521148
objects is not supported.
11531149

1154-
Instance attributes (read-only):
11551150

1151+
Instance attributes (read-only):
11561152

11571153
.. attribute:: time.hour
11581154

@@ -1179,6 +1175,7 @@ Instance attributes (read-only):
11791175
The object passed as the tzinfo argument to the :class:`time` constructor, or
11801176
``None`` if none was passed.
11811177

1178+
11821179
Supported operations:
11831180

11841181
* comparison of :class:`time` to :class:`time`, where *a* is considered less
@@ -1201,8 +1198,8 @@ Supported operations:
12011198
only if, after converting it to minutes and subtracting :meth:`utcoffset` (or
12021199
``0`` if that's ``None``), the result is non-zero.
12031200

1204-
Instance methods:
12051201

1202+
Instance methods:
12061203

12071204
.. method:: time.replace([hour[, minute[, second[, microsecond[, tzinfo]]]]])
12081205

@@ -1228,7 +1225,7 @@ Instance methods:
12281225
.. method:: time.strftime(format)
12291226

12301227
Return a string representing the time, controlled by an explicit format string.
1231-
See section :ref:`strftime-behavior`.
1228+
See section :ref:`strftime-strptime-behavior`.
12321229

12331230

12341231
.. method:: time.utcoffset()
@@ -1253,6 +1250,7 @@ Instance methods:
12531250
``self.tzinfo.tzname(None)``, or raises an exception if the latter doesn't
12541251
return ``None`` or a string object.
12551252

1253+
12561254
Example:
12571255

12581256
>>> from datetime import time, tzinfo
@@ -1389,6 +1387,7 @@ methods. Exactly which methods are needed depends on the uses made of aware
13891387

13901388
The default implementation of :meth:`tzname` raises :exc:`NotImplementedError`.
13911389

1390+
13921391
These methods are called by a :class:`datetime` or :class:`time` object, in
13931392
response to their methods of the same names. A :class:`datetime` object passes
13941393
itself as the argument, and a :class:`time` object passes ``None`` as the
@@ -1492,20 +1491,25 @@ other fixed-offset :class:`tzinfo` subclass (such as a class representing only
14921491
EST (fixed offset -5 hours), or only EDT (fixed offset -4 hours)).
14931492

14941493

1495-
.. _strftime-behavior:
1494+
.. _strftime-strptime-behavior:
14961495

1497-
:meth:`strftime` Behavior
1498-
-------------------------
1496+
:meth:`strftime` and :meth:`strptime` Behavior
1497+
----------------------------------------------
14991498

15001499
:class:`date`, :class:`datetime`, and :class:`time` objects all support a
15011500
``strftime(format)`` method, to create a string representing the time under the
15021501
control of an explicit format string. Broadly speaking, ``d.strftime(fmt)``
15031502
acts like the :mod:`time` module's ``time.strftime(fmt, d.timetuple())``
15041503
although not all objects support a :meth:`timetuple` method.
15051504

1505+
Conversely, the :meth:`datetime.strptime` class method creates a
1506+
:class:`datetime` object from a string representing a date and time and a
1507+
corresponding format string. ``datetime.strptime(date_string, format)`` is
1508+
equivalent to ``datetime(*(time.strptime(date_string, format)[0:6]))``.
1509+
15061510
For :class:`time` objects, the format codes for year, month, and day should not
15071511
be used, as time objects have no such values. If they're used anyway, ``1900``
1508-
is substituted for the year, and ``0`` for the month and day.
1512+
is substituted for the year, and ``1`` for the month and day.
15091513

15101514
For :class:`date` objects, the format codes for hours, minutes, seconds, and
15111515
microseconds should not be used, as :class:`date` objects have no such
@@ -1627,26 +1631,26 @@ platforms. Regardless of platform, years before 1900 cannot be used.
16271631
Notes:
16281632

16291633
(1)
1630-
When used with the :func:`strptime` function, the ``%f`` directive
1634+
When used with the :meth:`strptime` method, the ``%f`` directive
16311635
accepts from one to six digits and zero pads on the right. ``%f`` is
16321636
an extension to the set of format characters in the C standard (but
16331637
implemented separately in datetime objects, and therefore always
16341638
available).
16351639

16361640
(2)
1637-
When used with the :func:`strptime` function, the ``%p`` directive only affects
1641+
When used with the :meth:`strptime` method, the ``%p`` directive only affects
16381642
the output hour field if the ``%I`` directive is used to parse the hour.
16391643

16401644
(3)
16411645
The range really is ``0`` to ``61``; according to the Posix standard this
16421646
accounts for leap seconds and the (very rare) double leap seconds.
16431647
The :mod:`time` module may produce and does accept leap seconds since
16441648
it is based on the Posix standard, but the :mod:`datetime` module
1645-
does not accept leap seconds in :func:`strptime` input nor will it
1649+
does not accept leap seconds in :meth:`strptime` input nor will it
16461650
produce them in :func:`strftime` output.
16471651

16481652
(4)
1649-
When used with the :func:`strptime` function, ``%U`` and ``%W`` are only used in
1653+
When used with the :meth:`strptime` method, ``%U`` and ``%W`` are only used in
16501654
calculations when the day of the week and the year are specified.
16511655

16521656
(5)

0 commit comments

Comments
 (0)