[issue20430] Make argparse.SUPPRESS work as an argument "dest"

2014-05-27 Thread paul j3
paul j3 added the comment: If we make this change to '_StoreAction', we need to do it to 4 other subclasses which take the same 'setattr(namespace, self.dest, values)'. An alternative would be to define a 'Namespace' function that does this conditional 's

[issue9351] argparse set_defaults on subcommands should override top level set_defaults

2014-05-27 Thread paul j3
Changes by paul j3 : -- nosy: +paul.j3 ___ Python tracker <http://bugs.python.org/issue9351> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue20430] Make argparse.SUPPRESS work as an argument "dest"

2014-05-28 Thread paul j3
paul j3 added the comment: In the attached file I tried another approach - a custom Action class. It gives you the custom behavior now, instead of 2-3 releases in the future. class Action2(Action): # custom action def __init__(self, *args, **kwargs): super

[issue21208] Change default behavior of arguments with type bool when options are specified

2014-05-28 Thread paul j3
paul j3 added the comment: In http://bugs.python.org/issue11588#msg212243 I explore the option of using decorators to 'register' custom functions with the parser. There I was adding exclusive/inclusive tests, but the same approach could be used to register custom types and a

[issue9351] argparse set_defaults on subcommands should override top level set_defaults

2014-05-28 Thread paul j3
paul j3 added the comment: This is not getting much attention for several reasons: - there's quite a backlog of argparse patches and issues - 'set_defaults' is not commonly used. Setting default in 'add_argument' seems more common. - defining the same argumen

[issue12776] argparse: type conversion function should be called only once

2014-05-29 Thread paul j3
Changes by paul j3 : -- nosy: +paul.j3 ___ Python tracker <http://bugs.python.org/issue12776> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue1570255] redirected cookies

2014-05-30 Thread Paul Suh
Paul Suh added the comment: I found a repeatable, public test case: http://www.macupdate.com/download/26915/ScreenFlow-4.5.1.dmg Using urllib2 with the following code leads to a redirect loop: #!/usr/bin/python import urllib2 h = urllib2.HTTPHandler(debuglevel=1) h2 = urllib2.HTTPSHandler

[issue21616] argparse explodes with nargs='*' and a tuple metavar

2014-06-02 Thread paul j3
paul j3 added the comment: I think is issue was already raised in http://bugs.python.org/issue14074 argparse allows nargs>1 for positional arguments but doesn't allow metavar to be a tuple -- nosy: +paul.j3 ___ Python tracke

[issue21633] Argparse does not propagate HelpFormatter class to subparsers

2014-06-02 Thread paul j3
paul j3 added the comment: You can specify the 'formatter_class' when creating each subparser: sp1=sp.add_parser('cmd1', formatter_class = argparse.RawDescriptionHelpFormatter) The 'add_parser' command is the one that passes a variety of **kwargs to 'A

[issue10984] argparse add_mutually_exclusive_group should accept existing arguments to register conflicts

2014-06-02 Thread paul j3
paul j3 added the comment: Another way to add an existing Action to a group is to modify the 'add_argument' method for the Group subclass. For example we could add this to the _MutuallyExclusiveGroup class: def add_argument(self, *args, **kwargs): # allow adding a

[issue21666] Argparse exceptions should include which argument has a problem

2014-06-07 Thread paul j3
paul j3 added the comment: First, 'parse_intermixed_args' on stack is not relevant. It's from an unreleased patch that we worked on. What matters is the 'print_help', invoked probably with a '-h'. The error message that normally specifies the problem arg

