Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e9715b9

Browse files
committed
Merge 3.2
2 parents cfcc977 + d9d7bca commit e9715b9

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

Doc/library/argparse.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
===============================================================================
33

44
.. module:: argparse
5-
:synopsis: Command-line option and argument-parsing library.
5+
:synopsis: Command-line option and argument parsing library.
66
.. moduleauthor:: Steven Bethard <[email protected]>
77
.. sectionauthor:: Steven Bethard <[email protected]>
88

@@ -107,7 +107,7 @@ or the :func:`max` function if it was not.
107107
Parsing arguments
108108
^^^^^^^^^^^^^^^^^
109109

110-
:class:`ArgumentParser` parses args through the
110+
:class:`ArgumentParser` parses arguments through the
111111
:meth:`~ArgumentParser.parse_args` method. This will inspect the command line,
112112
convert each arg to the appropriate type and then invoke the appropriate action.
113113
In most cases, this means a simple :class:`Namespace` object will be built up from
@@ -118,7 +118,7 @@ attributes parsed out of the command line::
118118

119119
In a script, :meth:`~ArgumentParser.parse_args` will typically be called with no
120120
arguments, and the :class:`ArgumentParser` will automatically determine the
121-
command-line args from :data:`sys.argv`.
121+
command-line arguments from :data:`sys.argv`.
122122

123123

124124
ArgumentParser objects
@@ -669,11 +669,11 @@ be positional::
669669
action
670670
^^^^^^
671671

672-
:class:`ArgumentParser` objects associate command-line args with actions. These
673-
actions can do just about anything with the command-line args associated with
672+
:class:`ArgumentParser` objects associate command-line arguments with actions. These
673+
actions can do just about anything with the command-line arguments associated with
674674
them, though most actions simply add an attribute to the object returned by
675675
:meth:`~ArgumentParser.parse_args`. The ``action`` keyword argument specifies
676-
how the command-line args should be handled. The supported actions are:
676+
how the command-line arguments should be handled. The supported actions are:
677677

678678
* ``'store'`` - This just stores the argument's value. This is the default
679679
action. For example::
@@ -745,8 +745,8 @@ the Action API. The easiest way to do this is to extend
745745
:meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this
746746
object.
747747

