Skip to content

Commit d47d7e1

Browse files
authored
[3.12] gh-123517: Remove unnecessary :meth: parentheses (gh-123518) (GH-123576)
1 parent 95b073b commit d47d7e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+135
-135
lines changed

Doc/c-api/datetime.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,10 @@ Macros for the convenience of modules implementing the DB API:
318318
.. c:function:: PyObject* PyDateTime_FromTimestamp(PyObject *args)
319319
320320
Create and return a new :class:`datetime.datetime` object given an argument
321-
tuple suitable for passing to :meth:`datetime.datetime.fromtimestamp()`.
321+
tuple suitable for passing to :meth:`datetime.datetime.fromtimestamp`.
322322
323323
324324
.. c:function:: PyObject* PyDate_FromTimestamp(PyObject *args)
325325
326326
Create and return a new :class:`datetime.date` object given an argument
327-
tuple suitable for passing to :meth:`datetime.date.fromtimestamp()`.
327+
tuple suitable for passing to :meth:`datetime.date.fromtimestamp`.

Doc/extending/newtypes_tutorial.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ Further, the attributes can be deleted, setting the C pointers to ``NULL``. Eve
449449
though we can make sure the members are initialized to non-``NULL`` values, the
450450
members can be set to ``NULL`` if the attributes are deleted.
451451

452-
We define a single method, :meth:`!Custom.name()`, that outputs the objects name as the
452+
We define a single method, :meth:`!Custom.name`, that outputs the objects name as the
453453
concatenation of the first and last names. ::
454454

455455
static PyObject *

Doc/faq/programming.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ Not as such.
10131013
For simple input parsing, the easiest approach is usually to split the line into
10141014
whitespace-delimited words using the :meth:`~str.split` method of string objects
10151015
and then convert decimal strings to numeric values using :func:`int` or
1016-
:func:`float`. :meth:`!split()` supports an optional "sep" parameter which is useful
1016+
:func:`float`. :meth:`!split` supports an optional "sep" parameter which is useful
10171017
if the line uses something other than whitespace as a separator.
10181018

10191019
For more complicated input parsing, regular expressions are more powerful

Doc/howto/descriptor.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ The full C implementation can be found in :c:func:`!super_getattro` in
803803
Summary of invocation logic
804804
---------------------------
805805

806-
The mechanism for descriptors is embedded in the :meth:`__getattribute__()`
806+
The mechanism for descriptors is embedded in the :meth:`__getattribute__`
807807
methods for :class:`object`, :class:`type`, and :func:`super`.
808808

809809
The important points to remember are:

Doc/library/asyncio-eventloop.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Running and stopping the loop
126126

127127
Run the event loop until :meth:`stop` is called.
128128

129-
If :meth:`stop` is called before :meth:`run_forever()` is called,
129+
If :meth:`stop` is called before :meth:`run_forever` is called,
130130
the loop will poll the I/O selector once with a timeout of zero,
131131
run all callbacks scheduled in response to I/O events (and
132132
those that were already scheduled), and then exit.
@@ -165,7 +165,7 @@ Running and stopping the loop
165165
.. coroutinemethod:: loop.shutdown_asyncgens()
166166

167167
Schedule all currently open :term:`asynchronous generator` objects to
168-
close with an :meth:`~agen.aclose()` call. After calling this method,
168+
close with an :meth:`~agen.aclose` call. After calling this method,
169169
the event loop will issue a warning if a new asynchronous generator
170170
is iterated. This should be used to reliably finalize all scheduled
171171
asynchronous generators.
@@ -1386,7 +1386,7 @@ Allows customizing how exceptions are handled in the event loop.
13861386

13871387
This method should not be overloaded in subclassed
13881388
event loops. For custom exception handling, use
1389-
the :meth:`set_exception_handler()` method.
1389+
the :meth:`set_exception_handler` method.
13901390

13911391
Enabling debug mode
13921392
^^^^^^^^^^^^^^^^^^^
@@ -1469,7 +1469,7 @@ async/await code consider using the high-level
14691469
* *stdin* can be any of these:
14701470

14711471
* a file-like object
1472-
* an existing file descriptor (a positive integer), for example those created with :meth:`os.pipe()`
1472+
* an existing file descriptor (a positive integer), for example those created with :meth:`os.pipe`
14731473
* the :const:`subprocess.PIPE` constant (default) which will create a new
14741474
pipe and connect it,
14751475
* the value ``None`` which will make the subprocess inherit the file

Doc/library/asyncio-llapi-index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ See also the main documentation section about the
5656
* - :meth:`loop.close`
5757
- Close the event loop.
5858

59-
* - :meth:`loop.is_running()`
59+
* - :meth:`loop.is_running`
6060
- Return ``True`` if the event loop is running.
6161

