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):
|
def clear(self):
|
||||||
"""Wipes the current session from both the disk and memory."""
|
"""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
|
pass
|
||||||
|
|
||||||
def remake_file(self):
|
def remake_file(self):
|
||||||
|
|
|
@ -327,9 +327,9 @@ class JsonCommandField(cabc.Sequence):
|
||||||
if isinstance(rtn, xlj.LJNode):
|
if isinstance(rtn, xlj.LJNode):
|
||||||
rtn = rtn.load()
|
rtn = rtn.load()
|
||||||
queue.popleft()
|
queue.popleft()
|
||||||
|
return rtn
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
return rtn
|
|
||||||
|
|
||||||
def i_am_at_the_front(self):
|
def i_am_at_the_front(self):
|
||||||
"""Tests if the command field is at the front of the queue."""
|
"""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.
|
while self.gc.is_alive(): # while waiting for gc.
|
||||||
time.sleep(0.1) # don't monopolize the thread (or Python GIL?)
|
time.sleep(0.1) # don't monopolize the thread (or Python GIL?)
|
||||||
|
|
||||||
def wipe_disk(self):
|
def clear(self):
|
||||||
try:
|
def wipe_disk(hist):
|
||||||
os.remove(self.filename)
|
try:
|
||||||
except FileNotFoundError:
|
os.remove(hist.filename)
|
||||||
pass
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
def wipe_memory(self): # todo is this enough?
|
def wipe_memory(hist): # todo is this enough?
|
||||||
self.buffer = []
|
hist.buffer = []
|
||||||
|
|
||||||
|
wipe_disk(self)
|
||||||
|
wipe_memory(self)
|
||||||
|
|
||||||
def remake_file(self):
|
def remake_file(self):
|
||||||
meta = dict()
|
meta = dict()
|
||||||
|
|
Loading…
Add table
Reference in a new issue