Skip to content

Commit 103a047

Browse files
authored
gh-123492: Remove unnecessary :func: parentheses (#123493)
1 parent 8aaf752 commit 103a047

Some content is hidden

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

78 files changed

+154
-154
lines changed

Doc/c-api/exceptions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ propagated, additional calls into the Python/C API may not behave as intended
3434
and may fail in mysterious ways.
3535

3636
.. note::
37-
The error indicator is **not** the result of :func:`sys.exc_info()`.
37+
The error indicator is **not** the result of :func:`sys.exc_info`.
3838
The former corresponds to an exception that is not yet caught (and is
3939
therefore still propagating), while the latter returns an exception after
4040
it is caught (and has therefore stopped propagating).

Doc/c-api/import.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Importing Modules
190190
191191
.. versionadded:: 3.2
192192
.. versionchanged:: 3.3
193-
Uses :func:`!imp.source_from_cache()` in calculating the source path if
193+
Uses :func:`!imp.source_from_cache` in calculating the source path if
194194
only the bytecode path is provided.
195195
.. versionchanged:: 3.12
196196
No longer uses the removed :mod:`!imp` module.

Doc/deprecations/pending-removal-in-3.13.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,5 @@ APIs:
4848
* ``read_binary()``
4949
* ``read_text()``
5050

51-
Use :func:`importlib.resources.files()` instead. Refer to `importlib-resources: Migrating from Legacy
51+
Use :func:`importlib.resources.files` instead. Refer to `importlib-resources: Migrating from Legacy
5252
<https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy>`_ (:gh:`106531`)

Doc/deprecations/pending-removal-in-3.15.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Pending Removal in Python 3.15
99
* :class:`locale`: :func:`locale.getdefaultlocale` was deprecated in Python 3.11
1010
and originally planned for removal in Python 3.13 (:gh:`90817`),
1111
but removal has been postponed to Python 3.15.
12-
Use :func:`locale.setlocale()`, :func:`locale.getencoding()` and
13-
:func:`locale.getlocale()` instead.
12+
Use :func:`locale.setlocale`, :func:`locale.getencoding` and
13+
:func:`locale.getlocale` instead.
1414
(Contributed by Hugo van Kemenade in :gh:`111187`.)
1515

1616
* :mod:`pathlib`:

Doc/howto/descriptor.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ were defined.
513513

514514
Descriptors are a powerful, general purpose protocol. They are the mechanism
515515
behind properties, methods, static methods, class methods, and
516-
:func:`super()`. They are used throughout Python itself. Descriptors
516+
:func:`super`. They are used throughout Python itself. Descriptors
517517
simplify the underlying C code and offer a flexible set of new tools for
518518
everyday Python programs.
519519

Doc/howto/enum.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Enum HOWTO
99
.. currentmodule:: enum
1010

1111
An :class:`Enum` is a set of symbolic names bound to unique values. They are
12-
similar to global variables, but they offer a more useful :func:`repr()`,
12+
similar to global variables, but they offer a more useful :func:`repr`,
1313
grouping, type-safety, and a few other features.
1414

1515
They are most useful when you have a variable that can take one of a limited
@@ -167,7 +167,7 @@ And a function to display the chores for a given day::
167167
answer SO questions
168168

169169
In cases where the actual values of the members do not matter, you can save
170-
yourself some work and use :func:`auto()` for the values::
170+
yourself some work and use :func:`auto` for the values::
171171

172172
>>> from enum import auto
173173
>>> class Weekday(Flag):

Doc/howto/instrumentation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ Available static markers
307307
.. object:: gc__start(int generation)
308308

309309
Fires when the Python interpreter starts a garbage collection cycle.
310-
``arg0`` is the generation to scan, like :func:`gc.collect()`.
310+
``arg0`` is the generation to scan, like :func:`gc.collect`.
311311

312312
.. object:: gc__done(long collected)
313313

Doc/library/ast.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ and classes for traversing abstract syntax trees:
21342134
If ``type_comments=True`` is given, the parser is modified to check
21352135
and return type comments as specified by :pep:`484` and :pep:`526`.
21362136
This is equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the
2137-
flags passed to :func:`compile()`. This will report syntax errors
2137+
flags passed to :func:`compile`. This will report syntax errors
21382138
for misplaced type comments. Without this flag, type comments will
21392139
be ignored, and the ``type_comment`` field on selected AST nodes
21402140
will always be ``None``. In addition, the locations of ``# type:

Doc/library/asyncio-runner.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Runner context manager
9191
current one. By default :func:`asyncio.new_event_loop` is used and set as
9292
current event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``.
9393

94-
Basically, :func:`asyncio.run()` example can be rewritten with the runner usage::
94+
Basically, :func:`asyncio.run` example can be rewritten with the runner usage::
9595

9696
async def main():
9797
await asyncio.sleep(1)

Doc/library/compileall.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ compile Python sources.
9090
.. option:: -j N
9191

9292
Use *N* workers to compile the files within the given directory.
93-
If ``0`` is used, then the result of :func:`os.process_cpu_count()`
93+
If ``0`` is used, then the result of :func:`os.process_cpu_count`
9494
will be used.
9595

9696
.. option:: --invalidation-mode [timestamp|checked-hash|unchecked-hash]

Doc/library/contextvars.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function and the :class:`~contextvars.Context` class should be used to
1515
manage the current context in asynchronous frameworks.
1616

1717
Context managers that have state should use Context Variables
18-
instead of :func:`threading.local()` to prevent their state from
18+
instead of :func:`threading.local` to prevent their state from
1919
bleeding to other code unexpectedly, when used in concurrent code.
2020

2121
See also :pep:`567` for additional details.
@@ -146,7 +146,7 @@ Manual Context Management
146146

147147
Every thread will have a different top-level :class:`~contextvars.Context`
148148
object. This means that a :class:`ContextVar` object behaves in a similar
149-
fashion to :func:`threading.local()` when values are assigned in different
149+
fashion to :func:`threading.local` when values are assigned in different
150150
threads.
151151

152152
Context implements the :class:`collections.abc.Mapping` interface.

Doc/library/enum.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ Data Types
663663
* the result is a valid *IntFlag*: an *IntFlag* is returned
664664
* the result is not a valid *IntFlag*: the result depends on the :class:`FlagBoundary` setting
665665

666-
The :func:`repr()` of unnamed zero-valued flags has changed. It is now:
666+
The :func:`repr` of unnamed zero-valued flags has changed. It is now:
667667

668668
>>> Color(0)
669669
<Color: 0>

Doc/library/functions.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ are always available. They are listed here in alphabetical order.
161161
This function drops you into the debugger at the call site. Specifically,
162162
it calls :func:`sys.breakpointhook`, passing ``args`` and ``kws`` straight
163163
through. By default, ``sys.breakpointhook()`` calls
164-
:func:`pdb.set_trace()` expecting no arguments. In this case, it is
164+
:func:`pdb.set_trace` expecting no arguments. In this case, it is
165165
purely a convenience function so you don't have to explicitly import
166166
:mod:`pdb` or type as much code to enter the debugger. However,
167167
:func:`sys.breakpointhook` can be set to some other function and
@@ -1336,7 +1336,7 @@ are always available. They are listed here in alphabetical order.
13361336
(which on *some* Unix systems, means that *all* writes append to the end of
13371337
the file regardless of the current seek position). In text mode, if
13381338
*encoding* is not specified the encoding used is platform-dependent:
1339-
:func:`locale.getencoding()` is called to get the current locale encoding.
1339+
:func:`locale.getencoding` is called to get the current locale encoding.
13401340
(For reading and writing raw bytes use binary mode and leave
13411341
*encoding* unspecified.) The available modes are:
13421342

Doc/library/functools.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The :mod:`functools` module defines the following functions:
3434
Returns the same as ``lru_cache(maxsize=None)``, creating a thin
3535
wrapper around a dictionary lookup for the function arguments. Because it
3636
never needs to evict old values, this is smaller and faster than
37-
:func:`lru_cache()` with a size limit.
37+
:func:`lru_cache` with a size limit.
3838

3939
For example::
4040

Doc/library/getpass.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The :mod:`getpass` module provides two functions:
4949
systems which support the :mod:`pwd` module, otherwise, an :exc:`OSError`
5050
is raised.
5151

52-
In general, this function should be preferred over :func:`os.getlogin()`.
52+
In general, this function should be preferred over :func:`os.getlogin`.
5353

5454
.. versionchanged:: 3.13
5555
Previously, various exceptions beyond just :exc:`OSError` were raised.

Doc/library/inspect.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ Classes and functions
12611261
This function handles several details for you:
12621262

12631263
* If ``eval_str`` is true, values of type ``str`` will
1264-
be un-stringized using :func:`eval()`. This is intended
1264+
be un-stringized using :func:`eval`. This is intended
12651265
for use with stringized annotations
12661266
(``from __future__ import annotations``).
12671267
* If ``obj`` doesn't have an annotations dict, returns an
@@ -1275,16 +1275,16 @@ Classes and functions
12751275
* Always, always, always returns a freshly created dict.
12761276

12771277
``eval_str`` controls whether or not values of type ``str`` are replaced
1278-
with the result of calling :func:`eval()` on those values:
1278+
with the result of calling :func:`eval` on those values:
12791279

1280-
* If eval_str is true, :func:`eval()` is called on values of type ``str``.
1281-
(Note that ``get_annotations`` doesn't catch exceptions; if :func:`eval()`
1280+
* If eval_str is true, :func:`eval` is called on values of type ``str``.
1281+
(Note that ``get_annotations`` doesn't catch exceptions; if :func:`eval`
12821282
raises an exception, it will unwind the stack past the ``get_annotations``
12831283
call.)
12841284
* If eval_str is false (the default), values of type ``str`` are unchanged.
12851285

1286-
``globals`` and ``locals`` are passed in to :func:`eval()`; see the documentation
1287-
for :func:`eval()` for more information. If ``globals`` or ``locals``
1286+
``globals`` and ``locals`` are passed in to :func:`eval`; see the documentation
1287+
for :func:`eval` for more information. If ``globals`` or ``locals``
12881288
is ``None``, this function may replace that value with a context-specific
12891289
default, contingent on ``type(obj)``:
12901290

Doc/library/io.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ Text I/O
950950
:class:`TextIOBase`.
951951

952952
*encoding* gives the name of the encoding that the stream will be decoded or
953-
encoded with. It defaults to :func:`locale.getencoding()`.
953+
encoded with. It defaults to :func:`locale.getencoding`.
954954
``encoding="locale"`` can be used to specify the current locale's encoding
955955
explicitly. See :ref:`io-text-encoding` for more information.
956956

@@ -1182,7 +1182,7 @@ re-enter a buffered object which it is already accessing, a :exc:`RuntimeError`
11821182
is raised. Note this doesn't prohibit a different thread from entering the
11831183
buffered object.
11841184

1185-
The above implicitly extends to text files, since the :func:`open()` function
1185+
The above implicitly extends to text files, since the :func:`open` function
11861186
will wrap a buffered object inside a :class:`TextIOWrapper`. This includes
1187-
standard streams and therefore affects the built-in :func:`print()` function as
1187+
standard streams and therefore affects the built-in :func:`print` function as
11881188
well.

Doc/library/ipaddress.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ The module also provides the following module level functions:
10101010

10111011
doesn't make sense. There are some times however, where you may wish to
10121012
have :mod:`ipaddress` sort these anyway. If you need to do this, you can use
1013-
this function as the *key* argument to :func:`sorted()`.
1013+
this function as the *key* argument to :func:`sorted`.
10141014

10151015
*obj* is either a network or address object.
10161016

Doc/library/os.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ of the UTF-8 encoding:
113113

114114
* Use UTF-8 as the :term:`filesystem encoding <filesystem encoding and error
115115
handler>`.
116-
* :func:`sys.getfilesystemencoding()` returns ``'utf-8'``.
117-
* :func:`locale.getpreferredencoding()` returns ``'utf-8'`` (the *do_setlocale*
116+
* :func:`sys.getfilesystemencoding` returns ``'utf-8'``.
117+
* :func:`locale.getpreferredencoding` returns ``'utf-8'`` (the *do_setlocale*
118118
argument has no effect).
119119
* :data:`sys.stdin`, :data:`sys.stdout`, and :data:`sys.stderr` all use
120120
UTF-8 as their text encoding, with the ``surrogateescape``
@@ -133,8 +133,8 @@ level APIs also exhibit different default behaviours:
133133

134134
* Command line arguments, environment variables and filenames are decoded
135135
to text using the UTF-8 encoding.
136-
* :func:`os.fsdecode()` and :func:`os.fsencode()` use the UTF-8 encoding.
137-
* :func:`open()`, :func:`io.open()`, and :func:`codecs.open()` use the UTF-8
136+
* :func:`os.fsdecode` and :func:`os.fsencode` use the UTF-8 encoding.
137+
* :func:`open`, :func:`io.open`, and :func:`codecs.open` use the UTF-8
138138
encoding by default. However, they still use the strict error handler by
139139
default so that attempting to open a binary file in text mode is likely
140140
to raise an exception rather than producing nonsense data.
@@ -794,7 +794,7 @@ process and user.
794794
``socket.gethostbyaddr(socket.gethostname())``.
795795

796796
On macOS, iOS and Android, this returns the *kernel* name and version (i.e.,
797-
``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android). :func:`platform.uname()`
797+
``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android). :func:`platform.uname`
798798
can be used to get the user-facing operating system name and version on iOS and
799799
Android.
800800

@@ -2860,7 +2860,7 @@ features:
28602860

28612861
.. versionchanged:: 3.6
28622862
Added support for the :term:`context manager` protocol and the
2863-
:func:`~scandir.close()` method. If a :func:`scandir` iterator is neither
2863+
:func:`~scandir.close` method. If a :func:`scandir` iterator is neither
28642864
exhausted nor explicitly closed a :exc:`ResourceWarning` will be emitted
28652865
in its destructor.
28662866

Doc/library/pdb.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ You can then step through the code following this statement, and continue
4949
running without the debugger using the :pdbcmd:`continue` command.
5050

5151
.. versionchanged:: 3.7
52-
The built-in :func:`breakpoint()`, when called with defaults, can be used
52+
The built-in :func:`breakpoint`, when called with defaults, can be used
5353
instead of ``import pdb; pdb.set_trace()``.
5454

5555
::

Doc/library/platform.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Cross Platform
150150

151151
On iOS and Android, this returns the user-facing OS name (i.e, ``'iOS``,
152152
``'iPadOS'`` or ``'Android'``). To obtain the kernel name (``'Darwin'`` or
153-
``'Linux'``), use :func:`os.uname()`.
153+
``'Linux'``), use :func:`os.uname`.
154154

155155
.. function:: system_alias(system, release, version)
156156

@@ -165,7 +165,7 @@ Cross Platform
165165
returned if the value cannot be determined.
166166

167167
On iOS and Android, this is the user-facing OS version. To obtain the
168-
Darwin or Linux kernel version, use :func:`os.uname()`.
168+
Darwin or Linux kernel version, use :func:`os.uname`.
169169

170170
.. function:: uname()
171171

Doc/library/signal.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ The :mod:`signal` module defines the following functions:
425425
signal to a particular Python thread would be to force a running system call
426426
to fail with :exc:`InterruptedError`.
427427

428-
Use :func:`threading.get_ident()` or the :attr:`~threading.Thread.ident`
428+
Use :func:`threading.get_ident` or the :attr:`~threading.Thread.ident`
429429
attribute of :class:`threading.Thread` objects to get a suitable value
430430
for *thread_id*.
431431

Doc/library/stdtypes.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -3477,7 +3477,7 @@ place, and instead produce new objects.
34773477
``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters
34783478
are those byte values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``.
34793479

3480-
Unlike :func:`str.swapcase()`, it is always the case that
3480+
Unlike :func:`str.swapcase`, it is always the case that
34813481
``bin.swapcase().swapcase() == bin`` for the binary versions. Case
34823482
conversions are symmetrical in ASCII, even though that is not generally
34833483
true for arbitrary Unicode code points.

Doc/library/subprocess.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ functions.
608608

609609
If *group* is not ``None``, the setregid() system call will be made in the
610610
child process prior to the execution of the subprocess. If the provided
611-
value is a string, it will be looked up via :func:`grp.getgrnam()` and
611+
value is a string, it will be looked up via :func:`grp.getgrnam` and
612612
the value in ``gr_gid`` will be used. If the value is an integer, it
613613
will be passed verbatim. (POSIX only)
614614

@@ -618,15 +618,15 @@ functions.
618618
If *extra_groups* is not ``None``, the setgroups() system call will be
619619
made in the child process prior to the execution of the subprocess.
620620
Strings provided in *extra_groups* will be looked up via
621-
:func:`grp.getgrnam()` and the values in ``gr_gid`` will be used.
621+
:func:`grp.getgrnam` and the values in ``gr_gid`` will be used.
622622
Integer values will be passed verbatim. (POSIX only)
623623

624624
.. availability:: POSIX
625625
.. versionadded:: 3.9
626626

627627
If *user* is not ``None``, the setreuid() system call will be made in the
628628
child process prior to the execution of the subprocess. If the provided
629-
value is a string, it will be looked up via :func:`pwd.getpwnam()` and
629+
value is a string, it will be looked up via :func:`pwd.getpwnam` and
630630
the value in ``pw_uid`` will be used. If the value is an integer, it will
631631
be passed verbatim. (POSIX only)
632632

Doc/library/sys.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -735,11 +735,11 @@ always available.
735735
regardless of their size. This function is mainly useful for tracking
736736
and debugging memory leaks. Because of the interpreter's internal
737737
caches, the result can vary from call to call; you may have to call
738-
:func:`_clear_internal_caches()` and :func:`gc.collect()` to get more
738+
:func:`_clear_internal_caches` and :func:`gc.collect` to get more
739739
predictable results.
740740

741741
If a Python build or implementation cannot reasonably compute this
742-
information, :func:`getallocatedblocks()` is allowed to return 0 instead.
742+
information, :func:`getallocatedblocks` is allowed to return 0 instead.
743743

744744
.. versionadded:: 3.4
745745

Doc/library/sysconfig.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ Installation path functions
305305
mix with those by the other.
306306

307307
End users should not use this function, but :func:`get_default_scheme` and
308-
:func:`get_preferred_scheme()` instead.
308+
:func:`get_preferred_scheme` instead.
309309

310310
.. versionadded:: 3.10
311311

Doc/library/tarfile.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ be finalized; only the internally used file object will be closed. See the
615615
it is best practice to only do so in top-level applications or
616616
:mod:`site configuration <site>`.
617617
To set a global default this way, a filter function needs to be wrapped in
618-
:func:`staticmethod()` to prevent injection of a ``self`` argument.
618+
:func:`staticmethod` to prevent injection of a ``self`` argument.
619619

620620
.. versionchanged:: 3.14
621621

Doc/library/test.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1701,7 +1701,7 @@ The :mod:`test.support.warnings_helper` module provides support for warnings tes
17011701

17021702
.. function:: check_warnings(*filters, quiet=True)
17031703

1704-
A convenience wrapper for :func:`warnings.catch_warnings()` that makes it
1704+
A convenience wrapper for :func:`warnings.catch_warnings` that makes it
17051705
easier to test that a warning was correctly raised. It is approximately
17061706
equivalent to calling ``warnings.catch_warnings(record=True)`` with
17071707
:meth:`warnings.simplefilter` set to ``always`` and with the option to

Doc/library/time.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ Functions
327327

328328
.. impl-detail::
329329

330-
On CPython, use the same clock than :func:`time.monotonic()` and is a
330+
On CPython, use the same clock than :func:`time.monotonic` and is a
331331
monotonic clock, i.e. a clock that cannot go backwards.
332332

333333
Use :func:`perf_counter_ns` to avoid the precision loss caused by the
@@ -339,7 +339,7 @@ Functions
339339
On Windows, the function is now system-wide.
340340

341341
.. versionchanged:: 3.13
342-
Use the same clock than :func:`time.monotonic()`.
342+
Use the same clock than :func:`time.monotonic`.
343343

344344

345345
.. function:: perf_counter_ns() -> int

0 commit comments

Comments
 (0)