Lines Matching refs:file
874 async def sock_sendfile(self, sock, file, offset=0, count=None,
879 self._check_sendfile_params(sock, file, offset, count)
881 return await self._sock_sendfile_native(sock, file,
886 return await self._sock_sendfile_fallback(sock, file,
889 async def _sock_sendfile_native(self, sock, file, offset, count):
894 f"and file {file!r} combination")
896 async def _sock_sendfile_fallback(self, sock, file, offset, count):
898 file.seek(offset)
912 read = await self.run_in_executor(None, file.readinto, view)
919 if total_sent > 0 and hasattr(file, 'seek'):
920 file.seek(offset + total_sent)
922 def _check_sendfile_params(self, sock, file, offset, count):
923 if 'b' not in getattr(file, 'mode', 'b'):
924 raise ValueError("file should be opened in binary mode")
1152 async def sendfile(self, transport, file, offset=0, count=None,
1154 """Send a file to transport.
1160 file must be a regular file object opened in binary mode.
1162 offset tells from where to start reading the file. If specified,
1164 sending the file until EOF is reached. File position is updated on
1165 return or also in case of error in which case file.tell()
1170 the file when the platform does not support the sendfile syscall
1185 return await self._sendfile_native(transport, file,
1196 return await self._sendfile_fallback(transport, file,
1199 async def _sendfile_native(self, transp, file, offset, count):
1203 async def _sendfile_fallback(self, transp, file, offset, count):
1205 file.seek(offset)
1217 read = await self.run_in_executor(None, file.readinto, view)
1224 if total_sent > 0 and hasattr(file, 'seek'):
1225 file.seek(offset + total_sent)