diff options
Diffstat (limited to 'argparse.py')
-rw-r--r-- | argparse.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/argparse.py b/argparse.py index 83844d7..fd21104 100644 --- a/argparse.py +++ b/argparse.py @@ -1543,7 +1543,6 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): - usage -- A usage message (default: auto-generated from arguments) - description -- A description of what the program does - epilog -- Text following the argument descriptions - - version -- Add a -v/--version option with the given version string - parents -- Parsers whose arguments should be copied into this one - formatter_class -- HelpFormatter class for printing help messages - prefix_chars -- Characters that prefix optional arguments @@ -1568,6 +1567,14 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): conflict_handler='error', add_help=True): + if version is not None: + import warnings + warnings.warn( + """The "version" argument to ArgumentParser is deprecated. """ + """Please use """ + """"add_argument(..., action='version', version="N", ...)" """ + """instead""", DeprecationWarning) + superinit = super(ArgumentParser, self).__init__ superinit(description=description, prefix_chars=prefix_chars, @@ -2286,6 +2293,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): return formatter.format_help() def format_version(self): + import warnings + warnings.warn( + 'The format_version method is deprecated -- the "version" ' + 'argument to ArgumentParser is no longer supported.', + DeprecationWarning) formatter = self._get_formatter() formatter.add_text(self.version) return formatter.format_help() @@ -2307,6 +2319,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): self._print_message(self.format_help(), file) def print_version(self, file=None): + import warnings + warnings.warn( + 'The print_version method is deprecated -- the "version" ' + 'argument to ArgumentParser is no longer supported.', + DeprecationWarning) self._print_message(self.format_version(), file) def _print_message(self, message, file=None): |