Show More
@@ -862,7 +862,7 b' def extract_hist_ranges(ranges_str):' | |||||
862 | >>> list(extract_hist_ranges("~8/5-~7/4 2")) |
|
862 | >>> list(extract_hist_ranges("~8/5-~7/4 2")) | |
863 | [(-8, 5, None), (-7, 1, 5), (0, 2, 3)] |
|
863 | [(-8, 5, None), (-7, 1, 5), (0, 2, 3)] | |
864 | """ |
|
864 | """ | |
865 |
if ranges_str == |
|
865 | if ranges_str == "": | |
866 | yield (0, 1, None) # Everything from current session |
|
866 | yield (0, 1, None) # Everything from current session | |
867 | return |
|
867 | return | |
868 |
|
868 |
@@ -3722,10 +3722,10 b' class InteractiveShell(SingletonConfigurable):' | |||||
3722 |
|
3722 | |||
3723 | # Skip the last line, as it's probably the magic that called this |
|
3723 | # Skip the last line, as it's probably the magic that called this | |
3724 | if not range_str: |
|
3724 | if not range_str: | |
3725 |
if |
|
3725 | if "\n" not in text: | |
3726 |
text = |
|
3726 | text = "" | |
3727 | else: |
|
3727 | else: | |
3728 |
text = text[:text.rfind( |
|
3728 | text = text[: text.rfind("\n")] | |
3729 |
|
3729 | |||
3730 | return text |
|
3730 | return text | |
3731 |
|
3731 |
@@ -187,8 +187,9 b' class HistoryMagics(Magics):' | |||||
187 | if args.pattern: |
|
187 | if args.pattern: | |
188 | range_pattern = "*" + " ".join(args.pattern) + "*" |
|
188 | range_pattern = "*" + " ".join(args.pattern) + "*" | |
189 | print_nums = True |
|
189 | print_nums = True | |
190 |
hist = history_manager.get_range_by_str( |
|
190 | hist = history_manager.get_range_by_str( | |
191 | raw, get_output) |
|
191 | " ".join(args.range), raw, get_output | |
|
192 | ) | |||
192 |
|
193 | |||
193 | # We could be displaying the entire history, so let's not try to pull |
|
194 | # We could be displaying the entire history, so let's not try to pull | |
194 | # it into a list in memory. Anything that needs more space will just |
|
195 | # it into a list in memory. Anything that needs more space will just |
@@ -817,8 +817,7 b' class OSMagics(Magics):' | |||||
817 | %pycat http://www.example.com/myscript.py |
|
817 | %pycat http://www.example.com/myscript.py | |
818 | """ |
|
818 | """ | |
819 | try: |
|
819 | try: | |
820 | cont = self.shell.find_user_code(parameter_s, |
|
820 | cont = self.shell.find_user_code(parameter_s, skip_encoding_cookie=False) | |
821 | skip_encoding_cookie=False) |
|
|||
822 | except (ValueError, IOError): |
|
821 | except (ValueError, IOError): | |
823 | print("Error: no such file, variable, URL, history range or macro") |
|
822 | print("Error: no such file, variable, URL, history range or macro") | |
824 | return |
|
823 | return |
@@ -162,7 +162,7 b' def test_extract_hist_ranges():' | |||||
162 |
|
162 | |||
163 |
|
163 | |||
164 | def test_extract_hist_ranges_empty_str(): |
|
164 | def test_extract_hist_ranges_empty_str(): | |
165 |
instr = |
|
165 | instr = "" | |
166 | expected = [(0, 1, None)] # 0 == current session, None == to end |
|
166 | expected = [(0, 1, None)] # 0 == current session, None == to end | |
167 | actual = list(extract_hist_ranges(instr)) |
|
167 | actual = list(extract_hist_ranges(instr)) | |
168 | nt.assert_equal(actual, expected) |
|
168 | nt.assert_equal(actual, expected) |
@@ -1091,7 +1091,7 b' def test_save():' | |||||
1091 |
|
1091 | |||
1092 | def test_save_with_no_args(): |
|
1092 | def test_save_with_no_args(): | |
1093 | ip = get_ipython() |
|
1093 | ip = get_ipython() | |
1094 |
ip.history_manager.reset() |
|
1094 | ip.history_manager.reset() # Clear any existing history. | |
1095 | cmds = [u"a=1", u"def b():\n return a**2", u"print(a, b())", "%save"] |
|
1095 | cmds = [u"a=1", u"def b():\n return a**2", u"print(a, b())", "%save"] | |
1096 | for i, cmd in enumerate(cmds, start=1): |
|
1096 | for i, cmd in enumerate(cmds, start=1): | |
1097 | ip.history_manager.store_inputs(i, cmd) |
|
1097 | ip.history_manager.store_inputs(i, cmd) |
General Comments 0
You need to be logged in to leave comments.
Login now