def expect_types(__funcname=_qualified_name, **named):
 for (name, type_) in iteritems(named):
  if (not isinstance(type_, (type, tuple))):
   raise TypeError("expect_types() expected a type or tuple of types for argument '{name}', but got {type_} instead.".format(name=name, type_=type_))
 def _expect_type(type_):
  _template = "%(funcname)s() expected a value of type {type_or_types} for argument '%(argname)s', but got %(actual)s instead."
  if isinstance(type_, tuple):
   template = _template.format(type_or_types=' or '.join(map(_qualified_name, type_)))
  else:
   template = _template.format(type_or_types=_qualified_name(type_))
  return make_check(exc_type=TypeError, template=template, pred=(lambda v: (not isinstance(v, type_))), actual=compose(_qualified_name, type), funcname=__funcname)
 return preprocess(**valmap(_expect_type, named))

def expect_types ( __funcname = _qualified_name , ** named ) : for ( name , type_ ) in iteritems ( named ) : if ( not isinstance ( type_ , ( type , tuple ) ) ) : raise TypeError ( "expect_types() expected a type or tuple of types for argument '{name}', but got {type_} instead." . format ( name = name , type_ = type_ ) ) def _expect_type ( type_ ) : _template = "%(funcname)s() expected a value of type {type_or_types} for argument '%(argname)s', but got %(actual)s instead." if isinstance ( type_ , tuple ) : template = _template . format ( type_or_types = ' or ' . join ( map ( _qualified_name , type_ ) ) ) else : template = _template . format ( type_or_types = _qualified_name ( type_ ) ) return make_check ( exc_type = TypeError , template = template , pred = ( lambda v : ( not isinstance ( v , type_ ) ) ) , actual = compose ( _qualified_name , type ) , funcname = __funcname ) return preprocess ( ** valmap ( _expect_type , named ) )
preprocessing decorator that verifies inputs have expected types .