fix all thefuck/*
This commit is contained in:
parent
6a3bcbd23a
commit
752aa6af5b
|
|
@ -7,8 +7,10 @@ from ..utils import which
|
|||
|
||||
def _get_alias(known_args):
|
||||
if six.PY2:
|
||||
warn("The Fuck will drop Python 2 support soon, more details "
|
||||
"https://github.com/nvbn/thefuck/issues/685")
|
||||
warn(
|
||||
"The Fuck will drop Python 2 support soon, more details "
|
||||
"https://github.com/nvbn/thefuck/issues/685"
|
||||
)
|
||||
|
||||
alias = shell.app_alias(known_args.alias)
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,10 @@ def main():
|
|||
if known_args.help:
|
||||
parser.print_help()
|
||||
elif known_args.version:
|
||||
logs.version(get_installation_version(),
|
||||
sys.version.split()[0], shell.info())
|
||||
logs.version(
|
||||
get_installation_version(),
|
||||
sys.version.split()[0], shell.info()
|
||||
)
|
||||
# It's important to check if an alias is being requested before checking if
|
||||
# `TF_HISTORY` is in `os.environ`, otherwise it might mess with subshells.
|
||||
# Check https://github.com/nvbn/thefuck/issues/921 for reference
|
||||
|
|
|
|||
|
|
@ -28,9 +28,13 @@ def _get_shell_pid():
|
|||
|
||||
def _get_not_configured_usage_tracker_path():
|
||||
"""Returns path of special file where we store latest shell pid."""
|
||||
return Path(gettempdir()).joinpath(u'thefuck.last_not_configured_run_{}'.format(
|
||||
getpass.getuser(),
|
||||
))
|
||||
return (
|
||||
Path(gettempdir()).joinpath(
|
||||
u'thefuck.last_not_configured_run_{}'.format(
|
||||
getpass.getuser(),
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def _record_first_run():
|
||||
|
|
@ -68,8 +72,10 @@ def _is_second_run():
|
|||
if not (isinstance(info, dict) and info.get('pid') == current_pid):
|
||||
return False
|
||||
|
||||
return (_get_previous_command() == 'fuck' or
|
||||
time.time() - info.get('time', 0) < const.CONFIGURATION_TIMEOUT)
|
||||
return (
|
||||
_get_previous_command() == 'fuck' or
|
||||
time.time() - info.get('time', 0) < const.CONFIGURATION_TIMEOUT
|
||||
)
|
||||
|
||||
|
||||
def _is_already_configured(configuration_details):
|
||||
|
|
|
|||
|
|
@ -17,8 +17,11 @@ def _kill_process(proc):
|
|||
try:
|
||||
proc.kill()
|
||||
except AccessDenied:
|
||||
logs.debug(u'Rerun: process PID {} ({}) could not be terminated'.format(
|
||||
proc.pid, proc.exe()))
|
||||
logs.debug(
|
||||
u'Rerun: process PID {} ({}) could not be terminated'.format(
|
||||
proc.pid, proc.exe()
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def _wait_output(popen, is_slow):
|
||||
|
|
@ -33,8 +36,10 @@ def _wait_output(popen, is_slow):
|
|||
"""
|
||||
proc = Process(popen.pid)
|
||||
try:
|
||||
proc.wait(settings.wait_slow_command if is_slow
|
||||
else settings.wait_command)
|
||||
proc.wait(
|
||||
settings.wait_slow_command if is_slow
|
||||
else settings.wait_command
|
||||
)
|
||||
return True
|
||||
except TimeoutExpired:
|
||||
for child in proc.children(recursive=True):
|
||||
|
|
@ -59,8 +64,11 @@ def get_output(script, expanded):
|
|||
|
||||
split_expand = shlex.split(expanded)
|
||||
is_slow = split_expand[0] in settings.slow_commands if split_expand else False
|
||||
with logs.debug_time(u'Call: {}; with env: {}; is slow: {}'.format(
|
||||
script, env, is_slow)):
|
||||
with logs.debug_time(
|
||||
u'Call: {}; with env: {}; is slow: {}'.format(
|
||||
script, env, is_slow
|
||||
)
|
||||
):
|
||||
result = Popen(expanded, shell=True, stdin=PIPE,
|
||||
stdout=PIPE, stderr=STDOUT, env=env)
|
||||
if _wait_output(result, is_slow):
|
||||
|
|
|
|||
Loading…
Reference in New Issue