##// END OF EJS Templates
Fix DeprecationWarning with system-wide argparse.
Thomas Kluyver -
Show More
@@ -325,6 +325,7 b' class ArgParseConfigLoader(CommandLineConfigLoader):'
325 325 argv = sys.argv[1:]
326 326 self.argv = argv
327 327 self.parser_args = parser_args
328 self.version = parser_kw.pop("version", None)
328 329 kwargs = dict(argument_default=argparse.SUPPRESS)
329 330 kwargs.update(parser_kw)
330 331 self.parser_kw = kwargs
@@ -70,9 +70,15 b' class BaseAppConfigLoader(ArgParseConfigLoader):'
70 70 help='Set the log level (0,10,20,30,40,50). Default is 30.',
71 71 metavar='Global.log_level')
72 72
73 def _add_version(self, parser):
74 """Add the --version option to the parser."""
75 parser.add_argument('--version', action="version",
76 version=self.version)
77
73 78 def _add_arguments(self):
74 79 self._add_ipython_dir(self.parser)
75 80 self._add_log_level(self.parser)
81 self._add_version(self.parser)
76 82
77 83
78 84 class Application(object):
General Comments 0
You need to be logged in to leave comments. Login now