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

Method _ensure_fd_no_transport

Lib/test/test_asyncio/utils.py:437–452  ·  view source on GitHub ↗
(self, fd)

Source from the content-addressed store, hash-verified

435 raise AssertionError(f'{handle._args!r} != {args!r}')
436
437 def _ensure_fd_no_transport(self, fd):
438 if not isinstance(fd, int):
439 try:
440 fd = int(fd.fileno())
441 except (AttributeError, TypeError, ValueError):
442 # This code matches selectors._fileobj_to_fd function.
443 raise ValueError("Invalid file object: "
444 "{!r}".format(fd)) from None
445 try:
446 transport = self._transports[fd]
447 except KeyError:
448 pass
449 else:
450 raise RuntimeError(
451 'File descriptor {!r} is used by transport {!r}'.format(
452 fd, transport))
453
454 def add_reader(self, fd, callback, *args):
455 """Add a reader callback."""

Callers 4

add_readerMethod · 0.95
remove_readerMethod · 0.95
add_writerMethod · 0.95
remove_writerMethod · 0.95

Calls 2

filenoMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected