Inline class.
@@ -28,25 +28,21 @@ class VariableTableSetter(object):
self._store = store
def set(self, variables, overwrite=False):
- for name, value in VariableTableReader().read(variables):
+ for name, value in self._get_items(variables):
self._store.add(name, value, overwrite, decorated=False)
-
-class VariableTableReader(object):
-
- def read(self, variables):
+ def _get_items(self, variables):
for var in variables:
if var.error:
var.report_invalid_syntax(var.error)
continue
try:
- yield self._get_name_and_value(var.name, var.value,
+ value = VariableTableValue(var.value, var.name,
var.report_invalid_syntax)
except DataError as err:
var.report_invalid_syntax(err)
-
- def _get_name_and_value(self, name, value, error_reporter):
- return name[2:-1], VariableTableValue(value, name, error_reporter)
+ else:
+ yield var.name[2:-1], value
def VariableTableValue(value, name, error_reporter=None):
