Make it possible to not typecheck values in setv.
This commit is contained in:
parent
abaec2f044
commit
152bcae618
@ -68,7 +68,7 @@ class Section:
|
||||
"""Get value keys."""
|
||||
return self.values.keys()
|
||||
|
||||
def setv(self, layer, key, value, interpolated):
|
||||
def setv(self, layer, key, value, interpolated=None):
|
||||
"""Set the value on a layer.
|
||||
|
||||
Args:
|
||||
@ -111,7 +111,7 @@ class KeyValue(Section):
|
||||
self.values[k] = v
|
||||
self.descriptions[k] = desc
|
||||
|
||||
def setv(self, layer, key, value, interpolated):
|
||||
def setv(self, layer, key, value, interpolated=None):
|
||||
self.values[key].setv(layer, value, interpolated)
|
||||
|
||||
def dump_userconfig(self):
|
||||
@ -165,7 +165,7 @@ class ValueList(Section):
|
||||
self.values = ChainMap(self.layers['temp'], self.layers['conf'],
|
||||
self.layers['default'])
|
||||
|
||||
def setv(self, layer, key, value, interpolated):
|
||||
def setv(self, layer, key, value, interpolated=None):
|
||||
self.keytype().validate(key)
|
||||
if key in self.layers[layer]:
|
||||
self.layers[layer][key].setv(layer, value, interpolated)
|
||||
|
@ -90,7 +90,7 @@ class SettingValue:
|
||||
v = self.value
|
||||
return self.typ.transform(v)
|
||||
|
||||
def setv(self, layer, value, interpolated):
|
||||
def setv(self, layer, value, interpolated=None):
|
||||
"""Set the value on a layer.
|
||||
|
||||
Args:
|
||||
@ -98,6 +98,8 @@ class SettingValue:
|
||||
ValueLayers dict.
|
||||
value: The value to set.
|
||||
interpolated: The interpolated value, for typechecking.
|
||||
If None, no checks get performed.
|
||||
"""
|
||||
self.typ.validate(interpolated)
|
||||
if interpolated is not None:
|
||||
self.typ.validate(interpolated)
|
||||
self._values[layer] = value
|
||||
|
Loading…
Reference in New Issue
Block a user