748-
* ``values`` - The associated command-line args, with any type-conversions
749-
applied. (Type-conversions are specified with the type_ keyword argument to
748+
* ``values`` - The associated command-line arguments, with any type conversions
749+
applied. (Type conversions are specified with the type_ keyword argument to
750750
:meth:`~ArgumentParser.add_argument`.
751751

752752
* ``option_string`` - The option string that was used to invoke this action.
@@ -778,7 +778,7 @@ single action to be taken. The ``nargs`` keyword argument associates a
778778
different number of command-line arguments with a single action. The supported
779779
values are:
780780

781-
* N (an integer). N args from the command line will be gathered together into a
781+
* N (an integer). N arguments from the command line will be gathered together into a
782782
list. For example::
783783

784784
>>> parser = argparse.ArgumentParser()
@@ -822,7 +822,7 @@ values are:
822822
Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>,
823823
outfile=<_io.TextIOWrapper name='<stdout>' encoding='UTF-8'>)
824824

825-
* ``'*'``. All command-line args present are gathered into a list. Note that
825+
* ``'*'``. All command-line arguments present are gathered into a list. Note that
826826
it generally doesn't make much sense to have more than one positional argument
827827
with ``nargs='*'``, but multiple optional arguments with ``nargs='*'`` is
828828
possible. For example::
@@ -846,7 +846,7 @@ values are:
846846
usage: PROG [-h] foo [foo ...]
847847
PROG: error: too few arguments
848848

849-
If the ``nargs`` keyword argument is not provided, the number of args consumed
849+
If the ``nargs`` keyword argument is not provided, the number of arguments consumed
850850
is determined by the action_. Generally this means a single command-line arg
851851
will be consumed and a single item (not a list) will be produced.
852852

@@ -864,7 +864,7 @@ the various :class:`ArgumentParser` actions. The two most common uses of it are
864864

865865
* When :meth:`~ArgumentParser.add_argument` is called with option strings
866866
(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional
867-
argument that can be followed by zero or one command-line args.
867+
argument that can be followed by zero or one command-line arguments.
868868
When parsing the command line, if the option string is encountered with no
869869
command-line arg following it, the value of ``const`` will be assumed instead.
870870
See the nargs_ description for examples.
@@ -914,11 +914,11 @@ command-line argument was not present.::
914914
type
915915
^^^^
916916

917-
By default, :class:`ArgumentParser` objects read command-line args in as simple
917+
By default, :class:`ArgumentParser` objects read command-line arguments in as simple
918918
strings. However, quite often the command-line string should instead be
919919
interpreted as another type, like a :class:`float` or :class:`int`. The
920920
``type`` keyword argument of :meth:`~ArgumentParser.add_argument` allows any
921-
necessary type-checking and type-conversions to be performed. Common built-in
921+
necessary type-checking and type conversions to be performed. Common built-in
922922
types and functions can be used directly as the value of the ``type`` argument::
923923

924924
>>> parser = argparse.ArgumentParser()
@@ -938,7 +938,7 @@ writable file::
938938
Namespace(bar=<_io.TextIOWrapper name='out.txt' encoding='UTF-8'>)
939939

940940
``type=`` can take any callable that takes a single string argument and returns
941-
the type-converted value::
941+
the converted value::
942942

943943
>>> def perfect_square(string):
944944
... value = int(string)
@@ -973,7 +973,7 @@ See the choices_ section for more details.
973973
choices
974974
^^^^^^^
975975

976-
Some command-line args should be selected from a restricted set of values.
976+
Some command-line arguments should be selected from a restricted set of values.
977977
These can be handled by passing a container object as the ``choices`` keyword
978978
argument to :meth:`~ArgumentParser.add_argument`. When the command line is
979979
parsed, arg values will be checked, and an error message will be displayed if
@@ -1331,7 +1331,7 @@ An error is produced for arguments that could produce more than one options.
13311331
Beyond ``sys.argv``
13321332
^^^^^^^^^^^^^^^^^^^
13331333

1334-
Sometimes it may be useful to have an ArgumentParser parse args other than those
1334+
Sometimes it may be useful to have an ArgumentParser parse arguments other than those
13351335
of :data:`sys.argv`. This can be accomplished by passing a list of strings to
13361336
:meth:`~ArgumentParser.parse_args`. This is useful for testing at the
13371337
interactive prompt::
@@ -1559,7 +1559,7 @@ FileType objects
15591559

15601560
The :class:`FileType` factory creates objects that can be passed to the type
15611561
argument of :meth:`ArgumentParser.add_argument`. Arguments that have
1562-
:class:`FileType` objects as their type will open command-line args as files
1562+
:class:`FileType` objects as their type will open command-line arguments as files
15631563
with the requested modes and buffer sizes:
15641564

15651565
>>> parser = argparse.ArgumentParser()
@@ -1673,7 +1673,7 @@ Parser defaults
16731673
.. method:: ArgumentParser.set_defaults(**kwargs)
16741674

16751675
Most of the time, the attributes of the object returned by :meth:`parse_args`
1676-
will be fully determined by inspecting the command-line args and the argument
1676+
will be fully determined by inspecting the command-line arguments and the argument
16771677
actions. :meth:`set_defaults` allows some additional
16781678
attributes that are determined without any inspection of the command line to
16791679
be added::

Makefile.pre.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,8 +1331,8 @@ smelly: all
13311331

13321332
# Find files with funny names
13331333
funny:
1334-
find $(DISTDIRS) \
1335-
-o -type d \
1334+
find $(SUBDIRS) $(SUBDIRSTOO) \
1335+
-type d \
13361336
-o -name '*.[chs]' \
13371337
-o -name '*.py' \
13381338
-o -name '*.pyw' \
@@ -1360,7 +1360,7 @@ funny:
13601360
-o -name .hgignore \
13611361
-o -name .bzrignore \
13621362
-o -name MANIFEST \
1363-
-o -print
1363+
-print
13641364

13651365
# Perform some verification checks on any modified files.
13661366
patchcheck:

0 commit comments

Comments
 (0)