Skip to content
Snippets Groups Projects

Follow-Up Translations

Merged David Schäfer requested to merge translations into develop
Compare and Show latest version
3 files
+ 6
61
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 4
28
@@ -48,7 +48,6 @@ class _HistAccess:
self.obj._validateHistForFlags(value)
self.obj._data[key] = value
self.obj._cache.pop(key, None)
class Flags:
@@ -180,19 +179,6 @@ class Flags:
else:
self._data = self._initFromRaw(raw_data, copy)
# this is a simple cache that reduce the calculation of the flags
# from the entire history of a flag column. The _cache is filled
# with __getitem__ and cleared on any write access to self_data.
# There are not to may write access possibilities here so we don't
# have to much trouble.
# NOTE:
# `time pytest tests/core tests/funcs tests/integration tests/fuzzy`
# yields # identical runtimes without or without the cache, the cache
# however adds code complexity, through the additional dictionary and
# stuff like the `_HistAccess`. If tests on real-world datasets give
# similar results, we should get rid of it.
self._cache = {}
@staticmethod
def _initFromRaw(data: Mapping, copy: bool) -> Dict[str, History]:
"""
@@ -282,16 +268,12 @@ class Flags:
if not len(value) == len(self):
raise ValueError("index must match current index in length")
_data, _cache = {}, {}
_data = {}
for old, new in zip(self.columns, value):
_data[new] = self._data[old]
if old in self._cache:
_cache[new] = self._cache[old]
self._data = _data
self._cache = _cache
@property
def empty(self) -> bool:
@@ -315,11 +297,7 @@ class Flags:
# item access
def __getitem__(self, key: str) -> pd.Series:
if key not in self._cache:
self._cache[key] = self._data[key].max()
return self._cache[key].copy()
return self._data[key].max()
def __setitem__(self, key: SelectT, value: ValueT):
# force-KW is only internally available
@@ -365,11 +343,9 @@ class Flags:
self._data[key] = _simpleHist(value.index)
self._data[key].append(value, force=True)
self._cache.pop(key, None)
def __delitem__(self, key):
self._data.pop(key)
self._cache.pop(key, None)
def drop(self, key: str):
"""
@@ -455,8 +431,8 @@ class Flags:
"""
di = dios.DictOfSeries(columns=self.columns)
for k, v in self._data.items():
di[k] = self[k] # use cache
for k in self._data.keys():
di[k] = self[k]
return di.copy()
Loading