Issue #21818: Fixed references to classes that have names matching with module

names.
This commit is contained in:
Serhiy Storchaka 2016-12-02 23:15:22 +02:00
commit b6a6b45458
9 changed files with 30 additions and 30 deletions

View File

@ -254,7 +254,7 @@ When an array object is printed or converted to a string, it is represented as
empty, otherwise it is a string if the *typecode* is ``'u'``, otherwise it is a empty, otherwise it is a string if the *typecode* is ``'u'``, otherwise it is a
list of numbers. The string is guaranteed to be able to be converted back to an list of numbers. The string is guaranteed to be able to be converted back to an
array with the same type and value using :func:`eval`, so long as the array with the same type and value using :func:`eval`, so long as the
:func:`array` function has been imported using ``from array import array``. :class:`~array.array` class has been imported using ``from array import array``.
Examples:: Examples::
array('l') array('l')

View File

@ -1368,8 +1368,8 @@ Using datetime with tzinfo:
.. _datetime-time: .. _datetime-time:
:class:`time` Objects :class:`.time` Objects
--------------------- ----------------------
A time object represents a (local) time of day, independent of any particular A time object represents a (local) time of day, independent of any particular
day, and subject to adjustment via a :class:`tzinfo` object. day, and subject to adjustment via a :class:`tzinfo` object.
@ -1466,7 +1466,7 @@ Supported operations:
``!=``. The latter cases return :const:`False` or :const:`True`, respectively. ``!=``. The latter cases return :const:`False` or :const:`True`, respectively.
.. versionchanged:: 3.3 .. versionchanged:: 3.3
Equality comparisons between naive and aware :class:`time` instances Equality comparisons between naive and aware :class:`~datetime.time` instances
don't raise :exc:`TypeError`. don't raise :exc:`TypeError`.
* hash, use as dict key * hash, use as dict key

View File

@ -14,7 +14,7 @@ byte by doing ``obj[index] = 97``, or change a subsequence by assigning to a
slice: ``obj[i1:i2] = b'...'``. You can also read and write data starting at slice: ``obj[i1:i2] = b'...'``. You can also read and write data starting at
the current file position, and :meth:`seek` through the file to different positions. the current file position, and :meth:`seek` through the file to different positions.
A memory-mapped file is created by the :class:`mmap` constructor, which is A memory-mapped file is created by the :class:`~mmap.mmap` constructor, which is
different on Unix and on Windows. In either case you must provide a file different on Unix and on Windows. In either case you must provide a file
descriptor for a file opened for update. If you wish to map an existing Python descriptor for a file opened for update. If you wish to map an existing Python
file object, use its :meth:`fileno` method to obtain the correct value for the file object, use its :meth:`fileno` method to obtain the correct value for the
@ -70,7 +70,7 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
**(Unix version)** Maps *length* bytes from the file specified by the file **(Unix version)** Maps *length* bytes from the file specified by the file
descriptor *fileno*, and returns a mmap object. If *length* is ``0``, the descriptor *fileno*, and returns a mmap object. If *length* is ``0``, the
maximum length of the map will be the current size of the file when maximum length of the map will be the current size of the file when
:class:`mmap` is called. :class:`~mmap.mmap` is called.
*flags* specifies the nature of the mapping. :const:`MAP_PRIVATE` creates a *flags* specifies the nature of the mapping. :const:`MAP_PRIVATE` creates a
private copy-on-write mapping, so changes to the contents of the mmap private copy-on-write mapping, so changes to the contents of the mmap
@ -97,7 +97,7 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
by the descriptor *fileno* is internally automatically synchronized by the descriptor *fileno* is internally automatically synchronized
with physical backing store on Mac OS X and OpenVMS. with physical backing store on Mac OS X and OpenVMS.
This example shows a simple way of using :class:`mmap`:: This example shows a simple way of using :class:`~mmap.mmap`::
import mmap import mmap
@ -122,7 +122,7 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
mm.close() mm.close()
:class:`mmap` can also be used as a context manager in a :keyword:`with` :class:`~mmap.mmap` can also be used as a context manager in a :keyword:`with`
statement.:: statement.::
import mmap import mmap

View File

@ -12,13 +12,13 @@
-------------- --------------
The :class:`netrc` class parses and encapsulates the netrc file format used by The :class:`~netrc.netrc` class parses and encapsulates the netrc file format used by
the Unix :program:`ftp` program and other FTP clients. the Unix :program:`ftp` program and other FTP clients.
.. class:: netrc([file]) .. class:: netrc([file])
A :class:`netrc` instance or subclass instance encapsulates data from a netrc A :class:`~netrc.netrc` instance or subclass instance encapsulates data from a netrc
file. The initialization argument, if present, specifies the file to parse. If file. The initialization argument, if present, specifies the file to parse. If
no argument is given, the file :file:`.netrc` in the user's home directory will no argument is given, the file :file:`.netrc` in the user's home directory will
be read. Parse errors will raise :exc:`NetrcParseError` with diagnostic be read. Parse errors will raise :exc:`NetrcParseError` with diagnostic
@ -35,7 +35,7 @@ the Unix :program:`ftp` program and other FTP clients.
.. exception:: NetrcParseError .. exception:: NetrcParseError
Exception raised by the :class:`netrc` class when syntactical errors are Exception raised by the :class:`~netrc.netrc` class when syntactical errors are
encountered in source text. Instances of this exception provide three encountered in source text. Instances of this exception provide three
interesting attributes: :attr:`msg` is a textual explanation of the error, interesting attributes: :attr:`msg` is a textual explanation of the error,
:attr:`filename` is the name of the source file, and :attr:`lineno` gives the :attr:`filename` is the name of the source file, and :attr:`lineno` gives the
@ -47,7 +47,7 @@ the Unix :program:`ftp` program and other FTP clients.
netrc Objects netrc Objects
------------- -------------
A :class:`netrc` instance has the following methods: A :class:`~netrc.netrc` instance has the following methods:
.. method:: netrc.authenticators(host) .. method:: netrc.authenticators(host)
@ -63,7 +63,7 @@ A :class:`netrc` instance has the following methods:
Dump the class data as a string in the format of a netrc file. (This discards Dump the class data as a string in the format of a netrc file. (This discards
comments and may reorder the entries.) comments and may reorder the entries.)
Instances of :class:`netrc` have public instance variables: Instances of :class:`~netrc.netrc` have public instance variables:
.. attribute:: netrc.hosts .. attribute:: netrc.hosts

View File

@ -1429,7 +1429,7 @@ Note that there are no methods :meth:`read` or :meth:`write`; use
:meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument instead. :meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument instead.
Socket objects also have these (read-only) attributes that correspond to the Socket objects also have these (read-only) attributes that correspond to the
values given to the :class:`socket` constructor. values given to the :class:`~socket.socket` constructor.
.. attribute:: socket.family .. attribute:: socket.family

View File

