1
0
mirror of https://github.com/balkian/tsih.git synced 2025-01-09 15:21:29 +00:00

Compare commits

..

No commits in common. "92c5c219bdfe8a273bbe4dda69e9e6804c5ce0d8" and "70779fa0ad7d0c921aa5a34f089a2b46142219fa" have entirely different histories.

View File

@ -10,7 +10,7 @@ import tempfile
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
__version__ = '0.1.6' __version__ = '0.1.4'
from collections import UserDict, namedtuple from collections import UserDict, namedtuple
@ -240,7 +240,7 @@ class History:
The cache will be flushed at the end of the simulation, and when history is accessed. The cache will be flushed at the end of the simulation, and when history is accessed.
''' '''
if self.readonly: if self.readonly:
return raise Exception('DB in readonly mode')
logger.debug('Flushing cache {}'.format(self.db_path)) logger.debug('Flushing cache {}'.format(self.db_path))
with self.db: with self.db:
self.db.executemany("replace into history(dict_id, t_step, key, value) values (?, ?, ?, ?)", self._tups) self.db.executemany("replace into history(dict_id, t_step, key, value) values (?, ?, ?, ?)", self._tups)
@ -442,43 +442,3 @@ Key = namedtuple('Key', ['dict_id', 't_step', 'key'])
Record = namedtuple('Record', 'dict_id t_step key value') Record = namedtuple('Record', 'dict_id t_step key value')
Stat = namedtuple('Stat', 'stat_id text') Stat = namedtuple('Stat', 'stat_id text')
class NoHistory:
'''Empty implementation for history meant for testing.'''
def __init__(self, *args, **kwargs):
pass
def close(self):
pass
def save_stats(self, stat):
pass
def get_stats(self, unflatten=True):
return []
def save_tuples(self, tuples):
return
def save_records(self, records):
return
def save_record(self, dict_id, t_step, key, value):
return
def flush_cache(self):
return
def to_tuples(self):
return []
def __getitem__(self, key):
return None
def read_sql(self, keys=None, dict_ids=None, not_dict_ids=None, t_steps=None, convert_types=False, limit=-1):
return pandas.Dataframe()
def dump(self, f):
return