/usr/lib/python3/dist-packages/twisted/python/test
NameSizeModeActions
__pycache__/-0755rm
deprecatedattributes.py5050644editdlrm
modules_helpers.py18050644editdlrm
pullpipe.py12710644editdlrm
test_appdirs.py10750644editdlrm
test_components.py258260644editdlrm
test_constants.py378240644editdlrm
test_deprecate.py420240644editdlrm
test_fakepwd.py151950644editdlrm
test_htmlizer.py12730644editdlrm
test_inotify.py37100644editdlrm
test_pydoctor.py62140644editdlrm
test_release.py419710644editdlrm
test_runtime.py79920644editdlrm
test_sendmsg.py102740644editdlrm
test_shellcomp.py211670644editdlrm
test_syslog.py51650644editdlrm
test_systemd.py62720644editdlrm
test_textattributes.py6620644editdlrm
test_tzhelper.py38000644editdlrm
test_url.py289600644editdlrm
test_urlpath.py102130644editdlrm
test_util.py348880644editdlrm
test_versions.py52380644editdlrm
test_win32.py20170644editdlrm
test_zippath.py33730644editdlrm
test_zipstream.py120790644editdlrm
__init__.py420644editdlrm
Edit: /usr/lib/python3/dist-packages/twisted/python/test/pullpipe.py (1271B)
# -*- test-case-name: twisted.python.test.test_sendmsg -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import os import socket import sys from struct import unpack from typing import Tuple from twisted.python.sendmsg import recvmsg def recvfd(socketfd: int) -> Tuple[int, bytes]: """ Receive a file descriptor from a L{sendmsg} message on the given C{AF_UNIX} socket. @param socketfd: An C{AF_UNIX} socket, attached to another process waiting to send sockets via the ancillary data mechanism in L{send1msg}. @param fd: C{int} @return: a 2-tuple of (new file descriptor, description). @rtype: 2-tuple of (C{int}, C{bytes}) """ ourSocket = socket.fromfd(socketfd, socket.AF_UNIX, socket.SOCK_STREAM) data, ancillary, flags = recvmsg(ourSocket) [(cmsgLevel, cmsgType, packedFD)] = ancillary # cmsgLevel and cmsgType really need to be SOL_SOCKET / SCM_RIGHTS, but # since those are the *only* standard values, there's not much point in # checking. [unpackedFD] = unpack("i", packedFD) return (unpackedFD, data) if __name__ == "__main__": fd, description = recvfd(int(sys.argv[1])) os.write(fd, b"Test fixture data: " + description + b".\n") os.close(fd)