def functions_that_return(self, channel: str, text: str) -> ChannelMessages:
""" give a type, return functions that return things of that type
"""
func_names = []
text = text.strip()
text = html.unescape(text)
for (name, func) in self.known_functions().items():
if str(func.__annotations__.get('return', None)) == text:
func_names.append((name, func.__annotations__))
message = f"The following functions return `{text}`:\n"
message += '```\n'
message += '\n'.join(name for (name, type) in func_names)
message += '\n```'
return ChannelMessage(channel, message)
评论列表
文章目录