mirror of
https://github.com/balkian/tsih.git
synced 2025-01-08 06:41:28 +00:00
Compare commits
2 Commits
70779fa0ad
...
92c5c219bd
Author | SHA1 | Date | |
---|---|---|---|
|
92c5c219bd | ||
|
c857890d91 |
@ -10,7 +10,7 @@ import tempfile
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
__version__ = '0.1.4'
|
__version__ = '0.1.6'
|
||||||
|
|
||||||
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:
|
||||||
raise Exception('DB in readonly mode')
|
return
|
||||||
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,3 +442,43 @@ 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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user