[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

[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

[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)

[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

[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

[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

[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_

[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

[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

[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

[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

[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

[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

[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

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

2014-07-25 Thread paul j3
paul j3 added the comment: This patch adds a class TestMutuallyExclusiveGroupErrors test_invalid_add_group() test, closely modeled on test_invalid_add_argument() I'm using ValueError in group add methods (maintaining the similarity with add_argument errors). I ha

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

2014-07-29 Thread paul j3
Changes by paul j3 : Added file: http://bugs.python.org/file36160/issue22029_2.patch ___ Python tracker <http://bugs.python.org/issue22029> ___ ___ Python-bugs-list mailin

[issue12806] argparse: Hybrid help text formatter

2014-07-30 Thread paul j3
paul j3 added the comment: In http://bugs.python.org/issue22029 argparse CSS white-space: like control for individual text blocks I propose a set of `str` subclasses that can be used to define the wrapping style of individual text blocks. The idea is adapted from the HTML '' tag, a

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

2014-07-31 Thread paul j3
Changes by paul j3 : Added file: http://bugs.python.org/file36187/issue22029_2.patch ___ Python tracker <http://bugs.python.org/issue22029> ___ ___ Python-bugs-list mailin

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

2014-07-31 Thread paul j3
Changes by paul j3 : Removed file: http://bugs.python.org/file36160/issue22029_2.patch ___ Python tracker <http://bugs.python.org/issue22029> ___ ___ Python-bugs-list m

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

2014-08-06 Thread paul j3
paul j3 added the comment: In my suggestion I used if 'current_value is default': without going into detail. The use of an 'is' test for integer values is tricky, as discussed in http://bugs.python.org/issue18943 int("42") is 42# True int(&

[issue20598] argparse docs: '7'.split() is confusing magic

2014-08-07 Thread paul j3
paul j3 added the comment: For documentation, ['this','is','a','test'] might be a bit clearer than 'this is a test'.split(). But generating a list of strings by split is, I think, a pretty basic idiom. But for testing purposes the split() ver

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

2014-08-07 Thread paul j3
paul j3 added the comment: Another issue dealing with abbreviations is close to being committed. http://bugs.python.org/issue14910 argparse: disable abbreviation -- ___ Python tracker <http://bugs.python.org/issue14

[issue15428] add "Name Collision" section to argparse docs

2014-08-07 Thread paul j3
paul j3 added the comment: On Stackoverflow a couple of posters have asked about nesting namespaces as a way of separating the parser and subparser arguments. http://stackoverflow.com/questions/15782948 http://stackoverflow.com/questions/18668227 One solution that I rather like http

[issue18979] Use argparse in the uu module

2014-08-07 Thread paul j3
paul j3 added the comment: Reading through, but not testing, it looks like a faithful replacement. The usage like will be a bit different. Given optparse: usage='usage: %prog [-d] [-t] [input [output]] automatic argparse: usage='usage: %prog [-d] [-t] [input] [output]

[issue12954] Multiprocessing logging under Windows

2014-08-12 Thread paul j3
paul j3 added the comment: I added a print line to a 'windows' example from the documentation: from multiprocessing import Process print 'importing multiprocessing' def foo(): print 'hello' p = Process(target=foo) p.start() Run wi

[issue12954] Multiprocessing logging under Windows

2014-08-13 Thread paul j3
paul j3 added the comment: I had noticed the `global _log_to_stderr` in `util.log_to_stderr()`, but hadn't taken time to track down where it is used. Not only is it passed from the 'util' module to the 'forking' one, but it is also passed via a piped pickle fro

[issue15125] argparse: positional arguments containing - in name not handled well

2014-08-21 Thread paul j3
paul j3 added the comment: It still needs a documentation patch. And if the documentation was clearer, would sfllaw's patch still be needed? -- ___ Python tracker <http://bugs.python.org/is

[issue13540] Document the Action API in argparse

2014-08-21 Thread paul j3
paul j3 added the comment: The formatting of the descriptor line for this class is not consistent with the classes for this module. It lacks 'class'. It is all bold In contrast class argparse.ArgumentParser(prog=None, ... uses bold for onl

[issue13540] Document the Action API in argparse

2014-08-23 Thread paul j3
paul j3 added the comment: Maybe the problem is with the latest documentation build, not your patch. -- ___ Python tracker <http://bugs.python.org/issue13

[issue13540] Document the Action API in argparse

2014-08-23 Thread paul j3
paul j3 added the comment: You need line continuation characters '\' .. class:: Action(option_strings, dest, nargs=None, const=None, default=None, \ type=None, choices=None, required=False, help=None, \ me

[issue13540] Document the Action API in argparse

2014-08-23 Thread paul j3
paul j3 added the comment: While we are talking the Action class, the documentation isn't clear that the 'add_argument' method returns an Action object, specifically one the subclasses. More than once, when answering Stackoverflow questions I've recommended assign

[issue22240] argparse support for "python -m module" in help

2014-08-24 Thread paul j3
paul j3 added the comment: The patch tests assume the test is being run in a particular way: python -m unittest ... But I often use python3 -m unittest ... or python3 test_argparse.py both of which fail these tests. Testing this change might be more difficult than implementing

[issue22240] argparse support for "python -m module" in help

2014-08-24 Thread paul j3
paul j3 added the comment: What if the package is run without `-m`? -- ___ Python tracker <http://bugs.python.org/issue22240> ___ ___ Python-bugs-list mailin

[issue21480] A build now requires...

2014-08-24 Thread paul j3
paul j3 added the comment: I ran into a (possibly) related compiling problem (for 'default', 3.5 branch) in `asdl.py`: class Module(AST): def __init__(self, name, dfns): ... self.types = {type.name: type.value for type in dfns} The dictionary com

[issue22240] argparse support for "python -m module" in help

2014-08-24 Thread paul j3
paul j3 added the comment: Package might be the wrong term. How about a directory with a `__main__.py` file, and no local imports (relative or not)? In my tests it runs with and without the -m. -- ___ Python tracker <http://bugs.python.

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

2014-09-03 Thread paul j3
paul j3 added the comment: http://bugs.python.org/issue14191 'argparse doesn't allow optionals within positionals' implements a 'parse_intermixed_args()' method, which parses all of the optionals with one pass, followed by a second pass that handles the posi

[issue11588] Add "necessarily inclusive" groups to argparse

2014-09-03 Thread paul j3
paul j3 added the comment: http://stackoverflow.com/questions/25626109/python-argparse-conditionally-required-arguments asks about implementing a 'conditionally-required-arguments' case in `argparse`. The post-parsing test is simple enough: if args.argument and (args.a is None

[issue11588] Add "necessarily inclusive" groups to argparse

2014-09-05 Thread paul j3
paul j3 added the comment: Attached is a patch for 3.5.0 dev that adds UsageGroups. Now different 'kinds' are implemented as subclasses, which are accessed via the registry: _XorUsageGroup - replicate action of MutuallyExclusiveGroups _AndUsageGroup - an inclu

<    1   2   3   4   5   6   7   8   >