gh-110631: Fix some incorrect indents in the documentation (#129312)
This commit is contained in:
parent
88f8102a8f
commit
15a8b5b9bd
@ -1154,44 +1154,44 @@ are always available. They are listed here in alphabetical order.
|
|||||||
|
|
||||||
.. function:: locals()
|
.. function:: locals()
|
||||||
|
|
||||||
Return a mapping object representing the current local symbol table, with
|
Return a mapping object representing the current local symbol table, with
|
||||||
variable names as the keys, and their currently bound references as the
|
variable names as the keys, and their currently bound references as the
|
||||||
values.
|
values.
|
||||||
|
|
||||||
At module scope, as well as when using :func:`exec` or :func:`eval` with
|
At module scope, as well as when using :func:`exec` or :func:`eval` with
|
||||||
a single namespace, this function returns the same namespace as
|
a single namespace, this function returns the same namespace as
|
||||||
:func:`globals`.
|
:func:`globals`.
|
||||||
|
|
||||||
At class scope, it returns the namespace that will be passed to the
|
At class scope, it returns the namespace that will be passed to the
|
||||||
metaclass constructor.
|
metaclass constructor.
|
||||||
|
|
||||||
When using ``exec()`` or ``eval()`` with separate local and global
|
When using ``exec()`` or ``eval()`` with separate local and global
|
||||||
arguments, it returns the local namespace passed in to the function call.
|
arguments, it returns the local namespace passed in to the function call.
|
||||||
|
|
||||||
In all of the above cases, each call to ``locals()`` in a given frame of
|
In all of the above cases, each call to ``locals()`` in a given frame of
|
||||||
execution will return the *same* mapping object. Changes made through
|
execution will return the *same* mapping object. Changes made through
|
||||||
the mapping object returned from ``locals()`` will be visible as assigned,
|
the mapping object returned from ``locals()`` will be visible as assigned,
|
||||||
reassigned, or deleted local variables, and assigning, reassigning, or
|
reassigned, or deleted local variables, and assigning, reassigning, or
|
||||||
deleting local variables will immediately affect the contents of the
|
deleting local variables will immediately affect the contents of the
|
||||||
returned mapping object.
|
returned mapping object.
|
||||||
|
|
||||||
In an :term:`optimized scope` (including functions, generators, and
|
In an :term:`optimized scope` (including functions, generators, and
|
||||||
coroutines), each call to ``locals()`` instead returns a fresh dictionary
|
coroutines), each call to ``locals()`` instead returns a fresh dictionary
|
||||||
containing the current bindings of the function's local variables and any
|
containing the current bindings of the function's local variables and any
|
||||||
nonlocal cell references. In this case, name binding changes made via the
|
nonlocal cell references. In this case, name binding changes made via the
|
||||||
returned dict are *not* written back to the corresponding local variables
|
returned dict are *not* written back to the corresponding local variables
|
||||||
or nonlocal cell references, and assigning, reassigning, or deleting local
|
or nonlocal cell references, and assigning, reassigning, or deleting local
|
||||||
variables and nonlocal cell references does *not* affect the contents
|
variables and nonlocal cell references does *not* affect the contents
|
||||||
of previously returned dictionaries.
|
of previously returned dictionaries.
|
||||||
|
|
||||||
Calling ``locals()`` as part of a comprehension in a function, generator, or
|
Calling ``locals()`` as part of a comprehension in a function, generator, or
|
||||||
coroutine is equivalent to calling it in the containing scope, except that
|
coroutine is equivalent to calling it in the containing scope, except that
|
||||||
the comprehension's initialised iteration variables will be included. In
|
the comprehension's initialised iteration variables will be included. In
|
||||||
other scopes, it behaves as if the comprehension were running as a nested
|
other scopes, it behaves as if the comprehension were running as a nested
|
||||||
function.
|
function.
|
||||||
|
|
||||||
Calling ``locals()`` as part of a generator expression is equivalent to
|
Calling ``locals()`` as part of a generator expression is equivalent to
|
||||||
calling it in a nested generator function.
|
calling it in a nested generator function.
|
||||||
|
|
||||||
.. versionchanged:: 3.12
|
.. versionchanged:: 3.12
|
||||||
The behaviour of ``locals()`` in a comprehension has been updated as
|
The behaviour of ``locals()`` in a comprehension has been updated as
|
||||||
|
@ -49,44 +49,44 @@
|
|||||||
.. method:: open_resource(resource)
|
.. method:: open_resource(resource)
|
||||||
:abstractmethod:
|
:abstractmethod:
|
||||||
|
|
||||||
Returns an opened, :term:`file-like object` for binary reading
|
Returns an opened, :term:`file-like object` for binary reading
|
||||||
of the *resource*.
|
of the *resource*.
|
||||||
|
|
||||||
If the resource cannot be found, :exc:`FileNotFoundError` is
|
If the resource cannot be found, :exc:`FileNotFoundError` is
|
||||||
raised.
|
raised.
|
||||||
|
|
||||||
.. method:: resource_path(resource)
|
.. method:: resource_path(resource)
|
||||||
:abstractmethod:
|
:abstractmethod:
|
||||||
|
|
||||||
Returns the file system path to the *resource*.
|
Returns the file system path to the *resource*.
|
||||||
|
|
||||||
If the resource does not concretely exist on the file system,
|
If the resource does not concretely exist on the file system,
|
||||||
raise :exc:`FileNotFoundError`.
|
raise :exc:`FileNotFoundError`.
|
||||||
|
|
||||||
.. method:: is_resource(name)
|
.. method:: is_resource(name)
|
||||||
:abstractmethod:
|
:abstractmethod:
|
||||||
|
|
||||||
Returns ``True`` if the named *name* is considered a resource.
|
Returns ``True`` if the named *name* is considered a resource.
|
||||||
:exc:`FileNotFoundError` is raised if *name* does not exist.
|
:exc:`FileNotFoundError` is raised if *name* does not exist.
|
||||||
|
|
||||||
.. method:: contents()
|
.. method:: contents()
|
||||||
:abstractmethod:
|
:abstractmethod:
|
||||||
|
|
||||||
Returns an :term:`iterable` of strings over the contents of
|
Returns an :term:`iterable` of strings over the contents of
|
||||||
the package. Do note that it is not required that all names
|
the package. Do note that it is not required that all names
|
||||||
returned by the iterator be actual resources, e.g. it is
|
returned by the iterator be actual resources, e.g. it is
|
||||||
acceptable to return names for which :meth:`is_resource` would
|
acceptable to return names for which :meth:`is_resource` would
|
||||||
be false.
|
be false.
|
||||||
|
|
||||||
Allowing non-resource names to be returned is to allow for
|
Allowing non-resource names to be returned is to allow for
|
||||||
situations where how a package and its resources are stored
|
situations where how a package and its resources are stored
|
||||||
are known a priori and the non-resource names would be useful.
|
are known a priori and the non-resource names would be useful.
|
||||||
For instance, returning subdirectory names is allowed so that
|
For instance, returning subdirectory names is allowed so that
|
||||||
when it is known that the package and resources are stored on
|
when it is known that the package and resources are stored on
|
||||||
the file system then those subdirectory names can be used
|
the file system then those subdirectory names can be used
|
||||||
directly.
|
directly.
|
||||||
|
|
||||||
The abstract method returns an iterable of no items.
|
The abstract method returns an iterable of no items.
|
||||||
|
|
||||||
|
|
||||||
.. class:: Traversable
|
.. class:: Traversable
|
||||||
|
@ -211,8 +211,8 @@ The variables defined in the :mod:`signal` module are:
|
|||||||
|
|
||||||
.. data:: SIGSTKFLT
|
.. data:: SIGSTKFLT
|
||||||
|
|
||||||
Stack fault on coprocessor. The Linux kernel does not raise this signal: it
|
Stack fault on coprocessor. The Linux kernel does not raise this signal: it
|
||||||
can only be raised in user space.
|
can only be raised in user space.
|
||||||
|
|
||||||
.. availability:: Linux.
|
.. availability:: Linux.
|
||||||
|
|
||||||
|
@ -362,10 +362,10 @@ Exceptions
|
|||||||
Constants
|
Constants
|
||||||
^^^^^^^^^
|
^^^^^^^^^
|
||||||
|
|
||||||
The AF_* and SOCK_* constants are now :class:`AddressFamily` and
|
The AF_* and SOCK_* constants are now :class:`AddressFamily` and
|
||||||
:class:`SocketKind` :class:`.IntEnum` collections.
|
:class:`SocketKind` :class:`.IntEnum` collections.
|
||||||
|
|
||||||
.. versionadded:: 3.4
|
.. versionadded:: 3.4
|
||||||
|
|
||||||
.. data:: AF_UNIX
|
.. data:: AF_UNIX
|
||||||
AF_INET
|
AF_INET
|
||||||
@ -773,9 +773,9 @@ Constants
|
|||||||
Constant to optimize CPU locality, to be used in conjunction with
|
Constant to optimize CPU locality, to be used in conjunction with
|
||||||
:data:`SO_REUSEPORT`.
|
:data:`SO_REUSEPORT`.
|
||||||
|
|
||||||
.. versionadded:: 3.11
|
.. versionadded:: 3.11
|
||||||
|
|
||||||
.. availability:: Linux >= 3.9
|
.. availability:: Linux >= 3.9
|
||||||
|
|
||||||
.. data:: SO_REUSEPORT_LB
|
.. data:: SO_REUSEPORT_LB
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user