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


Python optparse.IndentedHelpFormatter方法代码示例

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


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

示例1: cmd_install_module

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import IndentedHelpFormatter [as 别名]
def cmd_install_module(params):
    formatter = optparse.IndentedHelpFormatter()
    formatter.set_long_opt_delimiter(' ')

    usage = '%prog install-module [options]'
    parser = optparse.OptionParser(usage=usage, formatter=formatter)

    parser.add_option('--modules-directory', metavar='DIRECTORY',
            default=apxs_config.LIBEXECDIR)

    (options, args) = parser.parse_args(params)

    if len(args) != 0:
        parser.error('Incorrect number of arguments.')

    target = os.path.abspath(os.path.join(options.modules_directory,
            os.path.basename(MOD_WSGI_SO)))

    shutil.copyfile(where(), target)

    if _py_dylib:
        print('LoadFile "%s"' % _py_dylib)
    print('LoadModule wsgi_module "%s"' % target)
    print('WSGIPythonHome "%s"' % os.path.normpath(sys.prefix)) 
开发者ID:acaceres2176,项目名称:scylla,代码行数:26,代码来源:__init__.py

示例2: __init__

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import IndentedHelpFormatter [as 别名]
def __init__(self, *args, **kwargs):
        # help position must be aligned with __init__.parseopts.description
        kwargs['max_help_position'] = 30
        kwargs['indent_increment'] = 1
        kwargs['width'] = get_terminal_size()[0] - 2
        optparse.IndentedHelpFormatter.__init__(self, *args, **kwargs) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:8,代码来源:baseparser.py

示例3: expand_default

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import IndentedHelpFormatter [as 别名]
def expand_default(self, option):
        if self.parser is not None:
            self.parser._update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:6,代码来源:baseparser.py

示例4: format_heading

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import IndentedHelpFormatter [as 别名]
def format_heading(self, heading):
        """
        This translates any heading of "options" or "Options" into
        "SCons Options."  Unfortunately, we have to do this here,
        because those titles are hard-coded in the optparse calls.
        """
        if heading == 'Options':
            heading = "SCons Options"
        return optparse.IndentedHelpFormatter.format_heading(self, heading) 
开发者ID:Autodesk,项目名称:arnold-usd,代码行数:11,代码来源:SConsOptions.py

示例5: format_heading

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import IndentedHelpFormatter [as 别名]
def format_heading(self, heading):
        """
        This translates any heading of "options" or "Options" into
        "SCons Options."  Unfortunately, we have to do this here,
        because those titles are hard-coded in the optparse calls.
        """
        if heading == 'options':
            # The versions of optparse.py shipped with Pythons 2.3 and
            # 2.4 pass this in uncapitalized; override that so we get
            # consistent output on all versions.
            heading = "Options"
        if heading == 'Options':
            heading = "SCons Options"
        return optparse.IndentedHelpFormatter.format_heading(self, heading) 
开发者ID:bq,项目名称:web2board,代码行数:16,代码来源:SConsOptions.py

示例6: expand_default

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import IndentedHelpFormatter [as 别名]
def expand_default(self, option):
        if self.parser is not None:
            self.parser.update_defaults(self.parser.defaults)
        return optparse.IndentedHelpFormatter.expand_default(self, option) 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:6,代码来源:baseparser.py

示例7: __init__

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import IndentedHelpFormatter [as 别名]
def __init__(self, banner, *argv, **argd):
        self.banner = banner
        optparse.IndentedHelpFormatter.__init__(self, *argv, **argd) 
开发者ID:fabioz,项目名称:PyDev.Debugger,代码行数:5,代码来源:util.py

示例8: format_usage

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import IndentedHelpFormatter [as 别名]
def format_usage(self, usage):
        msg = optparse.IndentedHelpFormatter.format_usage(self, usage)
        return '%s\n%s' % (self.banner, msg)

# See Process.generate_memory_snapshot() 
开发者ID:fabioz,项目名称:PyDev.Debugger,代码行数:7,代码来源:util.py


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