Skip to content
Snippets Groups Projects
Commit ef9c7128 authored by Bert Palm's avatar Bert Palm 🎇
Browse files

Merge branch 'history' into 'develop'

Expose History

See merge request !661
parents 044336be b458b55b
No related branches found
No related tags found
3 merge requests!685Release 2.4,!684Release 2.4,!661Expose History
Pipeline #162776 passed with stages
in 9 minutes and 46 seconds
......@@ -11,6 +11,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
### Added
- Methods `logicalAnd` and `logicalOr`
- `Flags` supports slicing and column selection with `list` or a `pd.Index`
- Expose the `History` via `SaQC._history_`
### Changed
- Deprecate `interpolate`, `linear` and `shift` in favor of `align`
- Depreacte `roll` in favor of `rolling`
......
......@@ -15,7 +15,7 @@ from typing import Any, Hashable, MutableMapping
import numpy as np
import pandas as pd
from saqc.core.flags import Flags, initFlagsLike
from saqc.core.flags import Flags, _HistAccess, initFlagsLike
from saqc.core.frame import DictOfSeries
from saqc.core.history import History
from saqc.core.register import FUNC_MAP
......@@ -113,6 +113,10 @@ class SaQC(FunctionsMixin):
flags.attrs = self._attrs.copy()
return flags
@property
def _history(self) -> _HistAccess:
return self._flags.history
def __getattr__(self, key):
"""
All failing attribute accesses are redirected to __getattr__.
......
......@@ -36,17 +36,17 @@ ValueT = Union[pd.Series, Iterable, float]
class _HistAccess:
def __init__(self, obj: Flags):
self.obj = obj
self._obj = obj
def __getitem__(self, key: str) -> History:
return self.obj._data[key]
return self._obj._data[key]
def __setitem__(self, key: str, value: History):
if not isinstance(value, History):
raise TypeError("Not a History")
self.obj._validateHistForFlags(value)
self.obj._data[key] = value
self._obj._validateHistForFlags(value)
self._obj._data[key] = value
class Flags:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment