开发者

Is there a script to manage/search python snippets which understands python code like nullege.com?

开发者 https://www.devze.com 2023-01-13 09:59 出处:网络
I ha开发者_开发百科ve a folder full of python snippets and want to search it in a more intelligent way than grep. Is there already a script which parses python snippets to AST and lets you search it,

I ha开发者_开发百科ve a folder full of python snippets and want to search it in a more intelligent way than grep. Is there already a script which parses python snippets to AST and lets you search it, like http://nullege.com?

For example, if you have the following code:

class InspectionFrame(wx.Frame):
    def SaveSettings(self, config):
        w, h = self.GetSize()

you should be able to search for wx.Frame.GetSize.


To my knowledge, ctags is a classic tool for such a task. As of now, python support in exuberant ctags is lacking, but some work have been done last year: http://ctags.sourceforge.net/news.html. Now indexing of classes, functions, class members, variables and imports are supported.


Your idea is awesome, I'd love to see that available. FFR, this won't do what you want but it's way better than for grep for code searching: ack, it's "better than grep".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号