@ -1683,13 +1683,13 @@ Date and time types suitable for expressing timestamps were added as the
fancy features, and just stick to the basics of representing time. fancy features, and just stick to the basics of representing time.
The three primary types are: :class:`date`, representing a day, month, and year; The three primary types are: :class:`date`, representing a day, month, and year;
:class:`time`, consisting of hour, minute, and second; and :class:`datetime`, :class:`~datetime.time`, consisting of hour, minute, and second; and :class:`~datetime.datetime`,
which contains all the attributes of both :class:`date` and :class:`time`. which contains all the attributes of both :class:`date` and :class:`~datetime.time`.
There's also a :class:`timedelta` class representing differences between two There's also a :class:`timedelta` class representing differences between two
points in time, and time zone logic is implemented by classes inheriting from points in time, and time zone logic is implemented by classes inheriting from
the abstract :class:`tzinfo` class. the abstract :class:`tzinfo` class.
You can create instances of :class:`date` and :class:`time` by either supplying You can create instances of :class:`date` and :class:`~datetime.time` by either supplying
keyword arguments to the appropriate constructor, e.g. keyword arguments to the appropriate constructor, e.g.
``datetime.date(year=1972, month=10, day=15)``, or by using one of a number of ``datetime.date(year=1972, month=10, day=15)``, or by using one of a number of
class methods. For example, the :meth:`date.today` class method returns the class methods. For example, the :meth:`date.today` class method returns the
@ -1708,7 +1708,7 @@ number of methods for producing formatted strings from objects::
'2002 30 Dec' '2002 30 Dec'
The :meth:`replace` method allows modifying one or more fields of a The :meth:`replace` method allows modifying one or more fields of a
:class:`date` or :class:`datetime` instance, returning a new instance:: :class:`date` or :class:`~datetime.datetime` instance, returning a new instance::
>>> d = datetime.datetime.now() >>> d = datetime.datetime.now()
>>> d >>> d
@ -1718,11 +1718,11 @@ The :meth:`replace` method allows modifying one or more fields of a
>>> >>>
Instances can be compared, hashed, and converted to strings (the result is the Instances can be compared, hashed, and converted to strings (the result is the
same as that of :meth:`isoformat`). :class:`date` and :class:`datetime` same as that of :meth:`isoformat`). :class:`date` and :class:`~datetime.datetime`
instances can be subtracted from each other, and added to :class:`timedelta` instances can be subtracted from each other, and added to :class:`timedelta`
instances. The largest missing feature is that there's no standard library instances. The largest missing feature is that there's no standard library
support for parsing strings and getting back a :class:`date` or support for parsing strings and getting back a :class:`date` or
:class:`datetime`. :class:`~datetime.datetime`.
For more information, refer to the module's reference documentation. For more information, refer to the module's reference documentation.
(Contributed by Tim Peters.) (Contributed by Tim Peters.)

View File

@ -1523,7 +1523,7 @@ code:
empty list instead of raising a :exc:`TypeError` exception if called with no empty list instead of raising a :exc:`TypeError` exception if called with no
arguments. arguments.
* You can no longer compare the :class:`date` and :class:`datetime` instances * You can no longer compare the :class:`date` and :class:`~datetime.datetime` instances
provided by the :mod:`datetime` module. Two instances of different classes provided by the :mod:`datetime` module. Two instances of different classes
will now always be unequal, and relative comparisons (``<``, ``>``) will raise will now always be unequal, and relative comparisons (``<``, ``>``) will raise
a :exc:`TypeError`. a :exc:`TypeError`.

View File

@ -1307,7 +1307,7 @@ complete list of changes, or look through the SVN logs for all the details.
(Contributed by Skip Montanaro and Andrew McNamara.) (Contributed by Skip Montanaro and Andrew McNamara.)
* The :class:`datetime` class in the :mod:`datetime` module now has a * The :class:`~datetime.datetime` class in the :mod:`datetime` module now has a
``strptime(string, format)`` method for parsing date strings, contributed ``strptime(string, format)`` method for parsing date strings, contributed
by Josh Spoerri. It uses the same format characters as :func:`time.strptime` and by Josh Spoerri. It uses the same format characters as :func:`time.strptime` and
:func:`time.strftime`:: :func:`time.strftime`::
@ -1497,7 +1497,7 @@ complete list of changes, or look through the SVN logs for all the details.
* The :mod:`pyexpat` module now uses version 2.0 of the Expat parser. * The :mod:`pyexpat` module now uses version 2.0 of the Expat parser.
(Contributed by Trent Mick.) (Contributed by Trent Mick.)
* The :class:`Queue` class provided by the :mod:`Queue` module gained two new * The :class:`~queue.Queue` class provided by the :mod:`Queue` module gained two new
methods. :meth:`join` blocks until all items in the queue have been retrieved methods. :meth:`join` blocks until all items in the queue have been retrieved
and all processing work on the items have been completed. Worker threads call and all processing work on the items have been completed. Worker threads call
the other new method, :meth:`task_done`, to signal that processing for an item the other new method, :meth:`task_done`, to signal that processing for an item
@ -1649,7 +1649,7 @@ complete list of changes, or look through the SVN logs for all the details.
.. Patch #754022 .. Patch #754022
* The :mod:`xmlrpclib` module now supports returning :class:`datetime` objects * The :mod:`xmlrpclib` module now supports returning :class:`~datetime.datetime` objects
for the XML-RPC date type. Supply ``use_datetime=True`` to the :func:`loads` for the XML-RPC date type. Supply ``use_datetime=True`` to the :func:`loads`
function or the :class:`Unmarshaller` class to enable this feature. (Contributed function or the :class:`Unmarshaller` class to enable this feature. (Contributed
by Skip Montanaro.) by Skip Montanaro.)

