17 from robot.utils import (is_dict_like, is_list_like, plural_or_not
as s,
36 raise DataError(
'Type information must be given as a dictionary or '
42 names = set(self.
_argspec_argspec.argument_names + [
'return'])
43 extra = [t
for t
in types
if t
not in names]
45 raise DataError(
'Type information given to non-existing '
47 % (s(extra),
seq2str(sorted(extra))))
51 names = self.
_argspec_argspec.argument_names
52 if len(types) > len(names):
53 raise DataError(
'Type information given to %d argument%s but '
54 'keyword has only %d argument%s.'
55 % (len(types), s(types), len(names), s(names)))
56 return {name: value
for name, value
in zip(names, types)
if value}
def validate_type_dict(self, types)
def __init__(self, argspec)
:type argspec: :py:class:robot.running.arguments.ArgumentSpec
def convert_type_list_to_dict(self, types)
def validate(self, types)
def seq2str(sequence, quote="'", sep=', ', lastsep=' and ')
Returns sequence in format ‘'item 1’, 'item 2' and 'item 3'`.
def type_name(item, capitalize=False)
Return "non-technical" type name for objects and types.