CallTips.py 文件源码

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

项目:CodeReader 作者: jasonrbr 项目源码 文件源码
def get_object_at_cursor(self,
                             wordchars="._" + string.ascii_uppercase + string.ascii_lowercase + string.digits):
        # XXX - This needs to be moved to a better place
        # so the "." attribute lookup code can also use it.
        text = self.text
        chars = text.get("insert linestart", "insert")
        i = len(chars)
        while i and chars[i-1] in wordchars:
            i = i-1
        word = chars[i:]
        if word:
            # How is this for a hack!
            import sys, __main__
            namespace = sys.modules.copy()
            namespace.update(__main__.__dict__)
            try:
                    return eval(word, namespace)
            except:
                    pass
        return None # Can't find an object.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号