##// END OF EJS Templates
Addressed issues: replaced abc with NotImplementedError; removed unneeded methods; fixed typo
Doug Blank -
Show More
@@ -15,7 +15,6 b' from __future__ import print_function'
15 15 # Stdlib imports
16 16 import atexit
17 17 import datetime
18 import abc
19 18 import os
20 19 import re
21 20 try:
@@ -103,22 +102,19 b' def catch_corrupt_db(f, self, *a, **kw):'
103 102 class HistoryAccessorBase(Configurable):
104 103 """An abstract class for History Accessors """
105 104
106 @abc.abstractmethod
107 105 def get_tail(self, n=10, raw=True, output=False, include_latest=False):
108 pass
106 raise NotImplementedError
109 107
110 @abc.abstractmethod
111 108 def search(self, pattern="*", raw=True, search_raw=True,
112 109 output=False, n=None, unique=False):
113 pass
110 raise NotImplementedError
114 111
115 @abc.abstractmethod
116 112 def get_range(self, session, start=1, stop=None, raw=True,output=False):
117 pass
113 raise NotImplementedError
118 114
119 @abc.abstractmethod
120 115 def get_range_by_str(self, rangestr, raw=True, output=False):
121 pass
116 raise NotImplementedError
117
122 118
123 119 class HistoryAccessor(HistoryAccessorBase):
124 120 """Access the history database without adding to it.
@@ -12,7 +12,6 b''
12 12 #-----------------------------------------------------------------------------
13 13
14 14 from IPython.core.history import HistoryAccessorBase
15 from IPython.utils import py3compat
16 15 from IPython.utils.traitlets import Dict, List
17 16
18 17 try:
@@ -46,9 +45,6 b' class ZMQHistoryManager(HistoryAccessorBase):'
46 45 Load the history over ZMQ from the kernel. Wraps the history
47 46 messaging with loop to wait to get history results.
48 47 """
49 # 'range' (fill in session, start and stop params),
50 # 'tail' (fill in n)
51 # 'search' (fill in pattern param).
52 48 msg_id = self.client.history(raw=raw, output=output,
53 49 hist_access_type=hist_access_type,
54 50 **kwargs)
@@ -64,12 +60,6 b' class ZMQHistoryManager(HistoryAccessorBase):'
64 60 break
65 61 return history
66 62
67 def writeout_cache(self):
68 """
69 Not needed for ZMQ-based histories.
70 """
71 pass
72
73 63 def get_tail(self, n=10, raw=True, output=False, include_latest=False):
74 64 return self._load_history(hist_access_type='tail', n=n, raw=raw,
75 65 output=output)
@@ -87,7 +77,7 b' class ZMQHistoryManager(HistoryAccessorBase):'
87 77
88 78 def get_range_by_str(self, rangestr, raw=True, output=False):
89 79 return self._load_history(hist_access_type='range', raw=raw,
90 output=output, rangestr=rangetr)
80 output=output, rangestr=rangestr)
91 81
92 82 def end_session(self):
93 83 """
@@ -96,16 +86,8 b' class ZMQHistoryManager(HistoryAccessorBase):'
96 86 pass
97 87
98 88 def reset(self, new_session=True):
99 """Clear the session history, releasing all object references, and
100 optionally open a new session."""
101 self.output_hist.clear()
102 # The directory history can't be completely empty
103 self.dir_hist[:] = [py3compat.getcwd()]
104
105 if new_session:
106 if self.session_number:
107 self.end_session()
108 self.input_hist_parsed[:] = [""]
109 self.input_hist_raw[:] = [""]
110 self.new_session()
89 """
90 Nothing to do for ZMQ-based histories.
91 """
92 pass
111 93
General Comments 0
You need to be logged in to leave comments. Login now