8000 [3.13] gh-123517: Remove unnecessary `:meth:` parentheses (gh-123518) by mattwang44 · Pull Request #123577 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.13] gh-123 8000 517: Remove unnecessary :meth: parentheses (gh-123518) #123577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Doc/c-api/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ Macros for the convenience of modules implementing the DB API:
.. c:function:: PyObject* PyDateTime_FromTimestamp(PyObject *args)

Create and return a new :class:`datetime.datetime` object given an argument
tuple suitable for passing to :meth:`datetime.datetime.fromtimestamp()`.
tuple suitable for passing to :meth:`datetime.datetime.fromtimestamp`.


.. c:function:: PyObject* PyDate_FromTimestamp(PyObject *args)

Create and return a new :class:`datetime.date` object given an argument
tuple suitable for passing to :meth:`datetime.date.fromtimestamp()`.
tuple suitable for passing to :meth:`datetime.date.fromtimestamp`.
2 changes: 1 addition & 1 deletion Doc/deprecations/pending-removal-in-future.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ although there is currently no date scheduled for their removal.
* Implicit ``None`` on return values.

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

* :mod:`mailbox`: Use of StringIO input and text mode is deprecated, use
BytesIO and binary mode instead.
Expand Down
2 changes: 1 addition & 1 deletion Doc/extending/newtypes_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ Further, the attributes can be deleted, setting the C pointers to ``NULL``. Eve
though we can make sure the members are initialized to non-``NULL`` values, the
members can be set to ``NULL`` if the attributes are deleted.

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

static PyObject *
Expand Down
2 changes: 1 addition & 1 deletion Doc/faq/programming.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@ Not as such.
For simple input parsing, the easiest approach is usually to split the line into
whitespace-delimited words using the :meth:`~str.split` method of string objects
and then convert decimal strings to numeric values using :func:`int` or
:func:`float`. :meth:`!split()` supports an optional "sep" parameter which is useful
:func:`float`. :meth:`!split` supports an optional "sep" parameter which is useful
if the line uses something other than whitespace as a separator.

For more complicated input parsing, regular expressions are more powerful
Expand Down
2 changes: 1 addition & 1 deletion Doc/howto/descriptor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@
Summary of invocation logic
---------------------------

The mechanism for descriptors is embedded in the :meth:`__getattribute__()`
The mechanism for descriptors is embedded in the :meth:`__getattribute__`

Check warning on line 806 in Doc/howto/descriptor.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: __getattribute__ [ref.meth]
methods for :class:`object`, :class:`type`, and :func:`super`.

The important points to remember are:
Expand Down
8 changes: 4 additions & 4 deletions Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Running and stopping the loop

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

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

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

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

Enabling debug mode
^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -1485,7 +1485,7 @@ async/await code consider using the high-level
* *stdin* can be any of these:

* a file-like object
* an existing file descriptor (a positive integer), for example those created with :meth:`os.pipe()`
* an existing file descriptor (a positive integer), for example those created with :meth:`os.pipe`
* the :const:`subprocess.PIPE` constant (default) which will create a new
pipe and connect it,
* the value ``None`` which will make the subprocess inherit the file
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/asyncio-llapi-index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ See also the main documentation section about the
* - :meth:`loop.close`
- Close the event loop.

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

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

* - ``await`` :meth:`loop.shutdown_asyncgens`
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/asyncio-queue.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Queue
Return ``True`` if there are :attr:`maxsize` items in the queue.

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

.. coroutinemethod:: get()

Expand Down
4 changes: 2 additions & 2 deletions Doc/library/configparser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ ConfigParser Objects
When *converters* is given, it should be a dictionary where each key
represents the name of a type converter and each value is a callable
implementing the conversion from string to the desired datatype. Every
converter gets its own corresponding :meth:`!get*()` method on the parser
converter gets its own corresponding :meth:`!get*` method on the parser
object and section proxies.

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

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

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Module contents
- *unsafe_hash*: If ``False`` (the default), a :meth:`~object.__hash__` method
is generated according to how *eq* and *frozen* are set.

