def norm_open(path): """return a stream for a file with content with normalized line feeds :type path: str :param path: path to the file to open :rtype: file or StringIO :return: the opened file with normalized line feeds """ if _HAS_UNIV_OPEN: return open(path, 'U') return StringIO(_LINE_RGX.sub('\n', open(path).read()))
def norm_open(path): """return a stream for a file with content with normalized line feeds :type path: str :param path: path to the file to open :rtype: file or StringIO :return: the opened file with normalized line feeds """ if _HAS_UNIV_OPEN: return open(path, 'U') return StringIO(_LINE_RGX.sub('\n', open(path).read()))
def norm_read(path): """return the content of the file with normalized line feeds :type path: str :param path: path to the file to read :rtype: str :return: the content of the file with normalized line feeds """ if _HAS_UNIV_OPEN: return open(path, 'U').read() return _LINE_RGX.sub('\n', open(path).read())
def norm_read(path): """return the content of the file with normalized line feeds :type path: str :param path: path to the file to read :rtype: str :return: the content of the file with normalized line feeds """ if _HAS_UNIV_OPEN: return open(path, 'U').read() return _LINE_RGX.sub('\n', open(path).read())