62-
* - :meth:`loop.is_closed()`
62+
* - :meth:`loop.is_closed`
6363
- Return ``True`` if the event loop is closed.
6464

6565
* - ``await`` :meth:`loop.shutdown_asyncgens`

Doc/library/asyncio-queue.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Queue
5555
Return ``True`` if there are :attr:`maxsize` items in the queue.
5656

5757
If the queue was initialized with ``maxsize=0`` (the default),
58-
then :meth:`full()` never returns ``True``.
58+
then :meth:`full` never returns ``True``.
5959

6060
.. coroutinemethod:: get()
6161

Doc/library/configparser.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ ConfigParser Objects
960960
When *converters* is given, it should be a dictionary where each key
961961
represents the name of a type converter and each value is a callable
962962
implementing the conversion from string to the desired datatype. Every
963-
converter gets its own corresponding :meth:`!get*()` method on the parser
963+
converter gets its own corresponding :meth:`!get*` method on the parser
964964
object and section proxies.
965965

966966
It is possible to read several configurations into a single
@@ -1000,7 +1000,7 @@ ConfigParser Objects
10001000
The *converters* argument was added.
10011001

10021002
.. versionchanged:: 3.7
1003-
The *defaults* argument is read with :meth:`read_dict()`,
1003+
The *defaults* argument is read with :meth:`read_dict`,
10041004
providing consistent behavior across the parser: non-string
10051005
keys and values are implicitly converted to strings.
10061006

Doc/library/dataclasses.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Module contents
124124
- *unsafe_hash*: If ``False`` (the default), a :meth:`~object.__hash__` method
125125
is generated according to how *eq* and *frozen* are set.
126126

127-
:meth:`!__hash__` is used by built-in :meth:`hash()`, and when objects are
127+
:meth:`!__hash__` is used by built-in :meth:`hash`, and when objects are
128128
added to hashed collections such as dictionaries and sets. Having a
129129
:meth:`!__hash__` implies that instances of the class are immutable.
130130
Mutability is a complicated property that depends on the programmer's

Doc/library/datetime.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ Other constructors, all class methods:
10341034
.. versionadded:: 3.7
10351035
.. versionchanged:: 3.11
10361036
Previously, this method only supported formats that could be emitted by
1037-
:meth:`date.isoformat()` or :meth:`datetime.isoformat()`.
1037+
:meth:`date.isoformat` or :meth:`datetime.isoformat`.
10381038

10391039

10401040
.. classmethod:: datetime.fromisocalendar(year, week, day)
@@ -1817,7 +1817,7 @@ Other constructor:
18171817
.. versionadded:: 3.7
18181818
.. versionchanged:: 3.11
18191819
Previously, this method only supported formats that could be emitted by
1820-
:meth:`time.isoformat()`.
1820+
:meth:`time.isoformat`.
18211821

18221822

18231823
Instance methods:

Doc/library/email.compat32-message.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Here are the methods of the :class:`Message` class:
105105

106106
.. method:: __str__()
107107

108-
Equivalent to :meth:`.as_string()`. Allows ``str(msg)`` to produce a
108+
Equivalent to :meth:`.as_string`. Allows ``str(msg)`` to produce a
109109
string containing the formatted message.
110110

111111

@@ -143,7 +143,7 @@ Here are the methods of the :class:`Message` class:
143143

144144
.. method:: __bytes__()
145145

146-
Equivalent to :meth:`.as_bytes()`. Allows ``bytes(msg)`` to produce a
146+
Equivalent to :meth:`.as_bytes`. Allows ``bytes(msg)`` to produce a
147147
bytes object containing the formatted message.
148148

149149
.. versionadded:: 3.4

Doc/library/email.message.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ message objects.
124124

125125
.. method:: __bytes__()
126126

127-
Equivalent to :meth:`.as_bytes()`. Allows ``bytes(msg)`` to produce a
127+
Equivalent to :meth:`.as_bytes`. Allows ``bytes(msg)`` to produce a
128128
bytes object containing the serialized message.
129129

130130

Doc/library/http.server.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ provides three different variants:
263263

264264
Adds a blank line
265265
(indicating the end of the HTTP headers in the response)
266-
to the headers buffer and calls :meth:`flush_headers()`.
266+
to the headers buffer and calls :meth:`flush_headers`.
267267

268268
.. versionchanged:: 3.2
269269
The buffered headers are written to the output stream.

Doc/library/io.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ the backing store is natively made of bytes (such as in the case of a file),
5555
encoding and decoding of data is made transparently as well as optional
5656
translation of platform-specific newline characters.
5757

58-
The easiest way to create a text stream is with :meth:`open()`, optionally
58+
The easiest way to create a text stream is with :meth:`open`, optionally
5959
specifying an encoding::
6060