[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2014-06-07 Thread Paul Moore
Paul Moore added the comment: TBH, I don't think I ever took this any further. As noted, the earlier patches fixed the failures I was hitting. It looks like Python 3.4 now has *two* definitions of find_unused_port, in test.test_support and in test.support. And test_asyncio and test_f

[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2014-06-07 Thread Paul Moore
Changes by Paul Moore : -- nosy: -pmoore ___ Python tracker <http://bugs.python.org/issue8576> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21666] Argparse exceptions should include which argument has a problem

2014-06-07 Thread paul j3
paul j3 added the comment: The ''_expand_help' method formats one action (argument) at a time, so it could issue an error message that includes that action's name. The disconnect that you noticed arises because your bad 'help' parameter wasn't tested until i

[issue21666] Argparse exceptions should include which argument has a problem

2014-06-07 Thread paul j3
paul j3 added the comment: In http://bugs.python.org/file30010/nargswarn.patch adding the '_expand_help(action)' line should test the help string (during add_argument). def _check_argument(self, action): # check action arguments # focus on the arguments that

[issue9849] Argparse needs better error handling for nargs

2014-06-07 Thread paul j3
paul j3 added the comment: http://bugs.python.org/issue21666 raises the possibility of testing the 'help' parameter in the same way. By adding (to _check_argument): # check the 'help' string try: self._get_formatter()._expand_help(action)

[issue21258] Add __iter__ support for mock_open

2014-06-12 Thread Paul Koning
Paul Koning added the comment: I created a fix for this. This also fixes a second issue in mock_open, which is that readline() raises StopIteration at EOF rather than returning empty strings. See attached diff. (Is there a better procedure for submitting fixes?) -- nosy: +pkoning

[issue21258] Add __iter__ support for mock_open

2014-06-12 Thread Paul Koning
Paul Koning added the comment: This is the corresponding patch to the test suite. -- Added file: http://bugs.python.org/file35598/testwith.diff ___ Python tracker <http://bugs.python.org/issue21

[issue11588] Add "necessarily inclusive" groups to argparse

2014-06-12 Thread paul j3
paul j3 added the comment: I have developed a UsageGroup class that can implement nested 'inclusive' tests. Using this, the original example in this issue could be coded as 3 groups, 2 mutually_exclusive and inclusive one. parser = ArgumentParser(prog='PROG

[issue21747] argvars: error while parsing under windows

2014-06-13 Thread paul j3
paul j3 added the comment: It's essentially the same issue as http://bugs.python.org/issue21666. An error in the 'help' parameter is not caught until 'print_help' is called (via 'parse_args'). A possible improvement is to test the 'help' string

[issue21750] mock_open data is visible only once for the life of the class

2014-06-13 Thread Paul Koning
New submission from Paul Koning: The read_data iterator that supplies bits of read data when asked from unittest.mock.mock_open is a class attribute. The result is that, if you instantiate the class multiple times, that iterator is shared. This isn't documented and it seems counterintu

[issue16399] argparse: append action with default list adds to list instead of overriding

2014-06-19 Thread paul j3
paul j3 added the comment: It should be easy to write a subclass of Action, or append Action, that does what you want. It just needs a different `__call__` method. You just need a way of identifying an default that needs to be overwritten as opposed to appended to. def __call__(self

[issue14794] slice.indices raises OverflowError

2012-11-02 Thread Paul Upchurch
Paul Upchurch added the comment: For the concept of "reasonable", it should be noted that this behaviour will affect code that works with reasonably sized sequences despite the largeness of the parameter. Consider an extremely large array. To work with such an array, one would

[issue14525] ia64-hp-hpux11.31 won't compile Python-2.6.8rc2 without -D_TERMIOS_INCLUDED

2012-11-20 Thread Paul A.
Paul A. added the comment: On Sun, Nov 18, 2012 at 08:01:39PM +, Terry J. Reedy wrote: > I should have added 'please try compiling 3.x to make sure it has the same > problem' since configure might behave differently. I'm fairly sure I did, that was quite a few mon

[issue16940] argparse 15.4.5.1. Sub-commands documentation missing indentation

2013-01-11 Thread paul j3
New submission from paul j3: Argparse 15.4.5.1. Sub-commands In the example: >>> parser.parse_args(['--help']) usage: PROG [-h] [--foo] {a,b} ... positional arguments: {a,b} sub-command help a a help b b help optional arguments: -h, --help show this he

[issue11708] argparse: suggestion for formatting optional positional args

2013-09-15 Thread paul j3
Changes by paul j3 : -- nosy: +paul.j3 ___ Python tracker <http://bugs.python.org/issue11708> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue13824] argparse.FileType opens a file and never closes it

2013-09-15 Thread paul j3
Changes by paul j3 : -- nosy: +paul.j3 ___ Python tracker <http://bugs.python.org/issue13824> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2013-09-16 Thread paul j3
Changes by paul j3 : -- nosy: +paul.j3 ___ Python tracker <http://bugs.python.org/issue14365> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue9694] argparse required arguments displayed under "optional arguments"

2013-09-16 Thread paul j3
Changes by paul j3 : -- nosy: +paul.j3 ___ Python tracker <http://bugs.python.org/issue9694> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue10984] argparse add_mutually_exclusive_group should accept existing arguments to register conflicts

2013-09-16 Thread paul j3
paul j3 added the comment: Another situation in which this MultiGroupHelpFormatter helps is when one or more of the groups includes an optional positional. The regular formatter moves all the positionals to the end, after the optionals. This move could easily break up a mutually exclusive

[issue16878] argparse: positional args with nargs='*' defaults to []

2013-09-18 Thread paul j3
paul j3 added the comment: On a related point, the 'action.required' value is set differently for '?' and '*' positionals. if kwargs.get('nargs') not in [OPTIONAL, ZERO_OR_MORE]: kwargs['required'] = True if kwargs.get(&#

[issue11708] argparse: suggestion for formatting optional positional args

2013-09-18 Thread paul j3
paul j3 added the comment: This is a HelpFormatter function that takes a list of formatted actions, and groups contiguous blocks of optional positional actions. It accounts for optionals (via prefix_chars) and mutually exclusive groups. Since it assumes 'parts' is a list, rather t

[issue13824] argparse.FileType opens a file and never closes it

2013-09-23 Thread paul j3
paul j3 added the comment: In this patch I implement a FileContext class. It differs from FileType in 2 key areas: - it returns a 'partial(open, filename, ...)' - it wraps '-' (stdin/out) in a dummy context protecting the file from closure. The resulting argument is

[issue13824] argparse.FileType opens a file and never closes it

2013-09-25 Thread paul j3
paul j3 added the comment: An alternative way to delay the file opening, is to return an instance that has a `filename` attribute, and has an `open` method. This can be compactly added to the `FileContext` that I defined in the previous patch. The `FileContext` provides the `_ostest

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2013-09-26 Thread paul j3
paul j3 added the comment: Steven's patch (subparse_optionals.diff) run with jakub's test case (argparse_subparses_ambiguous_bug.py) works. But if the input string is print(parser.parse_args('--foo baz'.split())) produces Namespace(cmd=None, foo='baz&#x

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2013-09-27 Thread paul j3
paul j3 added the comment: I think the correction to the problem that I noted in the previous post is to return 'None, arg_string, None', rather than 'action, arg_string, None' in the case where the action is found in a subparser. This is what '_parse_optional'

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2013-09-27 Thread paul j3
paul j3 added the comment: In the last patch, 'parser.scan = True' is needed to activate this fix. I left that switch in for testing convenience. -- ___ Python tracker <http://bugs.python.o

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2013-09-28 Thread paul j3
Changes by paul j3 : Removed file: http://bugs.python.org/file31888/subparser_patch.diff ___ Python tracker <http://bugs.python.org/issue14365> ___ ___ Python-bugs-list m

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2013-09-28 Thread paul j3
paul j3 added the comment: This the argparse patch as described in the previous post, along with test_argparse tests. For now the tests handle both subparser required cases and not required ones ( http://bugs.python.org/issue9253 ). While error messages can differ based on this

[issue19139] In venv, __VENV_NAME__ is the prompt, not the name

2013-10-01 Thread Paul Moore
New submission from Paul Moore: The documentation for venv states that __VENV_NAME__ in scripts is replaced by the name of the virtualenv. In fact, it is replaced by context.prompt, which is the prompt, rather than the name. The various activate scripts are not consistent with this behaviour

[issue19139] In venv, __VENV_NAME__ is the prompt, not the name

2013-10-01 Thread Paul Moore
Paul Moore added the comment: Cool. Patch attached (this fixes __VENV_NAME__ and implements __VENV_PROMPT__) -- keywords: +patch Added file: http://bugs.python.org/file31938/venv_prompt.patch ___ Python tracker <http://bugs.python.org/issue19

[issue19208] Bas64.decodestring() returns data instead of throwing exception

2013-10-09 Thread Tymoteusz Paul
New submission from Tymoteusz Paul: What happens (and how to reproduce): import base64 str = """GET http://www.google.com.hk/search?q=hotels+near+airport&pws=1&igu=1&ip=0.0.0.0&safe=images&gl=CN&gll=39.913889,116.391667&near=china&hl=zh-CN HTTP

[issue15613] argparse ArgumentDefaultsHelpFormatter interacts badly with --arg and nargs=+

2013-10-14 Thread paul j3
paul j3 added the comment: Looks like this behavior is intentional. This subclass adds a '%(default)s' string to the help lines if: if '%(default)' not in action.help: if action.default is not SUPPRESS: defaulting_nargs = [OPTIONAL, ZERO_OR_

[issue19331] Revise PEP 8 recommendation for class names

2013-10-21 Thread Paul Moore
Paul Moore added the comment: How about simply adding a further sentence, something like: "Where a class is being used conceptually as a callable (for example, context managers), the naming convention for callables (lower_case_with_underscores) should be followed." Maybe also add

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2013-10-21 Thread Paul Hawkins
Paul Hawkins added the comment: I ran into this bug the first time I needed nargs + in a tool. I found of course that if the option with the nargs is followed by another option before the positional arguments it will work as expected. But then the help would have to point this out, and it

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2013-10-21 Thread paul j3
paul j3 added the comment: parse_args() would see ['-foo', 'bar1,bar2,bar3', 'pos1', 'pos2']. The splitting on space is done by the shell. So having your own code split 'bar1,bar2,bar3' is simplest. But that would be messed up if the user e

[issue19331] Revise PEP 8 recommendation for class names

2013-10-22 Thread Paul Moore
Paul Moore added the comment: +1 on switching the wording in the overriding principle section to say "factory function to class". Although the fact that I made that mistake reflects my point that if I'm thinking of class->wrapper as an "internal change" then I'

[issue19331] Revise PEP 8 recommendation for class names

2013-10-24 Thread Paul Moore
Paul Moore added the comment: I'm in favour of keeping it simple - "use your common sense" should be a general guideline here (even though I know people's tastes differ, and that can be a source of endless debate :-)) -- ___ P

[issue19462] Add remove_argument() method to argparse.ArgumentParser

2013-11-01 Thread paul j3
paul j3 added the comment: When you add an argument, argparse creates an `Action`, and returns it. It also places that action in various lists (e.g. parse._actions) and dictionaries. A `remove_argument` function would have to trace and remove all of those links. That's a non-trivial

[issue19462] Add remove_argument() method to argparse.ArgumentParser

2013-11-01 Thread paul j3
paul j3 added the comment: Just hang on the Action object that the `add_argument` returned, and change its `help` attribute. a = parser.add_argument('--foo', help='initial help') a.help = 'new help' If using a custom parser class and s

[issue19462] Add remove_argument() method to argparse.ArgumentParser

2013-11-13 Thread paul j3
paul j3 added the comment: `argparse.SUPPRESS` should do the trick. According to the documentation it can be used with `default` and `help` parameters. -- ___ Python tracker <http://bugs.python.org/issue19

[issue19462] Add remove_argument() method to argparse.ArgumentParser

2013-11-20 Thread paul j3
paul j3 added the comment: f.nargs = '?' f.default = argparse.SUPPRESS f.help = argparse.SUPPRESS may be best set of tweaks to a positional Action `f`. In quick tests it removes `f` from the help, suppresses any complaints about a missing string, and does not put anyth

[issue17204] argparser's subparsers.add_parser() should accept an ArgumentParser

2013-11-25 Thread paul j3
paul j3 added the comment: http://stackoverflow.com/a/20167038/901925 is an example of using `_parser_class` to produce different behavior in the subparsers. parser = ArgumentParser() parser.add_argument('foo') sp = parser.add_subparsers(dest='cmd') sp._pars

[issue19814] Document prefix matching behavior of argparse, particularly for parse_known_args

2013-11-28 Thread paul j3
paul j3 added the comment: `parse_args` just calls `parse_known_args`, and then raises an error if `rest` is not empty. So it is `parse_known_args` that is doing the abbreviation matching. Abbreviation matching is done relatively early, when `_parse_known_args` first loops through the

[issue14910] argparse: disable abbreviation

2013-11-28 Thread paul j3
paul j3 added the comment: For a programmer who needs to turn off this abbreviation matching now, a simple solution is to subclass ArgumentParser: class MyParser(ArgumentParser): def _get_option_tuples(self, option_string): return [] This could be the place to

[issue11354] argparse: nargs could accept range of options count

2013-11-29 Thread paul j3
paul j3 added the comment: With a minor tweak to `argparse._is_mnrep()`, `nargs='{3}'` would also work. This means the same as `nargs=3`, so it isn't needed. But it is consistent with the idea of accepting Regular Expression syntax where it makes sense. `nargs='{2,3}?&

[issue11695] Improve argparse usage/help customization

2014-06-19 Thread paul j3
paul j3 added the comment: Here's a function that implements the format string: def custom_help(template): def usage(self): formatter = self._get_formatter() formatter.add_usage(self.usage, self._actions, self._mutually_exclusive_g

[issue21805] Argparse Revert config_file defaults

2014-06-20 Thread paul j3
paul j3 added the comment: Another approach would be make the 'argparse' argument a 'switch' command, and act on it after parsing. Roughly what I have in mind is: parser.add_argument('--verbosity', dest='switch_verbosity, action='store_tru

[issue11695] Improve argparse usage/help customization

2014-06-20 Thread paul j3
paul j3 added the comment: This patch has a 'custom_help' which, with a default template, is compatible with 'format_help' (i.e. it passes test_argparse). It also handles the sample template in this issue. Due to long line wrapping issues, the 'Usage: ' strin

[issue11695] Improve argparse usage/help customization

2014-06-21 Thread paul j3
paul j3 added the comment: That original template can also be implemented with a customized 'format_help': def custom_help(self): formatter = self._get_formatter() formatter.add_text('My Program, version 3.5') formatter.add_usage(self.

[issue9341] allow argparse subcommands to be grouped

2014-06-22 Thread paul j3
paul j3 added the comment: This patch accomplishes this task by adding a _PseudoGroup class to _SubParsersAction. It's like the _ChoicesPseudoAction except that it maintains its own _choices_actions list. It takes advantage of the fact that formatter._format_actions is recursive whe

[issue14540] Crash in Modules/_ctypes/libffi/src/dlmalloc.c on ia64-hp-hpux11.31

2014-06-22 Thread Paul A.
Paul A. added the comment: I believe this problem has been gone since around 2.7.5, so can I close this myself? -- resolution: -> out of date status: open -> closed ___ Python tracker <http://bugs.python.org/i

[issue1859] textwrap doesn't linebreak on "\n"

2014-06-24 Thread paul j3
Changes by paul j3 : -- nosy: +paul.j3 ___ Python tracker <http://bugs.python.org/issue1859> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue12954] Multiprocessing logging under Windows

2014-06-25 Thread paul j3
paul j3 added the comment: It will take a while to reconstruct the circumstances behind this issue. I think I was working through some online class examples, working in the Eclipse pydev environment. Currently I'm mostly working in linux, and not doing much with multiprocessing. Looks

[issue9350] add remove_argument_group to argparse

2014-06-27 Thread paul j3
paul j3 added the comment: I wonder if this patch is needed. - there hasn't been discussion in 4 years - In Steven's use case, a group without any arguments, the group does not show up. A common example of an empty argument group, is a parser without any user defined arguments

[issue15112] argparse: nargs='*' positional argument doesn't accept any items if preceded by an option and another positional

2014-06-30 Thread paul j3
paul j3 added the comment: I believe http://bugs.python.org/issue14174 with REMAINDER has its roots in the same issue - parse_args tries to process as many positionals as it can at a time, regardless of what's left in the argument strings. The fix proposed here depends on the 2nd arg

[issue20554] Use specific asserts in optparse test

2014-06-30 Thread paul j3
Changes by paul j3 : -- nosy: +paul.j3 ___ Python tracker <http://bugs.python.org/issue20554> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue21896] Unexpected ConnectionResetError in urllib.request against a valid website

2014-07-01 Thread Tymoteusz Paul
New submission from Tymoteusz Paul: I've recently ran into a problem with urellib.request.urlopen that it fails against one website (that I've found so far). The website itself is working fine, I can access its content with other libraries like requests, curl and outside of python w

[issue14174] argparse.REMAINDER fails to parse remainder correctly

2014-07-01 Thread paul j3
paul j3 added the comment: Here's a possible solution to the problem (assuming there really is one): - redefine REMAINDER so it matches a '((?:A[AO]*)?)' pattern (where O is a string that looks like an optional flag, A an argument string). I've added the condition that

[issue21896] Unexpected ConnectionResetError in urllib.request against a valid website

2014-07-02 Thread Tymoteusz Paul
Changes by Tymoteusz Paul : -- versions: +Python 3.2 ___ Python tracker <http://bugs.python.org/issue21896> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue12954] Multiprocessing logging under Windows

2014-07-04 Thread paul j3
paul j3 added the comment: The documentation currently warns https://docs.python.org/2/library/multiprocessing.html#windows > Safe importing of main module > Make sure that the main module can be safely imported by a new Python > interpreter without causing unintended side effect

[issue10190] Can argparse._AttributeHolder._get_kwargs become a public API?

2014-07-05 Thread paul j3
paul j3 added the comment: Apart from sorting, `_get_kwargs` does little more than: return [k for k in action.__dict__.items() if not k[0].startswith('_')] That is, it's the `items()` of the 'public' attributes of the action (or parser). Those attributes are

[issue9571] argparse: Allow the use of -- to break out of nargs and into subparser

2014-07-06 Thread paul j3
paul j3 added the comment: In elsdoerfer's example, the '--' effectively ends the argument list for '--ignore'. '--' are not allowed in the arguments of an optional (see the end of '_get_nargs_pattern()'). Rather the problem is at the start of

[issue9571] argparse: Allow the use of -- to break out of nargs and into subparser

2014-07-07 Thread paul j3
paul j3 added the comment: This patch modifies that '--' handling from 13922, removing '--' from PARSER and REMAINDER if it is the first string: if action.nargs not in [PARSER, REMAINDER]: try: arg_strings.remove('--')

[issue13922] argparse handling multiple "--" in args improperly

2014-07-07 Thread paul j3
paul j3 added the comment: http://bugs.python.org/issue9571 proposes a refinement to this patch - drop the '--' from PARSER and REMAINDER nargs if it is the 1st string. -- ___ Python tracker <http://bugs.python.o

[issue9055] test_issue_8959_b fails when run from a service

2014-07-09 Thread Paul Moore
Changes by Paul Moore : -- resolution: -> fixed status: open -> closed ___ Python tracker <http://bugs.python.org/issue9055> ___ ___ Python-bugs-list

[issue16516] argparse types (and actions) must be hashable

2014-07-12 Thread paul j3
paul j3 added the comment: This is a straight forward patch, modifying '_registry_get' to return 'default' if it gets this 'TypeError'. 'test_argparse.py' has a testcase based on jnothman's example. Temporarily it includes a skipped test that wo

[issue16623] argparse help formatter does not honor non-breaking space

2014-07-13 Thread paul j3
paul j3 added the comment: The issue here is how `textwrap` handles the non-breaking space. That's being address here: http://bugs.python.org/issue20491 textwrap: Non-breaking space not honored Temporarily an `argparse` user can get around it with `formatter_

[issue16786] argparse doesn't offer localization interface for "version" action

2014-07-13 Thread paul j3
paul j3 added the comment: In this patch I added the '_()' localization to the '_VersionAction' default 'help'. While this is a straight forward change, I haven't tested it. It does run test_argparse.py, but that doesn't have any tests for localiz

[issue16807] argparse group nesting lost on inheritance

2014-07-14 Thread paul j3
paul j3 added the comment: To put this issue in perspective: - There's nothing in the documentation about nesting a mutually exclusive group in an argument group. - There are prominent notes in the documentation about MEGs not taking title and description. The '_add_container_act

[issue9341] allow argparse subcommands to be grouped

2014-07-15 Thread paul j3
paul j3 added the comment: This patch probably won't work with [parents]. see http://bugs.python.org/issue16807 -- ___ Python tracker <http://bugs.python.org/i

[issue16807] argparse group nesting lost on inheritance

2014-07-15 Thread paul j3
paul j3 added the comment: The subcommands grouping mechanism proposed in http://bugs.python.org/issue9341 probably does not work with [parents] either. This _add_container_actions method is brittle. It has to know too much about the structure of a parser and its groups. Any change to that

[issue17250] argparse: Issue 15906 patch; positional with nargs='*' and string default

2014-07-15 Thread paul j3
paul j3 added the comment: Positionals with '*' are discussed in more detail in: http://bugs.python.org/issue9625 - argparse: Problem with defaults for variable nargs when using choices http://bugs.python.org/issue16878 - argparse: positional args with nargs='*'

[issue16878] argparse: positional args with nargs='*' defaults to []

2014-07-15 Thread paul j3
paul j3 added the comment: The documentation patch here should note that a positional '*' string default is not parsed (i.e. does not pass through _get_value). (see http://bugs.python.org/issue17250) -- ___ Python tracker <http://bu

[issue13041] argparse: terminal width is not detected properly

2014-07-16 Thread paul j3
paul j3 added the comment: The latest patch, using _shutil.get_terminal_size(), looks fine. It lets environ['COLUMNS'] have priority over the end user's terminal width, as demonstrated by the change to test_argparse. test_argparse doesn't test changing the actual

[issue17113] argparse.RawDescriptionHelpFormatter should not delete blank lines

2014-07-17 Thread paul j3
paul j3 added the comment: I suspect fixing this isn't going to be easy. Extra lines are removed by the top most `formatter` function: def format_help(self): help = self._root_section.format_help() if help: help = self._long_break_matcher.sub('\

[issue17113] argparse.RawDescriptionHelpFormatter should not delete blank lines

2014-07-17 Thread paul j3
paul j3 added the comment: A user could preserve blank lines by including a space (or more) in each. That is, instead of ending with '\n', end with '\n \n'. epilog = 'Epilog: No wrap text %(prog)s\n\tNext line\n \n' --- I just checked a simple hel

[issue9399] Provide a 'print' action for argparse

2014-07-19 Thread paul j3
paul j3 added the comment: As Steven notes, the patch lacks tests. It also lacks documentation. The 2 things that this class does different from 'version' are - write without passing the text through 'textwrap' - write to a user defined file There is a difference in opin

[issue13540] Document the Action API in argparse

2014-07-20 Thread paul j3
paul j3 added the comment: I think you want to unlink 9ac347a7f375.diff It's from a different project -- ___ Python tracker <http://bugs.python.org/is

[issue22029] argparse - CSS white-space: like control for individual text blocks

2014-07-21 Thread paul j3
New submission from paul j3: A number of the issues seek to customize the wrapping behavior in HelpFormatter - beyond what the current Formatter subclasses offer. http://bugs.python.org/issue13923 and http://bugs.python.org/issue12806 - want a wrapping method that preserves existing \n, while

[issue22029] argparse - CSS white-space: like control for individual text blocks

2014-07-21 Thread paul j3
paul j3 added the comment: One way of marking a string for special wrap handing is to make it an instance of a subclass of 'str'. This patch adds class _WhitespaceStyle(str), and 5 subclasses corresponding to the possible values of the CSS whitespace:. Normal Pre

[issue22040] Add a "force" parameter to shutil.rmtree

2014-07-22 Thread Paul Moore
New submission from Paul Moore: It would be useful for shutil.rmtree to have a "force" argument that overrode read-only permission issues, essentially replicating the behaviour of the -f flag in rm -rf (Unix) and the -force parameter of del (Windows Powershell). It's poss

[issue22040] Add a "force" parameter to shutil.rmtree

2014-07-22 Thread Paul Moore
Paul Moore added the comment: Doh. And I was even involved in the previous issue. Sorry for the noise. -- ___ Python tracker <http://bugs.python.org/issue22

[issue13041] argparse: terminal width is not detected properly

2014-07-23 Thread paul j3
paul j3 added the comment: For now the user could add this to his module: import os, shutil os.environ['COLUMNS'] = str(shutil.get_terminal_size().columns) -- ___ Python tracker <http://bugs.python.o

[issue22049] argparse: type= doesn't honor nargs > 1

2014-07-24 Thread paul j3
paul j3 added the comment: Note that '-t 1 2 3'.split() becomes ['-t', '1', '2', '3'] Your 'type' function sees those 3 strings individually. Try printing 'string' the first

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2014-07-24 Thread paul j3
paul j3 added the comment: That's an artifact of how the group usage is formatted (which isn't very robust). It's not designed to handle nested groups. Mutually exclusive groups aren't meant to nest inside other mutually exclusive groups. While it possible,

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2014-07-25 Thread paul j3
paul j3 added the comment: On further thought, I think group2 = group1.add_mutually_exclusive_group() should have raised an error, stating that a group (argument or mutually exclusive) cannot be added to a mutually exclusive group. Also an argument group should not be added to another

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2014-07-25 Thread paul j3
paul j3 added the comment: Here's a preliminary patch that raises an error if there's an attempt to nest a mutually exclusive group in another, or there's an attempt to add an argument group to either kind of group. It still needs test_argparse.py and argparse.rst changes

[issue22049] argparse: type= doesn't honor nargs > 1

2014-07-25 Thread paul j3
paul j3 added the comment: What you want is a custom Action rather than a custom Type. from the documentation: >>> class FooAction(argparse.Action): ... def __call__(self, parser, namespace, values, option_string=None): ... print('%r %r %r' %

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2014-07-25 Thread paul j3
paul j3 added the comment: ArgumentGroups and MutuallyExclusiveGroups, as currently defined, won't give you that kind of usage. I have appended a script that uses UsageGroups, which I am developing for http://bugs.python.org/issue11588, to solve this. It defines 2 'mxg' grou

<    15   16   17   18   19   20   21   22   23   24   >