From ef1e94a848533f2e7dbb2ed7a8b2de50e97e4b7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Tue, 9 Aug 2011 23:03:43 +0200 Subject: Test pipes.quote with a few non-ASCII characters (see #9723). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That pipes.quote thinks all non-ASCII characters need to be quoted may be a bug, but right now I’m committing this test to make sure I haven’t introduced a behavior change in 3.3 when I simplified the code to use a regex (in 5966eeb0457d). --- Lib/test/test_pipes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_pipes.py b/Lib/test/test_pipes.py index f2b58d5..d5b886f 100644 --- a/Lib/test/test_pipes.py +++ b/Lib/test/test_pipes.py @@ -81,7 +81,8 @@ class SimplePipeTests(unittest.TestCase): def testQuoting(self): safeunquoted = string.ascii_letters + string.digits + '@%_-+=:,./' - unsafe = '"`$\\!' + unicode_sample = '\xe9\xe0\xdf' # e + acute accent, a + grave, sharp s + unsafe = '"`$\\!' + unicode_sample self.assertEqual(pipes.quote(''), "''") self.assertEqual(pipes.quote(safeunquoted), safeunquoted) -- cgit v0.12 From 1c608e38474d7b0aa74f023d877c38e37a8cae0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Wed, 10 Aug 2011 02:01:32 +0200 Subject: =?UTF-8?q?Fix=20find=20command=20in=20makefile=20=E2=80=9Cfunny?= =?UTF-8?q?=E2=80=9D=20target?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile.pre.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index dfa7219..1108c75 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1283,7 +1283,7 @@ smelly: all # Find files with funny names funny: - find $(DISTDIRS) \ + find $(SUBDIRS) $(SUBDIRSTOO) \ -name .svn -prune \ -o -type d \ -o -name '*.[chs]' \ @@ -1313,7 +1313,7 @@ funny: -o -name .hgignore \ -o -name .bzrignore \ -o -name MANIFEST \ - -o -print + -print # Perform some verification checks on any modified files. patchcheck: -- cgit v0.12 From d9d7bca6dac2917eac7bd0ec306ad298d2de4a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Wed, 10 Aug 2011 04:19:03 +0200 Subject: Use real word in English text (i.e. not code) --- Doc/library/argparse.rst | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst index e4add74..8d602fe 100644 --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -2,7 +2,7 @@ =============================================================================== .. module:: argparse - :synopsis: Command-line option and argument-parsing library. + :synopsis: Command-line option and argument parsing library. .. moduleauthor:: Steven Bethard .. sectionauthor:: Steven Bethard @@ -107,7 +107,7 @@ or the :func:`max` function if it was not. Parsing arguments ^^^^^^^^^^^^^^^^^ -:class:`ArgumentParser` parses args through the +:class:`ArgumentParser` parses arguments through the :meth:`~ArgumentParser.parse_args` method. This will inspect the command line, convert each arg to the appropriate type and then invoke the appropriate action. 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:: In a script, :meth:`~ArgumentParser.parse_args` will typically be called with no arguments, and the :class:`ArgumentParser` will automatically determine the -command-line args from :data:`sys.argv`. +command-line arguments from :data:`sys.argv`. ArgumentParser objects @@ -650,11 +650,11 @@ be positional:: action ^^^^^^ -:class:`ArgumentParser` objects associate command-line args with actions. These -actions can do just about anything with the command-line args associated with +:class:`ArgumentParser` objects associate command-line arguments with actions. These +actions can do just about anything with the command-line arguments associated with them, though most actions simply add an attribute to the object returned by :meth:`~ArgumentParser.parse_args`. The ``action`` keyword argument specifies -how the command-line args should be handled. The supported actions are: +how the command-line arguments should be handled. The supported actions are: * ``'store'`` - This just stores the argument's value. This is the default action. For example:: @@ -726,8 +726,8 @@ the Action API. The easiest way to do this is to extend :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this object. -* ``values`` - The associated command-line args, with any type-conversions - applied. (Type-conversions are specified with the type_ keyword argument to +* ``values`` - The associated command-line arguments, with any type conversions + applied. (Type conversions are specified with the type_ keyword argument to :meth:`~ArgumentParser.add_argument`. * ``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 different number of command-line arguments with a single action. The supported values are: -* N (an integer). N args from the command line will be gathered together into a +* N (an integer). N arguments from the command line will be gathered together into a list. For example:: >>> parser = argparse.ArgumentParser() @@ -803,7 +803,7 @@ values are: Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>, outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>) -* ``'*'``. All command-line args present are gathered into a list. Note that +* ``'*'``. All command-line arguments present are gathered into a list. Note that it generally doesn't make much sense to have more than one positional argument with ``nargs='*'``, but multiple optional arguments with ``nargs='*'`` is possible. For example:: @@ -827,7 +827,7 @@ values are: usage: PROG [-h] foo [foo ...] PROG: error: too few arguments -If the ``nargs`` keyword argument is not provided, the number of args consumed +If the ``nargs`` keyword argument is not provided, the number of arguments consumed is determined by the action_. Generally this means a single command-line arg will be consumed and a single item (not a list) will be produced. @@ -845,7 +845,7 @@ the various :class:`ArgumentParser` actions. The two most common uses of it are * When :meth:`~ArgumentParser.add_argument` is called with option strings (like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional - argument that can be followed by zero or one command-line args. + argument that can be followed by zero or one command-line arguments. When parsing the command line, if the option string is encountered with no command-line arg following it, the value of ``const`` will be assumed instead. See the nargs_ description for examples. @@ -895,11 +895,11 @@ command-line argument was not present.:: type ^^^^ -By default, :class:`ArgumentParser` objects read command-line args in as simple +By default, :class:`ArgumentParser` objects read command-line arguments in as simple strings. However, quite often the command-line string should instead be interpreted as another type, like a :class:`float` or :class:`int`. The ``type`` keyword argument of :meth:`~ArgumentParser.add_argument` allows any -necessary type-checking and type-conversions to be performed. Common built-in +necessary type-checking and type conversions to be performed. Common built-in types and functions can be used directly as the value of the ``type`` argument:: >>> parser = argparse.ArgumentParser() @@ -919,7 +919,7 @@ writable file:: Namespace(bar=<_io.TextIOWrapper name='out.txt' encoding='UTF-8'>) ``type=`` can take any callable that takes a single string argument and returns -the type-converted value:: +the converted value:: >>> def perfect_square(string): ... value = int(string) @@ -954,7 +954,7 @@ See the choices_ section for more details. choices ^^^^^^^ -Some command-line args should be selected from a restricted set of values. +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 argument to :meth:`~ArgumentParser.add_argument`. When the command line is 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. Beyond ``sys.argv`` ^^^^^^^^^^^^^^^^^^^ -Sometimes it may be useful to have an ArgumentParser parse args other than those +Sometimes it may be useful to have an ArgumentParser parse arguments other than those of :data:`sys.argv`. This can be accomplished by passing a list of strings to :meth:`~ArgumentParser.parse_args`. This is useful for testing at the interactive prompt:: @@ -1540,7 +1540,7 @@ FileType objects The :class:`FileType` factory creates objects that can be passed to the type argument of :meth:`ArgumentParser.add_argument`. Arguments that have - :class:`FileType` objects as their type will open command-line args as files + :class:`FileType` objects as their type will open command-line arguments as files with the requested modes and buffer sizes: >>> parser = argparse.ArgumentParser() @@ -1654,7 +1654,7 @@ Parser defaults .. method:: ArgumentParser.set_defaults(**kwargs) Most of the time, the attributes of the object returned by :meth:`parse_args` - will be fully determined by inspecting the command-line args and the argument + will be fully determined by inspecting the command-line arguments and the argument actions. :meth:`set_defaults` allows some additional attributes that are determined without any inspection of the command line to be added:: -- cgit v0.12