6161
f = open("myfile.txt", "r", encoding="utf-8")
@@ -77,7 +77,7 @@ objects. No encoding, decoding, or newline translation is performed. This
7777
category of streams can be used for all kinds of non-text data, and also when
7878
manual control over the handling of text data is desired.
7979

80-
The easiest way to create a binary stream is with :meth:`open()` with ``'b'`` in
80+
The easiest way to create a binary stream is with :meth:`open` with ``'b'`` in
8181
the mode string::
8282

8383
f = open("myfile.jpg", "rb")

Doc/library/logging.config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ in :mod:`logging` itself) and defining handlers which are declared either in
6969
dictConfigClass(config).configure()
7070

7171
For example, a subclass of :class:`DictConfigurator` could call
72-
``DictConfigurator.__init__()`` in its own :meth:`__init__()`, then
72+
``DictConfigurator.__init__()`` in its own :meth:`__init__`, then
7373
set up custom prefixes which would be usable in the subsequent
7474
:meth:`configure` call. :attr:`dictConfigClass` would be bound to
7575
this new subclass, and then :func:`dictConfig` could be called exactly as

Doc/library/multiprocessing.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ The :mod:`multiprocessing` package mostly replicates the API of the
505505
The constructor should always be called with keyword arguments. *group*
506506
should always be ``None``; it exists solely for compatibility with
507507
:class:`threading.Thread`. *target* is the callable object to be invoked by
508-
the :meth:`run()` method. It defaults to ``None``, meaning nothing is
508+
the :meth:`run` method. It defaults to ``None``, meaning nothing is
509509
called. *name* is the process name (see :attr:`name` for more details).
510510
*args* is the argument tuple for the target invocation. *kwargs* is a
511511
dictionary of keyword arguments for the target invocation. If provided,
@@ -642,7 +642,7 @@ The :mod:`multiprocessing` package mostly replicates the API of the
642642

643643
You can use this value if you want to wait on several events at
644644
once using :func:`multiprocessing.connection.wait`. Otherwise
645-
calling :meth:`join()` is simpler.
645+
calling :meth:`join` is simpler.
646646

647647
On Windows, this is an OS handle usable with the ``WaitForSingleObject``
648648
and ``WaitForMultipleObjects`` family of API calls. On POSIX, this is
@@ -669,7 +669,7 @@ The :mod:`multiprocessing` package mostly replicates the API of the
669669

670670
.. method:: kill()
671671

672-
Same as :meth:`terminate()` but using the ``SIGKILL`` signal on POSIX.
672+
Same as :meth:`terminate` but using the ``SIGKILL`` signal on POSIX.
673673

674674
.. versionadded:: 3.7
675675

@@ -712,7 +712,7 @@ The :mod:`multiprocessing` package mostly replicates the API of the
712712

713713
.. exception:: BufferTooShort
714714

715-
Exception raised by :meth:`Connection.recv_bytes_into()` when the supplied
715+
Exception raised by :meth:`Connection.recv_bytes_into` when the supplied
716716
buffer object is too small for the message read.
717717

718718
If ``e`` is an instance of :exc:`BufferTooShort` then ``e.args[0]`` will give
@@ -2951,7 +2951,7 @@ Beware of replacing :data:`sys.stdin` with a "file like object"
29512951
resulting in a bad file descriptor error, but introduces a potential danger
29522952
to applications which replace :func:`sys.stdin` with a "file-like object"
29532953
with output buffering. This danger is that if multiple processes call
2954-
:meth:`~io.IOBase.close()` on this file-like object, it could result in the same
2954+
:meth:`~io.IOBase.close` on this file-like object, it could result in the same
29552955
data being flushed to the object multiple times, resulting in corruption.
29562956

29572957
If you write a file-like object and implement your own caching, you can

Doc/library/nntplib.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,14 +484,14 @@ tuples or objects that the method normally returns will be empty.
484484

485485
.. method:: NNTP.head(message_spec=None, *, file=None)
486486

487-
Same as :meth:`article()`, but sends a ``HEAD`` command. The *lines*
487+
Same as :meth:`article`, but sends a ``HEAD`` command. The *lines*
488488
returned (or written to *file*) will only contain the message headers, not
489489
the body.
490490

491491

492492
.. method:: NNTP.body(message_spec=None, *, file=None)
493493

494-
Same as :meth:`article()`, but sends a ``BODY`` command. The *lines*
494+
Same as :meth:`article`, but sends a ``BODY`` command. The *lines*
495495
returned (or written to *file*) will only contain the message body, not the
496496
headers.
497497

@@ -513,7 +513,7 @@ tuples or objects that the method normally returns will be empty.
513513

