diff --git a/src/finam/adapters/base.py b/src/finam/adapters/base.py index b8055b7ac6fff8851761ae1dcba3fd860c02cfec..fd4f6fbc32d107b088cc3fe068d992adc5256d9a 100644 --- a/src/finam/adapters/base.py +++ b/src/finam/adapters/base.py @@ -1,6 +1,7 @@ """ Basic data transformation adapters. """ + import numpy as np from ..data.grid_spec import NoGrid @@ -123,7 +124,6 @@ class ValueToGrid(Adapter): def __init__(self, grid): super().__init__() self.grid = grid - self._info = None def _get_data(self, time, target): """Get the output's data-set for the given time. @@ -139,12 +139,7 @@ class ValueToGrid(Adapter): data-set for the requested time. """ value = self.pull_data(time, target) - return quantify( - np.full( - self._info.grid.data_shape, get_magnitude(value), dtype=value.dtype - ), - get_units(value), - ) + return np.full(self.info.grid_shape, get_magnitude(value)) def _get_info(self, info): up_info = info.copy_with(grid=NoGrid()) @@ -157,7 +152,6 @@ class ValueToGrid(Adapter): f"Grid specifications don't match. Target has {info.grid}, expected {out_info.grid}" ) - self._info = out_info return out_info diff --git a/src/finam/adapters/time_integration.py b/src/finam/adapters/time_integration.py index 5d18cd5957766f41b0d315a042b7349331df1a61..19435c053f0966fb237acfc68f63c8599cf28da7 100644 --- a/src/finam/adapters/time_integration.py +++ b/src/finam/adapters/time_integration.py @@ -1,4 +1,5 @@ """Adapters for time integration""" + from abc import ABC from datetime import timedelta @@ -14,7 +15,6 @@ class TimeIntegrationAdapter(TimeCachingAdapter, ABC): def __init__(self): super().__init__() self._prev_time = None - self._info = None def _source_updated(self, time): """Informs the input that a new output is available. @@ -107,7 +107,6 @@ class AvgOverTime(TimeIntegrationAdapter): super().__init__() self._prev_time = None self._step = step - self._info = None def _interpolate(self, time): if len(self.data) == 1: @@ -238,8 +237,6 @@ class SumOverTime(TimeIntegrationAdapter): self._per_time = per_time self._initial_interval = initial_interval - self._info = None - def _interpolate(self, time): if len(self.data) == 1 or time <= self.data[0][0]: if self._per_time: @@ -307,5 +304,4 @@ class SumOverTime(TimeIntegrationAdapter): else: out_info = in_info.copy_with() - self._info = out_info return out_info