parameters: (path, is_dry_run = True, verbose = True, eol = '\n')
return_statement: return True
docstring: Makes sure that all sources have the specified eol sequence (default: unix).
docstring_summary: Makes sure that all sources have the specified eol sequence (default: unix).
docstring_tokens: Makes sure that all sources have the specified eol sequence ( default : unix ) .
function: def fix_source_eol(path, is_dry_run = True, verbose = True, eol = '\n'):
      """Makes sure that all sources have the specified eol sequence (default: unix)."""
      if not os.path.isfile(path):
          raise ValueError('Path "%s" is not a file' % path)
      try:
          f = open(path, 'rb')
      except IOError as msg:
          print("%s: I/O Error: %s" % (file, str(msg)), file=sys.stderr)
          return False
      try:
          raw_lines = f.readlines()
      finally:
          f.close()
      fixed_lines = [line.rstrip('\r\n') + eol for line in raw_lines]
      if raw_lines != fixed_lines:
          print('%s =>' % path, end=' ')
          if not is_dry_run:
              f = open(path, "wb")
              try:
                  f.writelines(fixed_lines)
              finally:
                  f.close()
          if verbose:
              print(is_dry_run and ' NEED FIX' or ' FIXED')
      return True
function_tokens: def fix_source_eol ( path , is_dry_run = True , verbose = True , eol = '\n' ) : if not os . path . isfile ( path ) : raise ValueError ( 'Path "%s" is not a file' % path ) try : f = open ( path , 'rb' ) except IOError as msg : print ( "%s: I/O Error: %s" % ( file , str ( msg ) ) , file = sys . stderr ) return False try : raw_lines = f . readlines ( ) finally : f . close ( ) fixed_lines = [ line . rstrip ( '\r\n' ) + eol for line in raw_lines ] if raw_lines != fixed_lines : print ( '%s =>' % path , end = ' ' ) if not is_dry_run : f = open ( path , "wb" ) try : f . writelines ( fixed_lines ) finally : f . close ( ) if verbose : print ( is_dry_run and ' NEED FIX' or ' FIXED' ) return True