mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 19:31:33 +00:00
Make Historymonitor.history a list instead of a deque (for slicing)
This commit is contained in:
parent
eea6a418a8
commit
5133806d33
@ -1,6 +1,5 @@
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
from collections import deque
|
||||
from os.path import dirname
|
||||
|
||||
|
||||
@ -17,7 +16,7 @@ class CallbackEventHandler(FileSystemEventHandler):
|
||||
class HistoryMonitor:
|
||||
def __init__(self, histfile):
|
||||
self.histfile = histfile
|
||||
self._history = deque()
|
||||
self._history = []
|
||||
self.observer = Observer()
|
||||
self.observer.schedule(CallbackEventHandler(self._fetch_history), dirname(self.histfile))
|
||||
|
||||
@ -27,7 +26,7 @@ class HistoryMonitor:
|
||||
|
||||
def _fetch_history(self):
|
||||
with open(self.histfile, 'r') as ifile:
|
||||
self._history = deque(ifile.readlines())
|
||||
self._history = ifile.readlines()
|
||||
|
||||
def watch(self):
|
||||
self.observer.start()
|
||||
|
Loading…
Reference in New Issue
Block a user