def _get_var_table_name_and_value(self, name, value, path=None): if not is_var(name): raise DataError("Invalid variable name.") value = [ self._unescape_leading_trailing_spaces(cell) for cell in value ] if name[0] == '@': return name, self.replace_list(value) return name, self._get_var_table_scalar_value(name, value, path)
def __getitem__(self, name): if not is_var(name): raise DataError("Invalid variable name '%s'." % name) try: return utils.NormalizedDict.__getitem__(self, name) except KeyError: try: return self._get_number_var(name) except ValueError: try: return self._get_extended_var(name) except ValueError: try: return self._get_list_var_as_scalar(name) except ValueError: raise DataError("Non-existing variable '%s'." % name)
def _validate_var_name(self, name): if not is_var(name): raise DataError("Invalid variable name '%s'." % name)
def __setitem__(self, name, value, path=None, depr_warning=True): if not is_var(name): raise DataError("Invalid variable name '%s'." % name) if depr_warning: self._deprecation_warning_if_basename_already_used(name, path) utils.NormalizedDict.__setitem__(self, name, value)