mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
Simplify API.
This commit is contained in:
parent
0e3b34d0cd
commit
cf5067dca8
2 changed files with 12 additions and 17 deletions
|
@ -170,15 +170,6 @@ class History:
|
|||
|
||||
def clear(self):
|
||||
"""Wipes the current session from both the disk and memory."""
|
||||
self.wipe_disk()
|
||||
self.wipe_memory()
|
||||
|
||||
def wipe_disk(self):
|
||||
"""Wipes the current session's history from the disk."""
|
||||
pass
|
||||
|
||||
def wipe_memory(self):
|
||||
"""Reinitialises History object with blank commands."""
|
||||
pass
|
||||
|
||||
def remake_file(self):
|
||||
|
|
|
@ -327,9 +327,9 @@ class JsonCommandField(cabc.Sequence):
|
|||
if isinstance(rtn, xlj.LJNode):
|
||||
rtn = rtn.load()
|
||||
queue.popleft()
|
||||
return rtn
|
||||
else:
|
||||
return ""
|
||||
return rtn
|
||||
|
||||
def i_am_at_the_front(self):
|
||||
"""Tests if the command field is at the front of the queue."""
|
||||
|
@ -508,14 +508,18 @@ class JsonHistory(History):
|
|||
while self.gc.is_alive(): # while waiting for gc.
|
||||
time.sleep(0.1) # don't monopolize the thread (or Python GIL?)
|
||||
|
||||
def wipe_disk(self):
|
||||
try:
|
||||
os.remove(self.filename)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
def clear(self):
|
||||
def wipe_disk(hist):
|
||||
try:
|
||||
os.remove(hist.filename)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
def wipe_memory(self): # todo is this enough?
|
||||
self.buffer = []
|
||||
def wipe_memory(hist): # todo is this enough?
|
||||
hist.buffer = []
|
||||
|
||||
wipe_disk(self)
|
||||
wipe_memory(self)
|
||||
|
||||
def remake_file(self):
|
||||
meta = dict()
|
||||
|
|
Loading…
Add table
Reference in a new issue