mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
start of pep8 cleanups
This commit is contained in:
parent
214f430c30
commit
bc4eee6f85
3 changed files with 16 additions and 13 deletions
|
@ -1,15 +1,15 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Prompt formatter for simple version control branchs"""
|
||||
|
||||
import builtins
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import threading, queue
|
||||
import time
|
||||
import queue
|
||||
import builtins
|
||||
import warnings
|
||||
import threading
|
||||
import subprocess
|
||||
|
||||
import xonsh.platform as xp
|
||||
import xonsh.tools as xt
|
||||
|
||||
|
||||
|
@ -24,6 +24,7 @@ def _get_git_branch(q):
|
|||
branch = info.splitlines()[0].split()[-1]
|
||||
q.put(branch)
|
||||
|
||||
|
||||
def get_git_branch():
|
||||
"""Attempts to find the current git branch. If this could not
|
||||
be determined (timeout, not in a git repo, etc.) then this returns None.
|
||||
|
|
|
@ -53,8 +53,8 @@ def carriage_return(b, cli, *, autoindent=True):
|
|||
not current_line_blank):
|
||||
b.newline(copy_margin=autoindent)
|
||||
elif (doc.char_before_cursor == '\\' and
|
||||
not (not builtins.__xonsh_env__.get('FORCE_POSIX_PATHS')
|
||||
and ON_WINDOWS)):
|
||||
not (not builtins.__xonsh_env__.get('FORCE_POSIX_PATHS') and
|
||||
ON_WINDOWS)):
|
||||
b.newline(copy_margin=autoindent)
|
||||
elif (doc.find_next_word_beginning() is not None and
|
||||
(any(not _is_blank(i)
|
||||
|
@ -90,8 +90,8 @@ class BeginningOfLine(Filter):
|
|||
def __call__(self, cli):
|
||||
before_cursor = cli.current_buffer.document.current_line_before_cursor
|
||||
|
||||
return bool(len(before_cursor) == 0
|
||||
and not cli.current_buffer.document.on_first_line)
|
||||
return bool(len(before_cursor) == 0 and
|
||||
not cli.current_buffer.document.on_first_line)
|
||||
|
||||
|
||||
class EndOfLine(Filter):
|
||||
|
@ -112,8 +112,8 @@ class ShouldConfirmCompletion(Filter):
|
|||
Check if completion needs confirmation
|
||||
"""
|
||||
def __call__(self, cli):
|
||||
return (builtins.__xonsh_env__.get('COMPLETIONS_CONFIRM')
|
||||
and cli.current_buffer.complete_state)
|
||||
return (builtins.__xonsh_env__.get('COMPLETIONS_CONFIRM') and
|
||||
cli.current_buffer.complete_state)
|
||||
|
||||
|
||||
# Copied from prompt-toolkit's key_binding/bindings/basic.py
|
||||
|
@ -246,7 +246,9 @@ def load_xonsh_bindings(key_bindings_manager):
|
|||
|
||||
@handle(Keys.Left, filter=BeginningOfLine())
|
||||
def wrap_cursor_back(event):
|
||||
"""Move cursor to end of previous line unless at beginning of document"""
|
||||
"""Move cursor to end of previous line unless at beginning of
|
||||
document
|
||||
"""
|
||||
b = event.cli.current_buffer
|
||||
b.cursor_up(count=1)
|
||||
relative_end_index = b.document.get_end_of_line_position()
|
||||
|
|
|
@ -126,9 +126,9 @@ class PromptToolkitShell(BaseShell):
|
|||
else:
|
||||
line = self.precmd(line)
|
||||
self.default(line)
|
||||
except KeyboardInterrupt as e:
|
||||
except KeyboardInterrupt:
|
||||
self.reset_buffer()
|
||||
except EOFError as e:
|
||||
except EOFError:
|
||||
if builtins.__xonsh_env__.get("IGNOREEOF"):
|
||||
print('Use "exit" to leave the shell.', file=sys.stderr)
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue