本文整理汇总了Python中matplotlib.docstring.startswith函数的典型用法代码示例。如果您正苦于以下问题:Python startswith函数的具体用法?Python startswith怎么用?Python startswith使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了startswith函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_valid_values
def get_valid_values(self, attr):
"""
Get the legal arguments for the setter associated with *attr*.
This is done by querying the docstring of the function *set_attr*
for a line that begins with ACCEPTS:
e.g., for a line linestyle, return
"[ ``'-'`` | ``'--'`` | ``'-.'`` | ``':'`` | ``'steps'`` | ``'None'``
]"
"""
name = "set_%s" % attr
if not hasattr(self.o, name):
raise AttributeError("%s has no function %s" % (self.o, name))
func = getattr(self.o, name)
docstring = func.__doc__
if docstring is None:
return "unknown"
if docstring.startswith("alias for "):
return None
match = self._get_valid_values_regex.search(docstring)
if match is not None:
return match.group(1).replace("\n", " ")
return "unknown"
开发者ID:fonnesbeck,项目名称:matplotlib,代码行数:28,代码来源:artist.py
示例2: get_valid_values
def get_valid_values(self, attr):
"""
Get the legal arguments for the setter associated with *attr*.
This is done by querying the docstring of the function *set_attr*
for a line that begins with ACCEPTS:
Eg., for a line linestyle, return
[ '-' | '--' | '-.' | ':' | 'steps' | 'None' ]
"""
name = 'set_%s'%attr
if not hasattr(self.o, name):
raise AttributeError('%s has no function %s'%(self.o,name))
func = getattr(self.o, name)
docstring = func.__doc__
if docstring is None: return 'unknown'
if docstring.startswith('alias for '):
return None
match = self._get_valid_values_regex.search(docstring)
if match is not None:
return match.group(1).replace('\n', ' ')
return 'unknown'
开发者ID:zoccolan,项目名称:eyetracker,代码行数:26,代码来源:artist.py
注:本文中的matplotlib.docstring.startswith函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论