8000 [3.13] gh-123517: Remove unnecessary `:meth:` parentheses (gh-123518)… · python/cpython@05dcc81 · GitHub
[go: up one dir, main page]

Skip to content

Commit 05dcc81

Browse files
authored
[3.13] gh-123517: Remove unnecessary :meth: parentheses (gh-123518) (GH-123577)
1 parent 10735bf commit 05dcc81

Some content is hidden

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

52 files changed

+138
-138
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/deprecations/pending-removal-in-future.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ although there is currently no date scheduled for their removal.
6767
* Implicit ``None`` on return values.
6868

6969
* :mod:`logging`: the ``warn()`` method has been deprecated
70-
since Python 3.3, use :meth:`~logging.warning()` instead.
70+
since Python 3.3, use :meth:`~logging.warning` instead.
7171

7272
* :mod:`mailbox`: Use of StringIO input and text mode is deprecated, use
7373
BytesIO and binary mode instead.

Doc/extending/newtypes_tutorial.rst

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

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

453453
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.
@@ -1402,7 +1402,7 @@ Allows customizing how exceptions are handled in the event loop.
14021402

14031403
This method should not be overloaded in subclassed
14041404
event loops. For custom exception handling, use
1405-
the :meth:`set_exception_handler()` method.
1405+
the :meth:`set_exception_handler` method.
14061406

14071407
Enabling debug mode
14081408
^^^^^^^^^^^^^^^^^^^
@@ -1485,7 +1485,7 @@ async/await code consider using the high-level
14851485
* *stdin* can be any of these:
14861486

14871487
* a file-like object
1488-
* an existing file descriptor (a positive integer), for example those created with :meth:`os.pipe()`
1488+
* an existing file descriptor (a positive integer), for example those created with :meth:`os.pipe`
14891489
* the :const:`subprocess.PIPE` constant (default) which will create a new
14901490
pipe and connect it,
14911491
* 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
@@ -986,7 +986,7 @@ ConfigParser Objects
986986
When *converters* is given, it should be a dictionary where each key
987987
represents the name of a type converter and each value is a callable
988988
implementing the conversion from string to the desired datatype. Every
989-
converter gets its own corresponding :meth:`!get*()` method on the parser
989+
converter gets its own corresponding :meth:`!get*` method on the parser
990990
object and section proxies.
991991

992992
It is possible to read several configurations into a single
@@ -1026,7 +1026,7 @@ ConfigParser Objects
10261026
The *converters* argument was added.
10271027

10281028
.. versionchanged:: 3.7
1029-
The *defaults* argument is read with :meth:`read_dict()`,
1029+
The *defaults* argument is read with :meth:`read_dict`,
10301030
providing consistent behavior across the parser: non-string
10311031
keys and values are implicitly converted to strings.
10321032

Doc/library/dataclasses.rst

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
@@ -1053,7 +1053,7 @@ Other constructors, all class methods:
10531053
.. versionadded:: 3.7
10541054
.. versionchanged:: 3.11
10551055
Previously, this method only supported formats that could be emitted by
1056-
:meth:`date.isoformat()` or :meth:`datetime.isoformat()`.
1056+
:meth:`date.isoformat` or :meth:`datetime.isoformat`.
10571057

10581058

10591059
.. classmethod:: datetime.fromisocalendar(year, week, day)
@@ -1861,7 +1861,7 @@ Other constructor:
18611861
.. versionadded:: 3.7
18621862
.. versionchanged:: 3.11
18631863
Previously, this method only supported formats that could be emitted by
1864-
:meth:`time.isoformat()`.
1864+
:meth:`time.isoformat`.
18651865

18661866

18671867
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
@@ -2961,7 +2961,7 @@ Beware of replacing :data:`sys.stdin` with a "file like object"
29612961
resulting in a bad file descriptor error, but introduces a potential danger
29622962
to applications which replace :func:`sys.stdin` with a "file-like object"
29632963
with output buffering. This danger is that if multiple processes call
2964-
:meth:`~io.IOBase.close()` on this file-like object, it could result in the same
2964+
:meth:`~io.IOBase.close` on this file-like object, it could result in the same
29652965
data being flushed to the object multiple times, resulting in corruption.
29662966

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

Doc/library/pathlib.rst

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

985985
.. versionchanged:: 3.8
986986

