Last active
September 23, 2015 13:26
-
-
Save amontalenti/64ca33fd482fa9ad6a8f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #/bin/bash | |
| # weird one-liner to find top 100 Python imports in a project | |
| # stolen/customized from Chris H. Wiggins @ https://gist.github.com/chrishwiggins/7518300e0d8649d8d791 | |
| find . -name '*.py' | grep -v -e '/venv/' -e '(' -e ')' | \ | |
| xargs -I % grep import % | sed -e 's/^[ ]*//' | \ | |
| grep -e '^from ' -e '^import ' | awk '{print $2}' | \ | |
| sed -e 's/^[\.]*//' | cut -d\. -f1 | tr '[A-Z]' '[a-z]' | \ | |
| sort -bfd | uniq -c | sort -nr | head -100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment