def expect_element(__funcname=_qualified_name, **named):
 def _expect_element(collection):
  if isinstance(collection, (set, frozenset)):
   collection_for_error_message = tuple(sorted(collection))
  else:
   collection_for_error_message = collection
  template = "%(funcname)s() expected a value in {collection} for argument '%(argname)s', but got %(actual)s instead.".format(collection=collection_for_error_message)
  return make_check(ValueError, template, complement(op.contains(collection)), repr, funcname=__funcname)
 return preprocess(**valmap(_expect_element, named))

def expect_element ( __funcname = _qualified_name , ** named ) : def _expect_element ( collection ) : if isinstance ( collection , ( set , frozenset ) ) : collection_for_error_message = tuple ( sorted ( collection ) ) else : collection_for_error_message = collection template = "%(funcname)s() expected a value in {collection} for argument '%(argname)s', but got %(actual)s instead." . format ( collection = collection_for_error_message ) return make_check ( ValueError , template , complement ( op . contains ( collection ) ) , repr , funcname = __funcname ) return preprocess ( ** valmap ( _expect_element , named ) )
preprocessing decorator that verifies inputs are elements of some expected collection .