def convert_type_list_to_dict(self, types):
     names = self._argspec.argument_names
     if len(types) > len(names):
         raise DataError('Type information given to %d argument%s but '
                         'keyword has only %d argument%s.'
                         % (len(types), s(types), len(names), s(names)))
     return {name: value for name, value in zip(names, types) if value}
Beispiel #2
0
 def _replace_variables(self, data):
     values = super(ForInZipRunner, self)._replace_variables(data)
     if len(data.variables) == len(data.values):
         return values
     raise DataError('FOR IN ZIP expects an equal number of variables and '
                     'iterables. Got %d variable%s and %d iterable%s.'
                     % (len(data.variables), s(data.variables),
                        len(data.values), s(data.values)))
 def validate_type_dict(self, types):
     # 'return' isn't used for anything yet but it may be shown by Libdoc
     # in the future. Trying to be forward compatible.
     names = set(self._argspec.argument_names + ['return'])
     extra = [t for t in types if t not in names]
     if extra:
         raise DataError('Type information given to non-existing '
                         'argument%s %s.'
                         % (s(extra), seq2str(sorted(extra))))
     return types
Beispiel #4
0
 def _raise_wrong_variable_count(self, variables, values):
     raise DataError('Number of FOR IN ENUMERATE loop values should be '
                     'multiple of its variables (excluding the index). '
                     'Got %d variable%s but %d value%s.'
                     % (variables, s(variables), values, s(values)))
Beispiel #5
0
 def _raise_wrong_variable_count(self, variables, values):
     raise DataError('Number of FOR loop values should be multiple of '
                     'its variables. Got %d variables but %d value%s.'
                     % (variables, values, s(values)))