def file_contents(matcher):
 def get_content(file_path):
  return file_path.getContent()
 def content_mismatches(original):
  return mismatch(original.mismatched, ('%s has unexpected contents:\n%s' % (original.mismatched.path, original.describe())), original.get_details())
 return MatchesAll(file_exists(), OnMismatch(content_mismatches, AfterPreprocessing(get_content, matcher, annotate=False)), first_only=True)

def file_contents ( matcher ) : def get_content ( file_path ) : return file_path . getContent ( ) def content_mismatches ( original ) : return mismatch ( original . mismatched , ( '%s has unexpected contents:\n%s' % ( original . mismatched . path , original . describe ( ) ) ) , original . get_details ( ) ) return MatchesAll ( file_exists ( ) , OnMismatch ( content_mismatches , AfterPreprocessing ( get_content , matcher , annotate = False ) ) , first_only = True )
match if a files contents match matcher .