Download Pytorch/Tools/scripts/google.py from RayTBRP/codellama-CodeLlama-7b-Python-hf: direct link, hf CLI and curl.
- Browser
- Download file 501 Bytes
-
https://huggingface.co/RayTBRP/codellama-CodeLlama-7b-Python-hf/resolve/236d801463903c4a84f208b9f0f0ebf153a69080/Pytorch/Tools/scripts/google.py
- Command line
-
hf download hf://RayTBRP/codellama-CodeLlama-7b-Python-hf@236d801463903c4a84f208b9f0f0ebf153a69080/Pytorch/Tools/scripts/google.py
-
curl -L -o google.py https://huggingface.co/RayTBRP/codellama-CodeLlama-7b-Python-hf/resolve/236d801463903c4a84f208b9f0f0ebf153a69080/Pytorch/Tools/scripts/google.py
501 Bytes
| #! /usr/bin/env python3 | |
| """Script to search with Google | |
| Usage: | |
| python3 google.py [search terms] | |
| """ | |
| import sys | |
| import urllib.parse | |
| import webbrowser | |
| def main(args): | |
| def quote(arg): | |
| if ' ' in arg: | |
| arg = '"%s"' % arg | |
| return urllib.parse.quote_plus(arg) | |
| qstring = '+'.join(quote(arg) for arg in args) | |
| url = urllib.parse.urljoin('https://www.google.com/search', '?q=' + qstring) | |
| webbrowser.open(url) | |
| if __name__ == '__main__': | |
| main(sys.argv[1:]) | |