Websocket server implementing a clock handling alarms and timezones
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

123456789101112131415161718192021222324
  1. import argparse
  2. from .errors import ArgumentParserError
  3. class CommandParser(argparse.ArgumentParser):
  4. """ ArgumentParser raising exception instead of exiting and printing help
  5. """
  6. def error(self, message):
  7. """ Raise an exception instead of printing to stderr and exiting """
  8. raise ArgumentParserError(message)
  9. def exit(self, *args):
  10. """ Do not allow a parser to exit the programm """
  11. pass
  12. def print_help(self, *args):
  13. """ If print_help() is called raise an exception """
  14. raise ArgumentParserError(self.format_usage())
  15. def add_subparsers(self, *args, **kwargs):
  16. """ Create subparsers indicated the good parser class """
  17. return super().add_subparsers(*args, **kwargs,
  18. parser_class=self.__class__)