View File

@ -613,10 +613,10 @@ multiple of 4.
result = queue.get() result = queue.get()
print 'Factorial', N, '=', result print 'Factorial', N, '=', result
A :class:`Queue` is used to communicate the result of the factorial. A :class:`~queue.Queue` is used to communicate the result of the factorial.
The :class:`Queue` object is stored in a global variable. The :class:`~queue.Queue` object is stored in a global variable.
The child process will use the value of the variable when the child The child process will use the value of the variable when the child
was created; because it's a :class:`Queue`, parent and child can use was created; because it's a :class:`~queue.Queue`, parent and child can use
the object to communicate. (If the parent were to change the value of the object to communicate. (If the parent were to change the value of
the global variable, the child's value would be unaffected, and vice the global variable, the child's value would be unaffected, and vice
versa.) versa.)
@ -2131,7 +2131,7 @@ changes, or look through the Subversion logs for all the details.
(Contributed by Christian Heimes and Mark Dickinson.) (Contributed by Christian Heimes and Mark Dickinson.)
* :class:`mmap` objects now have a :meth:`rfind` method that searches for a * :class:`~mmap.mmap` objects now have a :meth:`rfind` method that searches for a
substring beginning at the end of the string and searching substring beginning at the end of the string and searching
backwards. The :meth:`find` method also gained an *end* parameter backwards. The :meth:`find` method also gained an *end* parameter
giving an index at which to stop searching. giving an index at which to stop searching.
@ -2630,7 +2630,7 @@ changes, or look through the Subversion logs for all the details.
:class:`datetime.date` and :class:`datetime.time` to the :class:`datetime.date` and :class:`datetime.time` to the
:class:`xmlrpclib.DateTime` type; the conversion semantics were :class:`xmlrpclib.DateTime` type; the conversion semantics were
not necessarily correct for all applications. Code using not necessarily correct for all applications. Code using
:mod:`xmlrpclib` should convert :class:`date` and :class:`time` :mod:`xmlrpclib` should convert :class:`date` and :class:`~datetime.time`
instances. (:issue:`1330538`) The code can also handle instances. (:issue:`1330538`) The code can also handle
dates before 1900 (contributed by Ralf Schmitt; :issue:`2014`) dates before 1900 (contributed by Ralf Schmitt; :issue:`2014`)
and 64-bit integers represented by using ``<i8>`` in XML-RPC responses and 64-bit integers represented by using ``<i8>`` in XML-RPC responses
@ -3283,7 +3283,7 @@ that may require changes to your code:
:class:`datetime.date` and :class:`datetime.time` to the :class:`datetime.date` and :class:`datetime.time` to the
:class:`xmlrpclib.DateTime` type; the conversion semantics were :class:`xmlrpclib.DateTime` type; the conversion semantics were
not necessarily correct for all applications. Code using not necessarily correct for all applications. Code using
:mod:`xmlrpclib` should convert :class:`date` and :class:`time` :mod:`xmlrpclib` should convert :class:`date` and :class:`~datetime.time`
instances. (:issue:`1330538`) instances. (:issue:`1330538`)
* (3.0-warning mode) The :class:`Exception` class now warns * (3.0-warning mode) The :class:`Exception` class now warns