merge migration branch.

parent d8ee0292
......@@ -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:
......@@ -140,7 +141,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]
......@@ -182,7 +183,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):
"""
......@@ -529,7 +530,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:
......@@ -551,9 +552,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
......@@ -637,13 +638,13 @@ class SectionManager(object):
except KeyError:
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
else:
gI = gIndex
try:
self.openSections[gI].addArrayValues(valueMetaInfo, value)
self.openSections[gI].addArrayValues(valueMetaInfo, value, **kwargs)
except KeyError:
raise Exception("Cannot add array values for metadata %s to section %d (%d) of %s, as it is not open" % (valueMetaInfo.name, gI, gIndex, self.metaInfo.name))
......
Markdown is supported
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