:meth:`!__hash__` is used by built-in :meth:`hash()`, and when objects are
:meth:`!__hash__` is used by built-in :meth:`hash`, and when objects are
added to hashed collections such as dictionaries and sets. Having a
:meth:`!__hash__` implies that instances of the class are immutable.
Mutability is a complicated property that depends on the programmer's
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ Other constructors, all class methods:
.. versionadded:: 3.7
.. versionchanged:: 3.11
Previously, this method only supported formats that could be emitted by
:meth:`date.isoformat()` or :meth:`datetime.isoformat()`.
:meth:`date.isoformat` or :meth:`datetime.isoformat`.


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


Instance methods:
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/email.compat32-message.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Here are the methods of the :class:`Message` class:

.. method:: __str__()

Equivalent to :meth:`.as_string()`. Allows ``str(msg)`` to produce a
Equivalent to :meth:`.as_string`. Allows ``str(msg)`` to produce a
string containing the formatted message.


Expand Down Expand Up @@ -143,7 +143,7 @@ Here are the methods of the :class:`Message` class:

.. method:: __bytes__()

Equivalent to :meth:`.as_bytes()`. Allows ``bytes(msg)`` to produce a
Equivalent to :meth:`.as_bytes`. Allows ``bytes(msg)`` to produce a
bytes object containing the formatted message.

.. versionadded:: 3.4
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/email.message.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ message objects.

.. method:: __bytes__()

Equivalent to :meth:`.as_bytes()`. Allows ``bytes(msg)`` to produce a
Equivalent to :meth:`.as_bytes`. Allows ``bytes(msg)`` to produce a
bytes object containing the serialized message.


Expand Down
2 changes: 1 addition & 1 deletion Doc/library/http.server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ provides three different variants:

Adds a blank line
(indicating the end of the HTTP headers in the response)
to the headers buffer and calls :meth:`flush_headers()`.
to the headers buffer and calls :meth:`flush_headers`.

.. versionchanged:: 3.2
The buffered headers are written to the output stream.
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ the backing store is natively made of bytes (such as in the case of a file),
encoding and decoding of data is made transparently as well as optional
translation of platform-specific newline characters.

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

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

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

f = open("myfile.jpg", "rb")
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/logging.config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
def dictConfig(config):
dictConfigClass(config).configure()

For example, a subclass of :class:`DictConfigurator` could call

Check warning on line 71 in Doc/library/logging.config.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:class reference target not found: DictConfigurator [ref.class]

Check warning on line 71 in Doc/library/logging.config.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: __init__ [ref.meth]

Check warning on line 71 in Doc/library/logging.config.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: configure [ref.meth]

Check warning on line 71 in Doc/library/logging.config.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:attr reference target not found: dictConfigClass [ref.attr]
``DictConfigurator.__init__()`` in its own :meth:`__init__()`, then
``DictConfigurator.__init__()`` in its own :meth:`__init__`, then
set up custom prefixes which would be usable in the subsequent
:meth:`configure` call. :attr:`dictConfigClass` would be bound to
this new subclass, and then :func:`dictConfig` could be called exactly as
Expand Down
10 changes: 5 additions & 5 deletions Doc/library/multiprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ The :mod:`multiprocessing` package mostly replicates the API of the
The constructor should always be called with keyword arguments. *group*
should always be ``None``; it exists solely for compatibility with
:class:`threading.Thread`. *target* is the callable object to be invoked by
the :meth:`run()` method. It defaults to ``None``, meaning nothing is
the :meth:`run` method. It defaults to ``None``, meaning nothing is
called. *name* is the process name (see :attr:`name` for more details).
*args* is the argument tuple for the target invocation. *kwargs* is a
dictionary of keyword arguments for the target invocation. If provided,
Expand Down Expand Up @@ -642,7 +642,7 @@ The :mod:`multiprocessing` package mostly replicates the API of the

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

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

.. method:: kill()

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

.. versionadded:: 3.7

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

.. exception:: BufferTooShort

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

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

If you write a file-like object and implement your own caching, you can
Expand Down
10 changes: 5 additions & 5 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -984,10 +984,10 @@ Querying file type and status

.. versionchanged:: 3.8

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

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

