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


Python OptionParser.__init__方法代码示例

本文整理汇总了Python中optparse.OptionParser.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python OptionParser.__init__方法的具体用法?Python OptionParser.__init__怎么用?Python OptionParser.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在optparse.OptionParser的用法示例。


在下文中一共展示了OptionParser.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from optparse import OptionParser [as 别名]
# 或者: from optparse.OptionParser import __init__ [as 别名]
def __init__(self, usage, default_section, config_file = None):
        """This is an option parser that reads defaults from a config file.
           It also allows specification of types for each option (unlike our mess
           that is mainline BitTorrent), and is only a slight extension on the
           classes provided in the Python standard libraries (unlike the
           wheel reinvention in mainline).

           @param usage: usage string for this application.
           @param default_section: section in the config file containing configuration
             for this service.  This is a default that can be overriden for
             individual options by passing section as a kwarg to add_option.
        """
        self._default_section = default_section
        OptionParser.__init__(self,usage)
        RawConfigParser.__init__(self)
        if config_file:
            self.read(config_file) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:19,代码来源:opt.py

示例2: __init__

# 需要导入模块: from optparse import OptionParser [as 别名]
# 或者: from optparse.OptionParser import __init__ [as 别名]
def __init__(self, hr):
        self.hr = hr 
开发者ID:opensourcesec,项目名称:CIRTKit,代码行数:4,代码来源:cbcmd.py

示例3: __init__

# 需要导入模块: from optparse import OptionParser [as 别名]
# 或者: from optparse.OptionParser import __init__ [as 别名]
def __init__(self, unsaved_options=None):
        OptionParser.__init__(self, unsaved_options) 
开发者ID:CanonicalLtd,项目名称:landscape-client,代码行数:4,代码来源:config.py

示例4: __init__

# 需要导入模块: from optparse import OptionParser [as 别名]
# 或者: from optparse.OptionParser import __init__ [as 别名]
def __init__(self):
		OptionParser.__init__(self, version="%%prog %s" % __version__)

		group = OptionGroup(self, "Network Options")
		group.add_option("-H", "--host",
			dest="host", default=config.get('gntp', 'hostname'),
			help="Specify a hostname to which to send a remote notification. [%default]")
		group.add_option("--port",
			dest="port", default=config.getint('gntp', 'port'), type="int",
			help="port to listen on [%default]")
		group.add_option("-P", "--password",
			dest='password', default=config.get('gntp', 'password'),
			help="Network password")
		self.add_option_group(group)

		group = OptionGroup(self, "Notification Options")
		group.add_option("-n", "--name",
			dest="app", default='Python GNTP Test Client',
			help="Set the name of the application [%default]")
		group.add_option("-s", "--sticky",
			dest='sticky', default=False, action="store_true",
			help="Make the notification sticky [%default]")
		group.add_option("--image",
			dest="icon", default=None,
			help="Icon for notification (URL or /path/to/file)")
		group.add_option("-m", "--message",
			dest="message", default=None,
			help="Sets the message instead of using stdin")
		group.add_option("-p", "--priority",
			dest="priority", default=0, type="int",
			help="-2 to 2 [%default]")
		group.add_option("-d", "--identifier",
			dest="identifier",
			help="Identifier for coalescing")
		group.add_option("-t", "--title",
			dest="title", default=None,
			help="Set the title of the notification [%default]")
		group.add_option("-N", "--notification",
			dest="name", default='Notification',
			help="Set the notification name [%default]")
		group.add_option("--callback",
			dest="callback",
			help="URL callback")
		self.add_option_group(group)

		# Extra Options
		self.add_option('-v', '--verbose',
			dest='verbose', default=0, action='count',
			help="Verbosity levels") 
开发者ID:caronc,项目名称:apprise,代码行数:51,代码来源:cli.py


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