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

Skip to content

Commit 28d39a0

Browse files
committed
Branch merge
2 parents f6c7a85 + d9d7bca commit 28d39a0

3 files changed

Lines changed: 23 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
@@ -650,11 +650,11 @@ be positional::
650650
action
651651
^^^^^^
652652

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

659659
* ``'store'`` - This just stores the argument's value. This is the default
660660
action. For example::
@@ -726,8 +726,8 @@ the Action API. The easiest way to do this is to extend
726726
:meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this
727727
object.
728728

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

733733
* ``option_string`` - The option string that was used to invoke this action.
@@ -759,7 +759,7 @@ single action to be taken. The ``nargs`` keyword argument associates a
759759
different number of command-line arguments with a single action. The supported
760760
values are:
761761

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

765765
>>> parser = argparse.ArgumentParser()
@@ -803,7 +803,7 @@ values are:
803803
Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>,
804804
outfile=<_io.TextIOWrapper name='<stdout>' encoding='UTF-8'>)
805805

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

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

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

846846
* When :meth:`~ArgumentParser.add_argument` is called with option strings
847847
(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional
848-
argument that can be followed by zero or one command-line args.
848+
argument that can be followed by zero or one command-line arguments.
849849
When parsing the command line, if the option string is encountered with no
850850
command-line arg following it, the value of ``const`` will be assumed instead.
851851
See the nargs_ description for examples.
@@ -895,11 +895,11 @@ command-line argument was not present.::
895895
type
896896
^^^^
897897

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

905905
>>> parser = argparse.ArgumentParser()
@@ -919,7 +919,7 @@ writable file::
919919
Namespace(bar=<_io.TextIOWrapper name='out.txt' encoding='UTF-8'>)
920920

921921
``type=`` can take any callable that takes a single string argument and returns
922-
the type-converted value::
922+
the converted value::
923923

924924
>>> def perfect_square(string):
925925
... value = int(string)
@@ -954,7 +954,7 @@ See the choices_ section for more details.
954954
choices
955955
^^^^^^^
956956

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

1315-
Sometimes it may be useful to have an ArgumentParser parse args other than those
1315+
Sometimes it may be useful to have an ArgumentParser parse arguments other than those
13161316
of :data:`sys.argv`. This can be accomplished by passing a list of strings to
13171317
:meth:`~ArgumentParser.parse_args`. This is useful for testing at the
13181318
interactive prompt::
@@ -1540,7 +1540,7 @@ FileType objects
15401540

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

15461546
>>> parser = argparse.ArgumentParser()
@@ -1654,7 +1654,7 @@ Parser defaults
16541654
.. method:: ArgumentParser.set_defaults(**kwargs)
16551655

16561656
Most of the time, the attributes of the object returned by :meth:`parse_args`
1657-
will be fully determined by inspecting the command-line args and the argument
1657+
will be fully determined by inspecting the command-line arguments and the argument
16581658
actions. :meth:`set_defaults` allows some additional
16591659
attributes that are determined without any inspection of the command line to
16601660
be added::

Lib/test/test_pipes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ def testEmptyPipeline3(self):
8181

8282
def testQuoting(self):
8383
safeunquoted = string.ascii_letters + string.digits + '@%_-+=:,./'
84-
unsafe = '"`$\\!'
84+
unicode_sample = '\xe9\xe0\xdf' # e + acute accent, a + grave, sharp s
85+
unsafe = '"`$\\!' + unicode_sample
8586

8687
self.assertEqual(pipes.quote(''), "''")
8788
self.assertEqual(pipes.quote(safeunquoted), safeunquoted)

Makefile.pre.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ smelly: all
12831283

12841284
# Find files with funny names
12851285
funny:
1286-
find $(DISTDIRS) \
1286+
find $(SUBDIRS) $(SUBDIRSTOO) \
12871287
-name .svn -prune \
12881288
-o -type d \
12891289
-o -name '*.[chs]' \
@@ -1313,7 +1313,7 @@ funny:
13131313
-o -name .hgignore \
13141314
-o -name .bzrignore \
13151315
-o -name MANIFEST \
1316-
-o -print
1316+
-print
13171317

13181318
# Perform some verification checks on any modified files.
13191319
patchcheck:

0 commit comments

Comments
 (0)