Reads a file into memory and returns it's contents

        @type path: str
        @param path: path to load
480187
def read_file(self, path):
        

        self.assert_valid_path(path)

        with open(path, 'rb') as file:
            contents = file.read().decode('UTF-8')

        return contents
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)
1026920
def read_file(file_path, **kws):
    
    kw = {"mode":"r", "encoding":"utf-8"}
    if kws:
        for k,v in kws.items():
            kw[k] = v
    with open(file_path, **kw) as afile:
        txt = afile.read()
    return txt
754197
def _load_file(path):
    
    if not os.path.exists(path):
        parser.error("{} was not found!".format(path))
    if USING_PYTHON2:
        mode = "r"
    else:
        mode = "rb"
    try:
        f = open(path, mode)
        return f
    except IOError as ex:
        parser.error("{path} could not be read due to an I/O error! ({ex})".format(path=path, ex=ex))
1062927
def read_json_file(cls, path):
        
        with open(path, 'r') as f:
            return cls.from_dict(json.load(f))
277086
def load_from_file(cls, file_path: str):
        
        with open(file_path, "r") as f:
            data = json.load(f)
            item = cls.decode(data=data)
        return item
215593
def read_file(*path):
    
    with open(os.path.join(*path)) as f:
        return f.read().strip()
863279
def load_file(path):
    ''''''
    path = pathlib.Path(path)
    data = path.open().readlines()
    # remove comments and empty lines
    data = [l for l in data if len(l.strip()) and not l.startswith("#")]
    # determine data shape
    n = len(data)
    m = len(data[0].strip().split())
    res = np.zeros((n, m), dtype=np.dtype(float))
    # write data to array, replacing comma with point decimal separator
    for ii in range(n):
        res[ii] = np.array(data[ii].strip().replace(",", ".").split(),
                           dtype=float)
    return res
672796
def read_file(path)
      result = nil
      File.open(path, 'rb', encoding: 'UTF-8') { |f| result = f.read }
      result
    end
793021
function loadFromFile(path) {
    var data = fs.readFileSync(path, {encoding: "utf8"});
    _root = Repository.readObject(data);
    return _root;
}
1321859
def open_resource(self, path: FilePath, mode: str='rb') -> IO[AnyStr]:
        
        if mode not in {'r', 'rb'}:
            raise ValueError('Files can only be opened for reading')
        return open(self.root_path / file_path_to_path(path), mode)
552707
private String readFile(String path) {

        String result = (String)CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().getCachedObject(m_cms, path);
        if (result == null) {
            try {
                CmsFile file = m_cms.readFile(path);
                result = getContentAsString(file);
            } catch (CmsException e) {
                throw new RuntimeException(e);
            }
        }
        if (result != null) {
            CmsVfsMemoryObjectCache.getVfsMemoryObjectCache().putCachedObject(m_cms, path, result);
        }
        return result;

    }
942957
def read(path, root_path=None):
    """"""
    try:
        root_path = root_path or get_root_path()
        real_path = os.path.realpath(os.path.join(root_path, path))
        with open(real_path) as fp:
            return fp.read().strip()
    except IOError:
        return ""
643216
def load_path(self, path):
        
        logger.debug("load_path(path=%s)" % path)
        if os.path.isfile(path):
            configtype = self.guess_type(path)
            logger.debug("Detected config type: %s" % self._type_to_str(configtype))
            if configtype in self.TYPES:
                logger.debug("Opening config for reading")
                with open(path, 'r') as f:
                    data = f.read()
                datadict = self.TYPES[configtype]().reverse(data)
                return self.load_data(datadict)
            else:
                raise ValueError("Unsupported config type")
        else:
            logger.warn("load_path couldn't find the path: %s" % path)
89334
def loadFromFile(self, path):
        
        if '~' in path:
            path = os.path.expanduser(path)
        f = open(path)
        body = f.read()
        f.close()
        self._path = path
        self.loadFromString(body)
446323
def read_files(path):
    
    template = {}
    for file_name in os.listdir(path):
        with open(os.path.join(path, file_name), 'r') as f:
            template[file_name] = replace_whitespace(
                f.read(), insert=True)

    return template
344518
def _load_data(path):
    
    path = os.path.abspath(path)
    if not os.path.isdir(path):
        raise InitializationError('Directory not found: {0}'.format(path))
    wordlists = {}
    for file_name in os.listdir(path):
        if os.path.splitext(file_name)[1] != '.txt':
            continue
        file_path = os.path.join(path, file_name)
        name = os.path.splitext(os.path.split(file_path)[1])[0]
        try:
            with codecs.open(file_path, encoding='utf-8') as file:
                wordlists[name] = _load_wordlist(name, file)
        except OSError as ex:
            raise InitializationError('Failed to read {}: {}'.format(file_path, ex))
    config = _load_config(os.path.join(path, 'config.json'))
    return (config, wordlists)