当前位置: 首页>>代码示例>>Python>>正文


Python ArgumentParser.__init__方法代码示例

本文整理汇总了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 
开发者ID:Tribler,项目名称:Dollynator,代码行数:20,代码来源:test_cmdline.py

示例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",
            ) 
开发者ID:JoelBender,项目名称:bacpypes,代码行数:27,代码来源:consolelogging.py

示例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.") 
开发者ID:cirrax,项目名称:openstack-nagios-plugins,代码行数:22,代码来源:openstacknagios.py

示例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) 
开发者ID:eBay,项目名称:accelerator,代码行数:5,代码来源:shell.py

示例5: __init__

# 需要导入模块: from argparse import ArgumentParser [as 别名]
# 或者: from argparse.ArgumentParser import __init__ [as 别名]
def __init__(self):
        self._data = {}
        self._read() 
开发者ID:rpm-software-management,项目名称:dnf-plugin-system-upgrade,代码行数:5,代码来源:system_upgrade.py


注:本文中的argparse.ArgumentParser.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。