Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 400
Peter Hoffmann Avatar asked Aug 30 '10 08:08

Peter Hoffmann


1 Answers

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.

like image 74
fungusakafungus Avatar answered Oct 11 '22 10:10

fungusakafungus