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