514514
Send an ``IHAVE`` command. *message_id* is the id of the message to send
515515
to the server (enclosed in ``'<'`` and ``'>'``). The *data* parameter
516-
and the return value are the same as for :meth:`post()`.
516+
and the return value are the same as for :meth:`post`.
517517

518518

519519
.. method:: NNTP.date()
@@ -560,7 +560,7 @@ them have been superseded by newer commands in :rfc:`3977`.
560560

561561
Send an ``XOVER`` command. *start* and *end* are article numbers
562562
delimiting the range of articles to select. The return value is the
563-
same of for :meth:`over()`. It is recommended to use :meth:`over()`
563+
same of for :meth:`over`. It is recommended to use :meth:`over`
564564
instead, since it will automatically use the newer ``OVER`` command
565565
if available.
566566

Doc/library/pathlib.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -897,10 +897,10 @@ Querying file type and status
897897

898898
.. versionchanged:: 3.8
899899

900-
:meth:`~Path.exists()`, :meth:`~Path.is_dir()`, :meth:`~Path.is_file()`,
901-
:meth:`~Path.is_mount()`, :meth:`~Path.is_symlink()`,
902-
:meth:`~Path.is_block_device()`, :meth:`~Path.is_char_device()`,
903-
:meth:`~Path.is_fifo()`, :meth:`~Path.is_socket()` now return ``False``
900+
:meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`,
901+
:meth:`~Path.is_mount`, :meth:`~Path.is_symlink`,
902+
:meth:`~Path.is_block_device`, :meth:`~Path.is_char_device`,
903+
:meth:`~Path.is_fifo`, :meth:`~Path.is_socket` now return ``False``
904904
instead of raising an exception for paths that contain characters
905905
unrepresentable at the OS level.
906906

@@ -1272,7 +1272,7 @@ Reading directories
12721272
This can be used to prune the search, or to impose a specific order of visiting,
12731273
or even to inform :meth:`Path.walk` about directories the caller creates or
12741274
renames before it resumes :meth:`Path.walk` again. Modifying *dirnames* when
1275-
*top_down* is false has no effect on the behavior of :meth:`Path.walk()` since the
1275+
*top_down* is false has no effect on the behavior of :meth:`Path.walk` since the
12761276
directories in *dirnames* have already been generated by the time *dirnames*
12771277
is yielded to the caller.
12781278

Doc/library/socket.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ The following functions all create :ref:`socket objects <socket-objects>`.
731731
of :meth:`socket.getpeername` but not the actual OS resource. Unlike
732732
:func:`socket.fromfd`, *fileno* will return the same socket and not a
733733
duplicate. This may help close a detached socket using
734-
:meth:`socket.close()`.
734+
:meth:`socket.close`.
735735

736736
The newly created socket is :ref:`non-inheritable <fd_inheritance>`.
737737

@@ -1410,7 +1410,7 @@ to sockets.
14101410
.. method:: socket.close()
14111411

14121412
Mark the socket closed. The underlying system resource (e.g. a file
1413-
descriptor) is also closed when all file objects from :meth:`makefile()`
1413+
descriptor) is also closed when all file objects from :meth:`makefile`
14141414
are closed. Once that happens, all future operations on the socket
14151415
object will fail. The remote end will receive no more data (after
14161416
queued data is flushed).
@@ -1425,10 +1425,10 @@ to sockets.
14251425

14261426
.. note::
14271427

1428-
:meth:`close()` releases the resource associated with a connection but
1428+
:meth:`close` releases the resource associated with a connection but
14291429
does not necessarily close the connection immediately. If you want
1430-
to close the connection in a timely fashion, call :meth:`shutdown()`
1431-
before :meth:`close()`.
1430+
to close the connection in a timely fashion, call :meth:`shutdown`
1431+
before :meth:`close`.
14321432

14331433

14341434
.. method:: socket.connect(address)
@@ -2037,7 +2037,7 @@ can be changed by calling :func:`setdefaulttimeout`.
20372037
in non-blocking mode. Also, the blocking and timeout modes are shared between
20382038
file descriptors and socket objects that refer to the same network endpoint.
20392039
This implementation detail can have visible consequences if e.g. you decide
2040-
to use the :meth:`~socket.fileno()` of a socket.
2040+
to use the :meth:`~socket.fileno` of a socket.
20412041

20422042
Timeouts and the ``connect`` method
20432043
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Doc/library/sqlite3.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ and call :meth:`res.fetchone() <Cursor.fetchone>` to fetch the resulting row:
127127
We can see that the table has been created,
128128
as the query returns a :class:`tuple` containing the table's name.
129129
If we query ``sqlite_master`` for a non-existent table ``spam``,
130-
:meth:`!res.fetchone()` will return ``None``:
130+
:meth:`!res.fetchone` will return ``None``:
131131

132132
.. doctest::
133133

0 commit comments

Comments
 (0)