pkg_resources is expensive to load, and it's an external module provided
by the setuptools project.
Let's use importlib.metadata from Python 3.8+'s stdlib when available, which
is much faster. This also erases setuptools from thefuck's runtime
dependency.
Simple benchmark data for `thefuck --version`:
Before: 0.602s
After: 0.169s
Improves performance in WSL
Fix#1036
* Add excluded_search_path_prefixes setting
Allows filtering the paths used to search for commands
Can be useful to filter out /mnt/ in WSL for performance
* Add test for excluded_search_path_prefixes
* Apply suggestions from code review
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
For some reason, the index used by GH Actions is not considering the
requesting Python version to decide which package version to deliver.
This is unnecessary for the official index and will be removed once we
drop support to Python 2.
* adding in files for the cd-cs feature
* Updated thefuck/rules/cd_cs.py comments to be more verbose
Thanks Scorphus!
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
* Updating the rules file to exclude the \xe2 character
This character(–) has lead to the commit failing some of the tests.
I am removing it from the code and we should see the tests pass now.
* Setting the encoding in thefuck/rules/cd_cs.py
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
Co-authored-by: SID SHARDANAND <sshardan@deakin.edu.au>
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
* add conda rules
* revert
* add conda
* add to readme and flake
* consistency with quotes and use for_app
* Update thefuck/rules/conda_mistype.py
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
Some git hosts will copy the entire clone command, while others just
copy the url, so typing "git clone ", then pasting a git url that
already has a "git clone " on the front is a somewhat common issue.
* add mistyping support for git lfs
* add the rule
* fix flake8
* flake8
* add to readme
* use fixtures and regex
* get rid of additional matched strings
* Added pacman invalid option rule
* Added test
* flake8 fixes
* Test changes
* Test fix
* Typo - again
* Travis test fix
* More Travis
* Even more travis
* I hope im right here
* Update README.md
Co-Authored-By: Pablo Aguiar <scorphus@gmail.com>
* Update thefuck/rules/pacman_invalid_option.py
Co-Authored-By: Pablo Aguiar <scorphus@gmail.com>
Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
* Add choco_install rule
Adds a rule to append '.install' to a chocolatey install command that
failed because of a non-existent package.
TODO: add support for other suffixes (.portable), find more parameter
cases
* Apply suggestions from code review
Circling back to retest
Co-Authored-By: Pablo Aguiar <scorphus@gmail.com>
* Fixed errors from suggested changes
* Added more test cases, refactored parsing
* Reformat keyword detection if statement
* Fixed flake errors
* Added tests for match
* Add rule to remove shell prompt literals $
Rule added to handle cases where the $ symbol is used in the command,
this usually happens when the command is copy pasted from a
documentation that includes the shell prompt symbol in the code blocks.
* Change files using black and flake8 style check
* Refactor tests and rule
- Refactor test for cleaner test tables
- Removed unnecessary requires_output=True option
* switch korean letters to english
* revised according to recent changes
* Fix typo in tests/test_switch_lang.py
* Add a test case for coverage
* Change: Moved decomposing logic which changes command.script to get_new_command instead of match.
* Fix: changed unicode characters to unicode string for python2 compatibility.
* Fix: Modified to change request.
@ik1ne @yangkyeongmo