MCPcopy Index your code
hub / github.com/python/cpython / _check_sendfile_params

Method _check_sendfile_params

Lib/asyncio/base_events.py:996–1015  ·  view source on GitHub ↗
(self, sock, file, offset, count)

Source from the content-addressed store, hash-verified

994 file.seek(offset + total_sent)
995
996 def _check_sendfile_params(self, sock, file, offset, count):
997 if 'b' not in getattr(file, 'mode', 'b'):
998 raise ValueError("file should be opened in binary mode")
999 if not sock.type == socket.SOCK_STREAM:
1000 raise ValueError("only SOCK_STREAM type sockets are supported")
1001 if count is not None:
1002 if not isinstance(count, int):
1003 raise TypeError(
1004 "count must be a positive integer (got {!r})".format(count))
1005 if count <= 0:
1006 raise ValueError(
1007 "count must be a positive integer (got {!r})".format(count))
1008 if not isinstance(offset, int):
1009 raise TypeError(
1010 "offset must be a non-negative integer (got {!r})".format(
1011 offset))
1012 if offset < 0:
1013 raise ValueError(
1014 "offset must be a non-negative integer (got {!r})".format(
1015 offset))
1016
1017 async def _connect_sock(self, exceptions, addr_info, local_addr_infos=None):
1018 """Create, bind and connect one socket."""

Callers 1

sock_sendfileMethod · 0.95

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected