A semantic search engine for source code https://bitshift.benkurtovic.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
513 B

  1. #!/usr/bin/env python
  2. from json import loads
  3. from sys import argv
  4. from urllib import urlencode
  5. from urllib2 import urlopen
  6. def get_function(name):
  7. params = {"q": "lang:python and func:def:%s" % name}
  8. request = urlopen("http://bitshift.it/search.json?" + urlencode(params))
  9. res = loads(request.read())["results"]
  10. if res:
  11. print "%s: %s" % (name, res[0]["url"])
  12. else:
  13. print "%s not found." % name
  14. if __name__ == "__main__":
  15. if len(argv) == 2:
  16. get_function(argv[1])