987-
:meth:`~Path.exists()`, :meth:`~Path.is_dir()`, :meth:`~Path.is_file()`,
988-
:meth:`~Path.is_mount()`, :meth:`~Path.is_symlink()`,
989-
:meth:`~Path.is_block_device()`, :meth:`~Path.is_char_device()`,
990-
:meth:`~Path.is_fifo()`, :meth:`~Path.is_socket()` now return ``False``
987+
:meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`,
988+
:meth:`~Path.is_mount`, :meth:`~Path.is_symlink`,
989+
:meth:`~Path.is_block_device`, :meth:`~Path.is_char_device`,
990+
:meth:`~Path.is_fifo`, :meth:`~Path.is_socket` now return ``False``
991991
instead of raising an exception for paths that contain characters
992992
unrepresentable at the OS level.
993993

@@ -1367,7 +1367,7 @@ Reading directories
13671367
This can be used to prune the search, or to impose a specific order of visiting,
13681368
or even to inform :meth:`Path.walk` about directories the caller creates or
13691369
renames before it resumes :meth:`Path.walk` again. Modifying *dirnames* when
1370-
*top_down* is false has no effect on the behavior of :meth:`Path.walk()` since the
1370+
*top_down* is false has no effect on the behavior of :meth:`Path.walk` since the
13711371
directories in *dirnames* have already been generated by the time *dirnames*
13721372
is yielded to the caller.
13731373

Doc/library/socket.rst

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

741741
The newly created socket is :ref:`non-inheritable <fd_inheritance>`.
742742

@@ -1415,7 +1415,7 @@ to sockets.
14151415
.. method:: socket.close()
14161416

14171417
Mark the socket closed. The underlying system resource (e.g. a file
1418-
descriptor) is also closed when all file objects from :meth:`makefile()`
1418+
descriptor) is also closed when all file objects from :meth:`makefile`
14191419
are closed. Once that happens, all future operations on the socket
14201420
object will fail. The remote end will receive no more data (after
14211421
queued data is flushed).
@@ -1430,10 +1430,10 @@ to sockets.
14301430

14311431
.. note::
14321432

1433-
:meth:`close()` releases the resource associated with a connection but
1433+
:meth:`close` releases the resource associated with a connection but
14341434
does not necessarily close the connection immediately. If you want
1435-
to close the connection in a timely fashion, call :meth:`shutdown()`
1436-
before :meth:`close()`.
1435+
to close the connection in a timely fashion, call :meth:`shutdown`
1436+
before :meth:`close`.
14371437

14381438

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

20472047
Timeouts and the ``connect`` method
20482048
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

Doc/library/ssl.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,25 +1049,25 @@ SSL Sockets
10491049

10501050
SSL sockets provide the following methods of :ref:`socket-objects`:
10511051

1052-
- :meth:`~socket.socket.accept()`
1053-
- :meth:`~socket.socket.bind()`
1054-
- :meth:`~socket.socket.close()`
1055-
- :meth:`~socket.socket.connect()`
1056-
- :meth:`~socket.socket.detach()`
1057-
- :meth:`~socket.socket.fileno()`
1058-
- :meth:`~socket.socket.getpeername()`, :meth:`~socket.socket.getsockname()`
1059-
- :meth:`~socket.socket.getsockopt()`, :meth:`~socket.socket.setsockopt()`
1060-
- :meth:`~socket.socket.gettimeout()`, :meth:`~socket.socket.settimeout()`,
1061-
:meth:`~socket.socket.setblocking()`
1062-
- :meth:`~socket.socket.listen()`
1063-
- :meth:`~socket.socket.makefile()`
1064-
- :meth:`~socket.socket.recv()`, :meth:`~socket.socket.recv_into()`
1052+
- :meth:`~socket.socket.accept`
1053+
- :meth:`~socket.socket.bind`
1054+
- :meth:`~socket.socket.close`
1055+
- :meth:`~socket.socket.connect`
1056+
- :meth:`~socket.socket.detach`
1057+
- :meth:`~socket.socket.fileno`
1058+
- :meth:`~socket.socket.getpeername`, :meth:`~socket.socket.getsockname`
1059+
- :meth:`~socket.socket.getsockopt`, :meth:`~socket.socket.setsockopt`
1060+
- :meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`,
1061+
:meth:`~socket.socket.setblocking`
1062+
- :meth:`~socket.socket.listen`
1063+
- :meth:`~socket.socket.makefile`
1064+
- :meth:`~socket.socket.recv`, :meth:`~socket.socket.recv_into`
10651065
(but passing a non-zero ``flags`` argument is not allowed)
1066-
- :meth:`~socket.socket.send()`, :meth:`~socket.socket.sendall()` (with
1066+
- :meth:`~socket.socket.send`, :meth:`~socket.socket.sendall` (with
10671067
the same limitation)
1068-
- :meth:`~socket.socket.sendfile()` (but :mod:`os.sendfile` will be used
1069-
for plain-text sockets only, else :meth:`~socket.socket.send()` will be used)
1070-
F89D - :meth:`~socket.socket.shutdown()`
1068+
- :meth:`~socket.socket.sendfile` (but :mod:`os.sendfile` will be used
1069+
for plain-text sockets only, else :meth:`~socket.socket.send` will be used)
1070+
- :meth:`~socket.socket.shutdown`
10711071

10721072
However, since the SSL (and TLS) protocol has its own framing atop
10731073
of TCP, the SSL sockets abstraction can, in certain respects, diverge from

Doc/library/stdtypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3987,7 +3987,7 @@ copying.
39873987
dangling resources) as soon as possible.
39883988

39893989
After this method has been called, any further operation on the view
3990-
raises a :class:`ValueError` (except :meth:`release()` itself which can
3990+
raises a :class:`ValueError` (except :meth:`release` itself which can
39913991
be called multiple times)::
39923992

39933993
>>> m = memoryview(b'abc')

Doc/library/tkinter.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -983,10 +983,10 @@ option (other options are available as well).
983983
Added the :class:`!PhotoImage` method :meth:`!copy_replace` to copy a region
984984
from one image to other image, possibly with pixel zooming and/or
985985
subsampling.
986-
Add *from_coords* parameter to :class:`!PhotoImage` methods :meth:`!copy()`,
987-
:meth:`!zoom()` and :meth:`!subsample()`.
986+
Add *from_coords* parameter to :class:`!PhotoImage` methods :meth:`!copy`,
987+
:meth:`!zoom` and :meth:`!subsample`.
988988
Add *zoom* and *subsample* parameters to :class:`!PhotoImage` method
989-
:meth:`!copy()`.
989+
:meth:`!copy`.
990990

991991
The image object can then be used wherever an ``image`` option is supported by
992992
some widget (e.g. labels, buttons, menus). In these cases, Tk will not keep a

0 commit comments

Comments
 (0)
0