當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。