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

Method _check_sendfile_params

Lib/socket.py:470–481  ·  view source on GitHub ↗
(self, file, offset, count)

Source from the content-addressed store, hash-verified

468 file.seek(offset + total_sent)
469
470 def _check_sendfile_params(self, file, offset, count):
471 if 'b' not in getattr(file, 'mode', 'b'):
472 raise ValueError("file should be opened in binary mode")
473 if not self.type & SOCK_STREAM:
474 raise ValueError("only SOCK_STREAM type sockets are supported")
475 if count is not None:
476 if not isinstance(count, int):
477 raise TypeError(
478 "count must be a positive integer (got {!r})".format(count))
479 if count <= 0:
480 raise ValueError(
481 "count must be a positive integer (got {!r})".format(count))
482
483 def sendfile(self, file, offset=0, count=None):
484 """sendfile(file[, offset[, count]]) -> sent

Callers 2

_sendfile_zerocopyMethod · 0.95
_sendfile_use_sendMethod · 0.95

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected