From 674c532d07a92c858eff23069ac2eb4b2d5c4fc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 21 Jul 2024 12:26:53 +0300 Subject: [PATCH 1/2] Docs: spelling and grammar fixes --- Doc/c-api/init_config.rst | 4 ++-- Doc/howto/free-threading-extensions.rst | 2 +- Doc/howto/logging-cookbook.rst | 2 +- Doc/library/ast.rst | 4 ++-- Doc/library/asyncio-future.rst | 6 +++--- Doc/library/asyncio-task.rst | 2 +- Doc/library/contextlib.rst | 2 +- Doc/library/ctypes.rst | 2 +- Doc/library/fractions.rst | 2 +- Doc/library/http.server.rst | 2 +- Doc/library/importlib.resources.abc.rst | 2 +- Doc/library/importlib.rst | 2 +- Doc/library/inspect.rst | 4 ++-- Doc/library/mailbox.rst | 2 +- Doc/library/optparse.rst | 2 +- Doc/library/os.rst | 6 +++--- Doc/library/pathlib.rst | 2 +- Doc/library/plistlib.rst | 2 +- Doc/library/ssl.rst | 2 +- Doc/library/subprocess.rst | 2 +- Doc/library/urllib.request.rst | 4 ++-- Doc/library/warnings.rst | 2 +- Doc/using/ios.rst | 2 +- 23 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst index 5195f6cccfe9df..6e2e04fba55a45 100644 --- a/Doc/c-api/init_config.rst +++ b/Doc/c-api/init_config.rst @@ -509,7 +509,7 @@ PyConfig The :c:func:`PyConfig_Read` function only parses :c:member:`PyConfig.argv` arguments once: :c:member:`PyConfig.parse_argv` is set to ``2`` after arguments are parsed. Since Python arguments are - strippped from :c:member:`PyConfig.argv`, parsing arguments twice would + stripped from :c:member:`PyConfig.argv`, parsing arguments twice would parse the application options as Python options. :ref:`Preinitialize Python ` if needed. @@ -1041,7 +1041,7 @@ PyConfig The :c:func:`PyConfig_Read` function only parses :c:member:`PyConfig.argv` arguments once: :c:member:`PyConfig.parse_argv` is set to ``2`` after arguments are parsed. Since Python arguments are - strippped from :c:member:`PyConfig.argv`, parsing arguments twice would + stripped from :c:member:`PyConfig.argv`, parsing arguments twice would parse the application options as Python options. Default: ``1`` in Python mode, ``0`` in isolated mode. diff --git a/Doc/howto/free-threading-extensions.rst b/Doc/howto/free-threading-extensions.rst index 1ba91b09516f9c..521810e2887f2f 100644 --- a/Doc/howto/free-threading-extensions.rst +++ b/Doc/howto/free-threading-extensions.rst @@ -188,7 +188,7 @@ Python's memory management C API provides functions in three different :ref:`allocation domains `: "raw", "mem", and "object". For thread-safety, the free-threaded build requires that only Python objects are allocated using the object domain, and that all Python object are -allocated using that domain. This differes from the prior Python versions, +allocated using that domain. This differs from the prior Python versions, where this was only a best practice and not a hard requirement. .. note:: diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst index 3ed2dd6251afe9..321ec0c0f73871 100644 --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -4022,7 +4022,7 @@ As you can see, this output isn't ideal. That's because the underlying code which writes to ``sys.stderr`` makes multiple writes, each of which results in a separate logged line (for example, the last three lines above). To get around this problem, you need to buffer things and only output log lines when newlines -are seen. Let's use a slghtly better implementation of ``LoggerWriter``: +are seen. Let's use a slightly better implementation of ``LoggerWriter``: .. code-block:: python diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index 56662615275228..d05ad1e2a7854f 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -887,7 +887,7 @@ Statements .. class:: AnnAssign(target, annotation, value, simple) An assignment with a type annotation. ``target`` is a single node and can - be a :class:`Name`, a :class:`Attribute` or a :class:`Subscript`. + be a :class:`Name`, an :class:`Attribute` or a :class:`Subscript`. ``annotation`` is the annotation, such as a :class:`Constant` or :class:`Name` node. ``value`` is a single optional node. @@ -1979,7 +1979,7 @@ Function and class definitions YieldFrom(value) A ``yield`` or ``yield from`` expression. Because these are expressions, they - must be wrapped in a :class:`Expr` node if the value sent back is not used. + must be wrapped in an :class:`Expr` node if the value sent back is not used. .. doctest:: diff --git a/Doc/library/asyncio-future.rst b/Doc/library/asyncio-future.rst index 893ae5518f757d..9dce0731411940 100644 --- a/Doc/library/asyncio-future.rst +++ b/Doc/library/asyncio-future.rst @@ -120,20 +120,20 @@ Future Object a :exc:`CancelledError` exception. If the Future's result isn't yet available, this method raises - a :exc:`InvalidStateError` exception. + an :exc:`InvalidStateError` exception. .. method:: set_result(result) Mark the Future as *done* and set its result. - Raises a :exc:`InvalidStateError` error if the Future is + Raises an :exc:`InvalidStateError` error if the Future is already *done*. .. method:: set_exception(exception) Mark the Future as *done* and set an exception. - Raises a :exc:`InvalidStateError` error if the Future is + Raises an :exc:`InvalidStateError` error if the Future is already *done*. .. method:: done() diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index c5deac7e2748ae..abf1726b34f539 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -1170,7 +1170,7 @@ Task Object a :exc:`CancelledError` exception. If the Task's result isn't yet available, this method raises - a :exc:`InvalidStateError` exception. + an :exc:`InvalidStateError` exception. .. method:: exception() diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst index 27cf99446e5980..f5b349441bcfee 100644 --- a/Doc/library/contextlib.rst +++ b/Doc/library/contextlib.rst @@ -322,7 +322,7 @@ Functions and classes provided: .. versionchanged:: 3.12 ``suppress`` now supports suppressing exceptions raised as - part of an :exc:`BaseExceptionGroup`. + part of a :exc:`BaseExceptionGroup`. .. function:: redirect_stdout(new_target) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst index e3d74d7dc0d91c..9e69b3dc51a1ac 100644 --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -107,7 +107,7 @@ Functions are accessed as attributes of dll objects:: Note that win32 system dlls like ``kernel32`` and ``user32`` often export ANSI as well as UNICODE versions of a function. The UNICODE version is exported with -an ``W`` appended to the name, while the ANSI version is exported with an ``A`` +a ``W`` appended to the name, while the ANSI version is exported with an ``A`` appended to the name. The win32 ``GetModuleHandle`` function, which returns a *module handle* for a given module name, has the following C prototype, and a macro is used to expose one of them as ``GetModuleHandle`` depending on whether diff --git a/Doc/library/fractions.rst b/Doc/library/fractions.rst index d8796de10e1de7..c7c09b8ea6dc91 100644 --- a/Doc/library/fractions.rst +++ b/Doc/library/fractions.rst @@ -92,7 +92,7 @@ another rational number, or from a string. .. versionchanged:: 3.9 The :func:`math.gcd` function is now used to normalize the *numerator* - and *denominator*. :func:`math.gcd` always return a :class:`int` type. + and *denominator*. :func:`math.gcd` always return an :class:`int` type. Previously, the GCD type depended on *numerator* and *denominator*. .. versionchanged:: 3.11 diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst index 3c80fa747d5f1f..9ed92dc6957370 100644 --- a/Doc/library/http.server.rst +++ b/Doc/library/http.server.rst @@ -378,7 +378,7 @@ provides three different variants: If the request was mapped to a file, it is opened. Any :exc:`OSError` exception in opening the requested file is mapped to a ``404``, - ``'File not found'`` error. If there was a ``'If-Modified-Since'`` + ``'File not found'`` error. If there was an ``'If-Modified-Since'`` header in the request, and the file was not modified after this time, a ``304``, ``'Not Modified'`` response is sent. Otherwise, the content type is guessed by calling the :meth:`guess_type` method, which in turn diff --git a/Doc/library/importlib.resources.abc.rst b/Doc/library/importlib.resources.abc.rst index 5ea8044e1ec6ca..54995ddbfbca12 100644 --- a/Doc/library/importlib.resources.abc.rst +++ b/Doc/library/importlib.resources.abc.rst @@ -22,7 +22,7 @@ something like a data file that lives next to the ``__init__.py`` file of the package. The purpose of this class is to help abstract out the accessing of such data files so that it does not matter if - the package and its data file(s) are stored in a e.g. zip file + the package and its data file(s) are stored e.g. in a zip file versus on the file system. For any of methods of this class, a *resource* argument is diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 2ec15dd171c18a..1206a2d94d22a3 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -657,7 +657,7 @@ ABC hierarchy:: something like a data file that lives next to the ``__init__.py`` file of the package. The purpose of this class is to help abstract out the accessing of such data files so that it does not matter if - the package and its data file(s) are stored in a e.g. zip file + the package and its data file(s) are stored e.g. in a zip file versus on the file system. For any of methods of this class, a *resource* argument is diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 7838eeed2843c4..361f4054856d89 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -457,7 +457,7 @@ attributes (see :ref:`import-mod-attrs` for module attributes): .. versionchanged:: 3.8 Functions wrapped in :func:`functools.partial` now return ``True`` if the - wrapped function is a :term:`asynchronous generator` function. + wrapped function is an :term:`asynchronous generator` function. .. versionchanged:: 3.13 Functions wrapped in :func:`functools.partialmethod` now return ``True`` @@ -938,7 +938,7 @@ function. .. attribute:: Parameter.kind.description - Describes a enum value of :attr:`Parameter.kind`. + Describes an enum value of :attr:`Parameter.kind`. .. versionadded:: 3.8 diff --git a/Doc/library/mailbox.rst b/Doc/library/mailbox.rst index 40ea71cd342b47..abb32f9bf3457f 100644 --- a/Doc/library/mailbox.rst +++ b/Doc/library/mailbox.rst @@ -1387,7 +1387,7 @@ When an :class:`!MHMessage` instance is created based upon a .. method:: get_visible() - Return an :class:`Message` instance whose headers are the message's + Return a :class:`Message` instance whose headers are the message's visible headers and whose body is empty. diff --git a/Doc/library/optparse.rst b/Doc/library/optparse.rst index 3e96259f94d47b..74a49a8fb33666 100644 --- a/Doc/library/optparse.rst +++ b/Doc/library/optparse.rst @@ -1352,7 +1352,7 @@ The whole point of creating and populating an OptionParser is to call its the list of arguments to process (default: ``sys.argv[1:]``) ``values`` - an :class:`Values` object to store option arguments in (default: a + a :class:`Values` object to store option arguments in (default: a new instance of :class:`Values`) -- if you give an existing object, the option defaults will not be initialized on it diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 2878d425310d75..b0ff81141db77d 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1562,7 +1562,7 @@ or `the MSDN `_ on Windo .. function:: pwritev(fd, buffers, offset, flags=0, /) - Write the *buffers* contents to file descriptor *fd* at a offset *offset*, + Write the *buffers* contents to file descriptor *fd* at an offset *offset*, leaving the file offset unchanged. *buffers* must be a sequence of :term:`bytes-like objects `. Buffers are processed in array order. Entire contents of the first buffer is written before @@ -3805,7 +3805,7 @@ features: new file descriptor is :ref:`non-inheritable `. *initval* is the initial value of the event counter. The initial value - must be an 32 bit unsigned integer. Please note that the initial value is + must be a 32 bit unsigned integer. Please note that the initial value is limited to a 32 bit unsigned int although the event counter is an unsigned 64 bit integer with a maximum value of 2\ :sup:`64`\ -\ 2. @@ -3884,7 +3884,7 @@ features: .. data:: EFD_SEMAPHORE - Provide semaphore-like semantics for reads from a :func:`eventfd` file + Provide semaphore-like semantics for reads from an :func:`eventfd` file descriptor. On read the internal counter is decremented by one. .. availability:: Linux >= 2.6.30 diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 496a12a296e443..41b2d40a504a12 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -1016,7 +1016,7 @@ Querying file type and status .. method:: Path.stat(*, follow_symlinks=True) - Return a :class:`os.stat_result` object containing information about this path, like :func:`os.stat`. + Return an :class:`os.stat_result` object containing information about this path, like :func:`os.stat`. The result is looked up at each call to this method. This method normally follows symlinks; to stat a symlink add the argument diff --git a/Doc/library/plistlib.rst b/Doc/library/plistlib.rst index 78b3c2697bd696..2906ebe7822f52 100644 --- a/Doc/library/plistlib.rst +++ b/Doc/library/plistlib.rst @@ -117,7 +117,7 @@ This module defines the following functions: when a key of a dictionary is not a string, otherwise such keys are skipped. When *aware_datetime* is true and any field with type ``datetime.datetime`` - is set as a :ref:`aware object `, it will convert to + is set as an :ref:`aware object `, it will convert to UTC timezone before writing it. A :exc:`TypeError` will be raised if the object is of an unsupported type or diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index dc72f67c6361e2..7d4c1f0f2de347 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -1742,7 +1742,7 @@ to speed up repeated connections from the same clients. IDN-encoded internationalized domain name, the *server_name_callback* receives a decoded U-label (``"pythön.org"``). - If there is an decoding error on the server name, the TLS connection will + If there is a decoding error on the server name, the TLS connection will terminate with an :const:`ALERT_DESCRIPTION_INTERNAL_ERROR` fatal TLS alert message to the client. diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index f520d989e0c70d..a0ba97f429bec9 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -1126,7 +1126,7 @@ The :mod:`subprocess` module exposes the following constants. .. data:: NORMAL_PRIORITY_CLASS A :class:`Popen` ``creationflags`` parameter to specify that a new process - will have an normal priority. (default) + will have a normal priority. (default) .. versionadded:: 3.7 diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 754405e0fbe5b2..88c1f4bf85f662 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1092,7 +1092,7 @@ FileHandler Objects .. versionchanged:: 3.2 This method is applicable only for local hostnames. When a remote - hostname is given, an :exc:`~urllib.error.URLError` is raised. + hostname is given, a :exc:`~urllib.error.URLError` is raised. .. _data-handler-objects: @@ -1107,7 +1107,7 @@ DataHandler Objects ignores white spaces in base64 encoded data URLs so the URL may be wrapped in whatever source file it comes from. But even though some browsers don't mind about a missing padding at the end of a base64 encoded data URL, this - implementation will raise an :exc:`ValueError` in that case. + implementation will raise a :exc:`ValueError` in that case. .. _ftp-handler-objects: diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst index 68b9ff5ce2f78c..4f204514abef5c 100644 --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -344,7 +344,7 @@ check:: One can also cause all warnings to be exceptions by using ``error`` instead of ``always``. One thing to be aware of is that if a warning has already been -raised because of a ``once``/``default`` rule, then no matter what filters are +raised because of an ``once``/``default`` rule, then no matter what filters are set the warning will not be seen again unless the warnings registry related to the warning has been cleared. diff --git a/Doc/using/ios.rst b/Doc/using/ios.rst index 70a81fd8a53d29..659a253b86c2cf 100644 --- a/Doc/using/ios.rst +++ b/Doc/using/ios.rst @@ -39,7 +39,7 @@ iOS version compatibility The minimum supported iOS version is specified at compile time, using the :option:`--host` option to ``configure``. By default, when compiled for iOS, Python will be compiled with a minimum supported iOS version of 13.0. To use a -different miniumum iOS version, provide the version number as part of the +different minimum iOS version, provide the version number as part of the :option:`!--host` argument - for example, ``--host=arm64-apple-ios15.4-simulator`` would compile an ARM64 simulator build with a deployment target of 15.4. From ff065df3fc35dbd1dc2830fb108732ce55ac43da Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 22 Jul 2024 08:03:14 +0800 Subject: [PATCH 2/2] Additional corrections found during code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- Doc/library/fractions.rst | 2 +- Doc/library/warnings.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/fractions.rst b/Doc/library/fractions.rst index c7c09b8ea6dc91..2ee154952549ac 100644 --- a/Doc/library/fractions.rst +++ b/Doc/library/fractions.rst @@ -92,7 +92,7 @@ another rational number, or from a string. .. versionchanged:: 3.9 The :func:`math.gcd` function is now used to normalize the *numerator* - and *denominator*. :func:`math.gcd` always return an :class:`int` type. + and *denominator*. :func:`math.gcd` always returns an :class:`int` type. Previously, the GCD type depended on *numerator* and *denominator*. .. versionchanged:: 3.11 diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst index 4f204514abef5c..68b9ff5ce2f78c 100644 --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -344,7 +344,7 @@ check:: One can also cause all warnings to be exceptions by using ``error`` instead of ``always``. One thing to be aware of is that if a warning has already been -raised because of an ``once``/``default`` rule, then no matter what filters are +raised because of a ``once``/``default`` rule, then no matter what filters are set the warning will not be seen again unless the warnings registry related to the warning has been cleared.