generic_bot.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:slack-today-i-did 作者: eeue56 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号