Skip to content

Commit 80539f1

Browse files
committed
Apply black
1 parent 8f83fa5 commit 80539f1

File tree

19 files changed

+73
-92
lines changed

19 files changed

+73
-92
lines changed

bpdb/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535

3636
def set_trace():
37-
""" Just like pdb.set_trace(), a helper function that creates
38-
a debugger instance and sets the trace. """
37+
"""Just like pdb.set_trace(), a helper function that creates
38+
a debugger instance and sets the trace."""
3939
debugger = BPdb()
4040
debugger.set_trace(sys._getframe().f_back)
4141

bpython/args.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ def parse(args, extras=None, ignore_stdin=False):
8181
"--interactive",
8282
"-i",
8383
action="store_true",
84-
help=_(
85-
"Drop to bpython shell after running file instead of exiting."
86-
),
84+
help=_("Drop to bpython shell after running file instead of exiting."),
8785
)
8886
parser.add_option(
8987
"--quiet",

bpython/autocomplete.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def matches(self, cursor_offset, line, **kwargs):
170170
* determine whether suggestions should be `shown_before_tab`
171171
* `substitute(cur, line, match)` in a match for what's found with
172172
`target`
173-
"""
173+
"""
174174
raise NotImplementedError
175175

176176
def locate(self, cursor_offset, line):
@@ -315,8 +315,7 @@ def format(self, word):
315315
return after_last_dot(word)
316316

317317
def attr_matches(self, text, namespace):
318-
"""Taken from rlcompleter.py and bent to my will.
319-
"""
318+
"""Taken from rlcompleter.py and bent to my will."""
320319

321320
m = self.attr_matches_re.match(text)
322321
if not m:
@@ -377,9 +376,7 @@ def matches(self, cursor_offset, line, **kwargs):
377376
return None
378377
if isinstance(obj, dict) and obj.keys():
379378
matches = {
380-
f"{k!r}]"
381-
for k in obj.keys()
382-
if repr(k).startswith(r.word)
379+
f"{k!r}]" for k in obj.keys() if repr(k).startswith(r.word)
383380
}
384381
return matches if matches else None
385382
else:
@@ -462,9 +459,7 @@ def matches(self, cursor_offset, line, **kwargs):
462459
if isinstance(name, str) and name.startswith(r.word)
463460
}
464461
matches.update(
465-
name + "="
466-
for name in argspec[1][4]
467-
if name.startswith(r.word)
462+
name + "=" for name in argspec[1][4] if name.startswith(r.word)
468463
)
469464
return matches if matches else None
470465

@@ -519,10 +514,10 @@ def matches(self, cursor_offset, line, **kwargs):
519514
history = "\n".join(history) + "\n" + line
520515

521516
try:
522-
script = jedi.Script(
523-
history, path="fake.py"
517+
script = jedi.Script(history, path="fake.py")
518+
completions = script.complete(
519+
len(history.splitlines()), cursor_offset
524520
)
525-
completions = script.complete(len(history.splitlines()), cursor_offset)
526521
except (jedi.NotFoundError, IndexError, KeyError):
527522
# IndexError for #483
528523
# KeyError for #544
@@ -566,9 +561,7 @@ def matches(self, cursor_offset, line, **kwargs):
566561
cursor_offset,
567562
line,
568563
)
569-
results = super().matches(
570-
cursor_offset, line, history=history
571-
)
564+
results = super().matches(cursor_offset, line, history=history)
572565
return results
573566
else:
574567
return None

bpython/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -772,9 +772,7 @@ def mkargspec(self, topline, in_arg, down):
772772
if _args:
773773
if args:
774774
self.list_win.addstr(", ", punctuation_colpair)
775-
self.list_win.addstr(
776-
f"*{_args}", get_colpair(self.config, "token")
777-
)
775+
self.list_win.addstr(f"*{_args}", get_colpair(self.config, "token"))
778776

779777
if kwonly:
780778
if not _args:
@@ -1072,7 +1070,9 @@ def prompt(self, more):
10721070
"""Show the appropriate Python prompt"""
10731071
if not more:
10741072
self.echo(
1075-
"\x01{}\x03{}".format(self.config.color_scheme["prompt"], self.ps1)
1073+
"\x01{}\x03{}".format(
1074+
self.config.color_scheme["prompt"], self.ps1
1075+
)
10761076
)
10771077
self.stdout_hist += self.ps1
10781078
self.screen_hist.append(

bpython/config.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,14 @@ def loadini(struct, configfile):
117117
"up_one_line": "C-p",
118118
"yank_from_buffer": "C-y",
119119
},
120-
"cli": {"suggestion_width": 0.8, "trim_prompts": False,},
121-
"curtsies": {"list_above": False, "right_arrow_completion": True,},
120+
"cli": {
121+
"suggestion_width": 0.8,
122+
"trim_prompts": False,
123+
},
124+
"curtsies": {
125+
"list_above": False,
126+
"right_arrow_completion": True,
127+
},
122128
}
123129

