Read file content in binary mode
356216
def read_bytes(self, path):
        """"""
        file = staticfiles_storage.open(path)
        content = file.read()
        file.close()
        return content
271445
def readf(nb_file, fmt=None):
    """"""
    if nb_file == '-':
        text = sys.stdin.read()
        fmt = fmt or divine_format(text)
        return reads(text, fmt)

    _, ext = os.path.splitext(nb_file)
    fmt = copy(fmt or {})
    fmt.update({'extension': ext})
    with io.open(nb_file, encoding='utf-8') as stream:
        return read(stream, fmt, as_version=4)
1006053
def get_file(self, job_binary_id):
        """"""
        resp = self.api.get('/job-binaries/%s/data' % job_binary_id)

        if resp.status_code != 200:
            self._raise_api_exception(resp)
        return resp.content
238029
def read(filename, binary=True):
    
    with open(filename, 'rb' if binary else 'r') as f:
        return f.read()
675635
def _readFile(self, fileName):
        
        with open(fileName, 'rb') as binFile:
            b = binFile.read()
            return to_ubyte_array(b)
228830
def read_content (self):
        """"""
        if self.is_directory():
            self.url_connection.cwd(self.filename)
            self.files = self.get_files()
            # XXX limit number of files?
            data = get_index_html(self.files)
        else:
            # download file in BINARY mode
            ftpcmd = "RETR %s" % self.filename
            buf = StringIO()
            def stor_data (s):
                """Helper method storing given data"""
                # limit the download size
                if (buf.tell() + len(s)) > self.max_size:
                    raise LinkCheckerError(_("FTP file size too large"))
                buf.write(s)
            self.url_connection.retrbinary(ftpcmd, stor_data)
            data = buf.getvalue()
            buf.close()
        return data
343466
def read(self, bytes, offset):
        
        return Zchunk(lib.zfile_read(self._as_parameter_, bytes, offset), True)
135318
def _get_file_content(self, path):
        """"""
        with open(path, 'r') as file_:
            content = file_.read()
        return content
144165
def read_file(path):
    """"""
    file_path = os.path.join(here, *path)
    with open(file_path, encoding="utf-8") as f:
        return f.read()
737317
def binary2base64(binary_file: str) -> str:
    
    # Use mode = "rb" to read binary file
    with open(binary_file, "rb") as bin_file:
        encoded_string = base64.b64encode(bin_file.read())
    return encoded_string.decode()
19488
def read(path, encoding="UTF-8"):
    """"""
    with OPEN_FUNC(path, 'rb') as _file:
        cont = _file.read()
        return cont.decode(encoding)
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
198114
def read(self, _file):
        """"""
        with open(_file) as fh:
            data = fh.read()
            if self.verbose:
                sys.stdout.write("read %d bytes from %s\n"
                                 % (fh.tell(), _file))
        return data
1054484
public JSONObject readContentFromBinaryFile(File binaryFile) throws Exception {
    PlistFileUtils util = new PlistFileUtils(binaryFile);
    return util.toJSON();
  }
1218693
def load_file_contents(file_path, as_list=True):
    """"""
    abs_file_path = join(HERE, file_path)
    with open(abs_file_path, encoding='utf-8') as file_pointer:
        if as_list:
            return file_pointer.read().splitlines()
        return file_pointer.read()
510631
def read_file(cls, filepath):
        
        with open(filepath, mode='rb') as f:
            contents = f.read()
        return cls.decode(contents)
520819
def _readbin(fid, fmt='i', nwords=1, file64=False, unpack=True):
    
    if fmt in 'if':
        fmt += '8' if file64 else '4'
    elts = np.fromfile(fid, fmt, nwords)
    if unpack and len(elts) == 1:
        elts = elts[0]
    return elts