8000 [3.12] Use roles :data: and :const: for referencing module variables … · python/cpython@0d51b29 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0d51b29

Browse files
[3.12] Use roles :data: and :const: for referencing module variables (GH-129507) (GH-129650)
(cherry picked from commit 078ab82)
1 parent 86451b1 commit 0d51b29

File tree

13 files changed

+30
-30
lines changed

13 files changed

+30
-30
lines changed

Doc/library/datetime.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ The :mod:`!datetime` module exports the following constants:
9393
The largest year number allowed in a :class:`date` or :class:`.datetime` object.
9494
:const:`MAXYEAR` is 9999.
9595

96-
.. attribute:: UTC
96+
.. data:: UTC
9797

9898
Alias for the UTC time zone singleton :attr:`datetime.timezone.utc`.
9999

@@ -918,7 +918,7 @@ Other constructors, all class methods:
918918

919919
.. deprecated:: 3.12
920920

921-
Use :meth:`datetime.now` with :attr:`UTC` instead.
921+
Use :meth:`datetime.now` with :const:`UTC` instead.
922922

923923

924924
.. classmethod:: datetime.fromtimestamp(timestamp, tz=None)
@@ -990,7 +990,7 @@ Other constructors, all class methods:
990990

991991
.. deprecated:: 3.12
992992

993-
Use :meth:`datetime.fromtimestamp` with :attr:`UTC` instead.
993+
Use :meth:`datetime.fromtimestamp` with :const:`UTC` instead.
994994

995995

996996
.. classmethod:: datetime.fromordinal(ordinal)

