/argh/constants.py

https://bitbucket.org/neithere/argh/ · Python · 54 lines · 14 code · 12 blank · 28 comment · 0 complexity · 50d2486a2196aa57cc22f679441caa37 MD5 · raw file

  1. # -*- coding: utf-8 -*-
  2. #
  3. # Copyright (c) 2010â2013 Andrey Mikhaylenko and contributors
  4. #
  5. # This file is part of Argh.
  6. #
  7. # Argh is free software under terms of the GNU Lesser
  8. # General Public License version 3 (LGPLv3) as published by the Free
  9. # Software Foundation. See the file README for copying conditions.
  10. #
  11. import argparse
  12. __all__ = (
  13. 'ATTR_NAME', 'ATTR_ALIASES', 'ATTR_ARGS', 'ATTR_WRAPPED_EXCEPTIONS',
  14. 'ATTR_WRAPPED_EXCEPTIONS_PROCESSOR', 'ATTR_EXPECTS_NAMESPACE_OBJECT',
  15. 'PARSER_FORMATTER'
  16. )
  17. #
  18. # Names of function attributes where Argh stores command behaviour
  19. #
  20. # explicit command name (differing from function name)
  21. ATTR_NAME = 'argh_name'
  22. # alternative command names
  23. ATTR_ALIASES = 'argh_aliases'
  24. # declared arguments
  25. ATTR_ARGS = 'argh_args'
  26. # list of exception classes that should be wrapped and printed as results
  27. ATTR_WRAPPED_EXCEPTIONS = 'argh_wrap_errors'
  28. # a function to preprocess the exception object when it is wrapped
  29. ATTR_WRAPPED_EXCEPTIONS_PROCESSOR = 'argh_wrap_errors_processor'
  30. # forcing argparse.Namespace object instead of signature introspection
  31. ATTR_EXPECTS_NAMESPACE_OBJECT = 'argh_expects_namespace_object'
  32. #
  33. # Other library-wide stuff
  34. #
  35. PARSER_FORMATTER = argparse.ArgumentDefaultsHelpFormatter
  36. """ Default formatter to be used in implicitly instantiated ArgumentParser.
  37. """
  38. #-----------------------------------------------------------------------------
  39. #
  40. # deprecated
  41. #
  42. ATTR_INFER_ARGS_FROM_SIGNATURE = 'argh_infer_args_from_signature'