本文整理汇总了Python中matplotlib.cbook.dedent方法的典型用法代码示例。如果您正苦于以下问题:Python cbook.dedent方法的具体用法?Python cbook.dedent怎么用?Python cbook.dedent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.cbook
的用法示例。
在下文中一共展示了cbook.dedent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dedent
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import dedent [as 别名]
def dedent(func):
"Dedent a docstring (if present)"
func.__doc__ = func.__doc__ and cbook.dedent(func.__doc__)
return func
示例2: dedent_interpd
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import dedent [as 别名]
def dedent_interpd(func):
"""A special case of the interpd that first performs a dedent on
the incoming docstring"""
if isinstance(func, types.MethodType) and sys.version_info[0] < 3:
func = func.im_func
return interpd(dedent(func))
示例3: copy_dedent
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import dedent [as 别名]
def copy_dedent(source):
"""A decorator that will copy the docstring from the source and
then dedent it"""
# note the following is ugly because "Python is not a functional
# language" - GVR. Perhaps one day, functools.compose will exist.
# or perhaps not.
# http://mail.python.org/pipermail/patches/2007-February/021687.html
return lambda target: dedent(copy(source)(target))
示例4: get_scale_docs
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import dedent [as 别名]
def get_scale_docs():
"""
Helper function for generating docstrings related to scales.
"""
docs = []
for name in get_scale_names():
scale_class = _scale_mapping[name]
docs.append(" '%s'" % name)
docs.append("")
class_docs = dedent(scale_class.__init__.__doc__)
class_docs = "".join([" %s\n" %
x for x in class_docs.split("\n")])
docs.append(class_docs)
docs.append("")
return "\n".join(docs)
示例5: dedent_interpd
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import dedent [as 别名]
def dedent_interpd(func):
"""A special case of the interpd that first performs a dedent on
the incoming docstring"""
if isinstance(func, types.MethodType) and not six.PY3:
func = func.im_func
return interpd(dedent(func))
示例6: dedent_interpd
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import dedent [as 别名]
def dedent_interpd(func):
"""A special case of the interpd that first performs a dedent on
the incoming docstring"""
return interpd(dedent(func))
示例7: get_scale_docs
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import dedent [as 别名]
def get_scale_docs():
"""
Helper function for generating docstrings related to scales.
"""
docs = []
for name in get_scale_names():
scale_class = _scale_mapping[name]
docs.append(" '%s'" % name)
docs.append("")
class_docs = cbook.dedent(scale_class.__init__.__doc__)
class_docs = "".join([" %s\n" %
x for x in class_docs.split("\n")])
docs.append(class_docs)
docs.append("")
return "\n".join(docs)
示例8: parse_options
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import dedent [as 别名]
def parse_options():
doc = (__doc__ and __doc__.split('\n\n')) or " "
op = OptionParser(description=doc[0].strip(),
usage='%prog [options] [--] [backends and switches]',
#epilog='\n'.join(doc[1:]) # epilog not supported on my python2.4 machine: JDH
)
op.disable_interspersed_args()
op.set_defaults(dirs='pylab,api,units,mplot3d',
clean=False, coverage=False, valgrind=False)
op.add_option('-d', '--dirs', '--directories', type='string',
dest='dirs', help=dedent('''
Run only the tests in these directories; comma-separated list of
one or more of: pylab (or pylab_examples), api, units, mplot3d'''))
op.add_option('-b', '--backends', type='string', dest='backends',
help=dedent('''
Run tests only for these backends; comma-separated list of
one or more of: agg, ps, svg, pdf, template, cairo,
Default is everything except cairo.'''))
op.add_option('--clean', action='store_true', dest='clean',
help='Remove result directories, run no tests')
op.add_option('-c', '--coverage', action='store_true', dest='coverage',
help='Run in coverage.py')
op.add_option('-v', '--valgrind', action='store_true', dest='valgrind',
help='Run in valgrind')
options, args = op.parse_args()
switches = [x for x in args if x.startswith('--')]
backends = [x.lower() for x in args if not x.startswith('--')]
if options.backends:
backends += [be.lower() for be in options.backends.split(',')]
result = Bunch(
dirs=options.dirs.split(','),
backends=backends or ['agg', 'ps', 'svg', 'pdf', 'template'],
clean=options.clean,
coverage=options.coverage,
valgrind=options.valgrind,
switches=switches)
if 'pylab_examples' in result.dirs:
result.dirs[result.dirs.index('pylab_examples')] = 'pylab'
return result