<s> import re <EOL> from thefuck . shells import shell <EOL> patterns = ( <EOL> r"<STR_LIT>" , <EOL> r"<STR_LIT>" , <EOL> r"<STR_LIT>" , <EOL> r"<STR_LIT>" , <EOL> ) <EOL> def match ( command ) : <EOL> for pattern in patterns : <EOL> if re . search ( pattern , command . stderr ) : <EOL> return True <EOL> return False <EOL> def get_new_command ( command ) : <EOL> for pattern in patterns : <EOL> file = re . findall ( pattern , command . stderr ) <EOL> if file : <EOL> file = file [ <NUM_LIT:0> ] <EOL> dir = file [ <NUM_LIT:0> : file . rfind ( '<STR_LIT:/>' ) ] <EOL> formatme = shell . and_ ( '<STR_LIT>' , '<STR_LIT:{}>' ) <EOL> return formatme . format ( dir , command . script ) </s>
