Commit 3793ea2d authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

tsio: follow the docstring adaptation in variable names

auto -> upstream
synth -> edited
parent 85cc26d89bf4
...@@ -517,4 +517,4 @@ def test_serie_deletion(engine, tsh): ...@@ -517,4 +517,4 @@ def test_serie_deletion(engine, tsh):
tsh.insert(engine, ts, 'deleteme', 'Celeste') tsh.insert(engine, ts, 'deleteme', 'Celeste')
testit(tsh) testit(tsh)
testit(tsh.auto_store) testit(tsh.upstream)
...@@ -55,7 +55,7 @@ class timeseries(basets): ...@@ -55,7 +55,7 @@ class timeseries(basets):
def __init__(self, *a, **kw): def __init__(self, *a, **kw):
super().__init__(*a, **kw) super().__init__(*a, **kw)
self.auto_store = basets(namespace='{}-automatic'.format(self.namespace)) self.upstream = basets(namespace='{}-automatic'.format(self.namespace))
@tx @tx
def insert(self, cn, ts, name, author, def insert(self, cn, ts, name, author,
...@@ -65,7 +65,7 @@ class timeseries(basets): ...@@ -65,7 +65,7 @@ class timeseries(basets):
diff = ts diff = ts
else: else:
# insert & compute diff over automatic # insert & compute diff over automatic
diff = self.auto_store.insert( diff = self.upstream.insert(
cn, ts, name, author, cn, ts, name, author,
metadata=metadata, metadata=metadata,
_insertion_date=_insertion_date _insertion_date=_insertion_date
...@@ -84,25 +84,25 @@ class timeseries(basets): ...@@ -84,25 +84,25 @@ class timeseries(basets):
@tx @tx
def delete(self, cn, seriename): def delete(self, cn, seriename):
super().delete(cn, seriename) super().delete(cn, seriename)
self.auto_store.delete(cn, seriename) self.upstream.delete(cn, seriename)
# supervision specific API # supervision specific API
@tx @tx
def get_overrides(self, cn, name, revision_date=None, def get_overrides(self, cn, name, revision_date=None,
from_value_date=None, to_value_date=None): from_value_date=None, to_value_date=None):
autotsh = self.auto_store upstreamtsh = self.upstream
auto = autotsh.get(cn, name, upstream = upstreamtsh.get(cn, name,
revision_date=revision_date, revision_date=revision_date,
from_value_date=from_value_date, from_value_date=from_value_date,
to_value_date=to_value_date, to_value_date=to_value_date,
_keep_nans=True) _keep_nans=True)
synth = self.get(cn, name, edited = self.get(cn, name,
revision_date=revision_date, revision_date=revision_date,
from_value_date=from_value_date, from_value_date=from_value_date,
to_value_date=to_value_date, to_value_date=to_value_date,
_keep_nans=True) _keep_nans=True)
manual = self.diff(auto, synth) manual = self.diff(upstream, edited)
manual.name = name manual.name = name
return manual return manual
...@@ -114,20 +114,24 @@ class timeseries(basets): ...@@ -114,20 +114,24 @@ class timeseries(basets):
if table is None: if table is None:
return None, None return None, None
autotsh = self.auto_store upstreamtsh = self.upstream
auto = autotsh.get(cn, name, upstream = upstreamtsh.get(
revision_date=revision_date, cn, name,
from_value_date=from_value_date, revision_date=revision_date,
to_value_date=to_value_date, from_value_date=from_value_date,
_keep_nans=True) to_value_date=to_value_date,
synth = self.get(cn, name, _keep_nans=True
revision_date=revision_date, )
from_value_date=from_value_date, edited = self.get(
to_value_date=to_value_date, cn, name,
_keep_nans=True) revision_date=revision_date,
manual = self.diff(auto, synth) from_value_date=from_value_date,
to_value_date=to_value_date,
_keep_nans=True
)
manual = self.diff(upstream, edited)
unionindex = join_index(auto, manual) unionindex = join_index(upstream, manual)
if unionindex is None: if unionindex is None:
# this means both series are empty # this means both series are empty
return None, None return None, None
...@@ -137,4 +141,4 @@ class timeseries(basets): ...@@ -137,4 +141,4 @@ class timeseries(basets):
mask_manual[manual.index] = True mask_manual[manual.index] = True
mask_manual.name = name mask_manual.name = name
return synth.dropna(), mask_manual return edited.dropna(), mask_manual
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment