Skip to content

Commit ec29304

Browse files
committed
format with black/isort
1 parent ef2d19a commit ec29304

31 files changed

+1292
-956
lines changed

pyrepl/_minimal_curses.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ class error(Exception):
1717

1818

1919
def _find_clib():
20-
trylibs = ['ncursesw', 'ncurses', 'curses']
20+
trylibs = ["ncursesw", "ncurses", "curses"]
2121

2222
for lib in trylibs:
2323
path = ctypes.util.find_library(lib)
2424
if path:
2525
return path
2626
raise ImportError("curses library not found")
2727

28+
2829
_clibpath = _find_clib()
2930
clib = ctypes.cdll.LoadLibrary(_clibpath)
3031

31-
clib.setupterm.argtypes = [ctypes.c_char_p, ctypes.c_int,
32-
ctypes.POINTER(ctypes.c_int)]
32+
clib.setupterm.argtypes = [ctypes.c_char_p, ctypes.c_int, ctypes.POINTER(ctypes.c_int)]
3333
clib.setupterm.restype = ctypes.c_int
3434

3535
clib.tigetstr.argtypes = [ctypes.c_char_p]
@@ -45,6 +45,7 @@ def _find_clib():
4545

4646
try:
4747
from __pypy__ import builtinify
48+
4849
builtinify # silence broken pyflakes
4950
except ImportError:
5051
builtinify = lambda f: f
@@ -58,14 +59,13 @@ def setupterm(termstr, fd):
5859
err = ctypes.c_int(0)
5960
result = clib.setupterm(termstr, fd, ctypes.byref(err))
6061
if result == ERR:
61-
raise error("setupterm(%r, %d) failed (err=%d)" % (
62-
termstr, fd, err.value))
62+
raise error("setupterm(%r, %d) failed (err=%d)" % (termstr, fd, err.value))
6363

6464

6565
@builtinify
6666
def tigetstr(cap):
6767
if not isinstance(cap, bytes):
68-
cap = cap.encode('ascii')
68+
cap = cap.encode("ascii")
6969
result = clib.tigetstr(cap)
7070
if ctypes.cast(result, ctypes.c_void_p).value == ERR:
7171
return None

pyrepl/cmdrepl.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,18 @@
3434
pyrepl."""
3535

3636

37+
import cmd
3738

3839
from pyrepl import completer
3940
from pyrepl.completing_reader import CompletingReader as CR
40-
import cmd
4141

4242

4343
class CmdReader(CR):
4444
def collect_keymap(self):
4545
return super(CmdReader, self).collect_keymap() + (
4646
("\\M-\\n", "invalid-key"),
47-
("\\n", "accept"))
47+
("\\n", "accept"),
48+
)
4849

4950
def __init__(self, completions):
5051
super(CmdReader, self).__init__()
@@ -53,13 +54,10 @@ def __init__(self, completions):
5354
def get_completions(self, stem):
5455
if len(stem) != self.pos:
5556
return []
56-
return sorted(set(s
57-
for s in self.completions
58-
if s.startswith(stem)))
57+
return sorted(set(s for s in self.completions if s.startswith(stem)))
5958

6059

6160
def replize(klass, history_across_invocations=1):
62-
6361
"""Return a subclass of the cmd.Cmd-derived klass that uses
6462
pyrepl instead of readline.
6563
@@ -69,13 +67,13 @@ def replize(klass, history_across_invocations=1):
6967
controls whether instances of the returned class share
7068
histories."""
7169

72-
completions = [s[3:]
73-
for s in completer.get_class_members(klass)
74-
if s.startswith("do_")]
70+
completions = [
71+
s[3:] for s in completer.get_class_members(klass) if s.startswith("do_")
72+
]
7573

7674
assert issubclass(klass, cmd.Cmd)
77-
# if klass.cmdloop.im_class is not cmd.Cmd:
78-
# print "this may not work"
75+
# if klass.cmdloop.im_class is not cmd.Cmd:
76+
# print "this may not work"
7977

8078
class MultiHist(object):
8179
__history = []
@@ -118,4 +116,5 @@ def cmdloop(self, intro=None):
118116

119117
class CmdRepl(hist, CmdLoopMixin, klass):
120118
__name__ = "replize(%s.%s)" % (klass.__module__, klass.__name__)
119+
121120
return CmdRepl

0 commit comments

Comments
 (0)