Expand Down
12 changes: 6 additions & 6 deletions Doc/library/socket.rst
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ The following functions all create :ref:`socket objects <socket-objects>`.
of :meth:`socket.getpeername` but not the actual OS resource. Unlike
:func:`socket.fromfd`, *fileno* will return the same socket and not a
duplicate. This may help close a detached socket using
:meth:`socket.close()`.
:meth:`socket.close`.

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

Expand Down Expand Up @@ -1415,7 +1415,7 @@ to sockets.
.. method:: socket.close()

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

.. note::

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


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

Timeouts and the ``connect`` method
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/sqlite3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ and call :meth:`res.fetchone() <Cursor.fetchone>` to fetch the resulting row:
We can see that the table has been created,
as the query returns a :class:`tuple` containing the table's name.
If we query ``sqlite_master`` for a non-existent table ``spam``,
:meth:`!res.fetchone()` will return ``None``:
:meth:`!res.fetchone` will return ``None``:

.. doctest::

Expand Down
34 changes: 17 additions & 17 deletions Doc/library/ssl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1049,25 +1049,25 @@ SSL Sockets

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

- :meth:`~socket.socket.accept()`
- :meth:`~socket.socket.bind()`
- :meth:`~socket.socket.close()`
- :meth:`~socket.socket.connect()`
- :meth:`~socket.socket.detach()`
- :meth:`~socket.socket.fileno()`
- :meth:`~socket.socket.getpeername()`, :meth:`~socket.socket.getsockname()`
- :meth:`~socket.socket.getsockopt()`, :meth:`~socket.socket.setsockopt()`
- :meth:`~socket.socket.gettimeout()`, :meth:`~socket.socket.settimeout()`,
:meth:`~socket.socket.setblocking()`
- :meth:`~socket.socket.listen()`
- :meth:`~socket.socket.makefile()`
- :meth:`~socket.socket.recv()`, :meth:`~socket.socket.recv_into()`
- :meth:`~socket.socket.accept`
- :meth:`~socket.socket.bind`
- :meth:`~socket.socket.close`
- :meth:`~socket.socket.connect`
- :meth:`~socket.socket.detach`
- :meth:`~socket.socket.fileno`
- :meth:`~socket.socket.getpeername`, :meth:`~socket.socket.getsockname`
- :meth:`~socket.socket.getsockopt`, :meth:`~socket.socket.setsockopt`
- :meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`,
:meth:`~socket.socket.setblocking`
- :meth:`~socket.socket.listen`
- :meth:`~socket.socket.makefile`
- :meth:`~socket.socket.recv`, :meth:`~socket.socket.recv_into`
(but passing a non-zero ``flags`` argument is not allowed)
- :meth:`~socket.socket.send()`, :meth:`~socket.socket.sendall()` (with
- :meth:`~socket.socket.send`, :meth:`~socket.socket.sendall` (with
the same limitation)
- :meth:`~socket.socket.sendfile()` (but :mod:`os.sendfile` will be used
for plain-text sockets only, else :meth:`~socket.socket.send()` will be used)
- :meth:`~socket.socket.shutdown()`
- :meth:`~socket.socket.sendfile` (but :mod:`os.sendfile` will be used
for plain-text sockets only, else :meth:`~socket.socket.send` will be used)
- :meth:`~socket.socket.shutdown`

However, since the SSL (and TLS) protocol has its own framing atop
of TCP, the SSL sockets abstraction can, in certain respects, diverge from
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3987,7 +3987,7 @@ copying.
dangling resources) as soon as possible.

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

>>> m = memoryview(b'abc')
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/tkinter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -983,10 +983,10 @@ option (other options are available as well).
Added the :class:`!PhotoImage` method :meth:`!copy_replace` to copy a region
from one image to other image, possibly with pixel zooming and/or
subsampling.
Add *from_coords* parameter to :class:`!PhotoImage` methods :meth:`!copy()`,
:meth:`!zoom()` and :meth:`!subsample()`.
Add *from_coords* parameter to :class:`!PhotoImage` methods :meth:`!copy`,
:meth:`!zoom` and :meth:`!subsample`.
Add *zoom* and *subsample* parameters to :class:`!PhotoImage` method
:meth:`!copy()`.
:meth:`!copy`.

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