本文整理匯總了Python中argparse.ArgumentParser.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python ArgumentParser.__init__方法的具體用法?Python ArgumentParser.__init__怎麽用?Python ArgumentParser.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類argparse.ArgumentParser
的用法示例。
在下文中一共展示了ArgumentParser.__init__方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_execute_exception
# 需要導入模塊: from argparse import ArgumentParser [as 別名]
# 或者: from argparse.ArgumentParser import __init__ [as 別名]
def test_execute_exception(self):
self.par = ArgumentParser.__init__
self.trb = traceback.format_exc
self.err = logger.error
self.isu = git_issuer.handle_error
traceback.format_exc = Mock()
logger.error = Mock()
git_issuer.handle_error = Mock()
ArgumentParser.__init__ = Mock(side_effect=Exception)
cmdline.execute('True')
git_issuer.handle_error.assert_called_once()
ArgumentParser.__init__ = self.par
traceback.format_exc = self.trb
logger.error = self.err
git_issuer.handle_error = self.isu
示例2: __init__
# 需要導入模塊: from argparse import ArgumentParser [as 別名]
# 或者: from argparse.ArgumentParser import __init__ [as 別名]
def __init__(self, **kwargs):
"""Follow normal initialization and add BACpypes arguments."""
if _debug: ArgumentParser._debug("__init__")
if not _argparse_success:
raise ImportError("No module named argparse, install via pip or easy_install: https://pypi.python.org/pypi/argparse\n")
_ArgumentParser.__init__(self, **kwargs)
# add a way to get a list of the debugging hooks
self.add_argument("--buggers",
help="list the debugging logger names",
action="store_true",
)
# add a way to attach debuggers
self.add_argument('--debug', nargs='*',
help="add a log handler to each debugging logger",
)
# add a way to turn on color debugging
self.add_argument("--color",
help="turn on color debugging",
action="store_true",
)
示例3: __init__
# 需要導入模塊: from argparse import ArgumentParser [as 別名]
# 或者: from argparse.ArgumentParser import __init__ [as 別名]
def __init__(self,description, epilog=''):
ArgArgumentParser.__init__(self,description=description, epilog=epilog)
self.add_argument('--filename',
help='file to read openstack credentials from. If not set it take the environment variables' )
self.add_argument('-v', '--verbose', action='count', default=0,
help='increase output verbosity (use up to 3 times)'
'(not everywhere implemented)')
self.add_argument('--timeout', type=int, default=10,
help='amount of seconds until execution stops with unknown state (default 10 seconds)')
self.add_argument('--insecure',
default=False,
action='store_true',
help="Explicitly allow client to perform \"insecure\" "
"SSL (https) requests. The server's certificate will "
"not be verified against any certificate authorities. "
"This option should be used with caution.")
self.add_argument('--cacert',
help="Specify a CA bundle file to use in verifying a TLS"
"(https) server certificate.")
示例4: __init__
# 需要導入模塊: from argparse import ArgumentParser [as 別名]
# 或者: from argparse.ArgumentParser import __init__ [as 別名]
def __init__(self, argv, **kw):
self.__argv = argv
ArgumentParser.__init__(self, **kw)
示例5: __init__
# 需要導入模塊: from argparse import ArgumentParser [as 別名]
# 或者: from argparse.ArgumentParser import __init__ [as 別名]
def __init__(self):
self._data = {}
self._read()