python.plugin.zsh 637 B

12345678910111213141516
  1. # Find python file
  2. alias pyfind='find . -name "*.py"'
  3. # Remove python compiled byte-code and mypy/pytest cache in either the current
  4. # directory or in a list of specified directories (including sub directories).
  5. function pyclean() {
  6. ZSH_PYCLEAN_PLACES=${*:-'.'}
  7. find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete
  8. find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete
  9. find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".mypy_cache" -exec rm -r "{}" +
  10. find ${ZSH_PYCLEAN_PLACES} -depth -type d -name ".pytest_cache" -exec rm -r "{}" +
  11. }
  12. # Grep among .py files
  13. alias pygrep='grep -r --include="*.py"'