124130
default_keys_to_commands = {
@@ -269,9 +275,7 @@ def get_key_no_doublebind(command):
269275
try:
270276
load_theme(struct, path, struct.color_scheme, default_colors)
271277
except OSError:
272-
sys.stderr.write(
273-
f"Could not load theme '{color_scheme_name}'.\n"
274-
)
278+
sys.stderr.write(f"Could not load theme '{color_scheme_name}'.\n")
275279
sys.exit(1)
276280

277281
# expand path of history file

bpython/curtsies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def __init__(self, config, locals_, banner, interp=None):
4848
self._request_reload = self.input_generator.threadsafe_event_trigger(
4949
bpythonevents.ReloadEvent
5050
)
51-
self.interrupting_refresh = self.input_generator.threadsafe_event_trigger(
52-
lambda: None
51+
self.interrupting_refresh = (
52+
self.input_generator.threadsafe_event_trigger(lambda: None)
5353
)
5454
self.request_undo = self.input_generator.event_trigger(
5555
bpythonevents.UndoEvent

bpython/curtsiesfrontend/manual_readline.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ def add(self, key, func, overwrite=False):
3737
else:
3838
raise ValueError(f"key {key!r} already has a mapping")
3939
params = getargspec(func)
40-
args = {
41-
k: v for k, v in self.default_kwargs.items() if k in params
42-
}
40+
args = {k: v for k, v in self.default_kwargs.items() if k in params}
4341
r = func(**args)
4442
if len(r) == 2:
4543
if hasattr(func, "kills"):
@@ -56,9 +54,7 @@ def add(self, key, func, overwrite=False):
5654
)
5755
self.cut_buffer_edits[key] = func
5856
else:
59-
raise ValueError(
60-
f"return type of function {func!r} not recognized"
61-
)
57+
raise ValueError(f"return type of function {func!r} not recognized")
6258

6359
def add_config_attr(self, config_attr, func):
6460
if config_attr in self.awaiting_config:

bpython/curtsiesfrontend/repl.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@
4040

4141
from bpython.curtsiesfrontend import replpainter as paint
4242
from bpython.curtsiesfrontend import sitefix
43-
from bpython.curtsiesfrontend.coderunner import CodeRunner, FakeOutput, is_main_thread
43+
from bpython.curtsiesfrontend.coderunner import (
44+
CodeRunner,
45+
FakeOutput,
46+
is_main_thread,
47+
)
4448
from bpython.curtsiesfrontend.filewatch import ModuleChangedEventHandler
4549
from bpython.curtsiesfrontend.interaction import StatusBar
4650
from bpython.curtsiesfrontend.manual_readline import edit_keys
@@ -971,7 +975,7 @@ def process_simple_keypress(self, e):
971975
self.add_normal_character(e)
972976

973977
def send_current_block_to_external_editor(self, filename=None):
974-
""""
978+
"""
975979
Sends the current code block to external editor to be edited. Usually bound to C-x.
976980
"""
977981
text = self.send_to_external_editor(self.get_current_block())
@@ -987,7 +991,7 @@ def send_current_block_to_external_editor(self, filename=None):
987991

988992
def send_session_to_external_editor(self, filename=None):
989993
"""
990-
Sends entire bpython session to external editor to be edited. Usually bound to F7.
994+
Sends entire bpython session to external editor to be edited. Usually bound to F7.
991995
"""
992996
for_editor = EDIT_SESSION_HEADER
993997
for_editor += self.get_session_formatted_for_file()
@@ -1349,16 +1353,11 @@ def display_line_with_prompt(self):
13491353
more = func_for_letter(self.config.color_scheme["prompt_more"])
13501354
if self.incr_search_mode == "reverse_incremental_search":
13511355
return (
1352-
prompt(
1353-
f"(reverse-i-search)`{self.incr_search_target}': "
1354-
)
1356+
prompt(f"(reverse-i-search)`{self.incr_search_target}': ")
13551357
+ self.current_line_formatted
13561358
)
13571359
elif self.incr_search_mode == "incremental_search":
1358-
return (
1359-
prompt(f"(i-search)`%s': ")
1360-
+ self.current_line_formatted
1361-
)
1360+
return prompt(f"(i-search)`%s': ") + self.current_line_formatted
13621361
return (
13631362
prompt(self.ps1) if self.done else more(self.ps2)
13641363
) + self.current_line_formatted
@@ -1407,11 +1406,11 @@ def current_output_line(self, value):
14071406
self.stdin.current_line = "\n"
14081407

14091408
def number_of_padding_chars_on_current_cursor_line(self):
1410-
""" To avoid cutting off two-column characters at the end of lines where
1409+
"""To avoid cutting off two-column characters at the end of lines where
14111410
there's only one column left, curtsies adds a padding char (u' ').
14121411
It's important to know about these for cursor positioning.
14131412
1414-
Should return zero unless there are fullwidth characters. """
1413+
Should return zero unless there are fullwidth characters."""
14151414
full_line = self.current_cursor_line_without_suggestion
14161415
line_with_padding = "".join(
14171416
line.s

bpython/curtsiesfrontend/sitefix.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44

55
def resetquit(builtins):
6-
"""Redefine builtins 'quit' and 'exit' not so close stdin
7-
8-
"""
6+
"""Redefine builtins 'quit' and 'exit' not so close stdin"""
97

108
def __call__(self, code=None):
119
raise SystemExit(code)

bpython/filelock.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939

4040

4141
class BaseLock:
42-
"""Base class for file locking
43-
"""
42+
"""Base class for file locking"""
4443

4544
def __init__(self, fileobj, mode=None, filename=None):
4645
self.fileobj = fileobj
@@ -66,8 +65,7 @@ def __del__(self):
6665

6766

6867
class UnixFileLock(BaseLock):
69-
"""Simple file locking for Unix using fcntl
70-
"""
68+
"""Simple file locking for Unix using fcntl"""
7169

7270
def __init__(self, fileobj, mode=None, filename=None):
7371
super().__init__(fileobj)
@@ -90,8 +88,7 @@ def release(self):
9088

9189

9290
class WindowsFileLock(BaseLock):
93-
"""Simple file locking for Windows using msvcrt
94-
"""
91+
"""Simple file locking for Windows using msvcrt"""
9592

9693
def __init__(self, fileobj, mode=None, filename=None):
9794
super().__init__(None)

0 commit comments

Comments
 (0)