Skip to content

Commit 9a0aeda

Browse files
committed
Updates to change previously made based on feedback
1 parent 204bc17 commit 9a0aeda

File tree

1 file changed

+26
-30
lines changed

1 file changed

+26
-30
lines changed

bpython/repl.py

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
# -*- coding: utf-8 -*-
22

3-
"""
4-
The MIT License
5-
6-
Copyright (c) 2009-2011 the bpython authors.
7-
Copyright (c) 2012-2013,2015 Sebastian Ramacher
8-
9-
Permission is hereby granted, free of charge, to any person obtaining a copy
10-
of this software and associated documentation files (the "Software"), to deal
11-
in the Software without restriction, including without limitation the rights
12-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13-
copies of the Software, and to permit persons to whom the Software is
14-
furnished to do so, subject to the following conditions:
15-
16-
The above copyright notice and this permission notice shall be included in
17-
all copies or substantial portions of the Software.
18-
19-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25-
THE SOFTWARE.
26-
"""
3+
# The MIT License
4+
5+
# Copyright (c) 2009-2011 the bpython authors.
6+
# Copyright (c) 2012-2013,2015 Sebastian Ramacher
7+
8+
# Permission is hereby granted, free of charge, to any person obtaining a copy
9+
# of this software and associated documentation files (the "Software"), to deal
10+
# in the Software without restriction, including without limitation the rights
11+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
# copies of the Software, and to permit persons to whom the Software is
13+
# furnished to do so, subject to the following conditions:
14+
15+
# The above copyright notice and this permission notice shall be included in
16+
# all copies or substantial portions of the Software.
17+
18+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
# THE SOFTWARE.
2725

2826
import code
2927
import inspect
@@ -604,7 +602,7 @@ def get_args(self):
604602
try:
605603
fake_cursor = self.current_line.index(func) + len(func)
606604
f = simpleeval.evaluate_current_attribute(
607-
fake_cursor, self.current_line, self.interp.locals)
605+
fake_cursor, self.current_line, self.interp.locals)
608606
except simpleeval.EvaluationError:
609607
return False
610608
except Exception:
@@ -773,13 +771,13 @@ def line_is_empty(line):
773771
indentation = 0
774772
return indentation
775773

776-
def formatforfile(self, stdout):
774+
def formatforfile(self, session_ouput):
777775
"""Format the stdout buffer to something suitable for writing to disk,
778776
i.e. without >>> and ... at input lines and with "# OUT: " prepended to
779777
output lines."""
780778

781779
def process():
782-
for line in stdout.split('\n'):
780+
for line in session_ouput.split('\n'):
783781
if line.startswith(self.ps1):
784782
yield line[len(self.ps1):]
785783
elif line.startswith(self.ps2):
@@ -820,7 +818,7 @@ def write2file(self):
820818
self.interact.notify(_('Save cancelled.'))
821819
return
822820

823-
stdout_text = self.formatforfile(self.getstdout())
821+
session_test = self.formatforfile(self.getstdout())
824822

825823
try:
826824
with open(fn, mode) as f:
@@ -1072,7 +1070,6 @@ def tokenize(self, s, newline=False):
10721070
def clear_current_line(self):
10731071
"""This is used as the exception callback for the Interpreter instance.
10741072
It prevents autoindentation from occurring after a traceback."""
1075-
# XXX: Empty function
10761073

10771074
def send_to_external_editor(self, text):
10781075
"""Returns modified text from an editor, or the original text if editor
@@ -1111,7 +1108,6 @@ def edit_config(self):
11111108
'sample-config')
11121109
if py3: # py3 files need unicode
11131110
default_config = default_config.decode('ascii')
1114-
#bpython_dir, script_name = os.path.split(__file__)
11151111
containing_dir = os.path.dirname(
11161112
os.path.abspath(self.config.config_path))
11171113
if not os.path.exists(containing_dir):

0 commit comments

Comments
 (0)