repl.py 文件源码

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

项目:Dumb-Cogs 作者: irdumbs 项目源码 文件源码
def rtfs(self, ctx, *, thing: str):
        """tries to show the source file of a thing

        thing may be a non-builtin module, class, method, function, traceback, frame, or code object,
        or if surrounded by single or double quotes,
            a space separated discord.ext.commands call,
            or a period deliminated file/module path as used when importing"""
        msg = ctx.message

        variables = {
            'ctx': ctx,
            'bot': self.bot,
            'message': msg,
            'server': msg.server,
            'channel': msg.channel,
            'author': msg.author
        }

        def call(thing, variables):
            return self.repl_format_source(eval(thing, variables))

        closure = _close(call, thing, variables)
        await self.print_results(ctx, _call_catch_fmt(closure, 0))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号