From 3dd34eb8f9273c31d023928287c891fe9dc0353d Mon Sep 17 00:00:00 2001 From: donBarbos Date: Wed, 5 Feb 2025 01:15:20 +0400 Subject: [PATCH 1/5] Update annotation in documentation --- Doc/library/code.rst | 6 +- Doc/library/codecs.rst | 20 ++--- Doc/library/concurrent.futures.rst | 2 +- Doc/library/configparser.rst | 12 +-- Doc/library/dataclasses.rst | 2 +- Doc/library/decimal.rst | 118 ++++++++++++++--------------- Doc/library/doctest.rst | 2 +- Doc/library/enum.rst | 6 +- Doc/library/http.server.rst | 10 ++- Doc/library/json.rst | 6 +- Lib/configparser.py | 2 +- 11 files changed, 94 insertions(+), 92 deletions(-) diff --git a/Doc/library/code.rst b/Doc/library/code.rst index 8f7692df9fb22d..5f98b0aa481d30 100644 --- a/Doc/library/code.rst +++ b/Doc/library/code.rst @@ -23,7 +23,7 @@ build applications which provide an interactive interpreter prompt. ``'__console__'`` and key ``'__doc__'`` set to ``None``. -.. class:: InteractiveConsole(locals=None, filename="", local_exit=False) +.. class:: InteractiveConsole(locals=None, filename="", *, local_exit=False) Closely emulate the behavior of the interactive Python interpreter. This class builds on :class:`InteractiveInterpreter` and adds prompting using the familiar @@ -112,7 +112,7 @@ Interactive Interpreter Objects with it. -.. method:: InteractiveInterpreter.showsyntaxerror(filename=None) +.. method:: InteractiveInterpreter.showsyntaxerror(filename=None, **kwargs) Display the syntax error that just occurred. This does not display a stack trace because there isn't one for syntax errors. If *filename* is given, it is @@ -166,7 +166,7 @@ interpreter objects as well as the following additions. Print an exit message when exiting. -.. method:: InteractiveConsole.push(line) +.. method:: InteractiveConsole.push(line, filename=None, _symbol="single") Push a line of source text to the interpreter. The line should not have a trailing newline; it may have internal newlines. The line is appended to a diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index a129a26190ba99..08c6b41f2ebe0a 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -55,7 +55,7 @@ any codec: The full details for each codec can also be looked up directly: -.. function:: lookup(encoding) +.. function:: lookup(encoding, /) Looks up the codec info in the Python codec registry and returns a :class:`CodecInfo` object as defined below. @@ -65,7 +65,7 @@ The full details for each codec can also be looked up directly: found, a :exc:`LookupError` is raised. Otherwise, the :class:`CodecInfo` object is stored in the cache and returned to the caller. -.. class:: CodecInfo(encode, decode, streamreader=None, streamwriter=None, incrementalencoder=None, incrementaldecoder=None, name=None) +.. class:: CodecInfo(encode, decode, streamreader=None, streamwriter=None, incrementalencoder=None, incrementaldecoder=None, name=None, *, _is_text_encoding=None) Codec details when looking up the codec registry. The constructor arguments are stored in attributes of the same name: @@ -156,7 +156,7 @@ these additional functions which use :func:`lookup` for the codec lookup: Custom codecs are made available by registering a suitable codec search function: -.. function:: register(search_function) +.. function:: register(search_function, /) Register a codec search function. Search functions are expected to take one argument, being the encoding name in all lower case letters with hyphens @@ -168,7 +168,7 @@ function: Hyphens and spaces are converted to underscore. -.. function:: unregister(search_function) +.. function:: unregister(search_function, /) Unregister a codec search function and clear the registry's cache. If the search function is not registered, do nothing. @@ -416,7 +416,7 @@ In addition, the following error handler is specific to the given codecs: The set of allowed values can be extended by registering a new named error handler: -.. function:: register_error(name, error_handler) +.. function:: register_error(name, error_handler, /) Register the error handling function *error_handler* under the name *name*. The *error_handler* argument will be called during encoding and decoding @@ -442,7 +442,7 @@ handler: Previously registered error handlers (including the standard error handlers) can be looked up by name: -.. function:: lookup_error(name) +.. function:: lookup_error(name, /) Return the error handler previously registered under the name *name*. @@ -607,9 +607,9 @@ define in order to be compatible with the Python codec registry. object. - .. method:: encode(object, final=False) + .. method:: encode(input, final=False) - Encodes *object* (taking the current state of the encoder into account) + Encodes *input* (taking the current state of the encoder into account) and returns the resulting encoded object. If this is the last call to :meth:`encode` *final* must be true (the default is false). @@ -664,9 +664,9 @@ define in order to be compatible with the Python codec registry. object. - .. method:: decode(object, final=False) + .. method:: decode(input, final=False) - Decodes *object* (taking the current state of the decoder into account) + Decodes *input* (taking the current state of the decoder into account) and returns the resulting decoded object. If this is the last call to :meth:`decode` *final* must be true (the default is false). If *final* is true the decoder must decode the input completely and must flush all diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst index 5a950081a1c98d..361c8ba58ac670 100644 --- a/Doc/library/concurrent.futures.rst +++ b/Doc/library/concurrent.futures.rst @@ -147,7 +147,7 @@ And:: executor.submit(wait_on_future) -.. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=()) +.. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=(), **ctxkwargs) An :class:`Executor` subclass that uses a pool of at most *max_workers* threads to execute calls asynchronously. diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst index ac0f3fca3d72fd..fc5ebabcd7f805 100644 --- a/Doc/library/configparser.rst +++ b/Doc/library/configparser.rst @@ -1229,14 +1229,14 @@ ConfigParser Objects interpolation. - .. method:: set(section, option, value) + .. method:: set(section, option, value=None) If the given section exists, set the given option to the specified value; otherwise raise :exc:`NoSectionError`. *option* and *value* must be strings; if not, :exc:`TypeError` is raised. - .. method:: write(fileobject, space_around_delimiters=True) + .. method:: write(fp, space_around_delimiters=True) Write a representation of the configuration to the specified :term:`file object`, which must be opened in text mode (accepting strings). This @@ -1266,12 +1266,12 @@ ConfigParser Objects fact existed, return ``True``. Otherwise return ``False``. - .. method:: optionxform(option) + .. method:: optionxform(optionstr) - Transforms the option name *option* as found in an input file or as passed + Transforms the option name *optionstr* as found in an input file or as passed in by client code to the form that should be used in the internal structures. The default implementation returns a lower-case version of - *option*; subclasses may override this or client code can set an attribute + *optionstr*; subclasses may override this or client code can set an attribute of this name on instances to affect this behavior. You don't need to subclass the parser to use this method, you can also @@ -1354,7 +1354,7 @@ RawConfigParser Objects Added support for :const:`UNNAMED_SECTION`. - .. method:: set(section, option, value) + .. method:: set(section, option, value=None) If the given section exists, set the given option to the specified value; otherwise raise :exc:`NoSectionError`. While it is possible to use diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index e34b2db0210960..9ca7c4b0f7687d 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -46,7 +46,7 @@ directly specified in the :class:`!InventoryItem` definition shown above. Module contents --------------- -.. decorator:: dataclass(*, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False) +.. decorator:: dataclass(cls=None, /, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False) This function is a :term:`decorator` that is used to add generated :term:`special methods ` to classes, as described below. diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst index 185eaf3f721c72..979523b45b418f 100644 --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -1146,11 +1146,11 @@ In addition to the three supplied contexts, new contexts can be created with the Return a duplicate of the context. - .. method:: copy_decimal(num) + .. method:: copy_decimal(num, /) Return a copy of the Decimal instance num. - .. method:: create_decimal(num) + .. method:: create_decimal(num='0', /) Creates a new Decimal instance from *num* but using *self* as context. Unlike the :class:`Decimal` constructor, the context precision, @@ -1174,7 +1174,7 @@ In addition to the three supplied contexts, new contexts can be created with the If the argument is a string, no leading or trailing whitespace or underscores are permitted. - .. method:: create_decimal_from_float(f) + .. method:: create_decimal_from_float(f, /) Creates a new Decimal instance from a float *f* but rounding using *self* as the context. Unlike the :meth:`Decimal.from_float` class method, @@ -1212,222 +1212,222 @@ In addition to the three supplied contexts, new contexts can be created with the recounted here. - .. method:: abs(x) + .. method:: abs(x, /) Returns the absolute value of *x*. - .. method:: add(x, y) + .. method:: add(x, y, /) Return the sum of *x* and *y*. - .. method:: canonical(x) + .. method:: canonical(x, /) Returns the same Decimal object *x*. - .. method:: compare(x, y) + .. method:: compare(x, y, /) Compares *x* and *y* numerically. - .. method:: compare_signal(x, y) + .. method:: compare_signal(x, y, /) Compares the values of the two operands numerically. - .. method:: compare_total(x, y) + .. method:: compare_total(x, y, /) Compares two operands using their abstract representation. - .. method:: compare_total_mag(x, y) + .. method:: compare_total_mag(x, y, /) Compares two operands using their abstract representation, ignoring sign. - .. method:: copy_abs(x) + .. method:: copy_abs(x, /) Returns a copy of *x* with the sign set to 0. - .. method:: copy_negate(x) + .. method:: copy_negate(x, /) Returns a copy of *x* with the sign inverted. - .. method:: copy_sign(x, y) + .. method:: copy_sign(x, y, /) Copies the sign from *y* to *x*. - .. method:: divide(x, y) + .. method:: divide(x, y, /) Return *x* divided by *y*. - .. method:: divide_int(x, y) + .. method:: divide_int(x, y, /) Return *x* divided by *y*, truncated to an integer. - .. method:: divmod(x, y) + .. method:: divmod(x, y, /) Divides two numbers and returns the integer part of the result. - .. method:: exp(x) + .. method:: exp(x, /) Returns ``e ** x``. - .. method:: fma(x, y, z) + .. method:: fma(x, y, z, /) Returns *x* multiplied by *y*, plus *z*. - .. method:: is_canonical(x) + .. method:: is_canonical(x, /) Returns ``True`` if *x* is canonical; otherwise returns ``False``. - .. method:: is_finite(x) + .. method:: is_finite(x, /) Returns ``True`` if *x* is finite; otherwise returns ``False``. - .. method:: is_infinite(x) + .. method:: is_infinite(x, /) Returns ``True`` if *x* is infinite; otherwise returns ``False``. - .. method:: is_nan(x) + .. method:: is_nan(x, /) Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``. - .. method:: is_normal(x) + .. method:: is_normal(x, /) Returns ``True`` if *x* is a normal number; otherwise returns ``False``. - .. method:: is_qnan(x) + .. method:: is_qnan(x, /) Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``. - .. method:: is_signed(x) + .. method:: is_signed(x, /) Returns ``True`` if *x* is negative; otherwise returns ``False``. - .. method:: is_snan(x) + .. method:: is_snan(x, /) Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``. - .. method:: is_subnormal(x) + .. method:: is_subnormal(x, /) Returns ``True`` if *x* is subnormal; otherwise returns ``False``. - .. method:: is_zero(x) + .. method:: is_zero(x, /) Returns ``True`` if *x* is a zero; otherwise returns ``False``. - .. method:: ln(x) + .. method:: ln(x, /) Returns the natural (base e) logarithm of *x*. - .. method:: log10(x) + .. method:: log10(x, /) Returns the base 10 logarithm of *x*. - .. method:: logb(x) + .. method:: logb(x, /) Returns the exponent of the magnitude of the operand's MSD. - .. method:: logical_and(x, y) + .. method:: logical_and(x, y, /) Applies the logical operation *and* between each operand's digits. - .. method:: logical_invert(x) + .. method:: logical_invert(x, /) Invert all the digits in *x*. - .. method:: logical_or(x, y) + .. method:: logical_or(x, y, /) Applies the logical operation *or* between each operand's digits. - .. method:: logical_xor(x, y) + .. method:: logical_xor(x, y, /) Applies the logical operation *xor* between each operand's digits. - .. method:: max(x, y) + .. method:: max(x, y, /) Compares two values numerically and returns the maximum. - .. method:: max_mag(x, y) + .. method:: max_mag(x, y, /) Compares the values numerically with their sign ignored. - .. method:: min(x, y) + .. method:: min(x, y, /) Compares two values numerically and returns the minimum. - .. method:: min_mag(x, y) + .. method:: min_mag(x, y, /) Compares the values numerically with their sign ignored. - .. method:: minus(x) + .. method:: minus(x, /) Minus corresponds to the unary prefix minus operator in Python. - .. method:: multiply(x, y) + .. method:: multiply(x, y, /) Return the product of *x* and *y*. - .. method:: next_minus(x) + .. method:: next_minus(x, /) Returns the largest representable number smaller than *x*. - .. method:: next_plus(x) + .. method:: next_plus(x, /) Returns the smallest representable number larger than *x*. - .. method:: next_toward(x, y) + .. method:: next_toward(x, y, /) Returns the number closest to *x*, in direction towards *y*. - .. method:: normalize(x) + .. method:: normalize(x, /) Reduces *x* to its simplest form. - .. method:: number_class(x) + .. method:: number_class(x, /) Returns an indication of the class of *x*. - .. method:: plus(x) + .. method:: plus(x, /) Plus corresponds to the unary prefix plus operator in Python. This operation applies the context precision and rounding, so it is *not* an @@ -1468,7 +1468,7 @@ In addition to the three supplied contexts, new contexts can be created with the always exact. - .. method:: quantize(x, y) + .. method:: quantize(x, y, /) Returns a value equal to *x* (rounded), having the exponent of *y*. @@ -1478,7 +1478,7 @@ In addition to the three supplied contexts, new contexts can be created with the Just returns 10, as this is Decimal, :) - .. method:: remainder(x, y) + .. method:: remainder(x, y, /) Returns the remainder from integer division. @@ -1486,43 +1486,43 @@ In addition to the three supplied contexts, new contexts can be created with the dividend. - .. method:: remainder_near(x, y) + .. method:: remainder_near(x, y, /) Returns ``x - y * n``, where *n* is the integer nearest the exact value of ``x / y`` (if the result is 0 then its sign will be the sign of *x*). - .. method:: rotate(x, y) + .. method:: rotate(x, y, /) Returns a rotated copy of *x*, *y* times. - .. method:: same_quantum(x, y) + .. method:: same_quantum(x, y, /) Returns ``True`` if the two operands have the same exponent. - .. method:: scaleb (x, y) + .. method:: scaleb (x, y, /) Returns the first operand after adding the second value its exp. - .. method:: shift(x, y) + .. method:: shift(x, y, /) Returns a shifted copy of *x*, *y* times. - .. method:: sqrt(x) + .. method:: sqrt(x, /) Square root of a non-negative number to context precision. - .. method:: subtract(x, y) + .. method:: subtract(x, y, /) Return the difference between *x* and *y*. - .. method:: to_eng_string(x) + .. method:: to_eng_string(x, /) Convert to a string, using engineering notation if an exponent is needed. @@ -1531,12 +1531,12 @@ In addition to the three supplied contexts, new contexts can be created with the require the addition of either one or two trailing zeros. - .. method:: to_integral_exact(x) + .. method:: to_integral_exact(x, /) Rounds to an integer. - .. method:: to_sci_string(x) + .. method:: to_sci_string(x, /) Converts a number to a string using scientific notation. diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst index 106b0a6c95b7be..354aeae5b3fc95 100644 --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -1447,7 +1447,7 @@ TestResults objects ^^^^^^^^^^^^^^^^^^^ -.. class:: TestResults(failed, attempted) +.. class:: TestResults(failed, attempted, *, skipped=0) .. attribute:: failed diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index 8ca949368db4ff..95b0a4c4105f72 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -196,9 +196,9 @@ Data Types :start: The first integer value for the Enum (used by :class:`auto`). :boundary: How to handle out-of-range values from bit operations (:class:`Flag` only). - .. method:: EnumType.__contains__(cls, member) + .. method:: EnumType.__contains__(cls, value) - Returns ``True`` if member belongs to the ``cls``:: + Returns ``True`` if value belongs to the ``cls``:: >>> some_var = Color.RED >>> some_var in Color @@ -362,7 +362,7 @@ Data Types >>> PowersOfThree.SECOND.value 9 - .. method:: Enum.__init__(self, *args, **kwds) + .. method:: Enum.__init__(self, /, *args, **kwds) By default, does nothing. If multiple values are given in the member assignment, those values become separate arguments to ``__init__``; e.g. diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst index 1197b575c00455..a08f8a381bf91c 100644 --- a/Doc/library/http.server.rst +++ b/Doc/library/http.server.rst @@ -34,14 +34,16 @@ handler. Code to create and run the server looks like this:: httpd.serve_forever() -.. class:: HTTPServer(server_address, RequestHandlerClass) +.. class:: HTTPServer(server_address, RequestHandlerClass, \ + bind_and_activate=True) This class builds on the :class:`~socketserver.TCPServer` class by storing the server address as instance variables named :attr:`server_name` and :attr:`server_port`. The server is accessible by the handler, typically through the handler's :attr:`server` instance variable. -.. class:: ThreadingHTTPServer(server_address, RequestHandlerClass) +.. class:: ThreadingHTTPServer(server_address, RequestHandlerClass, \ + bind_and_activate=True) This class is identical to HTTPServer but uses threads to handle requests by using the :class:`~socketserver.ThreadingMixIn`. This @@ -281,14 +283,14 @@ provides three different variants: HTTP code associated with the response. If a size of the response is available, then it should be passed as the *size* parameter. - .. method:: log_error(...) + .. method:: log_error(format, *args) Logs an error when a request cannot be fulfilled. By default, it passes the message to :meth:`log_message`, so it takes the same arguments (*format* and additional values). - .. method:: log_message(format, ...) + .. method:: log_message(format, *args) Logs an arbitrary message to ``sys.stderr``. This is typically overridden to create custom error logging mechanisms. The *format* argument is a diff --git a/Doc/library/json.rst b/Doc/library/json.rst index 4e7046d6d8f6ac..7fafbaca0c9e72 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -433,7 +433,7 @@ Encoders and Decoders .. versionchanged:: 3.6 All parameters are now :ref:`keyword-only `. - .. method:: decode(s) + .. method:: decode(s, _w=WHITESPACE.match) Return the Python representation of *s* (a :class:`str` instance containing a JSON document). @@ -441,7 +441,7 @@ Encoders and Decoders :exc:`JSONDecodeError` will be raised if the given JSON document is not valid. - .. method:: raw_decode(s) + .. method:: raw_decode(s, idx=0) Decode a JSON document from *s* (a :class:`str` beginning with a JSON document) and return a 2-tuple of the Python representation @@ -564,7 +564,7 @@ Encoders and Decoders '{"foo": ["bar", "baz"]}' - .. method:: iterencode(o) + .. method:: iterencode(o, _one_shot=False) Encode the given object, *o*, and yield each string representation as available. For example:: diff --git a/Lib/configparser.py b/Lib/configparser.py index 9dc4fa515cfcbe..af7f1c11dc58e9 100644 --- a/Lib/configparser.py +++ b/Lib/configparser.py @@ -134,7 +134,7 @@ remove_option(section, option) Remove the given option from the given section. - set(section, option, value) + set(section, option, value=None) Set the given option. write(fp, space_around_delimiters=True) From ec2398fbda9e4f390be2d343c9f55fee4d31c14f Mon Sep 17 00:00:00 2001 From: donBarbos Date: Wed, 5 Feb 2025 13:17:34 +0400 Subject: [PATCH 2/5] Revert adding '/' in params --- Doc/library/codecs.rst | 10 ++-- Doc/library/decimal.rst | 118 ++++++++++++++++++++-------------------- Doc/library/enum.rst | 2 +- 3 files changed, 65 insertions(+), 65 deletions(-) diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index 08c6b41f2ebe0a..90a8b6b94bb8dc 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -55,7 +55,7 @@ any codec: The full details for each codec can also be looked up directly: -.. function:: lookup(encoding, /) +.. function:: lookup(encoding) Looks up the codec info in the Python codec registry and returns a :class:`CodecInfo` object as defined below. @@ -156,7 +156,7 @@ these additional functions which use :func:`lookup` for the codec lookup: Custom codecs are made available by registering a suitable codec search function: -.. function:: register(search_function, /) +.. function:: register(search_function) Register a codec search function. Search functions are expected to take one argument, being the encoding name in all lower case letters with hyphens @@ -168,7 +168,7 @@ function: Hyphens and spaces are converted to underscore. -.. function:: unregister(search_function, /) +.. function:: unregister(search_function) Unregister a codec search function and clear the registry's cache. If the search function is not registered, do nothing. @@ -416,7 +416,7 @@ In addition, the following error handler is specific to the given codecs: The set of allowed values can be extended by registering a new named error handler: -.. function:: register_error(name, error_handler, /) +.. function:: register_error(name, error_handler) Register the error handling function *error_handler* under the name *name*. The *error_handler* argument will be called during encoding and decoding @@ -442,7 +442,7 @@ handler: Previously registered error handlers (including the standard error handlers) can be looked up by name: -.. function:: lookup_error(name, /) +.. function:: lookup_error(name) Return the error handler previously registered under the name *name*. diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst index 65f1dbd13f0fe2..74316276ba95eb 100644 --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -1146,11 +1146,11 @@ In addition to the three supplied contexts, new contexts can be created with the Return a duplicate of the context. - .. method:: copy_decimal(num, /) + .. method:: copy_decimal(num) Return a copy of the Decimal instance num. - .. method:: create_decimal(num='0', /) + .. method:: create_decimal(num='0') Creates a new Decimal instance from *num* but using *self* as context. Unlike the :class:`Decimal` constructor, the context precision, @@ -1174,7 +1174,7 @@ In addition to the three supplied contexts, new contexts can be created with the If the argument is a string, no leading or trailing whitespace or underscores are permitted. - .. method:: create_decimal_from_float(f, /) + .. method:: create_decimal_from_float(f) Creates a new Decimal instance from a float *f* but rounding using *self* as the context. Unlike the :meth:`Decimal.from_float` class method, @@ -1212,222 +1212,222 @@ In addition to the three supplied contexts, new contexts can be created with the recounted here. - .. method:: abs(x, /) + .. method:: abs(x) Returns the absolute value of *x*. - .. method:: add(x, y, /) + .. method:: add(x, y) Return the sum of *x* and *y*. - .. method:: canonical(x, /) + .. method:: canonical(x) Returns the same Decimal object *x*. - .. method:: compare(x, y, /) + .. method:: compare(x, y) Compares *x* and *y* numerically. - .. method:: compare_signal(x, y, /) + .. method:: compare_signal(x, y) Compares the values of the two operands numerically. - .. method:: compare_total(x, y, /) + .. method:: compare_total(x, y) Compares two operands using their abstract representation. - .. method:: compare_total_mag(x, y, /) + .. method:: compare_total_mag(x, y) Compares two operands using their abstract representation, ignoring sign. - .. method:: copy_abs(x, /) + .. method:: copy_abs(x) Returns a copy of *x* with the sign set to 0. - .. method:: copy_negate(x, /) + .. method:: copy_negate(x) Returns a copy of *x* with the sign inverted. - .. method:: copy_sign(x, y, /) + .. method:: copy_sign(x, y) Copies the sign from *y* to *x*. - .. method:: divide(x, y, /) + .. method:: divide(x, y) Return *x* divided by *y*. - .. method:: divide_int(x, y, /) + .. method:: divide_int(x, y) Return *x* divided by *y*, truncated to an integer. - .. method:: divmod(x, y, /) + .. method:: divmod(x, y) Divides two numbers and returns the integer part of the result. - .. method:: exp(x, /) + .. method:: exp(x) Returns ``e ** x``. - .. method:: fma(x, y, z, /) + .. method:: fma(x, y, z) Returns *x* multiplied by *y*, plus *z*. - .. method:: is_canonical(x, /) + .. method:: is_canonical(x) Returns ``True`` if *x* is canonical; otherwise returns ``False``. - .. method:: is_finite(x, /) + .. method:: is_finite(x) Returns ``True`` if *x* is finite; otherwise returns ``False``. - .. method:: is_infinite(x, /) + .. method:: is_infinite(x) Returns ``True`` if *x* is infinite; otherwise returns ``False``. - .. method:: is_nan(x, /) + .. method:: is_nan(x) Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``. - .. method:: is_normal(x, /) + .. method:: is_normal(x) Returns ``True`` if *x* is a normal number; otherwise returns ``False``. - .. method:: is_qnan(x, /) + .. method:: is_qnan(x) Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``. - .. method:: is_signed(x, /) + .. method:: is_signed(x) Returns ``True`` if *x* is negative; otherwise returns ``False``. - .. method:: is_snan(x, /) + .. method:: is_snan(x) Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``. - .. method:: is_subnormal(x, /) + .. method:: is_subnormal(x) Returns ``True`` if *x* is subnormal; otherwise returns ``False``. - .. method:: is_zero(x, /) + .. method:: is_zero(x) Returns ``True`` if *x* is a zero; otherwise returns ``False``. - .. method:: ln(x, /) + .. method:: ln(x) Returns the natural (base e) logarithm of *x*. - .. method:: log10(x, /) + .. method:: log10(x) Returns the base 10 logarithm of *x*. - .. method:: logb(x, /) + .. method:: logb(x) Returns the exponent of the magnitude of the operand's MSD. - .. method:: logical_and(x, y, /) + .. method:: logical_and(x, y) Applies the logical operation *and* between each operand's digits. - .. method:: logical_invert(x, /) + .. method:: logical_invert(x) Invert all the digits in *x*. - .. method:: logical_or(x, y, /) + .. method:: logical_or(x, y) Applies the logical operation *or* between each operand's digits. - .. method:: logical_xor(x, y, /) + .. method:: logical_xor(x, y) Applies the logical operation *xor* between each operand's digits. - .. method:: max(x, y, /) + .. method:: max(x, y) Compares two values numerically and returns the maximum. - .. method:: max_mag(x, y, /) + .. method:: max_mag(x, y) Compares the values numerically with their sign ignored. - .. method:: min(x, y, /) + .. method:: min(x, y) Compares two values numerically and returns the minimum. - .. method:: min_mag(x, y, /) + .. method:: min_mag(x, y) Compares the values numerically with their sign ignored. - .. method:: minus(x, /) + .. method:: minus(x) Minus corresponds to the unary prefix minus operator in Python. - .. method:: multiply(x, y, /) + .. method:: multiply(x, y) Return the product of *x* and *y*. - .. method:: next_minus(x, /) + .. method:: next_minus(x) Returns the largest representable number smaller than *x*. - .. method:: next_plus(x, /) + .. method:: next_plus(x) Returns the smallest representable number larger than *x*. - .. method:: next_toward(x, y, /) + .. method:: next_toward(x, y) Returns the number closest to *x*, in direction towards *y*. - .. method:: normalize(x, /) + .. method:: normalize(x) Reduces *x* to its simplest form. - .. method:: number_class(x, /) + .. method:: number_class(x) Returns an indication of the class of *x*. - .. method:: plus(x, /) + .. method:: plus(x) Plus corresponds to the unary prefix plus operator in Python. This operation applies the context precision and rounding, so it is *not* an @@ -1468,7 +1468,7 @@ In addition to the three supplied contexts, new contexts can be created with the always exact. - .. method:: quantize(x, y, /) + .. method:: quantize(x, y) Returns a value equal to *x* (rounded), having the exponent of *y*. @@ -1478,7 +1478,7 @@ In addition to the three supplied contexts, new contexts can be created with the Just returns 10, as this is Decimal, :) - .. method:: remainder(x, y, /) + .. method:: remainder(x, y) Returns the remainder from integer division. @@ -1486,43 +1486,43 @@ In addition to the three supplied contexts, new contexts can be created with the dividend. - .. method:: remainder_near(x, y, /) + .. method:: remainder_near(x, y) Returns ``x - y * n``, where *n* is the integer nearest the exact value of ``x / y`` (if the result is 0 then its sign will be the sign of *x*). - .. method:: rotate(x, y, /) + .. method:: rotate(x, y) Returns a rotated copy of *x*, *y* times. - .. method:: same_quantum(x, y, /) + .. method:: same_quantum(x, y) Returns ``True`` if the two operands have the same exponent. - .. method:: scaleb (x, y, /) + .. method:: scaleb (x, y) Returns the first operand after adding the second value its exp. - .. method:: shift(x, y, /) + .. method:: shift(x, y) Returns a shifted copy of *x*, *y* times. - .. method:: sqrt(x, /) + .. method:: sqrt(x) Square root of a non-negative number to context precision. - .. method:: subtract(x, y, /) + .. method:: subtract(x, y) Return the difference between *x* and *y*. - .. method:: to_eng_string(x, /) + .. method:: to_eng_string(x) Convert to a string, using engineering notation if an exponent is needed. @@ -1531,12 +1531,12 @@ In addition to the three supplied contexts, new contexts can be created with the require the addition of either one or two trailing zeros. - .. method:: to_integral_exact(x, /) + .. method:: to_integral_exact(x) Rounds to an integer. - .. method:: to_sci_string(x, /) + .. method:: to_sci_string(x) Converts a number to a string using scientific notation. diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index 95b0a4c4105f72..b6f33dc8097e1e 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -362,7 +362,7 @@ Data Types >>> PowersOfThree.SECOND.value 9 - .. method:: Enum.__init__(self, /, *args, **kwds) + .. method:: Enum.__init__(self, *args, **kwds) By default, does nothing. If multiple values are given in the member assignment, those values become separate arguments to ``__init__``; e.g. From f2f86abb08d64977fcc473f1c5d4c1d6f8e592f2 Mon Sep 17 00:00:00 2001 From: donBarbos Date: Thu, 6 Feb 2025 03:06:52 +0400 Subject: [PATCH 3/5] Revert "Revert adding '/' in params" This reverts commit ec2398fbda9e4f390be2d343c9f55fee4d31c14f. --- Doc/library/codecs.rst | 10 ++-- Doc/library/decimal.rst | 118 ++++++++++++++++++++-------------------- Doc/library/enum.rst | 2 +- 3 files changed, 65 insertions(+), 65 deletions(-) diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index 90a8b6b94bb8dc..08c6b41f2ebe0a 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -55,7 +55,7 @@ any codec: The full details for each codec can also be looked up directly: -.. function:: lookup(encoding) +.. function:: lookup(encoding, /) Looks up the codec info in the Python codec registry and returns a :class:`CodecInfo` object as defined below. @@ -156,7 +156,7 @@ these additional functions which use :func:`lookup` for the codec lookup: Custom codecs are made available by registering a suitable codec search function: -.. function:: register(search_function) +.. function:: register(search_function, /) Register a codec search function. Search functions are expected to take one argument, being the encoding name in all lower case letters with hyphens @@ -168,7 +168,7 @@ function: Hyphens and spaces are converted to underscore. -.. function:: unregister(search_function) +.. function:: unregister(search_function, /) Unregister a codec search function and clear the registry's cache. If the search function is not registered, do nothing. @@ -416,7 +416,7 @@ In addition, the following error handler is specific to the given codecs: The set of allowed values can be extended by registering a new named error handler: -.. function:: register_error(name, error_handler) +.. function:: register_error(name, error_handler, /) Register the error handling function *error_handler* under the name *name*. The *error_handler* argument will be called during encoding and decoding @@ -442,7 +442,7 @@ handler: Previously registered error handlers (including the standard error handlers) can be looked up by name: -.. function:: lookup_error(name) +.. function:: lookup_error(name, /) Return the error handler previously registered under the name *name*. diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst index 74316276ba95eb..65f1dbd13f0fe2 100644 --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -1146,11 +1146,11 @@ In addition to the three supplied contexts, new contexts can be created with the Return a duplicate of the context. - .. method:: copy_decimal(num) + .. method:: copy_decimal(num, /) Return a copy of the Decimal instance num. - .. method:: create_decimal(num='0') + .. method:: create_decimal(num='0', /) Creates a new Decimal instance from *num* but using *self* as context. Unlike the :class:`Decimal` constructor, the context precision, @@ -1174,7 +1174,7 @@ In addition to the three supplied contexts, new contexts can be created with the If the argument is a string, no leading or trailing whitespace or underscores are permitted. - .. method:: create_decimal_from_float(f) + .. method:: create_decimal_from_float(f, /) Creates a new Decimal instance from a float *f* but rounding using *self* as the context. Unlike the :meth:`Decimal.from_float` class method, @@ -1212,222 +1212,222 @@ In addition to the three supplied contexts, new contexts can be created with the recounted here. - .. method:: abs(x) + .. method:: abs(x, /) Returns the absolute value of *x*. - .. method:: add(x, y) + .. method:: add(x, y, /) Return the sum of *x* and *y*. - .. method:: canonical(x) + .. method:: canonical(x, /) Returns the same Decimal object *x*. - .. method:: compare(x, y) + .. method:: compare(x, y, /) Compares *x* and *y* numerically. - .. method:: compare_signal(x, y) + .. method:: compare_signal(x, y, /) Compares the values of the two operands numerically. - .. method:: compare_total(x, y) + .. method:: compare_total(x, y, /) Compares two operands using their abstract representation. - .. method:: compare_total_mag(x, y) + .. method:: compare_total_mag(x, y, /) Compares two operands using their abstract representation, ignoring sign. - .. method:: copy_abs(x) + .. method:: copy_abs(x, /) Returns a copy of *x* with the sign set to 0. - .. method:: copy_negate(x) + .. method:: copy_negate(x, /) Returns a copy of *x* with the sign inverted. - .. method:: copy_sign(x, y) + .. method:: copy_sign(x, y, /) Copies the sign from *y* to *x*. - .. method:: divide(x, y) + .. method:: divide(x, y, /) Return *x* divided by *y*. - .. method:: divide_int(x, y) + .. method:: divide_int(x, y, /) Return *x* divided by *y*, truncated to an integer. - .. method:: divmod(x, y) + .. method:: divmod(x, y, /) Divides two numbers and returns the integer part of the result. - .. method:: exp(x) + .. method:: exp(x, /) Returns ``e ** x``. - .. method:: fma(x, y, z) + .. method:: fma(x, y, z, /) Returns *x* multiplied by *y*, plus *z*. - .. method:: is_canonical(x) + .. method:: is_canonical(x, /) Returns ``True`` if *x* is canonical; otherwise returns ``False``. - .. method:: is_finite(x) + .. method:: is_finite(x, /) Returns ``True`` if *x* is finite; otherwise returns ``False``. - .. method:: is_infinite(x) + .. method:: is_infinite(x, /) Returns ``True`` if *x* is infinite; otherwise returns ``False``. - .. method:: is_nan(x) + .. method:: is_nan(x, /) Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``. - .. method:: is_normal(x) + .. method:: is_normal(x, /) Returns ``True`` if *x* is a normal number; otherwise returns ``False``. - .. method:: is_qnan(x) + .. method:: is_qnan(x, /) Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``. - .. method:: is_signed(x) + .. method:: is_signed(x, /) Returns ``True`` if *x* is negative; otherwise returns ``False``. - .. method:: is_snan(x) + .. method:: is_snan(x, /) Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``. - .. method:: is_subnormal(x) + .. method:: is_subnormal(x, /) Returns ``True`` if *x* is subnormal; otherwise returns ``False``. - .. method:: is_zero(x) + .. method:: is_zero(x, /) Returns ``True`` if *x* is a zero; otherwise returns ``False``. - .. method:: ln(x) + .. method:: ln(x, /) Returns the natural (base e) logarithm of *x*. - .. method:: log10(x) + .. method:: log10(x, /) Returns the base 10 logarithm of *x*. - .. method:: logb(x) + .. method:: logb(x, /) Returns the exponent of the magnitude of the operand's MSD. - .. method:: logical_and(x, y) + .. method:: logical_and(x, y, /) Applies the logical operation *and* between each operand's digits. - .. method:: logical_invert(x) + .. method:: logical_invert(x, /) Invert all the digits in *x*. - .. method:: logical_or(x, y) + .. method:: logical_or(x, y, /) Applies the logical operation *or* between each operand's digits. - .. method:: logical_xor(x, y) + .. method:: logical_xor(x, y, /) Applies the logical operation *xor* between each operand's digits. - .. method:: max(x, y) + .. method:: max(x, y, /) Compares two values numerically and returns the maximum. - .. method:: max_mag(x, y) + .. method:: max_mag(x, y, /) Compares the values numerically with their sign ignored. - .. method:: min(x, y) + .. method:: min(x, y, /) Compares two values numerically and returns the minimum. - .. method:: min_mag(x, y) + .. method:: min_mag(x, y, /) Compares the values numerically with their sign ignored. - .. method:: minus(x) + .. method:: minus(x, /) Minus corresponds to the unary prefix minus operator in Python. - .. method:: multiply(x, y) + .. method:: multiply(x, y, /) Return the product of *x* and *y*. - .. method:: next_minus(x) + .. method:: next_minus(x, /) Returns the largest representable number smaller than *x*. - .. method:: next_plus(x) + .. method:: next_plus(x, /) Returns the smallest representable number larger than *x*. - .. method:: next_toward(x, y) + .. method:: next_toward(x, y, /) Returns the number closest to *x*, in direction towards *y*. - .. method:: normalize(x) + .. method:: normalize(x, /) Reduces *x* to its simplest form. - .. method:: number_class(x) + .. method:: number_class(x, /) Returns an indication of the class of *x*. - .. method:: plus(x) + .. method:: plus(x, /) Plus corresponds to the unary prefix plus operator in Python. This operation applies the context precision and rounding, so it is *not* an @@ -1468,7 +1468,7 @@ In addition to the three supplied contexts, new contexts can be created with the always exact. - .. method:: quantize(x, y) + .. method:: quantize(x, y, /) Returns a value equal to *x* (rounded), having the exponent of *y*. @@ -1478,7 +1478,7 @@ In addition to the three supplied contexts, new contexts can be created with the Just returns 10, as this is Decimal, :) - .. method:: remainder(x, y) + .. method:: remainder(x, y, /) Returns the remainder from integer division. @@ -1486,43 +1486,43 @@ In addition to the three supplied contexts, new contexts can be created with the dividend. - .. method:: remainder_near(x, y) + .. method:: remainder_near(x, y, /) Returns ``x - y * n``, where *n* is the integer nearest the exact value of ``x / y`` (if the result is 0 then its sign will be the sign of *x*). - .. method:: rotate(x, y) + .. method:: rotate(x, y, /) Returns a rotated copy of *x*, *y* times. - .. method:: same_quantum(x, y) + .. method:: same_quantum(x, y, /) Returns ``True`` if the two operands have the same exponent. - .. method:: scaleb (x, y) + .. method:: scaleb (x, y, /) Returns the first operand after adding the second value its exp. - .. method:: shift(x, y) + .. method:: shift(x, y, /) Returns a shifted copy of *x*, *y* times. - .. method:: sqrt(x) + .. method:: sqrt(x, /) Square root of a non-negative number to context precision. - .. method:: subtract(x, y) + .. method:: subtract(x, y, /) Return the difference between *x* and *y*. - .. method:: to_eng_string(x) + .. method:: to_eng_string(x, /) Convert to a string, using engineering notation if an exponent is needed. @@ -1531,12 +1531,12 @@ In addition to the three supplied contexts, new contexts can be created with the require the addition of either one or two trailing zeros. - .. method:: to_integral_exact(x) + .. method:: to_integral_exact(x, /) Rounds to an integer. - .. method:: to_sci_string(x) + .. method:: to_sci_string(x, /) Converts a number to a string using scientific notation. diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index b6f33dc8097e1e..95b0a4c4105f72 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -362,7 +362,7 @@ Data Types >>> PowersOfThree.SECOND.value 9 - .. method:: Enum.__init__(self, *args, **kwds) + .. method:: Enum.__init__(self, /, *args, **kwds) By default, does nothing. If multiple values are given in the member assignment, those values become separate arguments to ``__init__``; e.g. From c24d1a16b46fe76243f71633c1667c71bbc47e2d Mon Sep 17 00:00:00 2001 From: donBarbos Date: Sun, 30 Mar 2025 18:33:04 +0400 Subject: [PATCH 4/5] Revert some updates --- Doc/library/code.rst | 2 +- Doc/library/codecs.rst | 12 ++-- Doc/library/dataclasses.rst | 2 +- Doc/library/decimal.rst | 118 ++++++++++++++++++------------------ Doc/library/doctest.rst | 2 +- Doc/library/enum.rst | 2 +- Doc/library/json.rst | 6 +- 7 files changed, 72 insertions(+), 72 deletions(-) diff --git a/Doc/library/code.rst b/Doc/library/code.rst index 5f98b0aa481d30..6d3a3dce5f23d5 100644 --- a/Doc/library/code.rst +++ b/Doc/library/code.rst @@ -23,7 +23,7 @@ build applications which provide an interactive interpreter prompt. ``'__console__'`` and key ``'__doc__'`` set to ``None``. -.. class:: InteractiveConsole(locals=None, filename="", *, local_exit=False) +.. class:: InteractiveConsole(locals=None, filename="", local_exit=False) Closely emulate the behavior of the interactive Python interpreter. This class builds on :class:`InteractiveInterpreter` and adds prompting using the familiar diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index 08c6b41f2ebe0a..05e339a3669986 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -55,7 +55,7 @@ any codec: The full details for each codec can also be looked up directly: -.. function:: lookup(encoding, /) +.. function:: lookup(encoding) Looks up the codec info in the Python codec registry and returns a :class:`CodecInfo` object as defined below. @@ -65,7 +65,7 @@ The full details for each codec can also be looked up directly: found, a :exc:`LookupError` is raised. Otherwise, the :class:`CodecInfo` object is stored in the cache and returned to the caller. -.. class:: CodecInfo(encode, decode, streamreader=None, streamwriter=None, incrementalencoder=None, incrementaldecoder=None, name=None, *, _is_text_encoding=None) +.. class:: CodecInfo(encode, decode, streamreader=None, streamwriter=None, incrementalencoder=None, incrementaldecoder=None, name=None) Codec details when looking up the codec registry. The constructor arguments are stored in attributes of the same name: @@ -156,7 +156,7 @@ these additional functions which use :func:`lookup` for the codec lookup: Custom codecs are made available by registering a suitable codec search function: -.. function:: register(search_function, /) +.. function:: register(search_function) Register a codec search function. Search functions are expected to take one argument, being the encoding name in all lower case letters with hyphens @@ -168,7 +168,7 @@ function: Hyphens and spaces are converted to underscore. -.. function:: unregister(search_function, /) +.. function:: unregister(search_function) Unregister a codec search function and clear the registry's cache. If the search function is not registered, do nothing. @@ -416,7 +416,7 @@ In addition, the following error handler is specific to the given codecs: The set of allowed values can be extended by registering a new named error handler: -.. function:: register_error(name, error_handler, /) +.. function:: register_error(name, error_handler) Register the error handling function *error_handler* under the name *name*. The *error_handler* argument will be called during encoding and decoding @@ -442,7 +442,7 @@ handler: Previously registered error handlers (including the standard error handlers) can be looked up by name: -.. function:: lookup_error(name, /) +.. function:: lookup_error(name) Return the error handler previously registered under the name *name*. diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 9ca7c4b0f7687d..e34b2db0210960 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -46,7 +46,7 @@ directly specified in the :class:`!InventoryItem` definition shown above. Module contents --------------- -.. decorator:: dataclass(cls=None, /, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False) +.. decorator:: dataclass(*, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False) This function is a :term:`decorator` that is used to add generated :term:`special methods ` to classes, as described below. diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst index 65f1dbd13f0fe2..9318af60b60f95 100644 --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -1146,11 +1146,11 @@ In addition to the three supplied contexts, new contexts can be created with the Return a duplicate of the context. - .. method:: copy_decimal(num, /) + .. method:: copy_decimal(num) Return a copy of the Decimal instance num. - .. method:: create_decimal(num='0', /) + .. method:: create_decimal(num) Creates a new Decimal instance from *num* but using *self* as context. Unlike the :class:`Decimal` constructor, the context precision, @@ -1174,7 +1174,7 @@ In addition to the three supplied contexts, new contexts can be created with the If the argument is a string, no leading or trailing whitespace or underscores are permitted. - .. method:: create_decimal_from_float(f, /) + .. method:: create_decimal_from_float(f) Creates a new Decimal instance from a float *f* but rounding using *self* as the context. Unlike the :meth:`Decimal.from_float` class method, @@ -1212,222 +1212,222 @@ In addition to the three supplied contexts, new contexts can be created with the recounted here. - .. method:: abs(x, /) + .. method:: abs(x) Returns the absolute value of *x*. - .. method:: add(x, y, /) + .. method:: add(x, y) Return the sum of *x* and *y*. - .. method:: canonical(x, /) + .. method:: canonical(x) Returns the same Decimal object *x*. - .. method:: compare(x, y, /) + .. method:: compare(x, y) Compares *x* and *y* numerically. - .. method:: compare_signal(x, y, /) + .. method:: compare_signal(x, y) Compares the values of the two operands numerically. - .. method:: compare_total(x, y, /) + .. method:: compare_total(x, y) Compares two operands using their abstract representation. - .. method:: compare_total_mag(x, y, /) + .. method:: compare_total_mag(x, y) Compares two operands using their abstract representation, ignoring sign. - .. method:: copy_abs(x, /) + .. method:: copy_abs(x) Returns a copy of *x* with the sign set to 0. - .. method:: copy_negate(x, /) + .. method:: copy_negate(x) Returns a copy of *x* with the sign inverted. - .. method:: copy_sign(x, y, /) + .. method:: copy_sign(x, y) Copies the sign from *y* to *x*. - .. method:: divide(x, y, /) + .. method:: divide(x, y) Return *x* divided by *y*. - .. method:: divide_int(x, y, /) + .. method:: divide_int(x, y) Return *x* divided by *y*, truncated to an integer. - .. method:: divmod(x, y, /) + .. method:: divmod(x, y) Divides two numbers and returns the integer part of the result. - .. method:: exp(x, /) + .. method:: exp(x) Returns ``e ** x``. - .. method:: fma(x, y, z, /) + .. method:: fma(x, y, z) Returns *x* multiplied by *y*, plus *z*. - .. method:: is_canonical(x, /) + .. method:: is_canonical(x) Returns ``True`` if *x* is canonical; otherwise returns ``False``. - .. method:: is_finite(x, /) + .. method:: is_finite(x) Returns ``True`` if *x* is finite; otherwise returns ``False``. - .. method:: is_infinite(x, /) + .. method:: is_infinite(x) Returns ``True`` if *x* is infinite; otherwise returns ``False``. - .. method:: is_nan(x, /) + .. method:: is_nan(x) Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``. - .. method:: is_normal(x, /) + .. method:: is_normal(x) Returns ``True`` if *x* is a normal number; otherwise returns ``False``. - .. method:: is_qnan(x, /) + .. method:: is_qnan(x) Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``. - .. method:: is_signed(x, /) + .. method:: is_signed(x) Returns ``True`` if *x* is negative; otherwise returns ``False``. - .. method:: is_snan(x, /) + .. method:: is_snan(x) Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``. - .. method:: is_subnormal(x, /) + .. method:: is_subnormal(x) Returns ``True`` if *x* is subnormal; otherwise returns ``False``. - .. method:: is_zero(x, /) + .. method:: is_zero(x) Returns ``True`` if *x* is a zero; otherwise returns ``False``. - .. method:: ln(x, /) + .. method:: ln(x) Returns the natural (base e) logarithm of *x*. - .. method:: log10(x, /) + .. method:: log10(x) Returns the base 10 logarithm of *x*. - .. method:: logb(x, /) + .. method:: logb(x) Returns the exponent of the magnitude of the operand's MSD. - .. method:: logical_and(x, y, /) + .. method:: logical_and(x, y) Applies the logical operation *and* between each operand's digits. - .. method:: logical_invert(x, /) + .. method:: logical_invert(x) Invert all the digits in *x*. - .. method:: logical_or(x, y, /) + .. method:: logical_or(x, y) Applies the logical operation *or* between each operand's digits. - .. method:: logical_xor(x, y, /) + .. method:: logical_xor(x, y) Applies the logical operation *xor* between each operand's digits. - .. method:: max(x, y, /) + .. method:: max(x, y) Compares two values numerically and returns the maximum. - .. method:: max_mag(x, y, /) + .. method:: max_mag(x, y) Compares the values numerically with their sign ignored. - .. method:: min(x, y, /) + .. method:: min(x, y) Compares two values numerically and returns the minimum. - .. method:: min_mag(x, y, /) + .. method:: min_mag(x, y) Compares the values numerically with their sign ignored. - .. method:: minus(x, /) + .. method:: minus(x) Minus corresponds to the unary prefix minus operator in Python. - .. method:: multiply(x, y, /) + .. method:: multiply(x, y) Return the product of *x* and *y*. - .. method:: next_minus(x, /) + .. method:: next_minus(x) Returns the largest representable number smaller than *x*. - .. method:: next_plus(x, /) + .. method:: next_plus(x) Returns the smallest representable number larger than *x*. - .. method:: next_toward(x, y, /) + .. method:: next_toward(x, y) Returns the number closest to *x*, in direction towards *y*. - .. method:: normalize(x, /) + .. method:: normalize(x) Reduces *x* to its simplest form. - .. method:: number_class(x, /) + .. method:: number_class(x) Returns an indication of the class of *x*. - .. method:: plus(x, /) + .. method:: plus(x) Plus corresponds to the unary prefix plus operator in Python. This operation applies the context precision and rounding, so it is *not* an @@ -1468,7 +1468,7 @@ In addition to the three supplied contexts, new contexts can be created with the always exact. - .. method:: quantize(x, y, /) + .. method:: quantize(x, y) Returns a value equal to *x* (rounded), having the exponent of *y*. @@ -1478,7 +1478,7 @@ In addition to the three supplied contexts, new contexts can be created with the Just returns 10, as this is Decimal, :) - .. method:: remainder(x, y, /) + .. method:: remainder(x, y) Returns the remainder from integer division. @@ -1486,43 +1486,43 @@ In addition to the three supplied contexts, new contexts can be created with the dividend. - .. method:: remainder_near(x, y, /) + .. method:: remainder_near(x, y) Returns ``x - y * n``, where *n* is the integer nearest the exact value of ``x / y`` (if the result is 0 then its sign will be the sign of *x*). - .. method:: rotate(x, y, /) + .. method:: rotate(x, y) Returns a rotated copy of *x*, *y* times. - .. method:: same_quantum(x, y, /) + .. method:: same_quantum(x, y) Returns ``True`` if the two operands have the same exponent. - .. method:: scaleb (x, y, /) + .. method:: scaleb (x, y) Returns the first operand after adding the second value its exp. - .. method:: shift(x, y, /) + .. method:: shift(x, y) Returns a shifted copy of *x*, *y* times. - .. method:: sqrt(x, /) + .. method:: sqrt(x) Square root of a non-negative number to context precision. - .. method:: subtract(x, y, /) + .. method:: subtract(x, y) Return the difference between *x* and *y*. - .. method:: to_eng_string(x, /) + .. method:: to_eng_string(x) Convert to a string, using engineering notation if an exponent is needed. @@ -1531,12 +1531,12 @@ In addition to the three supplied contexts, new contexts can be created with the require the addition of either one or two trailing zeros. - .. method:: to_integral_exact(x, /) + .. method:: to_integral_exact(x) Rounds to an integer. - .. method:: to_sci_string(x, /) + .. method:: to_sci_string(x) Converts a number to a string using scientific notation. diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst index 354aeae5b3fc95..106b0a6c95b7be 100644 --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -1447,7 +1447,7 @@ TestResults objects ^^^^^^^^^^^^^^^^^^^ -.. class:: TestResults(failed, attempted, *, skipped=0) +.. class:: TestResults(failed, attempted) .. attribute:: failed diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index 95b0a4c4105f72..b6f33dc8097e1e 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -362,7 +362,7 @@ Data Types >>> PowersOfThree.SECOND.value 9 - .. method:: Enum.__init__(self, /, *args, **kwds) + .. method:: Enum.__init__(self, *args, **kwds) By default, does nothing. If multiple values are given in the member assignment, those values become separate arguments to ``__init__``; e.g. diff --git a/Doc/library/json.rst b/Doc/library/json.rst index 7fafbaca0c9e72..4e7046d6d8f6ac 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -433,7 +433,7 @@ Encoders and Decoders .. versionchanged:: 3.6 All parameters are now :ref:`keyword-only `. - .. method:: decode(s, _w=WHITESPACE.match) + .. method:: decode(s) Return the Python representation of *s* (a :class:`str` instance containing a JSON document). @@ -441,7 +441,7 @@ Encoders and Decoders :exc:`JSONDecodeError` will be raised if the given JSON document is not valid. - .. method:: raw_decode(s, idx=0) + .. method:: raw_decode(s) Decode a JSON document from *s* (a :class:`str` beginning with a JSON document) and return a 2-tuple of the Python representation @@ -564,7 +564,7 @@ Encoders and Decoders '{"foo": ["bar", "baz"]}' - .. method:: iterencode(o, _one_shot=False) + .. method:: iterencode(o) Encode the given object, *o*, and yield each string representation as available. For example:: From f576ea5fe934222200666be83f9190dc51104fdc Mon Sep 17 00:00:00 2001 From: donBarbos Date: Fri, 4 Apr 2025 15:41:16 +0400 Subject: [PATCH 5/5] Add description for ctxkwargs --- Doc/library/concurrent.futures.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst index 361c8ba58ac670..3aa5342cca2427 100644 --- a/Doc/library/concurrent.futures.rst +++ b/Doc/library/concurrent.futures.rst @@ -194,6 +194,10 @@ And:: Default value of *max_workers* is changed to ``min(32, (os.process_cpu_count() or 1) + 4)``. + .. versionchanged:: next + Added *ctxkwargs* to pass additional arguments to ``cls.prepare_context`` + class method. + .. _threadpoolexecutor-example: