##// END OF EJS Templates
Small improvements to argparse....
Fernando Perez -
Show More
@@ -1169,8 +1169,7 b' class Namespace(_AttributeHolder):'
1169 1169 """
1170 1170
1171 1171 def __init__(self, **kwargs):
1172 for name in kwargs:
1173 setattr(self, name, kwargs[name])
1172 self.__dict__.update(**kwargs)
1174 1173
1175 1174 def __eq__(self, other):
1176 1175 return vars(self) == vars(other)
@@ -1178,6 +1177,9 b' class Namespace(_AttributeHolder):'
1178 1177 def __ne__(self, other):
1179 1178 return not (self == other)
1180 1179
1180 def __contains__(self, key):
1181 return key in self.__dict__
1182
1181 1183
1182 1184 class _ActionsContainer(object):
1183 1185
@@ -2288,9 +2290,13 b' class ArgumentParser(_AttributeHolder, _ActionsContainer):'
2288 2290 # Help-printing methods
2289 2291 # =====================
2290 2292 def print_usage(self, file=None):
2293 if file is None:
2294 file = _sys.stdout
2291 2295 self._print_message(self.format_usage(), file)
2292 2296
2293 2297 def print_help(self, file=None):
2298 if file is None:
2299 file = _sys.stdout
2294 2300 self._print_message(self.format_help(), file)
2295 2301
2296 2302 def print_version(self, file=None):
General Comments 0
You need to be logged in to leave comments. Login now