Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdf32e68

Browse files
committed
Some simplifications
1 parent4ec5d76 commitdf32e68

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

‎bpython/curtsiesfrontend/interpreter.py‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ def writetb(self, lines: Iterable[str]) -> None:
9494
# TODO for tracebacks get_lexer_by_name("pytb", stripall=True)
9595

9696
defformat(self,tbtext:str,lexer:Any)->None:
97-
# FIXME: lexer shouldis aLexer
97+
# FIXME: lexer shouldbe "Lexer"
9898
traceback_informative_formatter=BPythonFormatter(default_colors)
99-
traceback_code_formatter=BPythonFormatter({Token:("d")})
99+
traceback_code_formatter=BPythonFormatter({Token:"d"})
100100

101101
no_format_mode=False
102102
cur_line= []
@@ -111,7 +111,7 @@ def format(self, tbtext: str, lexer: Any) -> None:
111111
cur_line,self.outfile
112112
)
113113
cur_line= []
114-
eliftext==" "andcur_line==[]:
114+
eliftext==" "andlen(cur_line)==0:
115115
no_format_mode=True
116116
cur_line.append((token,text))
117117
else:
@@ -130,9 +130,6 @@ def code_finished_will_parse(
130130
False, True means code block is unfinished
131131
False, False isn't possible - an predicted error makes code block done"""
132132
try:
133-
finished=bool(compiler(s))
134-
code_will_parse=True
133+
returnbool(compiler(s)),True
135134
except (ValueError,SyntaxError,OverflowError):
136-
finished=True
137-
code_will_parse=False
138-
returnfinished,code_will_parse
135+
returnTrue,False

‎bpython/curtsiesfrontend/repl.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,9 +1363,8 @@ def unhighlight_paren(self):
13631363
defclear_current_block(self,remove_from_history=True):
13641364
self.display_buffer= []
13651365
ifremove_from_history:
1366-
forunusedinself.buffer:
1367-
self.history.pop()
1368-
self.all_logical_lines.pop()
1366+
delself.history[-len(self.buffer) :]
1367+
delself.all_logical_lines[-len(self.buffer) :]
13691368
self.buffer= []
13701369
self.cursor_offset=0
13711370
self.saved_indent=0
@@ -2080,7 +2079,6 @@ def focus_on_subprocess(self, args):
20802079
try:
20812080
signal.signal(signal.SIGWINCH,self.orig_sigwinch_handler)
20822081
withTermmode(self.orig_stdin,self.orig_tcattrs):
2083-
assertself.windowisnotNone
20842082
terminal=self.window.t
20852083
withterminal.fullscreen():
20862084
sys.__stdout__.write(terminal.save)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2026 Movatter.jp