def check_newlines(fname, bytes_to_read=52428800):
 CHUNK_SIZE = (2 ** 20)
 f = open(fname, 'r')
 for chunk in f.read(CHUNK_SIZE):
  if (f.tell() > bytes_to_read):
   break
  if chunk.count('\r'):
   f.close()
   return True
 f.close()
 return False

def check_newlines ( fname , bytes_to_read = 52428800 ) : CHUNK_SIZE = ( 2 ** 20 ) f = open ( fname , 'r' ) for chunk in f . read ( CHUNK_SIZE ) : if ( f . tell ( ) > bytes_to_read ) : break if chunk . count ( '\r' ) : f . close ( ) return True f . close ( ) return False
determines if there are any non-posix newlines in the first number_of_bytes of the file .