PageRenderTime 17ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/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#
11import argparse
12
13__all__ = (
14    'ATTR_NAME', 'ATTR_ALIASES', 'ATTR_ARGS', 'ATTR_WRAPPED_EXCEPTIONS',
15    'ATTR_WRAPPED_EXCEPTIONS_PROCESSOR', 'ATTR_EXPECTS_NAMESPACE_OBJECT',
16    'PARSER_FORMATTER'
17)
18
19
20#
21# Names of function attributes where Argh stores command behaviour
22#
23
24# explicit command name (differing from function name)
25ATTR_NAME = 'argh_name'
26
27# alternative command names
28ATTR_ALIASES = 'argh_aliases'
29
30# declared arguments
31ATTR_ARGS = 'argh_args'
32
33# list of exception classes that should be wrapped and printed as results
34ATTR_WRAPPED_EXCEPTIONS = 'argh_wrap_errors'
35
36# a function to preprocess the exception object when it is wrapped
37ATTR_WRAPPED_EXCEPTIONS_PROCESSOR = 'argh_wrap_errors_processor'
38
39# forcing argparse.Namespace object instead of signature introspection
40ATTR_EXPECTS_NAMESPACE_OBJECT = 'argh_expects_namespace_object'
41
42#
43# Other library-wide stuff
44#
45
46PARSER_FORMATTER = argparse.ArgumentDefaultsHelpFormatter
47""" Default formatter to be used in implicitly instantiated ArgumentParser.
48"""
49
50#-----------------------------------------------------------------------------
51#
52# deprecated
53#
54ATTR_INFER_ARGS_FROM_SIGNATURE = 'argh_infer_args_from_signature'