Commits (2)
......@@ -112,7 +112,8 @@ class LocalBackend(object):
self.closeSection(metaName, openGIndexes[0][1])
def addValue(self, metaName, value, gIndex=-1):
"""override will cause the backend to rewrite the
first value of MetaName in gindex in the backend"""
dataManager = self.dataManagers[metaName]
if self.debug:
......@@ -142,7 +143,7 @@ class LocalBackend(object):
def addRealValue(self, metaName, value, gIndex=-1):
self.addValue(metaName, value, gIndex)
def addArrayValues(self, metaName, values, gIndex=-1):
def addArrayValues(self, metaName, values, gIndex=-1, **kwargs):
dataManager = self.dataManagers[metaName]
......@@ -184,7 +185,7 @@ class LocalBackend(object):
if actual_numpy_type not in array_types:
raise TypeError("The given array for metainfo '{}' has incorrect type of values in it. The values given are '{}', whereas the datatype given in metainfo is '{}'".format(metaName, actual_numpy_type, dtype_str))
dataManager.superSectionManager.addArrayValues(dataManager.metaInfo, values, gIndex=gIndex)
dataManager.superSectionManager.addArrayValues(dataManager.metaInfo, values, gIndex=gIndex, **kwargs)
def setSectionInfo(self, metaName, gIndex, references):
......@@ -531,7 +532,7 @@ class Section(object):
return key in keys
def addValue(self, metaInfo, value):
if self.backend.store:
if self.backend.store: # Check if backend set to store values.
if self.debug:
vals = self.simple_values.get(metaInfo.name, None)
if vals is None:
......@@ -553,9 +554,9 @@ class Section(object):
idxs = [slice(0, x) for x in values.shape]
vals[len(vals) - 1][idxs] = values
def addArrayValues(self, metaInfo, values):
def addArrayValues(self, metaInfo, values, override: bool = False):
if self.backend.store:
if self.debug:
if self.debug and not override:
vals = self.array_values.get(metaInfo.name, None)
if vals is None:
self.array_values[metaInfo.name] = values
......@@ -639,7 +640,7 @@ class SectionManager(object):
except (KeyError, IndexError):
raise Exception("Cannot set array values for metadata %s to section %d (%d) of %s, as it is not open" % (valueMetaInfo.name, gI, gIndex, self.metaInfo.name))
def addArrayValues(self, valueMetaInfo, value, gIndex=-1):
def addArrayValues(self, valueMetaInfo, value, gIndex=-1, **kwargs):
if gIndex == -1:
gI = self.lastSectionGIndex