Commit 825616d2 authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

deprecate TimeSerie and propose `timeseries` instead

Also `get_delta` becomes `staircase`
and `get_history` becomes `history`
parent ac162bf13283
......@@ -11,6 +11,7 @@ setup(name='tshistory',
packages=['tshistory'],
install_requires=[
'pandas ~= 0.23.4',
'deprecated',
'dateutils',
'sqlalchemy',
'click',
......
......@@ -8,6 +8,8 @@ from pathlib import Path
import pandas as pd
from deprecated import deprecated
from tshistory.schema import tsschema
from tshistory.util import (
closed_overlaps,
......@@ -24,7 +26,7 @@ L = logging.getLogger('tshistory.tsio')
SERIESSCHEMA = Path(__file__).parent / 'series.sql'
class TimeSerie(SeriesServices):
class timeseries(SeriesServices):
namespace = 'tsh'
schema = None
metadatacache = None
......@@ -162,15 +164,15 @@ class TimeSerie(SeriesServices):
return 'primary'
@tx
def get_history(self, cn, seriename,
from_insertion_date=None,
to_insertion_date=None,
from_value_date=None,
to_value_date=None,
deltabefore=None,
deltaafter=None,
diffmode=False,
_keep_nans=False):
def history(self, cn, seriename,
from_insertion_date=None,
to_insertion_date=None,
from_value_date=None,
to_value_date=None,
deltabefore=None,
deltaafter=None,
diffmode=False,
_keep_nans=False):
tablename = self._serie_to_tablename(cn, seriename)
if tablename is None:
return
......@@ -256,7 +258,7 @@ class TimeSerie(SeriesServices):
}
@tx
def get_delta(self, cn, seriename, delta,
def staircase(self, cn, seriename, delta,
from_value_date=None,
to_value_date=None):
""" compute a series whose value dates are bounded to be
......@@ -741,3 +743,11 @@ class TimeSerie(SeriesServices):
self.metadatacache.clear()
self.registry_map.clear()
self.serie_tablename.clear()
@deprecated(reason='use the `timeseries` object instead')
class TimeSerie(timeseries):
get_history = deprecated(timeseries.history)
get_delta = deprecated(timeseries.staircase)
......@@ -229,6 +229,7 @@ def tx(func):
return func(self, txcn, *a, **kw)
return func(self, cn, *a, **kw)
check_tx_and_call.__name__ = func.__name__
return check_tx_and_call
......
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