Read and return content from file *path*
19488
def read(path, encoding="UTF-8"):
    """"""
    with OPEN_FUNC(path, 'rb') as _file:
        cont = _file.read()
        return cont.decode(encoding)
614092
def reader(path_or_f):
    
    if hasattr(path_or_f, "read"):
        return path_or_f
    else:
        path = path_or_f

    path = normalize_path(path)
    _, extension = extract_extension(path)

    reader_func = FILE_READERS[extension]

    return reader_func(path)
62162
def read(path, encoding="utf-8"):
    
    try:
        with io.open(path, encoding=encoding) as f:
            return f.read()
    except Exception as e:
        logger.error("read: %s failed. Error: %s", path, e)
        return ""
544466
def read_file(cls, path):
        
        with open(path, encoding="utf-8") as file:
            file_contents = file.read()
            return cls.read(file_contents)
1177062
def from_file(cls, file_path, compressed=False, encoded=False):
        """"""
        file_id = '.'.join(path.basename(file_path).split('.')[:-1])
        file_format = file_path.split('.')[-1]
        content = cls(file_id, file_format, compressed, encoded)
        content.file_exists = True
        content._location = path.dirname(file_path)
        return content
733470
def _read_file(folder, filename):
    '''
    
    '''
    path = os.path.join(folder, filename)
    try:
        with salt.utils.files.fopen(path, 'rb') as contents:
            return salt.utils.data.decode(contents.readlines())
    except (OSError, IOError):
        return ''
672796
def read_file(path)
      result = nil
      File.open(path, 'rb', encoding: 'UTF-8') { |f| result = f.read }
      result
    end
179734
def _read_file_data(self, path):
        
        _, ext = os.path.splitext(path)
        # YAML files
        if ext in ('.yml', '.yaml'):
            try:
                with open(path) as f:
                    return yaml.safe_load(f)
            except YAMLError as e:
                raise ConfigParseError(path, e)
        # JSON files
        elif ext == '.json':
            try:
                return json.loads(open(path).read())
            except ValueError as e:
                raise ConfigParseError(path, e)
        else:
            raise ConfigParseError(path, TypeError("Unsupported file type {}".format(ext)))
602135
def read(*p):
    """"""
    with open(os.path.join(*p), 'r') as fi:
        return fi.read()
188835
def _read_file(path):
    '''
    
    '''
    try:
        with salt.utils.files.fopen(path, 'rb') as contents:
            return salt.utils.yaml.safe_load(contents)
    except (OSError, IOError):
        return {}
1218122
def fromFile(path_or_buffer):
        
        return TOC.fromLatex(open(path_or_buffer).read() 
                             if isinstance(path_or_buffer, str)
                             else path_or_buffer)
510631
def read_file(cls, filepath):
        
        with open(filepath, mode='rb') as f:
            contents = f.read()
        return cls.decode(contents)
356216
def read_bytes(self, path):
        """"""
        file = staticfiles_storage.open(path)
        content = file.read()
        file.close()
        return content
215593
def read_file(*path):
    
    with open(os.path.join(*path)) as f:
        return f.read().strip()
673747
def read_file(*path):
    """"""
    real_path = os.path.realpath(os.path.join(*path))
    with click.open_file(real_path, "r") as fp:
        return fp.read()
994159
def read(path, create_file=False):
        
        if create_file:
            with open(str(path), 'a+') as data_file:
                data_file.seek(0)
                return json.load(data_file)

        else:
            with open(str(path)) as data_file:
                return json.load(data_file)
932838
def read(*paths):
    """"""
    basedir = os.path.dirname(__file__)
    fullpath = os.path.join(basedir, *paths)
    contents = io.open(fullpath, encoding='utf-8').read().strip()
    return contents