From 3e55685c3a933fb18305078a5589231ca9dd1672 Mon Sep 17 00:00:00 2001 From: Guy Yagev Date: Thu, 7 Jul 2022 01:24:16 +0300 Subject: [PATCH 1/3] Revert lzma documentation change --- Doc/library/lzma.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/lzma.rst b/Doc/library/lzma.rst index f7aaa0cb30c2a8..21092645366da7 100644 --- a/Doc/library/lzma.rst +++ b/Doc/library/lzma.rst @@ -147,7 +147,7 @@ Compressing and decompressing data in memory This format is more limited than ``.xz`` -- it does not support integrity checks or multiple filters. - * :const:`FORMAT_RAW`: A raw data stream, not using sequences format. + * :const:`FORMAT_RAW`: A raw data stream, not using any container format. This format specifier does not support integrity checks, and requires that you always specify a custom filter chain (for both compression and decompression). Additionally, data compressed in this manner cannot be From 956df83cdba54696f1f6aadde56086613d30490b Mon Sep 17 00:00:00 2001 From: Guy Yagev Date: Thu, 7 Jul 2022 01:24:45 +0300 Subject: [PATCH 2/3] Update the argparse documentation to refer to choices as a sequence --- Doc/library/argparse.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index b2fa0b3c23c3a1..ad82c31577667b 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -763,7 +763,7 @@ The add_argument() method * type_ - The type to which the command-line argument should be converted. - * choices_ - A container of the allowable values for the argument. + * choices_ - A sequence of the allowable values for the argument. * required_ - Whether or not the command-line option may be omitted (optionals only). @@ -1207,7 +1207,7 @@ choices ^^^^^^^ Some command-line arguments should be selected from a restricted set of values. -These can be handled by passing a container object as the *choices* keyword +These can be handled by passing a sequence object as the *choices* keyword argument to :meth:`~ArgumentParser.add_argument`. When the command line is parsed, argument values will be checked, and an error message will be displayed if the argument was not one of the acceptable values:: @@ -1221,9 +1221,9 @@ if the argument was not one of the acceptable values:: game.py: error: argument move: invalid choice: 'fire' (choose from 'rock', 'paper', 'scissors') -Note that inclusion in the *choices* container is checked after any type_ +Note that inclusion in the *choices* sequence is checked after any type_ conversions have been performed, so the type of the objects in the *choices* -container should match the type_ specified:: +sequence should match the type_ specified:: >>> parser = argparse.ArgumentParser(prog='doors.py') >>> parser.add_argument('door', type=int, choices=range(1, 4)) @@ -1233,8 +1233,8 @@ container should match the type_ specified:: usage: doors.py [-h] {1,2,3} doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3) -Any container can be passed as the *choices* value, so :class:`list` objects, -:class:`set` objects, and custom containers are all supported. +Any sequence can be passed as the *choices* value, so :class:`list` objects, +:class:`set` objects, and custom sequences are all supported. Use of :class:`enum.Enum` is not recommended because it is difficult to control its appearance in usage, help, and error messages. From 0e96c380a6c72a6a8de54d7030bb125f390708a1 Mon Sep 17 00:00:00 2001 From: Stanley <46876382+slateny@users.noreply.github.com> Date: Sun, 25 Dec 2022 00:03:19 -0800 Subject: [PATCH 3/3] Say tuple instead of set Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> --- Doc/library/argparse.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index ad82c31577667b..faf5dc00e2f932 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -1234,7 +1234,7 @@ sequence should match the type_ specified:: doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3) Any sequence can be passed as the *choices* value, so :class:`list` objects, -:class:`set` objects, and custom sequences are all supported. +:class:`tuple` objects, and custom sequences are all supported. Use of :class:`enum.Enum` is not recommended because it is difficult to control its appearance in usage, help, and error messages.