| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 204bc17 commit 9a0aeda
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,29 +1,27 @@ | |||
| 1 | 1 | # -*- coding: utf-8 -*- | |
| 2 | 2 | ||
| 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. | ||
| 27 | 25 | ||
| 28 | 26 | import code | |
| 29 | 27 | import inspect | |
@@ -604,7 +602,7 @@ def get_args(self): | |||
| 604 | 602 | try: | |
| 605 | 603 | fake_cursor = self.current_line.index(func) + len(func) | |
| 606 | 604 | f = simpleeval.evaluate_current_attribute( | |
| 607 | - fake_cursor, self.current_line, self.interp.locals) | ||
| 605 | + fake_cursor, self.current_line, self.interp.locals) | ||
| 608 | 606 | except simpleeval.EvaluationError: | |
| 609 | 607 | return False | |
| 610 | 608 | except Exception: | |
@@ -773,13 +771,13 @@ def line_is_empty(line): | |||
| 773 | 771 | indentation = 0 | |
| 774 | 772 | return indentation | |
| 775 | 773 | ||
| 776 | - def formatforfile(self, stdout): | ||
| 774 | + def formatforfile(self, session_ouput): | ||
| 777 | 775 | """Format the stdout buffer to something suitable for writing to disk, | |
| 778 | 776 | i.e. without >>> and ... at input lines and with "# OUT: " prepended to | |
| 779 | 777 | output lines.""" | |
| 780 | 778 | ||
| 781 | 779 | def process(): | |
| 782 | - for line in stdout.split('\n'): | ||
| 780 | + for line in session_ouput.split('\n'): | ||
| 783 | 781 | if line.startswith(self.ps1): | |
| 784 | 782 | yield line[len(self.ps1):] | |
| 785 | 783 | elif line.startswith(self.ps2): | |
@@ -820,7 +818,7 @@ def write2file(self): | |||
| 820 | 818 | self.interact.notify(_('Save cancelled.')) | |
| 821 | 819 | return | |
| 822 | 820 | ||
| 823 | - stdout_text = self.formatforfile(self.getstdout()) | ||
| 821 | + session_test = self.formatforfile(self.getstdout()) | ||
| 824 | 822 | ||
| 825 | 823 | try: | |
| 826 | 824 | with open(fn, mode) as f: | |
@@ -1072,7 +1070,6 @@ def tokenize(self, s, newline=False): | |||
| 1072 | 1070 | def clear_current_line(self): | |
| 1073 | 1071 | """This is used as the exception callback for the Interpreter instance. | |
| 1074 | 1072 | It prevents autoindentation from occurring after a traceback.""" | |
| 1075 | - # XXX: Empty function | ||
| 1076 | 1073 | ||
| 1077 | 1074 | def send_to_external_editor(self, text): | |
| 1078 | 1075 | """Returns modified text from an editor, or the original text if editor | |
@@ -1111,7 +1108,6 @@ def edit_config(self): | |||
| 1111 | 1108 | 'sample-config') | |
| 1112 | 1109 | if py3: # py3 files need unicode | |
| 1113 | 1110 | default_config = default_config.decode('ascii') | |
| 1114 | - #bpython_dir, script_name = os.path.split(__file__) | ||
| 1115 | 1111 | containing_dir = os.path.dirname( | |
| 1116 | 1112 | os.path.abspath(self.config.config_path)) | |
| 1117 | 1113 | if not os.path.exists(containing_dir): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments