示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 def _validate_var_name(self, name):
     if not is_var(name):
         raise DataError("Invalid variable name '%s'." % name)
示例#4
0
 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)
示例#5
0
 def _validate_var_name(self, name):
     if not is_var(name):
         raise DataError("Invalid variable name '%s'." % name)