Skip to content

Commit d6f2949

Browse files
committed
Fix flake8 issues
1 parent c4c722a commit d6f2949

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

awsshell/app.py

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,18 @@
33
Main entry point to the AWS Shell.
44
55
"""
6+
import tempfile
7+
import subprocess
8+
69
from prompt_toolkit.document import Document
710
from prompt_toolkit.shortcuts import create_eventloop
811
from prompt_toolkit.buffer import Buffer
9-
from prompt_toolkit.enums import DEFAULT_BUFFER, SEARCH_BUFFER
10-
from prompt_toolkit.filters import IsDone, HasFocus, Always, RendererHeightIsKnown, to_cli_filter
11-
from prompt_toolkit.interface import CommandLineInterface, Application, AbortAction, AcceptAction
12+
from prompt_toolkit.filters import Always
13+
from prompt_toolkit.interface import CommandLineInterface, Application
14+
from prompt_toolkit.interface import AbortAction, AcceptAction
1215
from prompt_toolkit.key_binding.manager import KeyBindingManager
13-
from prompt_toolkit.layout import Window, HSplit, VSplit, FloatContainer, Float
14-
from prompt_toolkit.layout.containers import ConditionalContainer
15-
from prompt_toolkit.layout.controls import BufferControl, TokenListControl, FillControl
16-
from prompt_toolkit.layout.dimension import LayoutDimension
17-
from prompt_toolkit.layout.menus import CompletionsMenu, MultiColumnCompletionsMenu
18-
from prompt_toolkit.layout.processors import PasswordProcessor, HighlightSearchProcessor, \
19-
HighlightSelectionProcessor, ConditionalProcessor
20-
from prompt_toolkit.layout.prompt import DefaultPrompt
21-
from prompt_toolkit.layout.screen import Char
22-
from prompt_toolkit.layout.toolbars import ValidationToolbar, SystemToolbar, ArgToolbar, SearchToolbar
23-
from prompt_toolkit.layout.utils import explode_tokens
2416
from prompt_toolkit.utils import Callback
25-
from pygments.token import Token
2617

27-
from awsshell.compat import text_type
2818
from awsshell.ui import create_default_layout
2919

3020

@@ -55,13 +45,13 @@ def run(self):
5545
if text.strip() in ['quit', 'exit']:
5646
break
5747
if text.startswith('.'):
58-
# These are special commands. The only one supported for now
59-
# is .edit.
48+
# These are special commands. The only one supported for
49+
# now is .edit.
6050
if text.startswith('.edit'):
61-
# Hardcoded VIM editor for now. It's for demo purposes!
51+
# TODO: Use EDITOR env var.
6252
all_commands = '\n'.join(
6353
['aws ' + h for h in list(self.history)
64-
if not h.startswith(('.', '!'))])
54+
if not h.startswith(('.', '!'))])
6555
with tempfile.NamedTemporaryFile('w') as f:
6656
f.write(all_commands)
6757
f.flush()
@@ -81,15 +71,13 @@ def create_layout(self):
8171
u'aws> ', reserve_space_for_menu=True,
8272
display_completions_in_columns=True)
8373

84-
8574
def create_buffer(self, completer, history):
8675
return Buffer(
8776
history=history,
8877
completer=completer,
8978
complete_while_typing=Always(),
9079
accept_action=AcceptAction.RETURN_DOCUMENT)
9180

92-
9381
def create_application(self, completer, history):
9482
key_bindings_registry = KeyBindingManager(
9583
enable_vi_mode=True,
@@ -109,13 +97,12 @@ def create_application(self, completer, history):
10997
key_bindings_registry=key_bindings_registry,
11098
)
11199

112-
113100
def on_input_timeout(self, cli):
114101
buffer = cli.current_buffer
115102
document = buffer.document
116103
text = document.text
117-
cli.buffers['clidocs'].reset(initial_document=Document(text, cursor_position=0))
118-
104+
cli.buffers['clidocs'].reset(
105+
initial_document=Document(text, cursor_position=0))
119106

120107
def create_cli_interface(self):
121108
# A CommandLineInterface from prompt_toolkit

0 commit comments

Comments
 (0)