index int64 0 50.7k | project_path stringclasses 279
values | completion_path stringlengths 57 199 | signature_postion stringlengths 3 11 | class_position stringlengths 3 11 | function_name stringlengths 1 62 | class_name stringlengths 0 55 | body_position stringlengths 3 11 | body_position_with_comments stringlengths 3 11 | masked_class stringlengths 14 8.32k | masked_class_with_comment stringlengths 14 8.32k | func_body stringlengths 9 6.72k | func_body_with_comment stringlengths 9 6.72k | len_func_body int64 1 643 | len_input int64 10 2.02k | len_output int64 4 1.9k | total int64 20 2.05k | file_code stringlengths 14 442k | file_code_with_comment stringlengths 14 442k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
21,576 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_merge_unrelated.py | 10,12 | 1,13 | get_new_command | 12,13 | 12,13 | from thefuck.specific.git import git_support
@git_support
def match(command):
return ('merge' in command.script
and 'fatal: refusing to merge unrelated histories' in command.output)
@git_support
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.specific.git import git_support
@git_support
def match(command):
return ('merge' in command.script
and 'fatal: refusing to merge unrelated histories' in command.output)
@git_support
def get_new_command(command):
FILL_FUNC_BODY | return command.script + ' --allow-unrelated-histories'
| return command.script + ' --allow-unrelated-histories'
| 5 | 84 | 18 | 102 | from thefuck.specific.git import git_support
@git_support
def match(command):
return ('merge' in command.script
and 'fatal: refusing to merge unrelated histories' in command.output)
@git_support
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.specific.git import git_support
@git_support
def match(command):
return ('merge' in command.script
and 'fatal: refusing to merge unrelated histories' in command.output)
@git_support
def get_new_command(command):
FILL_FUNC_BODY | |
21,577 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_not_command.py | 13,15 | 1,19 | get_new_command | 15,19 | 15,19 | import re
from thefuck.utils import get_all_matched_commands, replace_command
from thefuck.specific.git import git_support
@git_support
def match(command):
return (" is not a git command. See 'git --help'." in command.output
and ('The most similar command' in command.output
or 'Did yo... | import re
from thefuck.utils import get_all_matched_commands, replace_command
from thefuck.specific.git import git_support
@git_support
def match(command):
return (" is not a git command. See 'git --help'." in command.output
and ('The most similar command' in command.output
or 'Did yo... | broken_cmd = re.findall(r"git: '([^']*)' is not a git command",
command.output)[0]
matched = get_all_matched_commands(command.output, ['The most similar command', 'Did you mean'])
return replace_command(command, broken_cmd, matched)
| broken_cmd = re.findall(r"git: '([^']*)' is not a git command",
command.output)[0]
matched = get_all_matched_commands(command.output, ['The most similar command', 'Did you mean'])
return replace_command(command, broken_cmd, matched)
| 24 | 124 | 83 | 207 | import re
from thefuck.utils import get_all_matched_commands, replace_command
from thefuck.specific.git import git_support
@git_support
def match(command):
return (" is not a git command. See 'git --help'." in command.output
and ('The most similar command' in command.output
or 'Did yo... | import re
from thefuck.utils import get_all_matched_commands, replace_command
from thefuck.specific.git import git_support
@git_support
def match(command):
return (" is not a git command. See 'git --help'." in command.output
and ('The most similar command' in command.output
or 'Did yo... | |
21,578 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_pull.py | 10,12 | 1,17 | get_new_command | 12,17 | 12,17 | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
return 'pull' in command.script and 'set-upstream' in command.output
@git_support
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
return 'pull' in command.script and 'set-upstream' in command.output
@git_support
def get_new_command(command):
FILL_FUNC_BODY | line = command.output.split('\n')[-3].strip()
branch = line.split(' ')[-1]
set_upstream = line.replace('<remote>', 'origin')\
.replace('<branch>', branch)
return shell.and_(set_upstream, command.script)
| line = command.output.split('\n')[-3].strip()
branch = line.split(' ')[-1]
set_upstream = line.replace('<remote>', 'origin')\
.replace('<branch>', branch)
return shell.and_(set_upstream, command.script)
| 16 | 84 | 82 | 166 | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
return 'pull' in command.script and 'set-upstream' in command.output
@git_support
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
return 'pull' in command.script and 'set-upstream' in command.output
@git_support
def get_new_command(command):
FILL_FUNC_BODY | |
21,579 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_pull_clone.py | 5,7 | 1,14 | match | 7,11 | 7,11 | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return replace_argument(command.script, 'pull', 'clone')
| from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return replace_argument(command.script, 'pull', 'clone')
| return ('fatal: Not a git repository' in command.output
and "Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)." in command.output)
| return ('fatal: Not a git repository' in command.output
and "Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)." in command.output)
| 18 | 79 | 56 | 135 | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return replace_argument(command.script, 'pull', 'clone')
| from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return replace_argument(command.script, 'pull', 'clone')
| |
21,580 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_pull_uncommitted_changes.py | 5,7 | 1,15 | match | 7,12 | 7,12 | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return shell.and_('git stash', 'git pull', 'git stash pop')
| from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return shell.and_('git stash', 'git pull', 'git stash pop')
| return ('pull' in command.script
and ('You have unstaged changes' in command.output
or 'contains uncommitted changes' in command.output))
| return ('pull' in command.script
and ('You have unstaged changes' in command.output
or 'contains uncommitted changes' in command.output))
| 17 | 83 | 47 | 130 | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return shell.and_('git stash', 'git pull', 'git stash pop')
| from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return shell.and_('git stash', 'git pull', 'git stash pop')
| |
21,581 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_push.py | 21,23 | 1,45 | get_new_command | 23,45 | 23,45 | import re
from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('push' in command.script_parts
and 'git push --set-upstream' in command.output)
def _get_upstream_option_index(command_parts):
if '--set-upstream' in command... | import re
from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('push' in command.script_parts
and 'git push --set-upstream' in command.output)
def _get_upstream_option_index(command_parts):
if '--set-upstream' in command... | # If --set-upstream or -u are passed, remove it and its argument. This is
# because the remaining arguments are concatenated onto the command suggested
# by git, which includes --set-upstream and its argument
command_parts = command.script_parts[:]
upstream_option_index = _get_upstream_option_index(... | # If --set-upstream or -u are passed, remove it and its argument. This is
# because the remaining arguments are concatenated onto the command suggested
# by git, which includes --set-upstream and its argument
command_parts = command.script_parts[:]
upstream_option_index = _get_upstream_option_index(... | 121 | 175 | 369 | 544 | import re
from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('push' in command.script_parts
and 'git push --set-upstream' in command.output)
def _get_upstream_option_index(command_parts):
if '--set-upstream' in command... | import re
from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('push' in command.script_parts
and 'git push --set-upstream' in command.output)
def _get_upstream_option_index(command_parts):
if '--set-upstream' in command... | |
21,582 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_push_different_branch_names.py | 5,7 | 1,13 | match | 7,10 | 7,10 | import re
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return re.findall(r'^ +(git push [^\s]+ [^\s]+)', command.output, re.MULTILINE)[0]
| import re
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return re.findall(r'^ +(git push [^\s]+ [^\s]+)', command.output, re.MULTILINE)[0]
| return "push" in command.script and "The upstream branch of your current branch does not match" in command.output
| return "push" in command.script and "The upstream branch of your current branch does not match" in command.output
| 17 | 96 | 33 | 129 | import re
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return re.findall(r'^ +(git push [^\s]+ [^\s]+)', command.output, re.MULTILINE)[0]
| import re
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return re.findall(r'^ +(git push [^\s]+ [^\s]+)', command.output, re.MULTILINE)[0]
| |
21,583 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_push_force.py | 5,7 | 1,19 | match | 7,13 | 7,13 | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return replace_argument(command.script, 'push', 'push --force-with-lease')
enabled_by_default = False
| from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return replace_argument(command.script, 'push', 'push --force-with-lease')
enabled_by_default = False
| return ('push' in command.script
and '! [rejected]' in command.output
and 'failed to push some refs to' in command.output
and 'Updates were rejected because the tip of your current branch is behind' in command.output)
| return ('push' in command.script
and '! [rejected]' in command.output
and 'failed to push some refs to' in command.output
and 'Updates were rejected because the tip of your current branch is behind' in command.output)
| 33 | 95 | 71 | 166 | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return replace_argument(command.script, 'push', 'push --force-with-lease')
enabled_by_default = False
| from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return replace_argument(command.script, 'push', 'push --force-with-lease')
enabled_by_default = False
| |
21,584 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_push_pull.py | 6,8 | 1,21 | match | 8,17 | 8,17 | from thefuck.shells import shell
from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return shell.and_(replace_argument(command.script, 'push', 'pull'),
command.scrip... | from thefuck.shells import shell
from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return shell.and_(replace_argument(command.script, 'push', 'pull'),
command.scrip... | return ('push' in command.script and
'! [rejected]' in command.output and
'failed to push some refs to' in command.output and
('Updates were rejected because the tip of your'
' current branch is behind' in command.output or
'Updates were rejected because... | return ('push' in command.script and
'! [rejected]' in command.output and
'failed to push some refs to' in command.output and
('Updates were rejected because the tip of your'
' current branch is behind' in command.output or
'Updates were rejected because... | 49 | 99 | 103 | 202 | from thefuck.shells import shell
from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return shell.and_(replace_argument(command.script, 'push', 'pull'),
command.scrip... | from thefuck.shells import shell
from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
return shell.and_(replace_argument(command.script, 'push', 'pull'),
command.scrip... | |
21,585 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_push_without_commits.py | 6,8 | 1,13 | match | 8,11 | 8,11 | import re
from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return shell.and_('git commit -m "Initial commit"', command.script)
| import re
from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return shell.and_('git commit -m "Initial commit"', command.script)
| return bool(re.search(r"src refspec \w+ does not match any", command.output))
| return bool(re.search(r"src refspec \w+ does not match any", command.output))
| 9 | 80 | 31 | 111 | import re
from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return shell.and_('git commit -m "Initial commit"', command.script)
| import re
from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return shell.and_('git commit -m "Initial commit"', command.script)
| |
21,586 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_rebase_merge_dir.py | 5,7 | 1,18 | match | 7,12 | 7,12 | from thefuck.utils import get_close_matches
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_list = ['git rebase --continue', 'git rebase --abort', 'git rebase --skip']
rm_cmd = command.output.split('\n')[-4]
com... | from thefuck.utils import get_close_matches
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_list = ['git rebase --continue', 'git rebase --abort', 'git rebase --skip']
rm_cmd = command.output.split('\n')[-4]
com... | return (' rebase' in command.script and
'It seems that there is already a rebase-merge directory' in command.output and
'I wonder if you are in the middle of another rebase' in command.output)
| return (' rebase' in command.script and
'It seems that there is already a rebase-merge directory' in command.output and
'I wonder if you are in the middle of another rebase' in command.output)
| 31 | 149 | 61 | 210 | from thefuck.utils import get_close_matches
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_list = ['git rebase --continue', 'git rebase --abort', 'git rebase --skip']
rm_cmd = command.output.split('\n')[-4]
com... | from thefuck.utils import get_close_matches
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_list = ['git rebase --continue', 'git rebase --abort', 'git rebase --skip']
rm_cmd = command.output.split('\n')[-4]
com... | |
21,587 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_rebase_no_changes.py | 4,6 | 1,14 | match | 6,12 | 6,12 | from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return 'git rebase --skip'
| from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return 'git rebase --skip'
| return (
{'rebase', '--continue'}.issubset(command.script_parts) and
'No changes - did you forget to use \'git add\'?' in command.output
)
| return (
{'rebase', '--continue'}.issubset(command.script_parts) and
'No changes - did you forget to use \'git add\'?' in command.output
)
| 18 | 56 | 58 | 114 | from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return 'git rebase --skip'
| from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return 'git rebase --skip'
| |
21,588 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_remote_delete.py | 11,13 | 1,14 | get_new_command | 13,14 | 13,14 | import re
from thefuck.specific.git import git_support
@git_support
def match(command):
return "remote delete" in command.script
@git_support
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.specific.git import git_support
@git_support
def match(command):
return "remote delete" in command.script
@git_support
def get_new_command(command):
FILL_FUNC_BODY | return re.sub(r"delete", "remove", command.script, 1)
| return re.sub(r"delete", "remove", command.script, 1)
| 5 | 68 | 22 | 90 | import re
from thefuck.specific.git import git_support
@git_support
def match(command):
return "remote delete" in command.script
@git_support
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.specific.git import git_support
@git_support
def match(command):
return "remote delete" in command.script
@git_support
def get_new_command(command):
FILL_FUNC_BODY | |
21,589 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_remote_seturl_add.py | 5,7 | 1,13 | match | 7,11 | 7,11 | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return replace_argument(command.script, 'set-url', 'add')
| from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return replace_argument(command.script, 'set-url', 'add')
| return ('set-url' in command.script
and 'fatal: No such remote' in command.output)
| return ('set-url' in command.script
and 'fatal: No such remote' in command.output)
| 11 | 76 | 34 | 110 | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return replace_argument(command.script, 'set-url', 'add')
| from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return replace_argument(command.script, 'set-url', 'add')
| |
21,590 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_rm_local_modifications.py | 4,6 | 1,20 | match | 6,11 | 6,11 | from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
index = command_parts.index('rm') + 1
command_parts.insert(index, '--cached')
command_list = [u' '.join(command_parts)]
com... | from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
index = command_parts.index('rm') + 1
command_parts.insert(index, '--cached')
command_list = [u' '.join(command_parts)]
com... | return (' rm ' in command.script and
'error: the following file has local modifications' in command.output and
'use --cached to keep the file, or -f to force removal' in command.output)
| return (' rm ' in command.script and
'error: the following file has local modifications' in command.output and
'use --cached to keep the file, or -f to force removal' in command.output)
| 30 | 144 | 59 | 203 | from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
index = command_parts.index('rm') + 1
command_parts.insert(index, '--cached')
command_list = [u' '.join(command_parts)]
com... | from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
index = command_parts.index('rm') + 1
command_parts.insert(index, '--cached')
command_list = [u' '.join(command_parts)]
com... | |
21,591 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_rm_recursive.py | 4,6 | 1,17 | match | 6,11 | 6,11 | from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
index = command_parts.index('rm') + 1
command_parts.insert(index, '-r')
return u' '.join(command_parts)
| from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
index = command_parts.index('rm') + 1
command_parts.insert(index, '-r')
return u' '.join(command_parts)
| return (' rm ' in command.script
and "fatal: not removing '" in command.output
and "' recursively without -r" in command.output)
| return (' rm ' in command.script
and "fatal: not removing '" in command.output
and "' recursively without -r" in command.output)
| 20 | 103 | 46 | 149 | from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
index = command_parts.index('rm') + 1
command_parts.insert(index, '-r')
return u' '.join(command_parts)
| from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
index = command_parts.index('rm') + 1
command_parts.insert(index, '-r')
return u' '.join(command_parts)
| |
21,592 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_rm_staged.py | 4,6 | 1,20 | match | 6,11 | 6,11 | from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
index = command_parts.index('rm') + 1
command_parts.insert(index, '--cached')
command_list = [u' '.join(command_parts)]
com... | from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
index = command_parts.index('rm') + 1
command_parts.insert(index, '--cached')
command_list = [u' '.join(command_parts)]
com... | return (' rm ' in command.script and
'error: the following file has changes staged in the index' in command.output and
'use --cached to keep the file, or -f to force removal' in command.output)
| return (' rm ' in command.script and
'error: the following file has changes staged in the index' in command.output and
'use --cached to keep the file, or -f to force removal' in command.output)
| 33 | 144 | 63 | 207 | from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
index = command_parts.index('rm') + 1
command_parts.insert(index, '--cached')
command_list = [u' '.join(command_parts)]
com... | from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
command_parts = command.script_parts[:]
index = command_parts.index('rm') + 1
command_parts.insert(index, '--cached')
command_list = [u' '.join(command_parts)]
com... | |
21,593 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_stash.py | 5,7 | 1,16 | match | 7,12 | 7,12 | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
formatme = shell.and_('git stash', '{}')
return formatme.format(command.script)
| from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
formatme = shell.and_('git stash', '{}')
return formatme.format(command.script)
| # catches "Please commit or stash them" and "Please, commit your changes or
# stash them before you can switch branches."
return 'or stash them' in command.output
| # catches "Please commit or stash them" and "Please, commit your changes or
# stash them before you can switch branches."
return 'or stash them' in command.output
| 27 | 90 | 53 | 143 | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
formatme = shell.and_('git stash', '{}')
return formatme.format(command.script)
| from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
formatme = shell.and_('git stash', '{}')
return formatme.format(command.script)
| |
21,594 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_stash_pop.py | 12,14 | 1,19 | get_new_command | 14,18 | 14,18 | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('stash' in command.script
and 'pop' in command.script
and 'Your local changes to the following files would be overwritten by merge' in command.output)
@git_support
def g... | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('stash' in command.script
and 'pop' in command.script
and 'Your local changes to the following files would be overwritten by merge' in command.output)
@git_support
def g... | return shell.and_('git add --update', 'git stash pop', 'git reset .')
# make it come before the other applicable rules
| return shell.and_('git add --update', 'git stash pop', 'git reset .')
# make it come before the other applicable rules
| 19 | 114 | 40 | 154 | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('stash' in command.script
and 'pop' in command.script
and 'Your local changes to the following files would be overwritten by merge' in command.output)
@git_support
def g... | from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('stash' in command.script
and 'pop' in command.script
and 'Your local changes to the following files would be overwritten by merge' in command.output)
@git_support
def g... | |
21,595 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_tag_force.py | 11,13 | 1,14 | get_new_command | 13,14 | 13,14 | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('tag' in command.script_parts
and 'already exists' in command.output)
@git_support
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('tag' in command.script_parts
and 'already exists' in command.output)
@git_support
def get_new_command(command):
FILL_FUNC_BODY | return replace_argument(command.script, 'tag', 'tag --force')
| return replace_argument(command.script, 'tag', 'tag --force')
| 5 | 88 | 20 | 108 | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('tag' in command.script_parts
and 'already exists' in command.output)
@git_support
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
return ('tag' in command.script_parts
and 'already exists' in command.output)
@git_support
def get_new_command(command):
FILL_FUNC_BODY | |
21,596 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/git_two_dashes.py | 5,7 | 1,15 | match | 7,11 | 7,11 | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
to = command.output.split('`')[1]
return replace_argument(command.script, to[1:], to)
| from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
to = command.output.split('`')[1]
return replace_argument(command.script, to[1:], to)
| return ('error: did you mean `' in command.output
and '` (with two dashes ?)' in command.output)
| return ('error: did you mean `' in command.output
and '` (with two dashes ?)' in command.output)
| 16 | 95 | 38 | 133 | from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
to = command.output.split('`')[1]
return replace_argument(command.script, to[1:], to)
| from thefuck.utils import replace_argument
from thefuck.specific.git import git_support
@git_support
def match(command):
FILL_FUNC_BODY@git_support
def get_new_command(command):
to = command.output.split('`')[1]
return replace_argument(command.script, to[1:], to)
| |
21,597 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/go_run.py | 15,16 | 1,17 | get_new_command | 16,17 | 16,17 | from thefuck.utils import for_app
# Appends .go when compiling go files
#
# Example:
# > go run foo
# error: go run: no go files listed
@for_app('go')
def match(command):
return (command.script.startswith('go run ')
and not command.script.endswith('.go'))
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.utils import for_app
# Appends .go when compiling go files
#
# Example:
# > go run foo
# error: go run: no go files listed
@for_app('go')
def match(command):
return (command.script.startswith('go run ')
and not command.script.endswith('.go'))
def get_new_command(command):
FILL_FUNC_BODY | return command.script + '.go'
| return command.script + '.go'
| 4 | 114 | 11 | 125 | from thefuck.utils import for_app
# Appends .go when compiling go files
#
# Example:
# > go run foo
# error: go run: no go files listed
@for_app('go')
def match(command):
return (command.script.startswith('go run ')
and not command.script.endswith('.go'))
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.utils import for_app
# Appends .go when compiling go files
#
# Example:
# > go run foo
# error: go run: no go files listed
@for_app('go')
def match(command):
return (command.script.startswith('go run ')
and not command.script.endswith('.go'))
def get_new_command(command):
FILL_FUNC_BODY | |
21,598 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/go_unknown_command.py | 7,8 | 1,29 | get_golang_commands | 8,16 | 8,16 | from itertools import dropwhile, islice, takewhile
import subprocess
from thefuck.utils import get_closest, replace_argument, for_app, which, cache
def get_golang_commands():
FILL_FUNC_BODYif which('go'):
get_golang_commands = cache(which('go'))(get_golang_commands)
@for_app('go')
def match(command):
retur... | from itertools import dropwhile, islice, takewhile
import subprocess
from thefuck.utils import get_closest, replace_argument, for_app, which, cache
def get_golang_commands():
FILL_FUNC_BODYif which('go'):
get_golang_commands = cache(which('go'))(get_golang_commands)
@for_app('go')
def match(command):
retur... | proc = subprocess.Popen('go', stderr=subprocess.PIPE)
lines = [line.decode('utf-8').strip() for line in proc.stderr.readlines()]
lines = dropwhile(lambda line: line != 'The commands are:', lines)
lines = islice(lines, 2, None)
lines = takewhile(lambda line: line, lines)
return [line.split(' ')[0... | proc = subprocess.Popen('go', stderr=subprocess.PIPE)
lines = [line.decode('utf-8').strip() for line in proc.stderr.readlines()]
lines = dropwhile(lambda line: line != 'The commands are:', lines)
lines = islice(lines, 2, None)
lines = takewhile(lambda line: line, lines)
return [line.split(' ')[0... | 39 | 194 | 125 | 319 | from itertools import dropwhile, islice, takewhile
import subprocess
from thefuck.utils import get_closest, replace_argument, for_app, which, cache
def get_golang_commands():
FILL_FUNC_BODYif which('go'):
get_golang_commands = cache(which('go'))(get_golang_commands)
@for_app('go')
def match(command):
retur... | from itertools import dropwhile, islice, takewhile
import subprocess
from thefuck.utils import get_closest, replace_argument, for_app, which, cache
def get_golang_commands():
FILL_FUNC_BODYif which('go'):
get_golang_commands = cache(which('go'))(get_golang_commands)
@for_app('go')
def match(command):
retur... | |
21,599 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/gradle_no_task.py | 13,15 | 1,35 | _get_all_tasks | 15,31 | 15,31 | import re
from subprocess import Popen, PIPE
from thefuck.utils import for_app, eager, replace_command
regex = re.compile(r"Task '(.*)' (is ambiguous|not found)")
@for_app('gradle', 'gradlew')
def match(command):
return regex.findall(command.output)
@eager
def _get_all_tasks(gradle):
FILL_FUNC_BODYdef get_new_... | import re
from subprocess import Popen, PIPE
from thefuck.utils import for_app, eager, replace_command
regex = re.compile(r"Task '(.*)' (is ambiguous|not found)")
@for_app('gradle', 'gradlew')
def match(command):
return regex.findall(command.output)
@eager
def _get_all_tasks(gradle):
FILL_FUNC_BODYdef get_new_... | proc = Popen([gradle, 'tasks'], stdout=PIPE)
should_yield = False
for line in proc.stdout.readlines():
line = line.decode().strip()
if line.startswith('----'):
should_yield = True
continue
if not line.strip():
should_yield = False
cont... | proc = Popen([gradle, 'tasks'], stdout=PIPE)
should_yield = False
for line in proc.stdout.readlines():
line = line.decode().strip()
if line.startswith('----'):
should_yield = True
continue
if not line.strip():
should_yield = False
cont... | 41 | 185 | 148 | 333 | import re
from subprocess import Popen, PIPE
from thefuck.utils import for_app, eager, replace_command
regex = re.compile(r"Task '(.*)' (is ambiguous|not found)")
@for_app('gradle', 'gradlew')
def match(command):
return regex.findall(command.output)
@eager
def _get_all_tasks(gradle):
FILL_FUNC_BODYdef get_new_... | import re
from subprocess import Popen, PIPE
from thefuck.utils import for_app, eager, replace_command
regex = re.compile(r"Task '(.*)' (is ambiguous|not found)")
@for_app('gradle', 'gradlew')
def match(command):
return regex.findall(command.output)
@eager
def _get_all_tasks(gradle):
FILL_FUNC_BODYdef get_new_... | |
21,600 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/gradle_wrapper.py | 5,7 | 1,14 | match | 7,12 | 7,12 | import os
from thefuck.utils import for_app, which
@for_app('gradle')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return u'./gradlew {}'.format(' '.join(command.script_parts[1:]))
| import os
from thefuck.utils import for_app, which
@for_app('gradle')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return u'./gradlew {}'.format(' '.join(command.script_parts[1:]))
| return (not which(command.script_parts[0])
and 'not found' in command.output
and os.path.isfile('gradlew'))
| return (not which(command.script_parts[0])
and 'not found' in command.output
and os.path.isfile('gradlew'))
| 10 | 76 | 46 | 122 | import os
from thefuck.utils import for_app, which
@for_app('gradle')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return u'./gradlew {}'.format(' '.join(command.script_parts[1:]))
| import os
from thefuck.utils import for_app, which
@for_app('gradle')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return u'./gradlew {}'.format(' '.join(command.script_parts[1:]))
| |
21,601 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/grep_arguments_order.py | 17,18 | 1,24 | get_new_command | 18,24 | 18,24 | import os
from thefuck.utils import for_app
def _get_actual_file(parts):
for part in parts[1:]:
if os.path.isfile(part) or os.path.isdir(part):
return part
@for_app('grep', 'egrep')
def match(command):
return ': No such file or directory' in command.output \
and _get_actual_file(... | import os
from thefuck.utils import for_app
def _get_actual_file(parts):
for part in parts[1:]:
if os.path.isfile(part) or os.path.isdir(part):
return part
@for_app('grep', 'egrep')
def match(command):
return ': No such file or directory' in command.output \
and _get_actual_file(... | actual_file = _get_actual_file(command.script_parts)
parts = command.script_parts[::]
# Moves file to the end of the script:
parts.remove(actual_file)
parts.append(actual_file)
return ' '.join(parts)
| actual_file = _get_actual_file(command.script_parts)
parts = command.script_parts[::]
# Moves file to the end of the script:
parts.remove(actual_file)
parts.append(actual_file)
return ' '.join(parts)
| 20 | 137 | 79 | 216 | import os
from thefuck.utils import for_app
def _get_actual_file(parts):
for part in parts[1:]:
if os.path.isfile(part) or os.path.isdir(part):
return part
@for_app('grep', 'egrep')
def match(command):
return ': No such file or directory' in command.output \
and _get_actual_file(... | import os
from thefuck.utils import for_app
def _get_actual_file(parts):
for part in parts[1:]:
if os.path.isfile(part) or os.path.isdir(part):
return part
@for_app('grep', 'egrep')
def match(command):
return ': No such file or directory' in command.output \
and _get_actual_file(... | |
21,602 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/grep_recursive.py | 4,6 | 1,11 | match | 6,9 | 6,9 | from thefuck.utils import for_app
@for_app('grep')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return u'grep -r {}'.format(command.script[5:])
| from thefuck.utils import for_app
@for_app('grep')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return u'grep -r {}'.format(command.script[5:])
| return 'is a directory' in command.output.lower()
| return 'is a directory' in command.output.lower()
| 6 | 68 | 20 | 88 | from thefuck.utils import for_app
@for_app('grep')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return u'grep -r {}'.format(command.script[5:])
| from thefuck.utils import for_app
@for_app('grep')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return u'grep -r {}'.format(command.script[5:])
| |
21,603 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/grunt_task_not_found.py | 13,16 | 1,38 | _get_all_tasks | 16,32 | 16,32 | import re
from subprocess import Popen, PIPE
from thefuck.utils import for_app, eager, get_closest, cache
regex = re.compile(r'Warning: Task "(.*)" not found.')
@for_app('grunt')
def match(command):
return regex.findall(command.output)
@cache('Gruntfile.js')
@eager
def _get_all_tasks():
FILL_FUNC_BODYdef get_n... | import re
from subprocess import Popen, PIPE
from thefuck.utils import for_app, eager, get_closest, cache
regex = re.compile(r'Warning: Task "(.*)" not found.')
@for_app('grunt')
def match(command):
return regex.findall(command.output)
@cache('Gruntfile.js')
@eager
def _get_all_tasks():
FILL_FUNC_BODYdef get_n... | proc = Popen(['grunt', '--help'], stdout=PIPE)
should_yield = False
for line in proc.stdout.readlines():
line = line.decode().strip()
if 'Available tasks' in line:
should_yield = True
continue
if should_yield and not line:
return
if ' '... | proc = Popen(['grunt', '--help'], stdout=PIPE)
should_yield = False
for line in proc.stdout.readlines():
line = line.decode().strip()
if 'Available tasks' in line:
should_yield = True
continue
if should_yield and not line:
return
if ' '... | 38 | 213 | 127 | 340 | import re
from subprocess import Popen, PIPE
from thefuck.utils import for_app, eager, get_closest, cache
regex = re.compile(r'Warning: Task "(.*)" not found.')
@for_app('grunt')
def match(command):
return regex.findall(command.output)
@cache('Gruntfile.js')
@eager
def _get_all_tasks():
FILL_FUNC_BODYdef get_n... | import re
from subprocess import Popen, PIPE
from thefuck.utils import for_app, eager, get_closest, cache
regex = re.compile(r'Warning: Task "(.*)" not found.')
@for_app('grunt')
def match(command):
return regex.findall(command.output)
@cache('Gruntfile.js')
@eager
def _get_all_tasks():
FILL_FUNC_BODYdef get_n... | |
21,604 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/gulp_not_task.py | 19,20 | 1,23 | get_new_command | 20,23 | 20,23 | import re
import subprocess
from thefuck.utils import replace_command, for_app, cache
@for_app('gulp')
def match(command):
return 'is not in your gulpfile' in command.output
@cache('gulpfile.js')
def get_gulp_tasks():
proc = subprocess.Popen(['gulp', '--tasks-simple'],
stdout=sub... | import re
import subprocess
from thefuck.utils import replace_command, for_app, cache
@for_app('gulp')
def match(command):
return 'is not in your gulpfile' in command.output
@cache('gulpfile.js')
def get_gulp_tasks():
proc = subprocess.Popen(['gulp', '--tasks-simple'],
stdout=sub... | wrong_task = re.findall(r"Task '(\w+)' is not in your gulpfile",
command.output)[0]
return replace_command(command, wrong_task, get_gulp_tasks())
| wrong_task = re.findall(r"Task '(\w+)' is not in your gulpfile",
command.output)[0]
return replace_command(command, wrong_task, get_gulp_tasks())
| 14 | 162 | 59 | 221 | import re
import subprocess
from thefuck.utils import replace_command, for_app, cache
@for_app('gulp')
def match(command):
return 'is not in your gulpfile' in command.output
@cache('gulpfile.js')
def get_gulp_tasks():
proc = subprocess.Popen(['gulp', '--tasks-simple'],
stdout=sub... | import re
import subprocess
from thefuck.utils import replace_command, for_app, cache
@for_app('gulp')
def match(command):
return 'is not in your gulpfile' in command.output
@cache('gulpfile.js')
def get_gulp_tasks():
proc = subprocess.Popen(['gulp', '--tasks-simple'],
stdout=sub... | |
21,605 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/has_exists_script.py | 5,7 | 1,14 | match | 7,11 | 7,11 | import os
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return u'./{}'.format(command.script)
| import os
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return u'./{}'.format(command.script)
| return command.script_parts and os.path.exists(command.script_parts[0]) \
and 'command not found' in command.output
| return command.script_parts and os.path.exists(command.script_parts[0]) \
and 'command not found' in command.output
| 11 | 68 | 42 | 110 | import os
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return u'./{}'.format(command.script)
| import os
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return u'./{}'.format(command.script)
| |
21,606 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/heroku_multiple_apps.py | 5,7 | 1,13 | match | 7,10 | 7,10 | import re
from thefuck.utils import for_app
@for_app('heroku')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
apps = re.findall('([^ ]*) \\([^)]*\\)', command.output)
return [command.script + ' --app ' + app for app in apps]
| import re
from thefuck.utils import for_app
@for_app('heroku')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
apps = re.findall('([^ ]*) \\([^)]*\\)', command.output)
return [command.script + ' --app ' + app for app in apps]
| return 'https://devcenter.heroku.com/articles/multiple-environments' in command.output
| return 'https://devcenter.heroku.com/articles/multiple-environments' in command.output
| 4 | 95 | 32 | 127 | import re
from thefuck.utils import for_app
@for_app('heroku')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
apps = re.findall('([^ ]*) \\([^)]*\\)', command.output)
return [command.script + ' --app ' + app for app in apps]
| import re
from thefuck.utils import for_app
@for_app('heroku')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
apps = re.findall('([^ ]*) \\([^)]*\\)', command.output)
return [command.script + ' --app ' + app for app in apps]
| |
21,607 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/heroku_not_command.py | 5,7 | 1,12 | match | 7,10 | 7,10 | import re
from thefuck.utils import for_app
@for_app('heroku')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return re.findall('Run heroku _ to run ([^.]*)', command.output)[0]
| import re
from thefuck.utils import for_app
@for_app('heroku')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return re.findall('Run heroku _ to run ([^.]*)', command.output)[0]
| return 'Run heroku _ to run' in command.output
| return 'Run heroku _ to run' in command.output
| 8 | 76 | 20 | 96 | import re
from thefuck.utils import for_app
@for_app('heroku')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return re.findall('Run heroku _ to run ([^.]*)', command.output)[0]
| import re
from thefuck.utils import for_app
@for_app('heroku')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return re.findall('Run heroku _ to run ([^.]*)', command.output)[0]
| |
21,608 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/history.py | 5,6 | 1,16 | match | 6,10 | 6,10 | from thefuck.utils import get_close_matches, get_closest, \
get_valid_history_without_current
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return get_closest(command.script,
get_valid_history_without_current(command))
priority = 9999
| from thefuck.utils import get_close_matches, get_closest, \
get_valid_history_without_current
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return get_closest(command.script,
get_valid_history_without_current(command))
priority = 9999
| return len(get_close_matches(command.script,
get_valid_history_without_current(command)))
| return len(get_close_matches(command.script,
get_valid_history_without_current(command)))
| 3 | 96 | 36 | 132 | from thefuck.utils import get_close_matches, get_closest, \
get_valid_history_without_current
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return get_closest(command.script,
get_valid_history_without_current(command))
priority = 9999
| from thefuck.utils import get_close_matches, get_closest, \
get_valid_history_without_current
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return get_closest(command.script,
get_valid_history_without_current(command))
priority = 9999
| |
21,609 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/hostscli.py | 19,21 | 1,28 | get_new_command | 21,28 | 21,28 | import re
from thefuck.specific.sudo import sudo_support
from thefuck.utils import replace_command, for_app
no_command = "Error: No such command"
no_website = "hostscli.errors.WebsiteImportError"
@sudo_support
@for_app('hostscli')
def match(command):
errors = [no_command, no_website]
for error in errors:
... | import re
from thefuck.specific.sudo import sudo_support
from thefuck.utils import replace_command, for_app
no_command = "Error: No such command"
no_website = "hostscli.errors.WebsiteImportError"
@sudo_support
@for_app('hostscli')
def match(command):
errors = [no_command, no_website]
for error in errors:
... | if no_website in command.output:
return ['hostscli websites']
misspelled_command = re.findall(
r'Error: No such command ".*"', command.output)[0]
commands = ['block', 'unblock', 'websites', 'block_all', 'unblock_all']
return replace_command(command, misspelled_command, commands)
| if no_website in command.output:
return ['hostscli websites']
misspelled_command = re.findall(
r'Error: No such command ".*"', command.output)[0]
commands = ['block', 'unblock', 'websites', 'block_all', 'unblock_all']
return replace_command(command, misspelled_command, commands)
| 27 | 150 | 105 | 255 | import re
from thefuck.specific.sudo import sudo_support
from thefuck.utils import replace_command, for_app
no_command = "Error: No such command"
no_website = "hostscli.errors.WebsiteImportError"
@sudo_support
@for_app('hostscli')
def match(command):
errors = [no_command, no_website]
for error in errors:
... | import re
from thefuck.specific.sudo import sudo_support
from thefuck.utils import replace_command, for_app
no_command = "Error: No such command"
no_website = "hostscli.errors.WebsiteImportError"
@sudo_support
@for_app('hostscli')
def match(command):
errors = [no_command, no_website]
for error in errors:
... | |
21,610 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/ifconfig_device_not_found.py | 11,13 | 1,24 | _get_possible_interfaces | 13,20 | 13,20 | import subprocess
from thefuck.utils import for_app, replace_command, eager
@for_app('ifconfig')
def match(command):
return 'error fetching interface information: Device not found' \
in command.output
@eager
def _get_possible_interfaces():
FILL_FUNC_BODYdef get_new_command(command):
interface = c... | import subprocess
from thefuck.utils import for_app, replace_command, eager
@for_app('ifconfig')
def match(command):
return 'error fetching interface information: Device not found' \
in command.output
@eager
def _get_possible_interfaces():
FILL_FUNC_BODYdef get_new_command(command):
interface = c... | proc = subprocess.Popen(['ifconfig', '-a'], stdout=subprocess.PIPE)
for line in proc.stdout.readlines():
line = line.decode()
if line and line != '\n' and not line.startswith(' '):
yield line.split(' ')[0]
| proc = subprocess.Popen(['ifconfig', '-a'], stdout=subprocess.PIPE)
for line in proc.stdout.readlines():
line = line.decode()
if line and line != '\n' and not line.startswith(' '):
yield line.split(' ')[0]
| 25 | 143 | 87 | 230 | import subprocess
from thefuck.utils import for_app, replace_command, eager
@for_app('ifconfig')
def match(command):
return 'error fetching interface information: Device not found' \
in command.output
@eager
def _get_possible_interfaces():
FILL_FUNC_BODYdef get_new_command(command):
interface = c... | import subprocess
from thefuck.utils import for_app, replace_command, eager
@for_app('ifconfig')
def match(command):
return 'error fetching interface information: Device not found' \
in command.output
@eager
def _get_possible_interfaces():
FILL_FUNC_BODYdef get_new_command(command):
interface = c... | |
21,611 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/java.py | 11,13 | 1,18 | match | 13,16 | 13,16 | """Fixes common java command mistake
Example:
> java foo.java
Error: Could not find or load main class foo.java
"""
from thefuck.utils import for_app
@for_app('java')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script[:-5]
| """Fixes common java command mistake
Example:
> java foo.java
Error: Could not find or load main class foo.java
"""
from thefuck.utils import for_app
@for_app('java')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script[:-5]
| return command.script.endswith('.java')
| return command.script.endswith('.java')
| 2 | 91 | 18 | 109 | """Fixes common java command mistake
Example:
> java foo.java
Error: Could not find or load main class foo.java
"""
from thefuck.utils import for_app
@for_app('java')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script[:-5]
| """Fixes common java command mistake
Example:
> java foo.java
Error: Could not find or load main class foo.java
"""
from thefuck.utils import for_app
@for_app('java')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script[:-5]
| |
21,612 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/javac.py | 12,14 | 1,19 | match | 14,17 | 14,17 | """Appends .java when compiling java files
Example:
> javac foo
error: Class names, 'foo', are only accepted if annotation
processing is explicitly requested
"""
from thefuck.utils import for_app
@for_app('javac')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script + '.java'... | """Appends .java when compiling java files
Example:
> javac foo
error: Class names, 'foo', are only accepted if annotation
processing is explicitly requested
"""
from thefuck.utils import for_app
@for_app('javac')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script + '.java'... | return not command.script.endswith('.java')
| return not command.script.endswith('.java')
| 3 | 100 | 19 | 119 | """Appends .java when compiling java files
Example:
> javac foo
error: Class names, 'foo', are only accepted if annotation
processing is explicitly requested
"""
from thefuck.utils import for_app
@for_app('javac')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script + '.java'... | """Appends .java when compiling java files
Example:
> javac foo
error: Class names, 'foo', are only accepted if annotation
processing is explicitly requested
"""
from thefuck.utils import for_app
@for_app('javac')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script + '.java'... | |
21,613 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/lein_not_task.py | 14,16 | 1,20 | get_new_command | 16,20 | 16,20 | import re
from thefuck.utils import replace_command, get_all_matched_commands, for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('lein')
def match(command):
return (command.script.startswith('lein')
and "is not a task. See 'lein help'" in command.output
and 'Did... | import re
from thefuck.utils import replace_command, get_all_matched_commands, for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('lein')
def match(command):
return (command.script.startswith('lein')
and "is not a task. See 'lein help'" in command.output
and 'Did... | broken_cmd = re.findall(r"'([^']*)' is not a task",
command.output)[0]
new_cmds = get_all_matched_commands(command.output, 'Did you mean this?')
return replace_command(command, broken_cmd, new_cmds)
| broken_cmd = re.findall(r"'([^']*)' is not a task",
command.output)[0]
new_cmds = get_all_matched_commands(command.output, 'Did you mean this?')
return replace_command(command, broken_cmd, new_cmds)
| 19 | 135 | 81 | 216 | import re
from thefuck.utils import replace_command, get_all_matched_commands, for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('lein')
def match(command):
return (command.script.startswith('lein')
and "is not a task. See 'lein help'" in command.output
and 'Did... | import re
from thefuck.utils import replace_command, get_all_matched_commands, for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('lein')
def match(command):
return (command.script.startswith('lein')
and "is not a task. See 'lein help'" in command.output
and 'Did... | |
21,614 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/ln_no_hard_link.py | 15,17 | 1,24 | match | 17,21 | 17,21 | # -*- coding: utf-8 -*-
"""Suggest creating symbolic link if hard link is not allowed.
Example:
> ln barDir barLink
ln: ‘barDir’: hard link not allowed for directory
--> ln -s barDir barLink
"""
import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
d... | # -*- coding: utf-8 -*-
"""Suggest creating symbolic link if hard link is not allowed.
Example:
> ln barDir barLink
ln: ‘barDir’: hard link not allowed for directory
--> ln -s barDir barLink
"""
import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
d... | return (command.output.endswith("hard link not allowed for directory") and
command.script_parts[0] == 'ln')
| return (command.output.endswith("hard link not allowed for directory") and
command.script_parts[0] == 'ln')
| 11 | 144 | 40 | 184 | # -*- coding: utf-8 -*-
"""Suggest creating symbolic link if hard link is not allowed.
Example:
> ln barDir barLink
ln: ‘barDir’: hard link not allowed for directory
--> ln -s barDir barLink
"""
import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
d... | # -*- coding: utf-8 -*-
"""Suggest creating symbolic link if hard link is not allowed.
Example:
> ln barDir barLink
ln: ‘barDir’: hard link not allowed for directory
--> ln -s barDir barLink
"""
import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
d... | |
21,615 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/ln_s_order.py | 12,14 | 1,27 | match | 14,20 | 14,20 | import os
from thefuck.specific.sudo import sudo_support
def _get_destination(script_parts):
"""When arguments order is wrong first argument will be destination."""
for part in script_parts:
if part not in {'ln', '-s', '--symbolic'} and os.path.exists(part):
return part
@sudo_support
def... | import os
from thefuck.specific.sudo import sudo_support
def _get_destination(script_parts):
"""When arguments order is wrong first argument will be destination."""
for part in script_parts:
if part not in {'ln', '-s', '--symbolic'} and os.path.exists(part):
return part
@sudo_support
def... | return (command.script_parts[0] == 'ln'
and {'-s', '--symbolic'}.intersection(command.script_parts)
and 'File exists' in command.output
and _get_destination(command.script_parts))
| return (command.script_parts[0] == 'ln'
and {'-s', '--symbolic'}.intersection(command.script_parts)
and 'File exists' in command.output
and _get_destination(command.script_parts))
| 14 | 175 | 72 | 247 | import os
from thefuck.specific.sudo import sudo_support
def _get_destination(script_parts):
"""When arguments order is wrong first argument will be destination."""
for part in script_parts:
if part not in {'ln', '-s', '--symbolic'} and os.path.exists(part):
return part
@sudo_support
def... | import os
from thefuck.specific.sudo import sudo_support
def _get_destination(script_parts):
"""When arguments order is wrong first argument will be destination."""
for part in script_parts:
if part not in {'ln', '-s', '--symbolic'} and os.path.exists(part):
return part
@sudo_support
def... | |
21,616 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/long_form_help.py | 8,9 | 1,28 | match | 9,18 | 9,18 | from thefuck.utils import replace_argument
import re
# regex to match a suggested help command from the tool output
help_regex = r"(?:Run|Try) '([^']+)'(?: or '[^']+')? for (?:details|more information)."
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
if re.search(help_regex, command.output) is n... | from thefuck.utils import replace_argument
import re
# regex to match a suggested help command from the tool output
help_regex = r"(?:Run|Try) '([^']+)'(?: or '[^']+')? for (?:details|more information)."
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
if re.search(help_regex, command.output) is n... | if re.search(help_regex, command.output, re.I) is not None:
return True
if '--help' in command.output:
return True
return False
| if re.search(help_regex, command.output, re.I) is not None:
return True
if '--help' in command.output:
return True
return False
| 17 | 182 | 60 | 242 | from thefuck.utils import replace_argument
import re
# regex to match a suggested help command from the tool output
help_regex = r"(?:Run|Try) '([^']+)'(?: or '[^']+')? for (?:details|more information)."
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
if re.search(help_regex, command.output) is n... | from thefuck.utils import replace_argument
import re
# regex to match a suggested help command from the tool output
help_regex = r"(?:Run|Try) '([^']+)'(?: or '[^']+')? for (?:details|more information)."
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
if re.search(help_regex, command.output) is n... | |
21,617 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/ls_all.py | 4,6 | 1,11 | match | 6,9 | 6,9 | from thefuck.utils import for_app
@for_app('ls')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return ' '.join(['ls', '-A'] + command.script_parts[1:])
| from thefuck.utils import for_app
@for_app('ls')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return ' '.join(['ls', '-A'] + command.script_parts[1:])
| return command.output.strip() == ''
| return command.output.strip() == ''
| 4 | 69 | 16 | 85 | from thefuck.utils import for_app
@for_app('ls')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return ' '.join(['ls', '-A'] + command.script_parts[1:])
| from thefuck.utils import for_app
@for_app('ls')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return ' '.join(['ls', '-A'] + command.script_parts[1:])
| |
21,618 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/ls_lah.py | 9,10 | 1,13 | get_new_command | 10,13 | 10,13 | from thefuck.utils import for_app
@for_app('ls')
def match(command):
return command.script_parts and 'ls -' not in command.script
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.utils import for_app
@for_app('ls')
def match(command):
return command.script_parts and 'ls -' not in command.script
def get_new_command(command):
FILL_FUNC_BODY | command = command.script_parts[:]
command[0] = 'ls -lah'
return ' '.join(command)
| command = command.script_parts[:]
command[0] = 'ls -lah'
return ' '.join(command)
| 10 | 67 | 35 | 102 | from thefuck.utils import for_app
@for_app('ls')
def match(command):
return command.script_parts and 'ls -' not in command.script
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.utils import for_app
@for_app('ls')
def match(command):
return command.script_parts and 'ls -' not in command.script
def get_new_command(command):
FILL_FUNC_BODY | |
21,619 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/man.py | 9,10 | 1,34 | get_new_command | 10,34 | 10,34 | from thefuck.utils import for_app
@for_app('man', at_least=1)
def match(command):
return True
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.utils import for_app
@for_app('man', at_least=1)
def match(command):
return True
def get_new_command(command):
FILL_FUNC_BODY | if '3' in command.script:
return command.script.replace("3", "2")
if '2' in command.script:
return command.script.replace("2", "3")
last_arg = command.script_parts[-1]
help_command = last_arg + ' --help'
# If there are no man pages for last_arg, suggest `last_arg --help` instead.
... | if '3' in command.script:
return command.script.replace("3", "2")
if '2' in command.script:
return command.script.replace("2", "3")
last_arg = command.script_parts[-1]
help_command = last_arg + ' --help'
# If there are no man pages for last_arg, suggest `last_arg --help` instead.
... | 78 | 59 | 269 | 328 | from thefuck.utils import for_app
@for_app('man', at_least=1)
def match(command):
return True
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.utils import for_app
@for_app('man', at_least=1)
def match(command):
return True
def get_new_command(command):
FILL_FUNC_BODY | |
21,620 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/man_no_space.py | 1,2 | 1,11 | match | 2,6 | 2,6 | def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return u'man {}'.format(command.script[3:])
priority = 2000
| def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return u'man {}'.format(command.script[3:])
priority = 2000
| return (command.script.startswith(u'man')
and u'command not found' in command.output.lower())
| return (command.script.startswith(u'man')
and u'command not found' in command.output.lower())
| 8 | 53 | 38 | 91 | def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return u'man {}'.format(command.script[3:])
priority = 2000
| def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return u'man {}'.format(command.script[3:])
priority = 2000
| |
21,621 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/mercurial.py | 15,17 | 1,28 | match | 17,23 | 17,23 | import re
from thefuck.utils import get_closest, for_app
def extract_possibilities(command):
possib = re.findall(r'\n\(did you mean one of ([^\?]+)\?\)', command.output)
if possib:
return possib[0].split(', ')
possib = re.findall(r'\n ([^$]+)$', command.output)
if possib:
return pos... | import re
from thefuck.utils import get_closest, for_app
def extract_possibilities(command):
possib = re.findall(r'\n\(did you mean one of ([^\?]+)\?\)', command.output)
if possib:
return possib[0].split(', ')
possib = re.findall(r'\n ([^$]+)$', command.output)
if possib:
return pos... | return ('hg: unknown command' in command.output
and '(did you mean one of ' in command.output
or "hg: command '" in command.output
and "' is ambiguous:" in command.output)
| return ('hg: unknown command' in command.output
and '(did you mean one of ' in command.output
or "hg: command '" in command.output
and "' is ambiguous:" in command.output)
| 27 | 218 | 63 | 281 | import re
from thefuck.utils import get_closest, for_app
def extract_possibilities(command):
possib = re.findall(r'\n\(did you mean one of ([^\?]+)\?\)', command.output)
if possib:
return possib[0].split(', ')
possib = re.findall(r'\n ([^$]+)$', command.output)
if possib:
return pos... | import re
from thefuck.utils import get_closest, for_app
def extract_possibilities(command):
possib = re.findall(r'\n\(did you mean one of ([^\?]+)\?\)', command.output)
if possib:
return possib[0].split(', ')
possib = re.findall(r'\n ([^$]+)$', command.output)
if possib:
return pos... | |
21,622 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/missing_space_before_subcommand.py | 4,6 | 1,22 | _get_executable | 6,11 | 6,11 | from thefuck.utils import get_all_executables, memoize
@memoize
def _get_executable(script_part):
FILL_FUNC_BODYdef match(command):
return (not command.script_parts[0] in get_all_executables()
and _get_executable(command.script_parts[0]))
def get_new_command(command):
executable = _get_executabl... | from thefuck.utils import get_all_executables, memoize
@memoize
def _get_executable(script_part):
FILL_FUNC_BODYdef match(command):
return (not command.script_parts[0] in get_all_executables()
and _get_executable(command.script_parts[0]))
def get_new_command(command):
executable = _get_executabl... | for executable in get_all_executables():
if len(executable) > 1 and script_part.startswith(executable):
return executable
| for executable in get_all_executables():
if len(executable) > 1 and script_part.startswith(executable):
return executable
| 12 | 155 | 45 | 200 | from thefuck.utils import get_all_executables, memoize
@memoize
def _get_executable(script_part):
FILL_FUNC_BODYdef match(command):
return (not command.script_parts[0] in get_all_executables()
and _get_executable(command.script_parts[0]))
def get_new_command(command):
executable = _get_executabl... | from thefuck.utils import get_all_executables, memoize
@memoize
def _get_executable(script_part):
FILL_FUNC_BODYdef match(command):
return (not command.script_parts[0] in get_all_executables()
and _get_executable(command.script_parts[0]))
def get_new_command(command):
executable = _get_executabl... | |
21,623 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/mkdir_p.py | 5,7 | 1,14 | match | 7,11 | 7,11 | import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return re.sub('\\bmkdir (.*)', 'mkdir -p \\1', command.script)
| import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return re.sub('\\bmkdir (.*)', 'mkdir -p \\1', command.script)
| return ('mkdir' in command.script
and 'No such file or directory' in command.output)
| return ('mkdir' in command.script
and 'No such file or directory' in command.output)
| 12 | 80 | 32 | 112 | import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return re.sub('\\bmkdir (.*)', 'mkdir -p \\1', command.script)
| import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return re.sub('\\bmkdir (.*)', 'mkdir -p \\1', command.script)
| |
21,624 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/mvn_no_command.py | 9,10 | 1,12 | get_new_command | 10,12 | 10,12 | from thefuck.utils import for_app
@for_app('mvn')
def match(command):
return 'No goals have been specified for this build' in command.output
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.utils import for_app
@for_app('mvn')
def match(command):
return 'No goals have been specified for this build' in command.output
def get_new_command(command):
FILL_FUNC_BODY | return [command.script + ' clean package',
command.script + ' clean install']
| return [command.script + ' clean package',
command.script + ' clean install']
| 11 | 67 | 24 | 91 | from thefuck.utils import for_app
@for_app('mvn')
def match(command):
return 'No goals have been specified for this build' in command.output
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.utils import for_app
@for_app('mvn')
def match(command):
return 'No goals have been specified for this build' in command.output
def get_new_command(command):
FILL_FUNC_BODY | |
21,625 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/mvn_unknown_lifecycle_phase.py | 22,23 | 1,31 | get_new_command | 23,31 | 23,31 | from thefuck.utils import for_app, get_close_matches, replace_command
import re
def _get_failed_lifecycle(command):
return re.search(r'\[ERROR\] Unknown lifecycle phase "(.+)"',
command.output)
def _getavailable_lifecycles(command):
return re.search(
r'Available lifecycle phases... | from thefuck.utils import for_app, get_close_matches, replace_command
import re
def _get_failed_lifecycle(command):
return re.search(r'\[ERROR\] Unknown lifecycle phase "(.+)"',
command.output)
def _getavailable_lifecycles(command):
return re.search(
r'Available lifecycle phases... | failed_lifecycle = _get_failed_lifecycle(command)
available_lifecycles = _getavailable_lifecycles(command)
if available_lifecycles and failed_lifecycle:
selected_lifecycle = get_close_matches(
failed_lifecycle.group(1), available_lifecycles.group(1).split(", "))
return replace_co... | failed_lifecycle = _get_failed_lifecycle(command)
available_lifecycles = _getavailable_lifecycles(command)
if available_lifecycles and failed_lifecycle:
selected_lifecycle = get_close_matches(
failed_lifecycle.group(1), available_lifecycles.group(1).split(", "))
return replace_co... | 23 | 217 | 150 | 367 | from thefuck.utils import for_app, get_close_matches, replace_command
import re
def _get_failed_lifecycle(command):
return re.search(r'\[ERROR\] Unknown lifecycle phase "(.+)"',
command.output)
def _getavailable_lifecycles(command):
return re.search(
r'Available lifecycle phases... | from thefuck.utils import for_app, get_close_matches, replace_command
import re
def _get_failed_lifecycle(command):
return re.search(r'\[ERROR\] Unknown lifecycle phase "(.+)"',
command.output)
def _getavailable_lifecycles(command):
return re.search(
r'Available lifecycle phases... | |
21,626 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/nixos_cmd_not_found.py | 9,10 | 1,16 | match | 10,13 | 10,13 | import re
from thefuck.specific.nix import nix_available
from thefuck.shells import shell
regex = re.compile(r'nix-env -iA ([^\s]*)')
enabled_by_default = nix_available
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
name = regex.findall(command.output)[0]
return shell.and_('nix-env -iA {}'.f... | import re
from thefuck.specific.nix import nix_available
from thefuck.shells import shell
regex = re.compile(r'nix-env -iA ([^\s]*)')
enabled_by_default = nix_available
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
name = regex.findall(command.output)[0]
return shell.and_('nix-env -iA {}'.f... | return regex.findall(command.output)
| return regex.findall(command.output)
| 2 | 131 | 17 | 148 | import re
from thefuck.specific.nix import nix_available
from thefuck.shells import shell
regex = re.compile(r'nix-env -iA ([^\s]*)')
enabled_by_default = nix_available
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
name = regex.findall(command.output)[0]
return shell.and_('nix-env -iA {}'.f... | import re
from thefuck.specific.nix import nix_available
from thefuck.shells import shell
regex = re.compile(r'nix-env -iA ([^\s]*)')
enabled_by_default = nix_available
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
name = regex.findall(command.output)[0]
return shell.and_('nix-env -iA {}'.f... | |
21,627 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/no_command.py | 20,22 | 1,42 | get_new_command | 22,41 | 22,41 | from thefuck.utils import get_all_executables, get_close_matches, \
get_valid_history_without_current, get_closest, which
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
return (not which(command.script_parts[0])
and ('not found' in command.output
... | from thefuck.utils import get_all_executables, get_close_matches, \
get_valid_history_without_current, get_closest, which
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
return (not which(command.script_parts[0])
and ('not found' in command.output
... | old_command = command.script_parts[0]
# One from history:
already_used = get_closest(
old_command, _get_used_executables(command),
fallback_to_first=False)
if already_used:
new_cmds = [already_used]
else:
new_cmds = []
# Other from all executables:
new_cmds ... | old_command = command.script_parts[0]
# One from history:
already_used = get_closest(
old_command, _get_used_executables(command),
fallback_to_first=False)
if already_used:
new_cmds = [already_used]
else:
new_cmds = []
# Other from all executables:
new_cmds ... | 48 | 214 | 194 | 408 | from thefuck.utils import get_all_executables, get_close_matches, \
get_valid_history_without_current, get_closest, which
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
return (not which(command.script_parts[0])
and ('not found' in command.output
... | from thefuck.utils import get_all_executables, get_close_matches, \
get_valid_history_without_current, get_closest, which
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
return (not which(command.script_parts[0])
and ('not found' in command.output
... | |
21,628 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/no_such_file.py | 21,22 | 1,31 | get_new_command | 22,31 | 22,31 | import re
from thefuck.shells import shell
patterns = (
r"mv: cannot move '[^']*' to '([^']*)': No such file or directory",
r"mv: cannot move '[^']*' to '([^']*)': Not a directory",
r"cp: cannot create regular file '([^']*)': No such file or directory",
r"cp: cannot create regular file '([^']*)': Not ... | import re
from thefuck.shells import shell
patterns = (
r"mv: cannot move '[^']*' to '([^']*)': No such file or directory",
r"mv: cannot move '[^']*' to '([^']*)': Not a directory",
r"cp: cannot create regular file '([^']*)': No such file or directory",
r"cp: cannot create regular file '([^']*)': Not ... | for pattern in patterns:
file = re.findall(pattern, command.output)
if file:
file = file[0]
dir = file[0:file.rfind('/')]
formatme = shell.and_('mkdir -p {}', '{}')
return formatme.format(dir, command.script)
| for pattern in patterns:
file = re.findall(pattern, command.output)
if file:
file = file[0]
dir = file[0:file.rfind('/')]
formatme = shell.and_('mkdir -p {}', '{}')
return formatme.format(dir, command.script)
| 25 | 175 | 94 | 269 | import re
from thefuck.shells import shell
patterns = (
r"mv: cannot move '[^']*' to '([^']*)': No such file or directory",
r"mv: cannot move '[^']*' to '([^']*)': Not a directory",
r"cp: cannot create regular file '([^']*)': No such file or directory",
r"cp: cannot create regular file '([^']*)': Not ... | import re
from thefuck.shells import shell
patterns = (
r"mv: cannot move '[^']*' to '([^']*)': No such file or directory",
r"mv: cannot move '[^']*' to '([^']*)': Not a directory",
r"cp: cannot create regular file '([^']*)': No such file or directory",
r"cp: cannot create regular file '([^']*)': Not ... | |
21,629 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/npm_missing_script.py | 8,10 | 1,18 | match | 10,14 | 10,14 | import re
from thefuck.utils import for_app, replace_command
from thefuck.specific.npm import get_scripts, npm_available
enabled_by_default = npm_available
@for_app('npm')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
misspelled_script = re.findall(
r'.*missing script: (.*)\n', command.... | import re
from thefuck.utils import for_app, replace_command
from thefuck.specific.npm import get_scripts, npm_available
enabled_by_default = npm_available
@for_app('npm')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
misspelled_script = re.findall(
r'.*missing script: (.*)\n', command.... | return (any(part.startswith('ru') for part in command.script_parts)
and 'npm ERR! missing script: ' in command.output)
| return (any(part.startswith('ru') for part in command.script_parts)
and 'npm ERR! missing script: ' in command.output)
| 14 | 136 | 45 | 181 | import re
from thefuck.utils import for_app, replace_command
from thefuck.specific.npm import get_scripts, npm_available
enabled_by_default = npm_available
@for_app('npm')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
misspelled_script = re.findall(
r'.*missing script: (.*)\n', command.... | import re
from thefuck.utils import for_app, replace_command
from thefuck.specific.npm import get_scripts, npm_available
enabled_by_default = npm_available
@for_app('npm')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
misspelled_script = re.findall(
r'.*missing script: (.*)\n', command.... | |
21,630 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/npm_run_script.py | 7,9 | 1,18 | match | 9,14 | 9,14 | from thefuck.specific.npm import npm_available, get_scripts
from thefuck.utils import for_app
enabled_by_default = npm_available
@for_app('npm')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
parts = command.script_parts[:]
parts.insert(1, 'run-script')
return ' '.join(parts)
| from thefuck.specific.npm import npm_available, get_scripts
from thefuck.utils import for_app
enabled_by_default = npm_available
@for_app('npm')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
parts = command.script_parts[:]
parts.insert(1, 'run-script')
return ' '.join(parts)
| return ('Usage: npm <command>' in command.output
and not any(part.startswith('ru') for part in command.script_parts)
and command.script_parts[1] in get_scripts())
| return ('Usage: npm <command>' in command.output
and not any(part.startswith('ru') for part in command.script_parts)
and command.script_parts[1] in get_scripts())
| 17 | 110 | 62 | 172 | from thefuck.specific.npm import npm_available, get_scripts
from thefuck.utils import for_app
enabled_by_default = npm_available
@for_app('npm')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
parts = command.script_parts[:]
parts.insert(1, 'run-script')
return ' '.join(parts)
| from thefuck.specific.npm import npm_available, get_scripts
from thefuck.utils import for_app
enabled_by_default = npm_available
@for_app('npm')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
parts = command.script_parts[:]
parts.insert(1, 'run-script')
return ' '.join(parts)
| |
21,631 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/npm_wrong_command.py | 22,24 | 1,43 | _get_available_commands | 24,38 | 24,38 | from thefuck.specific.npm import npm_available
from thefuck.utils import replace_argument, for_app, eager, get_closest
from thefuck.specific.sudo import sudo_support
enabled_by_default = npm_available
def _get_wrong_command(script_parts):
commands = [part for part in script_parts[1:] if not part.startswith('-')]... | from thefuck.specific.npm import npm_available
from thefuck.utils import replace_argument, for_app, eager, get_closest
from thefuck.specific.sudo import sudo_support
enabled_by_default = npm_available
def _get_wrong_command(script_parts):
commands = [part for part in script_parts[1:] if not part.startswith('-')]... | commands_listing = False
for line in stdout.split('\n'):
if line.startswith('where <command> is one of:'):
commands_listing = True
elif commands_listing:
if not line:
break
for command in line.split(', '):
stripped = command.st... | commands_listing = False
for line in stdout.split('\n'):
if line.startswith('where <command> is one of:'):
commands_listing = True
elif commands_listing:
if not line:
break
for command in line.split(', '):
stripped = command.st... | 34 | 301 | 114 | 415 | from thefuck.specific.npm import npm_available
from thefuck.utils import replace_argument, for_app, eager, get_closest
from thefuck.specific.sudo import sudo_support
enabled_by_default = npm_available
def _get_wrong_command(script_parts):
commands = [part for part in script_parts[1:] if not part.startswith('-')]... | from thefuck.specific.npm import npm_available
from thefuck.utils import replace_argument, for_app, eager, get_closest
from thefuck.specific.sudo import sudo_support
enabled_by_default = npm_available
def _get_wrong_command(script_parts):
commands = [part for part in script_parts[1:] if not part.startswith('-')]... | |
21,632 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/omnienv_no_such_command.py | 27,28 | 1,36 | get_new_command | 28,36 | 28,36 | import re
from thefuck.utils import (cache, for_app, replace_argument, replace_command,
which)
from subprocess import PIPE, Popen
supported_apps = 'goenv', 'nodenv', 'pyenv', 'rbenv'
enabled_by_default = any(which(a) for a in supported_apps)
COMMON_TYPOS = {
'list': ['versions', 'inst... | import re
from thefuck.utils import (cache, for_app, replace_argument, replace_command,
which)
from subprocess import PIPE, Popen
supported_apps = 'goenv', 'nodenv', 'pyenv', 'rbenv'
enabled_by_default = any(which(a) for a in supported_apps)
COMMON_TYPOS = {
'list': ['versions', 'inst... | broken = re.findall(r"env: no such command ['`]([^']*)'", command.output)[0]
matched = [replace_argument(command.script, broken, common_typo)
for common_typo in COMMON_TYPOS.get(broken, [])]
app = command.script_parts[0]
app_commands = cache(which(app))(get_app_commands)(app)
matched... | broken = re.findall(r"env: no such command ['`]([^']*)'", command.output)[0]
matched = [replace_argument(command.script, broken, common_typo)
for common_typo in COMMON_TYPOS.get(broken, [])]
app = command.script_parts[0]
app_commands = cache(which(app))(get_app_commands)(app)
matched... | 29 | 236 | 139 | 375 | import re
from thefuck.utils import (cache, for_app, replace_argument, replace_command,
which)
from subprocess import PIPE, Popen
supported_apps = 'goenv', 'nodenv', 'pyenv', 'rbenv'
enabled_by_default = any(which(a) for a in supported_apps)
COMMON_TYPOS = {
'list': ['versions', 'inst... | import re
from thefuck.utils import (cache, for_app, replace_argument, replace_command,
which)
from subprocess import PIPE, Popen
supported_apps = 'goenv', 'nodenv', 'pyenv', 'rbenv'
enabled_by_default = any(which(a) for a in supported_apps)
COMMON_TYPOS = {
'list': ['versions', 'inst... | |
21,633 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/open.py | 32,34 | 1,41 | get_new_command | 34,41 | 34,41 | # Opens URL's in the default web browser
#
# Example:
# > open github.com
# The file ~/github.com does not exist.
# Perhaps you meant 'http://github.com'?
#
from thefuck.shells import shell
from thefuck.utils import eager, for_app
def is_arg_url(command):
return ('.com' in command.script or
'.edu' in ... | # Opens URL's in the default web browser
#
# Example:
# > open github.com
# The file ~/github.com does not exist.
# Perhaps you meant 'http://github.com'?
#
from thefuck.shells import shell
from thefuck.utils import eager, for_app
def is_arg_url(command):
return ('.com' in command.script or
'.edu' in ... | output = command.output.strip()
if is_arg_url(command):
yield command.script.replace('open ', 'open http://')
elif output.startswith('The file ') and output.endswith(' does not exist.'):
arg = command.script.split(' ', 1)[1]
for option in ['touch', 'mkdir']:
yield shell.a... | output = command.output.strip()
if is_arg_url(command):
yield command.script.replace('open ', 'open http://')
elif output.startswith('The file ') and output.endswith(' does not exist.'):
arg = command.script.split(' ', 1)[1]
for option in ['touch', 'mkdir']:
yield shell.a... | 34 | 297 | 120 | 417 | # Opens URL's in the default web browser
#
# Example:
# > open github.com
# The file ~/github.com does not exist.
# Perhaps you meant 'http://github.com'?
#
from thefuck.shells import shell
from thefuck.utils import eager, for_app
def is_arg_url(command):
return ('.com' in command.script or
'.edu' in ... | # Opens URL's in the default web browser
#
# Example:
# > open github.com
# The file ~/github.com does not exist.
# Perhaps you meant 'http://github.com'?
#
from thefuck.shells import shell
from thefuck.utils import eager, for_app
def is_arg_url(command):
return ('.com' in command.script or
'.edu' in ... | |
21,634 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/pacman.py | 9,10 | 1,18 | get_new_command | 10,17 | 10,17 | from thefuck.specific.archlinux import get_pkgfile, archlinux_env
from thefuck.shells import shell
def match(command):
return 'not found' in command.output and get_pkgfile(command.script)
def get_new_command(command):
FILL_FUNC_BODYenabled_by_default, pacman = archlinux_env()
| from thefuck.specific.archlinux import get_pkgfile, archlinux_env
from thefuck.shells import shell
def match(command):
return 'not found' in command.output and get_pkgfile(command.script)
def get_new_command(command):
FILL_FUNC_BODYenabled_by_default, pacman = archlinux_env()
| packages = get_pkgfile(command.script)
formatme = shell.and_('{} -S {}', '{}')
return [formatme.format(pacman, package, command.script)
for package in packages]
| packages = get_pkgfile(command.script)
formatme = shell.and_('{} -S {}', '{}')
return [formatme.format(pacman, package, command.script)
for package in packages]
| 17 | 96 | 67 | 163 | from thefuck.specific.archlinux import get_pkgfile, archlinux_env
from thefuck.shells import shell
def match(command):
return 'not found' in command.output and get_pkgfile(command.script)
def get_new_command(command):
FILL_FUNC_BODYenabled_by_default, pacman = archlinux_env()
| from thefuck.specific.archlinux import get_pkgfile, archlinux_env
from thefuck.shells import shell
def match(command):
return 'not found' in command.output and get_pkgfile(command.script)
def get_new_command(command):
FILL_FUNC_BODYenabled_by_default, pacman = archlinux_env()
| |
21,635 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/pacman_invalid_option.py | 15,16 | 1,21 | get_new_command | 16,20 | 16,20 | from thefuck.specific.archlinux import archlinux_env
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app
import re
@sudo_support
@for_app("pacman")
def match(command):
return command.output.startswith("error: invalid option '-") and any(
" -{}".format(option) in command.script... | from thefuck.specific.archlinux import archlinux_env
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app
import re
@sudo_support
@for_app("pacman")
def match(command):
return command.output.startswith("error: invalid option '-") and any(
" -{}".format(option) in command.script... | option = re.findall(r" -[dfqrstuv]", command.script)[0]
return re.sub(option, option.upper(), command.script)
| option = re.findall(r" -[dfqrstuv]", command.script)[0]
return re.sub(option, option.upper(), command.script)
| 9 | 145 | 49 | 194 | from thefuck.specific.archlinux import archlinux_env
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app
import re
@sudo_support
@for_app("pacman")
def match(command):
return command.output.startswith("error: invalid option '-") and any(
" -{}".format(option) in command.script... | from thefuck.specific.archlinux import archlinux_env
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app
import re
@sudo_support
@for_app("pacman")
def match(command):
return command.output.startswith("error: invalid option '-") and any(
" -{}".format(option) in command.script... | |
21,636 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/pacman_not_found.py | 13,14 | 1,27 | match | 14,20 | 14,20 | """ Fixes wrong package names with pacman or yaourt.
For example the `llc` program is in package `llvm` so this:
yay -S llc
should be:
yay -S llvm
"""
from thefuck.utils import replace_command
from thefuck.specific.archlinux import get_pkgfile, archlinux_env
def match(command):
FILL_FUNC_BODYdef get_new_com... | """ Fixes wrong package names with pacman or yaourt.
For example the `llc` program is in package `llvm` so this:
yay -S llc
should be:
yay -S llvm
"""
from thefuck.utils import replace_command
from thefuck.specific.archlinux import get_pkgfile, archlinux_env
def match(command):
FILL_FUNC_BODYdef get_new_com... | return (command.script_parts
and (command.script_parts[0] in ('pacman', 'yay', 'pikaur', 'yaourt')
or command.script_parts[0:2] == ['sudo', 'pacman'])
and 'error: target not found:' in command.output)
| return (command.script_parts
and (command.script_parts[0] in ('pacman', 'yay', 'pikaur', 'yaourt')
or command.script_parts[0:2] == ['sudo', 'pacman'])
and 'error: target not found:' in command.output)
| 21 | 166 | 85 | 251 | """ Fixes wrong package names with pacman or yaourt.
For example the `llc` program is in package `llvm` so this:
yay -S llc
should be:
yay -S llvm
"""
from thefuck.utils import replace_command
from thefuck.specific.archlinux import get_pkgfile, archlinux_env
def match(command):
FILL_FUNC_BODYdef get_new_com... | """ Fixes wrong package names with pacman or yaourt.
For example the `llc` program is in package `llvm` so this:
yay -S llc
should be:
yay -S llvm
"""
from thefuck.utils import replace_command
from thefuck.specific.archlinux import get_pkgfile, archlinux_env
def match(command):
FILL_FUNC_BODYdef get_new_com... | |
21,637 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/path_from_history.py | 44,45 | 1,54 | get_new_command | 45,53 | 45,53 | from collections import Counter
import re
from thefuck.system import Path
from thefuck.utils import (get_valid_history_without_current,
memoize, replace_argument)
from thefuck.shells import shell
patterns = [r'no such file or directory: (.*)$',
r"cannot access '(.*)': No such fi... | from collections import Counter
import re
from thefuck.system import Path
from thefuck.utils import (get_valid_history_without_current,
memoize, replace_argument)
from thefuck.shells import shell
patterns = [r'no such file or directory: (.*)$',
r"cannot access '(.*)': No such fi... | destination = _get_destination(command)
paths = _get_all_absolute_paths_from_history(command)
return [replace_argument(command.script, destination, path)
for path in paths if path.endswith(destination)
and Path(path).expanduser().exists()]
| destination = _get_destination(command)
paths = _get_all_absolute_paths_from_history(command)
return [replace_argument(command.script, destination, path)
for path in paths if path.endswith(destination)
and Path(path).expanduser().exists()]
| 18 | 370 | 88 | 458 | from collections import Counter
import re
from thefuck.system import Path
from thefuck.utils import (get_valid_history_without_current,
memoize, replace_argument)
from thefuck.shells import shell
patterns = [r'no such file or directory: (.*)$',
r"cannot access '(.*)': No such fi... | from collections import Counter
import re
from thefuck.system import Path
from thefuck.utils import (get_valid_history_without_current,
memoize, replace_argument)
from thefuck.shells import shell
patterns = [r'no such file or directory: (.*)$',
r"cannot access '(.*)': No such fi... | |
21,638 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/php_s.py | 4,6 | 1,12 | match | 6,10 | 6,10 | from thefuck.utils import replace_argument, for_app
@for_app('php', at_least=2)
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return replace_argument(command.script, "-s", "-S")
| from thefuck.utils import replace_argument, for_app
@for_app('php', at_least=2)
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return replace_argument(command.script, "-s", "-S")
| return ('-s' in command.script_parts
and command.script_parts[-1] != '-s')
| return ('-s' in command.script_parts
and command.script_parts[-1] != '-s')
| 8 | 74 | 35 | 109 | from thefuck.utils import replace_argument, for_app
@for_app('php', at_least=2)
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return replace_argument(command.script, "-s", "-S")
| from thefuck.utils import replace_argument, for_app
@for_app('php', at_least=2)
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return replace_argument(command.script, "-s", "-S")
| |
21,639 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/pip_install.py | 11,12 | 1,16 | get_new_command | 12,16 | 12,16 | from thefuck.utils import for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('pip')
def match(command):
return ('pip install' in command.script and 'Permission denied' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.utils import for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('pip')
def match(command):
return ('pip install' in command.script and 'Permission denied' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | if '--user' not in command.script: # add --user (attempt 1)
return command.script.replace(' install ', ' install --user ')
return 'sudo {}'.format(command.script.replace(' --user', '')) # since --user didn't fix things, let's try sudo (attempt 2)
| if '--user' not in command.script: # add --user (attempt 1)
return command.script.replace(' install ', ' install --user ')
return 'sudo {}'.format(command.script.replace(' --user', '')) # since --user didn't fix things, let's try sudo (attempt 2)
| 34 | 88 | 88 | 176 | from thefuck.utils import for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('pip')
def match(command):
return ('pip install' in command.script and 'Permission denied' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.utils import for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('pip')
def match(command):
return ('pip install' in command.script and 'Permission denied' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | |
21,640 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/pip_unknown_command.py | 6,9 | 1,20 | match | 9,14 | 9,14 | import re
from thefuck.utils import replace_argument, for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('pip', 'pip2', 'pip3')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
broken_cmd = re.findall(r'ERROR: unknown command "([^"]+)"',
comman... | import re
from thefuck.utils import replace_argument, for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('pip', 'pip2', 'pip3')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
broken_cmd = re.findall(r'ERROR: unknown command "([^"]+)"',
comman... | return ('pip' in command.script and
'unknown command' in command.output and
'maybe you meant' in command.output)
| return ('pip' in command.script and
'unknown command' in command.output and
'maybe you meant' in command.output)
| 15 | 161 | 41 | 202 | import re
from thefuck.utils import replace_argument, for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('pip', 'pip2', 'pip3')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
broken_cmd = re.findall(r'ERROR: unknown command "([^"]+)"',
comman... | import re
from thefuck.utils import replace_argument, for_app
from thefuck.specific.sudo import sudo_support
@sudo_support
@for_app('pip', 'pip2', 'pip3')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
broken_cmd = re.findall(r'ERROR: unknown command "([^"]+)"',
comman... | |
21,641 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/port_already_in_use.py | 32,33 | 1,41 | match | 33,37 | 33,37 | import re
from subprocess import Popen, PIPE
from thefuck.utils import memoize, which
from thefuck.shells import shell
enabled_by_default = bool(which('lsof'))
patterns = [r"bind on address \('.*', (?P<port>\d+)\)",
r'Unable to bind [^ ]*:(?P<port>\d+)',
r"can't listen on port (?P<port>\d+)",
... | import re
from subprocess import Popen, PIPE
from thefuck.utils import memoize, which
from thefuck.shells import shell
enabled_by_default = bool(which('lsof'))
patterns = [r"bind on address \('.*', (?P<port>\d+)\)",
r'Unable to bind [^ ]*:(?P<port>\d+)',
r"can't listen on port (?P<port>\d+)",
... | port = _get_used_port(command)
return port and _get_pid_by_port(port)
| port = _get_used_port(command)
return port and _get_pid_by_port(port)
| 7 | 370 | 35 | 405 | import re
from subprocess import Popen, PIPE
from thefuck.utils import memoize, which
from thefuck.shells import shell
enabled_by_default = bool(which('lsof'))
patterns = [r"bind on address \('.*', (?P<port>\d+)\)",
r'Unable to bind [^ ]*:(?P<port>\d+)',
r"can't listen on port (?P<port>\d+)",
... | import re
from subprocess import Popen, PIPE
from thefuck.utils import memoize, which
from thefuck.shells import shell
enabled_by_default = bool(which('lsof'))
patterns = [r"bind on address \('.*', (?P<port>\d+)\)",
r'Unable to bind [^ ]*:(?P<port>\d+)',
r"can't listen on port (?P<port>\d+)",
... | |
21,642 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/prove_recursively.py | 5,6 | 1,28 | _is_recursive | 6,12 | 6,12 | import os
from thefuck.utils import for_app
def _is_recursive(part):
FILL_FUNC_BODYdef _isdir(part):
return not part.startswith('-') and os.path.isdir(part)
@for_app('prove')
def match(command):
return (
'NOTESTS' in command.output
and not any(_is_recursive(part) for part in command.script_p... | import os
from thefuck.utils import for_app
def _is_recursive(part):
FILL_FUNC_BODYdef _isdir(part):
return not part.startswith('-') and os.path.isdir(part)
@for_app('prove')
def match(command):
return (
'NOTESTS' in command.output
and not any(_is_recursive(part) for part in command.script_p... | if part == '--recurse':
return True
elif not part.startswith('--') and part.startswith('-') and 'r' in part:
return True
| if part == '--recurse':
return True
elif not part.startswith('--') and part.startswith('-') and 'r' in part:
return True
| 17 | 190 | 55 | 245 | import os
from thefuck.utils import for_app
def _is_recursive(part):
FILL_FUNC_BODYdef _isdir(part):
return not part.startswith('-') and os.path.isdir(part)
@for_app('prove')
def match(command):
return (
'NOTESTS' in command.output
and not any(_is_recursive(part) for part in command.script_p... | import os
from thefuck.utils import for_app
def _is_recursive(part):
FILL_FUNC_BODYdef _isdir(part):
return not part.startswith('-') and os.path.isdir(part)
@for_app('prove')
def match(command):
return (
'NOTESTS' in command.output
and not any(_is_recursive(part) for part in command.script_p... | |
21,643 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/python_command.py | 15,17 | 1,18 | get_new_command | 17,18 | 17,18 | from thefuck.specific.sudo import sudo_support
# add 'python' suffix to the command if
# 1) The script does not have execute permission or
# 2) is interpreted as shell script
@sudo_support
def match(command):
return (command.script_parts
and command.script_parts[0].endswith('.py')
and ('... | from thefuck.specific.sudo import sudo_support
# add 'python' suffix to the command if
# 1) The script does not have execute permission or
# 2) is interpreted as shell script
@sudo_support
def match(command):
return (command.script_parts
and command.script_parts[0].endswith('.py')
and ('... | return 'python ' + command.script
| return 'python ' + command.script
| 5 | 137 | 11 | 148 | from thefuck.specific.sudo import sudo_support
# add 'python' suffix to the command if
# 1) The script does not have execute permission or
# 2) is interpreted as shell script
@sudo_support
def match(command):
return (command.script_parts
and command.script_parts[0].endswith('.py')
and ('... | from thefuck.specific.sudo import sudo_support
# add 'python' suffix to the command if
# 1) The script does not have execute permission or
# 2) is interpreted as shell script
@sudo_support
def match(command):
return (command.script_parts
and command.script_parts[0].endswith('.py')
and ('... | |
21,644 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/python_execute.py | 14,15 | 1,16 | get_new_command | 15,16 | 15,16 | # Appends .py when executing python files
#
# Example:
# > python foo
# error: python: can't open file 'foo': [Errno 2] No such file or directory
from thefuck.utils import for_app
@for_app('python')
def match(command):
return not command.script.endswith('.py')
def get_new_command(command):
FILL_FUNC_BODY | # Appends .py when executing python files
#
# Example:
# > python foo
# error: python: can't open file 'foo': [Errno 2] No such file or directory
from thefuck.utils import for_app
@for_app('python')
def match(command):
return not command.script.endswith('.py')
def get_new_command(command):
FILL_FUNC_BODY | return command.script + '.py'
| return command.script + '.py'
| 4 | 110 | 11 | 121 | # Appends .py when executing python files
#
# Example:
# > python foo
# error: python: can't open file 'foo': [Errno 2] No such file or directory
from thefuck.utils import for_app
@for_app('python')
def match(command):
return not command.script.endswith('.py')
def get_new_command(command):
FILL_FUNC_BODY | # Appends .py when executing python files
#
# Example:
# > python foo
# error: python: can't open file 'foo': [Errno 2] No such file or directory
from thefuck.utils import for_app
@for_app('python')
def match(command):
return not command.script.endswith('.py')
def get_new_command(command):
FILL_FUNC_BODY | |
21,645 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/python_module_error.py | 7,8 | 1,14 | match | 8,11 | 8,11 | import re
from thefuck.shells import shell
MISSING_MODULE = r"ModuleNotFoundError: No module named '([^']+)'"
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
missing_module = re.findall(MISSING_MODULE, command.output)[0]
return shell.and_("pip install {}".format(missing_module), command.scrip... | import re
from thefuck.shells import shell
MISSING_MODULE = r"ModuleNotFoundError: No module named '([^']+)'"
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
missing_module = re.findall(MISSING_MODULE, command.output)[0]
return shell.and_("pip install {}".format(missing_module), command.scrip... | return "ModuleNotFoundError: No module named '" in command.output
| return "ModuleNotFoundError: No module named '" in command.output
| 8 | 111 | 21 | 132 | import re
from thefuck.shells import shell
MISSING_MODULE = r"ModuleNotFoundError: No module named '([^']+)'"
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
missing_module = re.findall(MISSING_MODULE, command.output)[0]
return shell.and_("pip install {}".format(missing_module), command.scrip... | import re
from thefuck.shells import shell
MISSING_MODULE = r"ModuleNotFoundError: No module named '([^']+)'"
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
missing_module = re.findall(MISSING_MODULE, command.output)[0]
return shell.and_("pip install {}".format(missing_module), command.scrip... | |
21,646 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/quotation_marks.py | 7,8 | 1,13 | match | 8,11 | 8,11 | # Fixes careless " and ' usage
#
# Example:
# > git commit -m 'My Message"
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script.replace('\'', '\"')
| # Fixes careless " and ' usage
#
# Example:
# > git commit -m 'My Message"
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script.replace('\'', '\"')
| return '\'' in command.script and '\"' in command.script
| return '\'' in command.script and '\"' in command.script
| 8 | 69 | 22 | 91 | # Fixes careless " and ' usage
#
# Example:
# > git commit -m 'My Message"
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script.replace('\'', '\"')
| # Fixes careless " and ' usage
#
# Example:
# > git commit -m 'My Message"
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script.replace('\'', '\"')
| |
21,647 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/rails_migrations_pending.py | 12,13 | 1,15 | get_new_command | 13,15 | 13,15 | import re
from thefuck.shells import shell
SUGGESTION_REGEX = r"To resolve this issue, run:\s+(.*?)\n"
def match(command):
return "Migrations are pending. To resolve this issue, run:" in command.output
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.shells import shell
SUGGESTION_REGEX = r"To resolve this issue, run:\s+(.*?)\n"
def match(command):
return "Migrations are pending. To resolve this issue, run:" in command.output
def get_new_command(command):
FILL_FUNC_BODY | migration_script = re.search(SUGGESTION_REGEX, command.output).group(1)
return shell.and_(migration_script, command.script)
| migration_script = re.search(SUGGESTION_REGEX, command.output).group(1)
return shell.and_(migration_script, command.script)
| 7 | 93 | 45 | 138 | import re
from thefuck.shells import shell
SUGGESTION_REGEX = r"To resolve this issue, run:\s+(.*?)\n"
def match(command):
return "Migrations are pending. To resolve this issue, run:" in command.output
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.shells import shell
SUGGESTION_REGEX = r"To resolve this issue, run:\s+(.*?)\n"
def match(command):
return "Migrations are pending. To resolve this issue, run:" in command.output
def get_new_command(command):
FILL_FUNC_BODY | |
21,648 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/react_native_command_unrecognized.py | 11,14 | 1,35 | _get_commands | 14,30 | 14,30 | import re
from subprocess import Popen, PIPE
from thefuck.utils import for_app, replace_command, cache, eager
@for_app('react-native')
def match(command):
return re.findall(r"Unrecognized command '.*'", command.output)
@cache('package.json')
@eager
def _get_commands():
FILL_FUNC_BODYdef get_new_command(command)... | import re
from subprocess import Popen, PIPE
from thefuck.utils import for_app, replace_command, cache, eager
@for_app('react-native')
def match(command):
return re.findall(r"Unrecognized command '.*'", command.output)
@cache('package.json')
@eager
def _get_commands():
FILL_FUNC_BODYdef get_new_command(command)... | proc = Popen(['react-native', '--help'], stdout=PIPE)
should_yield = False
for line in proc.stdout.readlines():
line = line.decode().strip()
if not line:
continue
if 'Commands:' in line:
should_yield = True
continue
if should_yield:
... | proc = Popen(['react-native', '--help'], stdout=PIPE)
should_yield = False
for line in proc.stdout.readlines():
line = line.decode().strip()
if not line:
continue
if 'Commands:' in line:
should_yield = True
continue
if should_yield:
... | 32 | 174 | 122 | 296 | import re
from subprocess import Popen, PIPE
from thefuck.utils import for_app, replace_command, cache, eager
@for_app('react-native')
def match(command):
return re.findall(r"Unrecognized command '.*'", command.output)
@cache('package.json')
@eager
def _get_commands():
FILL_FUNC_BODYdef get_new_command(command)... | import re
from subprocess import Popen, PIPE
from thefuck.utils import for_app, replace_command, cache, eager
@for_app('react-native')
def match(command):
return re.findall(r"Unrecognized command '.*'", command.output)
@cache('package.json')
@eager
def _get_commands():
FILL_FUNC_BODYdef get_new_command(command)... | |
21,649 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/remove_shell_prompt_literal.py | 15,16 | 1,24 | match | 16,22 | 16,22 | """Fixes error for commands containing one or more occurrences of the shell
prompt symbol '$'.
This usually happens when commands are copied from documentations
including them in their code blocks.
Example:
> $ git clone https://github.com/nvbn/thefuck.git
bash: $: command not found...
"""
import re
def match(comm... | """Fixes error for commands containing one or more occurrences of the shell
prompt symbol '$'.
This usually happens when commands are copied from documentations
including them in their code blocks.
Example:
> $ git clone https://github.com/nvbn/thefuck.git
bash: $: command not found...
"""
import re
def match(comm... | return (
"$: command not found" in command.output
and re.search(r"^[\s]*\$ [\S]+", command.script) is not None
)
| return (
"$: command not found" in command.output
and re.search(r"^[\s]*\$ [\S]+", command.script) is not None
)
| 16 | 122 | 55 | 177 | """Fixes error for commands containing one or more occurrences of the shell
prompt symbol '$'.
This usually happens when commands are copied from documentations
including them in their code blocks.
Example:
> $ git clone https://github.com/nvbn/thefuck.git
bash: $: command not found...
"""
import re
def match(comm... | """Fixes error for commands containing one or more occurrences of the shell
prompt symbol '$'.
This usually happens when commands are copied from documentations
including them in their code blocks.
Example:
> $ git clone https://github.com/nvbn/thefuck.git
bash: $: command not found...
"""
import re
def match(comm... | |
21,650 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/remove_trailing_cedilla.py | 10,11 | 1,12 | get_new_command | 11,12 | 11,12 | # -*- encoding: utf-8 -*-
CEDILLA = u"ç"
def match(command):
return command.script.endswith(CEDILLA)
def get_new_command(command):
FILL_FUNC_BODY | # -*- encoding: utf-8 -*-
CEDILLA = u"ç"
def match(command):
return command.script.endswith(CEDILLA)
def get_new_command(command):
FILL_FUNC_BODY | return command.script[:-1]
| return command.script[:-1]
| 2 | 70 | 11 | 81 | # -*- encoding: utf-8 -*-
CEDILLA = u"ç"
def match(command):
return command.script.endswith(CEDILLA)
def get_new_command(command):
FILL_FUNC_BODY | # -*- encoding: utf-8 -*-
CEDILLA = u"ç"
def match(command):
return command.script.endswith(CEDILLA)
def get_new_command(command):
FILL_FUNC_BODY | |
21,651 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/rm_dir.py | 11,13 | 1,17 | get_new_command | 13,17 | 13,17 | import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
return ('rm' in command.script
and 'is a directory' in command.output.lower())
@sudo_support
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
return ('rm' in command.script
and 'is a directory' in command.output.lower())
@sudo_support
def get_new_command(command):
FILL_FUNC_BODY | arguments = '-rf'
if 'hdfs' in command.script:
arguments = '-r'
return re.sub('\\brm (.*)', 'rm ' + arguments + ' \\1', command.script)
| arguments = '-rf'
if 'hdfs' in command.script:
arguments = '-r'
return re.sub('\\brm (.*)', 'rm ' + arguments + ' \\1', command.script)
| 21 | 81 | 58 | 139 | import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
return ('rm' in command.script
and 'is a directory' in command.output.lower())
@sudo_support
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
return ('rm' in command.script
and 'is a directory' in command.output.lower())
@sudo_support
def get_new_command(command):
FILL_FUNC_BODY | |
21,652 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/rm_root.py | 6,8 | 1,17 | match | 8,14 | 8,14 | from thefuck.specific.sudo import sudo_support
enabled_by_default = False
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return u'{} --no-preserve-root'.format(command.script)
| from thefuck.specific.sudo import sudo_support
enabled_by_default = False
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return u'{} --no-preserve-root'.format(command.script)
| return (command.script_parts
and {'rm', '/'}.issubset(command.script_parts)
and '--no-preserve-root' not in command.script
and '--no-preserve-root' in command.output)
| return (command.script_parts
and {'rm', '/'}.issubset(command.script_parts)
and '--no-preserve-root' not in command.script
and '--no-preserve-root' in command.output)
| 14 | 80 | 70 | 150 | from thefuck.specific.sudo import sudo_support
enabled_by_default = False
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return u'{} --no-preserve-root'.format(command.script)
| from thefuck.specific.sudo import sudo_support
enabled_by_default = False
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return u'{} --no-preserve-root'.format(command.script)
| |
21,653 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/scm_correction.py | 22,24 | 1,33 | match | 24,30 | 24,30 | from thefuck.utils import for_app, memoize
from thefuck.system import Path
path_to_scm = {
'.git': 'git',
'.hg': 'hg',
}
wrong_scm_patterns = {
'git': 'fatal: Not a git repository',
'hg': 'abort: no repository found',
}
@memoize
def _get_actual_scm():
for path, scm in path_to_scm.items():
... | from thefuck.utils import for_app, memoize
from thefuck.system import Path
path_to_scm = {
'.git': 'git',
'.hg': 'hg',
}
wrong_scm_patterns = {
'git': 'fatal: Not a git repository',
'hg': 'abort: no repository found',
}
@memoize
def _get_actual_scm():
for path, scm in path_to_scm.items():
... | scm = command.script_parts[0]
pattern = wrong_scm_patterns[scm]
return pattern in command.output and _get_actual_scm()
| scm = command.script_parts[0]
pattern = wrong_scm_patterns[scm]
return pattern in command.output and _get_actual_scm()
| 12 | 225 | 54 | 279 | from thefuck.utils import for_app, memoize
from thefuck.system import Path
path_to_scm = {
'.git': 'git',
'.hg': 'hg',
}
wrong_scm_patterns = {
'git': 'fatal: Not a git repository',
'hg': 'abort: no repository found',
}
@memoize
def _get_actual_scm():
for path, scm in path_to_scm.items():
... | from thefuck.utils import for_app, memoize
from thefuck.system import Path
path_to_scm = {
'.git': 'git',
'.hg': 'hg',
}
wrong_scm_patterns = {
'git': 'fatal: Not a git repository',
'hg': 'abort: no repository found',
}
@memoize
def _get_actual_scm():
for path, scm in path_to_scm.items():
... | |
21,654 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/sed_unterminated_s.py | 11,12 | 1,19 | get_new_command | 12,19 | 12,19 | import shlex
from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('sed')
def match(command):
return "unterminated `s' command" in command.output
def get_new_command(command):
FILL_FUNC_BODY | import shlex
from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('sed')
def match(command):
return "unterminated `s' command" in command.output
def get_new_command(command):
FILL_FUNC_BODY | script = shlex.split(command.script)
for (i, e) in enumerate(script):
if e.startswith(('s/', '-es/')) and e[-1] != '/':
script[i] += '/'
return ' '.join(map(shell.quote, script))
| script = shlex.split(command.script)
for (i, e) in enumerate(script):
if e.startswith(('s/', '-es/')) and e[-1] != '/':
script[i] += '/'
return ' '.join(map(shell.quote, script))
| 22 | 79 | 86 | 165 | import shlex
from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('sed')
def match(command):
return "unterminated `s' command" in command.output
def get_new_command(command):
FILL_FUNC_BODY | import shlex
from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('sed')
def match(command):
return "unterminated `s' command" in command.output
def get_new_command(command):
FILL_FUNC_BODY | |
21,655 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/sl_ls.py | 13,14 | 1,15 | get_new_command | 14,15 | 14,15 | """
This happens way too often
When typing really fast cause I'm a 1337 H4X0R,
I often fuck up 'ls' and type 'sl'. No more!
"""
def match(command):
return command.script == 'sl'
def get_new_command(command):
FILL_FUNC_BODY | """
This happens way too often
When typing really fast cause I'm a 1337 H4X0R,
I often fuck up 'ls' and type 'sl'. No more!
"""
def match(command):
return command.script == 'sl'
def get_new_command(command):
FILL_FUNC_BODY | return 'ls'
| return 'ls'
| 2 | 88 | 7 | 95 | """
This happens way too often
When typing really fast cause I'm a 1337 H4X0R,
I often fuck up 'ls' and type 'sl'. No more!
"""
def match(command):
return command.script == 'sl'
def get_new_command(command):
FILL_FUNC_BODY | """
This happens way too often
When typing really fast cause I'm a 1337 H4X0R,
I often fuck up 'ls' and type 'sl'. No more!
"""
def match(command):
return command.script == 'sl'
def get_new_command(command):
FILL_FUNC_BODY | |
21,656 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/ssh_known_hosts.py | 7,9 | 1,38 | match | 9,23 | 9,23 | import re
from thefuck.utils import for_app
commands = ('ssh', 'scp')
@for_app(*commands)
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script
def side_effect(old_cmd, command):
offending_pattern = re.compile(
r'(?:Offending (?:key for IP|\S+ key)|Matching host key)... | import re
from thefuck.utils import for_app
commands = ('ssh', 'scp')
@for_app(*commands)
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script
def side_effect(old_cmd, command):
offending_pattern = re.compile(
r'(?:Offending (?:key for IP|\S+ key)|Matching host key)... | if not command.script:
return False
if not command.script.startswith(commands):
return False
patterns = (
r'WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!',
r'WARNING: POSSIBLE DNS SPOOFING DETECTED!',
r"Warning: the \S+ host key for '([^']+)' differs from the key ... | if not command.script:
return False
if not command.script.startswith(commands):
return False
patterns = (
r'WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!',
r'WARNING: POSSIBLE DNS SPOOFING DETECTED!',
r"Warning: the \S+ host key for '([^']+)' differs from the key ... | 48 | 233 | 156 | 389 | import re
from thefuck.utils import for_app
commands = ('ssh', 'scp')
@for_app(*commands)
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script
def side_effect(old_cmd, command):
offending_pattern = re.compile(
r'(?:Offending (?:key for IP|\S+ key)|Matching host key)... | import re
from thefuck.utils import for_app
commands = ('ssh', 'scp')
@for_app(*commands)
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return command.script
def side_effect(old_cmd, command):
offending_pattern = re.compile(
r'(?:Offending (?:key for IP|\S+ key)|Matching host key)... | |
21,657 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/sudo.py | 31,32 | 1,48 | match | 32,41 | 32,41 | patterns = ['permission denied',
'eacces',
'pkg: insufficient privileges',
'you cannot perform this operation unless you are root',
'non-root users cannot',
'operation not permitted',
'not super-user',
'superuser privilege',
... | patterns = ['permission denied',
'eacces',
'pkg: insufficient privileges',
'you cannot perform this operation unless you are root',
'non-root users cannot',
'operation not permitted',
'not super-user',
'superuser privilege',
... | if command.script_parts and '&&' not in command.script_parts and command.script_parts[0] == 'sudo':
return False
for pattern in patterns:
if pattern in command.output.lower():
return True
return False
| if command.script_parts and '&&' not in command.script_parts and command.script_parts[0] == 'sudo':
return False
for pattern in patterns:
if pattern in command.output.lower():
return True
return False
| 25 | 383 | 74 | 457 | patterns = ['permission denied',
'eacces',
'pkg: insufficient privileges',
'you cannot perform this operation unless you are root',
'non-root users cannot',
'operation not permitted',
'not super-user',
'superuser privilege',
... | patterns = ['permission denied',
'eacces',
'pkg: insufficient privileges',
'you cannot perform this operation unless you are root',
'non-root users cannot',
'operation not permitted',
'not super-user',
'superuser privilege',
... | |
21,658 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/sudo_command_from_user_path.py | 18,19 | 1,22 | get_new_command | 19,22 | 19,22 | import re
from thefuck.utils import for_app, which, replace_argument
def _get_command_name(command):
found = re.findall(r'sudo: (.*): command not found', command.output)
if found:
return found[0]
@for_app('sudo')
def match(command):
if 'command not found' in command.output:
command_name ... | import re
from thefuck.utils import for_app, which, replace_argument
def _get_command_name(command):
found = re.findall(r'sudo: (.*): command not found', command.output)
if found:
return found[0]
@for_app('sudo')
def match(command):
if 'command not found' in command.output:
command_name ... | command_name = _get_command_name(command)
return replace_argument(command.script, command_name,
u'env "PATH=$PATH" {}'.format(command_name))
| command_name = _get_command_name(command)
return replace_argument(command.script, command_name,
u'env "PATH=$PATH" {}'.format(command_name))
| 9 | 144 | 51 | 195 | import re
from thefuck.utils import for_app, which, replace_argument
def _get_command_name(command):
found = re.findall(r'sudo: (.*): command not found', command.output)
if found:
return found[0]
@for_app('sudo')
def match(command):
if 'command not found' in command.output:
command_name ... | import re
from thefuck.utils import for_app, which, replace_argument
def _get_command_name(command):
found = re.findall(r'sudo: (.*): command not found', command.output)
if found:
return found[0]
@for_app('sudo')
def match(command):
if 'command not found' in command.output:
command_name ... | |
21,660 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/systemctl.py | 18,20 | 1,23 | get_new_command | 20,23 | 20,23 | """
The confusion in systemctl's param order is massive.
"""
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app
@sudo_support
@for_app('systemctl')
def match(command):
# Catches "Unknown operation 'service'." when executing systemctl with
# misordered arguments
cmd = command.... | """
The confusion in systemctl's param order is massive.
"""
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app
@sudo_support
@for_app('systemctl')
def match(command):
# Catches "Unknown operation 'service'." when executing systemctl with
# misordered arguments
cmd = command.... | cmd = command.script_parts[:]
cmd[-1], cmd[-2] = cmd[-2], cmd[-1]
return ' '.join(cmd)
| cmd = command.script_parts[:]
cmd[-1], cmd[-2] = cmd[-2], cmd[-1]
return ' '.join(cmd)
| 11 | 155 | 42 | 197 | """
The confusion in systemctl's param order is massive.
"""
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app
@sudo_support
@for_app('systemctl')
def match(command):
# Catches "Unknown operation 'service'." when executing systemctl with
# misordered arguments
cmd = command.... | """
The confusion in systemctl's param order is massive.
"""
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app
@sudo_support
@for_app('systemctl')
def match(command):
# Catches "Unknown operation 'service'." when executing systemctl with
# misordered arguments
cmd = command.... | |
21,661 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/terraform_init.py | 5,7 | 1,14 | match | 7,12 | 7,12 | from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('terraform')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return shell.and_('terraform init', command.script)
| from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('terraform')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return shell.and_('terraform init', command.script)
| return ('this module is not yet installed' in command.output.lower() or
'initialization required' in command.output.lower()
)
| return ('this module is not yet installed' in command.output.lower() or
'initialization required' in command.output.lower()
)
| 15 | 76 | 43 | 119 | from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('terraform')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return shell.and_('terraform init', command.script)
| from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('terraform')
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return shell.and_('terraform init', command.script)
| |
21,662 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/terraform_no_command.py | 13,14 | 1,17 | get_new_command | 14,17 | 14,17 | import re
from thefuck.utils import for_app
MISTAKE = r'(?<=Terraform has no command named ")([^"]+)(?="\.)'
FIX = r'(?<=Did you mean ")([^"]+)(?="\?)'
@for_app('terraform')
def match(command):
return re.search(MISTAKE, command.output) and re.search(FIX, command.output)
def get_new_command(command):
FILL_FUNC_... | import re
from thefuck.utils import for_app
MISTAKE = r'(?<=Terraform has no command named ")([^"]+)(?="\.)'
FIX = r'(?<=Did you mean ")([^"]+)(?="\?)'
@for_app('terraform')
def match(command):
return re.search(MISTAKE, command.output) and re.search(FIX, command.output)
def get_new_command(command):
FILL_FUNC_... | mistake = re.search(MISTAKE, command.output).group(0)
fix = re.search(FIX, command.output).group(0)
return command.script.replace(mistake, fix)
| mistake = re.search(MISTAKE, command.output).group(0)
fix = re.search(FIX, command.output).group(0)
return command.script.replace(mistake, fix)
| 11 | 137 | 56 | 193 | import re
from thefuck.utils import for_app
MISTAKE = r'(?<=Terraform has no command named ")([^"]+)(?="\.)'
FIX = r'(?<=Did you mean ")([^"]+)(?="\?)'
@for_app('terraform')
def match(command):
return re.search(MISTAKE, command.output) and re.search(FIX, command.output)
def get_new_command(command):
FILL_FUNC_... | import re
from thefuck.utils import for_app
MISTAKE = r'(?<=Terraform has no command named ")([^"]+)(?="\.)'
FIX = r'(?<=Did you mean ")([^"]+)(?="\?)'
@for_app('terraform')
def match(command):
return re.search(MISTAKE, command.output) and re.search(FIX, command.output)
def get_new_command(command):
FILL_FUNC_... | |
21,663 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/test.py.py | 1,2 | 1,11 | match | 2,5 | 2,5 | def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return 'pytest'
# make it come before the python_command rule
priority = 900
| def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return 'pytest'
# make it come before the python_command rule
priority = 900
| return command.script == 'test.py' and 'not found' in command.output
| return command.script == 'test.py' and 'not found' in command.output
| 9 | 53 | 26 | 79 | def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return 'pytest'
# make it come before the python_command rule
priority = 900
| def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return 'pytest'
# make it come before the python_command rule
priority = 900
| |
21,664 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/tmux.py | 11,12 | 1,19 | get_new_command | 12,19 | 12,19 | import re
from thefuck.utils import replace_command, for_app
@for_app('tmux')
def match(command):
return ('ambiguous command:' in command.output
and 'could be:' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.utils import replace_command, for_app
@for_app('tmux')
def match(command):
return ('ambiguous command:' in command.output
and 'could be:' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | cmd = re.match(r"ambiguous command: (.*), could be: (.*)",
command.output)
old_cmd = cmd.group(1)
suggestions = [c.strip() for c in cmd.group(2).split(',')]
return replace_command(command, old_cmd, suggestions)
| cmd = re.match(r"ambiguous command: (.*), could be: (.*)",
command.output)
old_cmd = cmd.group(1)
suggestions = [c.strip() for c in cmd.group(2).split(',')]
return replace_command(command, old_cmd, suggestions)
| 23 | 83 | 89 | 172 | import re
from thefuck.utils import replace_command, for_app
@for_app('tmux')
def match(command):
return ('ambiguous command:' in command.output
and 'could be:' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.utils import replace_command, for_app
@for_app('tmux')
def match(command):
return ('ambiguous command:' in command.output
and 'could be:' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | |
21,665 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/touch.py | 11,12 | 1,15 | get_new_command | 12,15 | 12,15 | import re
from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('touch')
def match(command):
return 'No such file or directory' in command.output
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('touch')
def match(command):
return 'No such file or directory' in command.output
def get_new_command(command):
FILL_FUNC_BODY | path = re.findall(
r"touch: (?:cannot touch ')?(.+)/.+'?:", command.output)[0]
return shell.and_(u'mkdir -p {}'.format(path), command.script)
| path = re.findall(
r"touch: (?:cannot touch ')?(.+)/.+'?:", command.output)[0]
return shell.and_(u'mkdir -p {}'.format(path), command.script)
| 13 | 76 | 61 | 137 | import re
from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('touch')
def match(command):
return 'No such file or directory' in command.output
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('touch')
def match(command):
return 'No such file or directory' in command.output
def get_new_command(command):
FILL_FUNC_BODY | |
21,666 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/tsuru_login.py | 11,12 | 1,13 | get_new_command | 12,13 | 12,13 | from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('tsuru')
def match(command):
return ('not authenticated' in command.output
and 'session has expired' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('tsuru')
def match(command):
return ('not authenticated' in command.output
and 'session has expired' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | return shell.and_('tsuru login', command.script)
| return shell.and_('tsuru login', command.script)
| 4 | 86 | 17 | 103 | from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('tsuru')
def match(command):
return ('not authenticated' in command.output
and 'session has expired' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('tsuru')
def match(command):
return ('not authenticated' in command.output
and 'session has expired' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | |
21,667 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/tsuru_not_command.py | 11,12 | 1,16 | get_new_command | 12,16 | 12,16 | import re
from thefuck.utils import get_all_matched_commands, replace_command, for_app
@for_app('tsuru')
def match(command):
return (' is not a tsuru command. See "tsuru help".' in command.output
and '\nDid you mean?\n\t' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.utils import get_all_matched_commands, replace_command, for_app
@for_app('tsuru')
def match(command):
return (' is not a tsuru command. See "tsuru help".' in command.output
and '\nDid you mean?\n\t' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | broken_cmd = re.findall(r'tsuru: "([^"]*)" is not a tsuru command',
command.output)[0]
return replace_command(command, broken_cmd,
get_all_matched_commands(command.output))
| broken_cmd = re.findall(r'tsuru: "([^"]*)" is not a tsuru command',
command.output)[0]
return replace_command(command, broken_cmd,
get_all_matched_commands(command.output))
| 14 | 109 | 71 | 180 | import re
from thefuck.utils import get_all_matched_commands, replace_command, for_app
@for_app('tsuru')
def match(command):
return (' is not a tsuru command. See "tsuru help".' in command.output
and '\nDid you mean?\n\t' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.utils import get_all_matched_commands, replace_command, for_app
@for_app('tsuru')
def match(command):
return (' is not a tsuru command. See "tsuru help".' in command.output
and '\nDid you mean?\n\t' in command.output)
def get_new_command(command):
FILL_FUNC_BODY | |
21,668 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/unknown_command.py | 5,6 | 1,14 | match | 6,10 | 6,10 | import re
from thefuck.utils import replace_command
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
broken_cmd = re.findall(r"([^:]*): Unknown command.*", command.output)[0]
matched = re.findall(r"Did you mean ([^?]*)?", command.output)
return replace_command(command, broken_cmd, matched)
| import re
from thefuck.utils import replace_command
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
broken_cmd = re.findall(r"([^:]*): Unknown command.*", command.output)[0]
matched = re.findall(r"Did you mean ([^?]*)?", command.output)
return replace_command(command, broken_cmd, matched)
| return (re.search(r"([^:]*): Unknown command.*", command.output) is not None
and re.search(r"Did you mean ([^?]*)?", command.output) is not None)
| return (re.search(r"([^:]*): Unknown command.*", command.output) is not None
and re.search(r"Did you mean ([^?]*)?", command.output) is not None)
| 17 | 110 | 59 | 169 | import re
from thefuck.utils import replace_command
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
broken_cmd = re.findall(r"([^:]*): Unknown command.*", command.output)[0]
matched = re.findall(r"Did you mean ([^?]*)?", command.output)
return replace_command(command, broken_cmd, matched)
| import re
from thefuck.utils import replace_command
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
broken_cmd = re.findall(r"([^:]*): Unknown command.*", command.output)[0]
matched = re.findall(r"Did you mean ([^?]*)?", command.output)
return replace_command(command, broken_cmd, matched)
| |
21,669 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/unsudo.py | 4,5 | 1,16 | match | 5,14 | 5,14 | patterns = ['you cannot perform this operation as root']
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return ' '.join(command.script_parts[1:])
| patterns = ['you cannot perform this operation as root']
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return ' '.join(command.script_parts[1:])
| if command.script_parts and command.script_parts[0] != 'sudo':
return False
for pattern in patterns:
if pattern in command.output.lower():
return True
return False
| if command.script_parts and command.script_parts[0] != 'sudo':
return False
for pattern in patterns:
if pattern in command.output.lower():
return True
return False
| 20 | 57 | 64 | 121 | patterns = ['you cannot perform this operation as root']
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return ' '.join(command.script_parts[1:])
| patterns = ['you cannot perform this operation as root']
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return ' '.join(command.script_parts[1:])
| |
21,670 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/vagrant_up.py | 10,11 | 1,22 | get_new_command | 11,22 | 11,22 | from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('vagrant')
def match(command):
return 'run `vagrant up`' in command.output.lower()
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('vagrant')
def match(command):
return 'run `vagrant up`' in command.output.lower()
def get_new_command(command):
FILL_FUNC_BODY | cmds = command.script_parts
machine = None
if len(cmds) >= 3:
machine = cmds[2]
start_all_instances = shell.and_(u"vagrant up", command.script)
if machine is None:
return start_all_instances
else:
return [shell.and_(u"vagrant up {}".format(machine), command.script),
... | cmds = command.script_parts
machine = None
if len(cmds) >= 3:
machine = cmds[2]
start_all_instances = shell.and_(u"vagrant up", command.script)
if machine is None:
return start_all_instances
else:
return [shell.and_(u"vagrant up {}".format(machine), command.script),
... | 31 | 78 | 122 | 200 | from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('vagrant')
def match(command):
return 'run `vagrant up`' in command.output.lower()
def get_new_command(command):
FILL_FUNC_BODY | from thefuck.shells import shell
from thefuck.utils import for_app
@for_app('vagrant')
def match(command):
return 'run `vagrant up`' in command.output.lower()
def get_new_command(command):
FILL_FUNC_BODY | |
21,671 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/whois.py | 27,28 | 1,35 | get_new_command | 28,35 | 28,35 | # -*- encoding: utf-8 -*-
from six.moves.urllib.parse import urlparse
from thefuck.utils import for_app
@for_app('whois', at_least=1)
def match(command):
"""
What the `whois` command returns depends on the 'Whois server' it contacted
and is not consistent through different servers. But there can be only t... | # -*- encoding: utf-8 -*-
from six.moves.urllib.parse import urlparse
from thefuck.utils import for_app
@for_app('whois', at_least=1)
def match(command):
"""
What the `whois` command returns depends on the 'Whois server' it contacted
and is not consistent through different servers. But there can be only t... | url = command.script_parts[1]
if '/' in command.script:
return 'whois ' + urlparse(url).netloc
elif '.' in command.script:
path = urlparse(url).path.split('.')
return ['whois ' + '.'.join(path[n:]) for n in range(1, len(path))]
| url = command.script_parts[1]
if '/' in command.script:
return 'whois ' + urlparse(url).netloc
elif '.' in command.script:
path = urlparse(url).path.split('.')
return ['whois ' + '.'.join(path[n:]) for n in range(1, len(path))]
| 29 | 334 | 99 | 433 | # -*- encoding: utf-8 -*-
from six.moves.urllib.parse import urlparse
from thefuck.utils import for_app
@for_app('whois', at_least=1)
def match(command):
"""
What the `whois` command returns depends on the 'Whois server' it contacted
and is not consistent through different servers. But there can be only t... | # -*- encoding: utf-8 -*-
from six.moves.urllib.parse import urlparse
from thefuck.utils import for_app
@for_app('whois', at_least=1)
def match(command):
"""
What the `whois` command returns depends on the 'Whois server' it contacted
and is not consistent through different servers. But there can be only t... | |
21,672 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/workon_doesnt_exists.py | 23,24 | 1,33 | get_new_command | 24,33 | 24,33 | from thefuck.utils import for_app, replace_command, eager, memoize
from thefuck.system import Path
@memoize
@eager
def _get_all_environments():
root = Path('~/.virtualenvs').expanduser()
if not root.is_dir():
return
for child in root.iterdir():
if child.is_dir():
yield child.n... | from thefuck.utils import for_app, replace_command, eager, memoize
from thefuck.system import Path
@memoize
@eager
def _get_all_environments():
root = Path('~/.virtualenvs').expanduser()
if not root.is_dir():
return
for child in root.iterdir():
if child.is_dir():
yield child.n... | misspelled_env = command.script_parts[1]
create_new = u'mkvirtualenv {}'.format(misspelled_env)
available = _get_all_environments()
if available:
return (replace_command(command, misspelled_env, available)
+ [create_new])
else:
return create_new
| misspelled_env = command.script_parts[1]
create_new = u'mkvirtualenv {}'.format(misspelled_env)
available = _get_all_environments()
if available:
return (replace_command(command, misspelled_env, available)
+ [create_new])
else:
return create_new
| 21 | 179 | 100 | 279 | from thefuck.utils import for_app, replace_command, eager, memoize
from thefuck.system import Path
@memoize
@eager
def _get_all_environments():
root = Path('~/.virtualenvs').expanduser()
if not root.is_dir():
return
for child in root.iterdir():
if child.is_dir():
yield child.n... | from thefuck.utils import for_app, replace_command, eager, memoize
from thefuck.system import Path
@memoize
@eager
def _get_all_environments():
root = Path('~/.virtualenvs').expanduser()
if not root.is_dir():
return
for child in root.iterdir():
if child.is_dir():
yield child.n... | |
21,673 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/wrong_hyphen_before_subcommand.py | 5,7 | 1,21 | match | 7,14 | 7,14 | from thefuck.utils import get_all_executables
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return command.script.replace("-", " ", 1)
priority = 4500
requires_output = False
| from thefuck.utils import get_all_executables
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return command.script.replace("-", " ", 1)
priority = 4500
requires_output = False
| first_part = command.script_parts[0]
if "-" not in first_part or first_part in get_all_executables():
return False
cmd, _ = first_part.split("-", 1)
return cmd in get_all_executables()
| first_part = command.script_parts[0]
if "-" not in first_part or first_part in get_all_executables():
return False
cmd, _ = first_part.split("-", 1)
return cmd in get_all_executables()
| 23 | 98 | 78 | 176 | from thefuck.utils import get_all_executables
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return command.script.replace("-", " ", 1)
priority = 4500
requires_output = False
| from thefuck.utils import get_all_executables
from thefuck.specific.sudo import sudo_support
@sudo_support
def match(command):
FILL_FUNC_BODY@sudo_support
def get_new_command(command):
return command.script.replace("-", " ", 1)
priority = 4500
requires_output = False
| |
21,674 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/yarn_alias.py | 10,11 | 1,15 | get_new_command | 11,15 | 11,15 | import re
from thefuck.utils import replace_argument, for_app
@for_app('yarn', at_least=1)
def match(command):
return 'Did you mean' in command.output
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.utils import replace_argument, for_app
@for_app('yarn', at_least=1)
def match(command):
return 'Did you mean' in command.output
def get_new_command(command):
FILL_FUNC_BODY | broken = command.script_parts[1]
fix = re.findall(r'Did you mean [`"](?:yarn )?([^`"]*)[`"]', command.output)[0]
return replace_argument(command.script, broken, fix)
| broken = command.script_parts[1]
fix = re.findall(r'Did you mean [`"](?:yarn )?([^`"]*)[`"]', command.output)[0]
return replace_argument(command.script, broken, fix)
| 15 | 75 | 70 | 145 | import re
from thefuck.utils import replace_argument, for_app
@for_app('yarn', at_least=1)
def match(command):
return 'Did you mean' in command.output
def get_new_command(command):
FILL_FUNC_BODY | import re
from thefuck.utils import replace_argument, for_app
@for_app('yarn', at_least=1)
def match(command):
return 'Did you mean' in command.output
def get_new_command(command):
FILL_FUNC_BODY | |
21,675 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/yarn_command_not_found.py | 36,37 | 1,44 | get_new_command | 37,44 | 37,44 | import re
from subprocess import Popen, PIPE
from thefuck.utils import (for_app, eager, replace_command, replace_argument,
cache, which)
regex = re.compile(r'error Command "(.*)" not found.')
@for_app('yarn')
def match(command):
return regex.findall(command.output)
npm_commands = {'r... | import re
from subprocess import Popen, PIPE
from thefuck.utils import (for_app, eager, replace_command, replace_argument,
cache, which)
regex = re.compile(r'error Command "(.*)" not found.')
@for_app('yarn')
def match(command):
return regex.findall(command.output)
npm_commands = {'r... | misspelled_task = regex.findall(command.output)[0]
if misspelled_task in npm_commands:
yarn_command = npm_commands[misspelled_task]
return replace_argument(command.script, misspelled_task, yarn_command)
else:
tasks = _get_all_tasks()
return replace_command(command, misspelled... | misspelled_task = regex.findall(command.output)[0]
if misspelled_task in npm_commands:
yarn_command = npm_commands[misspelled_task]
return replace_argument(command.script, misspelled_task, yarn_command)
else:
tasks = _get_all_tasks()
return replace_command(command, misspelled... | 22 | 278 | 113 | 391 | import re
from subprocess import Popen, PIPE
from thefuck.utils import (for_app, eager, replace_command, replace_argument,
cache, which)
regex = re.compile(r'error Command "(.*)" not found.')
@for_app('yarn')
def match(command):
return regex.findall(command.output)
npm_commands = {'r... | import re
from subprocess import Popen, PIPE
from thefuck.utils import (for_app, eager, replace_command, replace_argument,
cache, which)
regex = re.compile(r'error Command "(.*)" not found.')
@for_app('yarn')
def match(command):
return regex.findall(command.output)
npm_commands = {'r... | |
21,676 | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck | /home/hieuvd/dung_repo/raw/stars_01/nvbn_thefuck/thefuck/thefuck/rules/yarn_command_replaced.py | 7,9 | 1,14 | match | 9,12 | 9,12 | import re
from thefuck.utils import for_app
regex = re.compile(r'Run "(.*)" instead')
@for_app('yarn', at_least=1)
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return regex.findall(command.output)[0]
| import re
from thefuck.utils import for_app
regex = re.compile(r'Run "(.*)" instead')
@for_app('yarn', at_least=1)
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return regex.findall(command.output)[0]
| return regex.findall(command.output)
| return regex.findall(command.output)
| 2 | 88 | 17 | 105 | import re
from thefuck.utils import for_app
regex = re.compile(r'Run "(.*)" instead')
@for_app('yarn', at_least=1)
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return regex.findall(command.output)[0]
| import re
from thefuck.utils import for_app
regex = re.compile(r'Run "(.*)" instead')
@for_app('yarn', at_least=1)
def match(command):
FILL_FUNC_BODYdef get_new_command(command):
return regex.findall(command.output)[0]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.