本文整理汇总了Python中optparse.IndentedHelpFormatter.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python IndentedHelpFormatter.__init__方法的具体用法?Python IndentedHelpFormatter.__init__怎么用?Python IndentedHelpFormatter.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类optparse.IndentedHelpFormatter
的用法示例。
在下文中一共展示了IndentedHelpFormatter.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__ (self,
indent_increment=2,
max_help_position=32,
width=78,
short_first=1):
IndentedHelpFormatter.__init__(
self, indent_increment, max_help_position,
width, short_first)
示例2: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self, *args, **kwargs):
from textwrap import fill, wrap
IndentedHelpFormatter.__init__(self, *args, **kwargs)
tw = type('textwrap_mock', (object, ), dict(
fill=staticmethod(fill),
wrap=staticmethod(lambda *args, **kwargs:
wrap(*args, **dict(kwargs, break_on_hyphens=False)),
)))
self.format_option.__globals__['textwrap'] = tw
示例3: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self,
indent_increment=0,
max_help_position=80,
width=None,
short_first=1):
IndentedHelpFormatter.__init__(self,
indent_increment=indent_increment,
max_help_position=max_help_position,
width=width,
short_first=short_first)
示例4: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self, banner, *argv, **argd):
self.banner = banner
IndentedHelpFormatter.__init__(self, *argv, **argd)
示例5: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self, *args, **kwargs):
IndentedHelpFormatter.__init__(self, *args, **kwargs)
示例6: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self):
# indent incr, max_help_pos, width, short_first
IndentedHelpFormatter.__init__(self, 2, 26, None, 1)
示例7: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self, heading):
self.heading = heading
IndentedHelpFormatter.__init__(self)
示例8: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self, subcommand_arg_summaries, *args, **kwargs):
self.subcommand_arg_summaries = subcommand_arg_summaries
IndentedHelpFormatter.__init__(self, *args, **kwargs)
示例9: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self, *args, **kwargs):
IndentedHelpFormatter.__init__(self, *args, **kwargs)
self.help_position = 0
示例10: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self):
IndentedHelpFormatter.__init__(self)
示例11: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self, *args, **kwargs):
IndentedHelpFormatter.__init__(self, *args, **kwargs)
self.envvar_tag = "%envvar"
示例12: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self,
metavar_format=' <{}>',
metavar_column=None,
option_separator=', ',
align_long_opts=False,
help_string_formatter=None,
preformatted_description=True,
preformatted_epilog=True,
*args, **kw):
"""
:arg metavar_format:
Evaluated as `metavar_format.format(metavar)` if string.
If callable, evaluated as `metavar_format(metavar)`.
:arg metavar_column:
Column to which all metavars should be aligned.
:arg option_separator:
String between short and long option. E.g: ', ' -> '-f, --format'.
:arg align_long_opts:
Align all long options on the current indent level to the same
column. For example:
align_long_opts=False align_long_opts=True
-------------------------- --------------------------
-h, --help show this ... -h, --help show this ...
--fast avoid slow ... --fast avoid slow ...
:arg help_string_format:
Function to call to call on help string after expansion. Called
as `help_string_format(help, option)`.
:arg preformatted_description:
If True, description will be displayed as-is, instead of
text-wrapping it first.
:arg preformatted_description:
If True, epilog will be displayed as-is, instead of
text-wrapping it first.
:arg width:
Maximum help message width. Defaults to 78 unless $COLUMNS is set.
"""
if not callable(metavar_format):
func = partial(format_option_metavar, fmt=metavar_format)
else:
func = metavar_format
self.metavar_format = func
self.metavar_column = metavar_column
self.align_long_opts = align_long_opts
self.option_separator = option_separator
self.help_string_formatter = help_string_formatter
if 'width' not in kw:
try:
kw['width'] = int(os.environ['COLUMNS']) - 2
except (KeyError, ValueError):
kw['width'] = 78
kw['max_help_position'] = kw.get('max_help_position', kw['width'])
kw['indent_increment'] = kw.get('indent_increment', 1)
kw['short_first'] = kw.get('short_first', 1)
# leave full control of description and epilog to us
self.preformatted_description = preformatted_description
self.preformatted_epilog = preformatted_epilog
IndentedHelpFormatter.__init__(self, *args, **kw)
示例13: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self, output):
IndentedHelpFormatter.__init__(self)
self.output = output
示例14: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self):
IndentedHelpFormatter.__init__(self)
self.max_help_position = 50
self.width = 120
示例15: __init__
# 需要导入模块: from optparse import IndentedHelpFormatter [as 别名]
# 或者: from optparse.IndentedHelpFormatter import __init__ [as 别名]
def __init__(self):
IndentedHelpFormatter.__init__(self,
width=min(get_terminal_size()[0], 80) - 2)
self.default_tag = ''