Doc/library/decimal.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2245,7 +2245,7 @@ value for :attr:`~Context.prec` as well [#]_::
22452245
Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312')
22462246

22472247

2248-
For inexact results, :attr:`MAX_PREC` is far too large on 64-bit platforms and
2248+
For inexact results, :const:`MAX_PREC` is far too large on 64-bit platforms and
22492249
the available memory will be insufficient::
22502250

22512251
>>> Decimal(1) / 3

Doc/library/filecmp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ The :class:`dircmp` class
184184
are the same type as *self*, if *self* is a subclass of
185185
:class:`dircmp`.
186186

187-
.. attribute:: DEFAULT_IGNORES
187+
.. data:: DEFAULT_IGNORES
188188

189189
.. versionadded:: 3.4
190190

Doc/library/importlib.metadata.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ Mapping import to distribution packages
373373
.. function:: packages_distributions()
374374

375375
Return a mapping from the top level module and import package
376-
names found via :attr:`sys.meta_path` to the names of the distribution
376+
names found via :data:`sys.meta_path` to the names of the distribution
377377
packages (if any) that provide the corresponding files.
378378

379379
To allow for namespace packages (which may have members provided by

Doc/library/importlib.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ ABC hierarchy::
746746
suitable for reading (same as :attr:`pathlib.Path.open`).
747747

748748
When opening as text, accepts encoding parameters such as those
749-
accepted by :attr:`io.TextIOWrapper`.
749+
accepted by :class:`io.TextIOWrapper`.
750750

751751
.. method:: read_bytes()
752752

@@ -794,34 +794,34 @@ ABC hierarchy::
794794
This module contains the various objects that help :keyword:`import`
795795
find and load modules.
796796

797-
.. attribute:: SOURCE_SUFFIXES
797+
.. data:: SOURCE_SUFFIXES
798798

799799
A list of strings representing the recognized file suffixes for source
800800
modules.
801801

802802
.. versionadded:: 3.3
803803

804-
.. attribute:: DEBUG_BYTECODE_SUFFIXES
804+
.. data:: DEBUG_BYTECODE_SUFFIXES
805805

806806
A list of strings representing the file suffixes for non-optimized bytecode
807807
modules.
808808

809809
.. versionadded:: 3.3
810810

811811
.. deprecated:: 3.5
812-
Use :attr:`BYTECODE_SUFFIXES` instead.
812+
Use :const:`BYTECODE_SUFFIXES` instead.
813813

814-
.. attribute:: OPTIMIZED_BYTECODE_SUFFIXES
814+
.. data:: OPTIMIZED_BYTECODE_SUFFIXES
815815

816816
A list of strings representing the file suffixes for optimized bytecode
817817
modules.
818818

819819
.. versionadded:: 3.3
820820

821821
.. deprecated:: 3.5
822-
Use :attr:`BYTECODE_SUFFIXES` instead.
822+
Use :const:`BYTECODE_SUFFIXES` instead.
823823

824-
.. attribute:: BYTECODE_SUFFIXES
824+
.. data:: BYTECODE_SUFFIXES
825825

826826
A list of strings representing the recognized file suffixes for bytecode
827827
modules (including the leading dot).
@@ -831,7 +831,7 @@ find and load modules.
831831
.. versionchanged:: 3.5
832832
The value is no longer dependent on ``__debug__``.
833833

834-
.. attribute:: EXTENSION_SUFFIXES
834+
.. data:: EXTENSION_SUFFIXES
835835

836836
A list of strings representing the recognized file suffixes for
837837
extension modules.
@@ -1109,7 +1109,7 @@ find and load modules.
11091109
.. method:: is_package(fullname)
11101110

11111111
Returns ``True`` if the file path points to a package's ``__init__``
1112-
module based on :attr:`EXTENSION_SUFFIXES`.
1112+
module based on :const:`EXTENSION_SUFFIXES`.
11131113

11141114
.. method:: get_code(fullname)
11151115

@@ -1231,7 +1231,7 @@ find and load modules.
12311231
This module contains the various objects that help in the construction of
12321232
an :term:`importer`.
12331233

1234-
.. attribute:: MAGIC_NUMBER
1234+
.. data:: MAGIC_NUMBER
12351235

12361236
The bytes which represent the bytecode version number. If you need help with
12371237
loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`.

Doc/library/logging.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ in a module, ``__name__`` is the module's name in the Python package namespace.
342342

343343
If no handler is attached to this logger (or any of its ancestors,
344344
taking into account the relevant :attr:`Logger.propagate` attributes),
345-
the message will be sent to the handler set on :attr:`lastResort`.
345+
the message will be sent to the handler set on :data:`lastResort`.
346346

347347
.. versionchanged:: 3.2
348348
The *stack_info* parameter was added.
@@ -1487,7 +1487,7 @@ functions.
14871487
Module-Level Attributes
14881488
-----------------------
14891489

1490-
.. attribute:: lastResort
1490+
.. data:: lastResort
14911491

14921492
A "handler of last resort" is available through this attribute. This
14931493
is a :class:`StreamHandler` writing to ``sys.stderr`` with a level of
@@ -1499,7 +1499,7 @@ Module-Level Attributes
14991499

15001500
.. versionadded:: 3.2
15011501

1502-
.. attribute:: raiseExceptions
1502+
.. data:: raiseExceptions
15031503

15041504
Used to see if exceptions during handling should be propagated.
15051505

Doc/library/select.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ The module defines the following:
165165
:exc:`InterruptedError`.
166166

167167

168-
.. attribute:: PIPE_BUF
168+
.. data:: PIPE_BUF
169169

170170
The minimum number of bytes which can be written without blocking to a pipe
171171
when the pipe has been reported as ready for writing by :func:`~select.select`,

Doc/library/ssl.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,8 +1886,8 @@ to speed up repeated connections from the same clients.
18861886

18871887
A :class:`TLSVersion` enum member representing the highest supported
18881888
TLS version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`.
1889-
The attribute is read-only for protocols other than :attr:`PROTOCOL_TLS`,
1890-
:attr:`PROTOCOL_TLS_CLIENT`, and :attr:`PROTOCOL_TLS_SERVER`.
1889+
The attribute is read-only for protocols other than :const:`PROTOCOL_TLS`,
1890+
:const:`PROTOCOL_TLS_CLIENT`, and :const:`PROTOCOL_TLS_SERVER`.
18911891

18921892
The attributes :attr:`~SSLContext.maximum_version`,
18931893
:attr:`~SSLContext.minimum_version` and
@@ -1910,7 +1910,7 @@ to speed up repeated connections from the same clients.
19101910
.. attribute:: SSLContext.num_tickets
19111911

19121912
Control the number of TLS 1.3 session tickets of a
1913-
:attr:`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS
1913+
:const:`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS
19141914
1.0 to 1.2 connections.
19151915

19161916
.. versionadded:: 3.8

Doc/whatsnew/2.3.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ convert them to Unicode using the ``mbcs`` encoding.
353353
Other systems also allow Unicode strings as file names but convert them to byte
354354
strings before passing them to the system, which can cause a :exc:`UnicodeError`
355355
to be raised. Applications can test whether arbitrary Unicode strings are
356-
supported as file names by checking :attr:`os.path.supports_unicode_filenames`,
356+
supported as file names by checking :const:`os.path.supports_unicode_filenames`,
357357
a Boolean value.
358358

359359
Under MacOS, :func:`os.listdir` may now return Unicode filenames.

Doc/whatsnew/2.7.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,7 @@ changes, or look through the Subversion logs for all the details.
16021602
identifier instead of the previous default value of ``'python'``.
16031603
(Changed by Sean Reifschneider; :issue:`8451`.)
16041604

1605-
* The :attr:`sys.version_info` value is now a named tuple, with attributes
1605+
* The :data:`sys.version_info` value is now a named tuple, with attributes
16061606
named :attr:`!major`, :attr:`!minor`, :attr:`!micro`,
16071607
:attr:`!releaselevel`, and :attr:`!serial`. (Contributed by Ross
16081608
Light; :issue:`4285`.)

Doc/whatsnew/3.12.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,8 +1478,8 @@ imp
14781478
``imp.NullImporter`` Insert ``None`` into ``sys.path_importer_cache``
14791479
``imp.cache_from_source()`` :func:`importlib.util.cache_from_source`
14801480
``imp.find_module()`` :func:`importlib.util.find_spec`
1481-
``imp.get_magic()`` :attr:`importlib.util.MAGIC_NUMBER`
1482-
``imp.get_suffixes()`` :attr:`importlib.machinery.SOURCE_SUFFIXES`, :attr:`importlib.machinery.EXTENSION_SUFFIXES`, and :attr:`importlib.machinery.BYTECODE_SUFFIXES`
1481+
``imp.get_magic()`` :const:`importlib.util.MAGIC_NUMBER`
1482+
``imp.get_suffixes()`` :const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery.EXTENSION_SUFFIXES`, and :const:`importlib.machinery.BYTECODE_SUFFIXES`
14831483
``imp.get_tag()`` :attr:`sys.implementation.cache_tag <sys.implementation>`
14841484
``imp.load_module()`` :func:`importlib.import_module`
14851485
``imp.new_module(name)`` ``types.ModuleType(name)``

Doc/whatsnew/3.4.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ The :func:`~importlib.reload` function has been moved from :mod:`!imp` to
994994
:mod:`importlib` as part of the :mod:`!imp` module deprecation. (Contributed by
995995
Berker Peksag in :issue:`18193`.)
996996

997-
:mod:`importlib.util` now has a :data:`~importlib.util.MAGIC_NUMBER` attribute
997+
:mod:`importlib.util` now has a :const:`~importlib.util.MAGIC_NUMBER` attribute
998998
providing access to the bytecode version number. This replaces the
999999
:func:`!get_magic` function in the deprecated :mod:`!imp` module.
10001000
(Contributed by Brett Cannon in :issue:`18192`.)

Misc/NEWS.d/3.11.0a4.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,8 +775,8 @@ Ensure that :func:`math.expm1` does not raise on underflow.
775775
.. nonce: s9PuyF
776776
.. section: Library
777777
778-
Adding :attr:`F_DUP2FD` and :attr:`F_DUP2FD_CLOEXEC` constants from FreeBSD
779-
into the fcntl module.
778+
Adding :const:`!F_DUP2FD` and :const:`!F_DUP2FD_CLOEXEC` constants from FreeBSD
779+
into the :mod:`fcntl` module.
780780

781781
..
782782

0 commit comments

Comments
 (0)
0