my.bluemaestro: run against testdata, add on CI

This commit is contained in:
Dima Gerasimov 2020-10-03 20:05:21 +01:00 committed by karlicoss
parent e63c159b80
commit 6242307d7a
7 changed files with 49 additions and 20 deletions

View file

@ -10,9 +10,8 @@ from pathlib import Path
import sqlite3
from typing import Iterable, NamedTuple, Sequence, Set
from ..common import mcachew, LazyLogger, get_files
from ..core.common import mcachew, LazyLogger, get_files
from ..core.cachew import cache_dir
from my.config import bluemaestro as config
@ -99,12 +98,13 @@ def measurements(dbs=inputs()) -> Iterable[Measurement]:
# for k, v in merged.items():
# yield Point(dt=k, temp=v) # meh?
def stats():
from ..common import stat
from ..core.common import stat, Stats
def stats() -> Stats:
return stat(measurements)
def dataframe():
from ..core.pandas import DataFrameT
def dataframe() -> DataFrameT:
"""
%matplotlib gtk
from my.bluemaestro import dataframe
@ -115,13 +115,4 @@ def dataframe():
import pandas as pd # type: ignore
return pd.DataFrame(p._asdict() for p in measurements()).set_index('dt')
def main():
ll = list(measurements())
print(len(ll))
if __name__ == '__main__':
main()
# TODO copy a couble of databases (one old, one new) to my public data repository?
# todo test against an older db?

View file

@ -8,7 +8,11 @@ def disable_cachew():
NOTE: you need to use it before importing any function using @cachew.cachew
'''
# TODO not sure... maybe it should instead use some hook.. it's a ibt ugly do
import cachew
try:
import cachew
except ImportError:
# nothing to disable
return
@cachew.doublewrap
def cachew_off(func=None, *args, **kwargs):