本文整理汇总了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"
示例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'