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

2

11

I have 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.

Mythologize answered 30/8, 2010 at 8:59 Comment(1)
+1 for pointing out nullege.comAdopt
C
2

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.

Comma answered 4/9, 2010 at 13:42 Comment(0)
D
1

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".

Diagnostician answered 31/8, 2010 at 17:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.