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