Python asyncore.file_dispatcher() Examples

The following are 21 code examples of asyncore.file_dispatcher(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module asyncore , or try the search function .
Example #1
Source File: console.py    From bacpypes with MIT License 5 votes vote down vote up
def __init__(self, cid=None):
        if _debug: ConsoleClient._debug("__init__ cid=%r", cid)
        asyncore.file_dispatcher.__init__(self, sys.stdin)
        Client.__init__(self, cid) 
Example #2
Source File: test_asyncore.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_dispatcher(self):
        fd = os.open(TESTFN, os.O_RDONLY)
        data = []
        class FileDispatcher(asyncore.file_dispatcher):
            def handle_read(self):
                data.append(self.recv(29))
        s = FileDispatcher(fd)
        os.close(fd)
        asyncore.loop(timeout=0.01, use_poll=True, count=2)
        self.assertEqual(b"".join(data), self.d) 
Example #3
Source File: buffered_dispatcher.py    From polysh with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, fd: int) -> None:
        asyncore.file_dispatcher.__init__(self, fd)
        self.fd = fd
        self.read_buffer = b''
        self.write_buffer = b'' 
Example #4
Source File: pyinotify.py    From recursive-gobuster with MIT License 5 votes vote down vote up
def __init__(self, watch_manager, default_proc_fun=None, read_freq=0,
                 threshold=0, timeout=None, channel_map=None):
        """
        Initializes the async notifier. The only additional parameter is
        'channel_map' which is the optional asyncore private map. See
        Notifier class for the meaning of the others parameters.

        """
        Notifier.__init__(self, watch_manager, default_proc_fun, read_freq,
                          threshold, timeout)
        asyncore.file_dispatcher.__init__(self, self._fd, channel_map) 
Example #5
Source File: test_asyncore.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_dispatcher(self):
        fd = os.open(TESTFN, os.O_RDONLY)
        data = []
        class FileDispatcher(asyncore.file_dispatcher):
            def handle_read(self):
                data.append(self.recv(29))
        s = FileDispatcher(fd)
        os.close(fd)
        asyncore.loop(timeout=0.01, use_poll=True, count=2)
        self.assertEqual(b"".join(data), self.d) 
Example #6
Source File: test_asyncore.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_dispatcher(self):
        fd = os.open(support.TESTFN, os.O_RDONLY)
        data = []
        class FileDispatcher(asyncore.file_dispatcher):
            def handle_read(self):
                data.append(self.recv(29))
        s = FileDispatcher(fd)
        os.close(fd)
        asyncore.loop(timeout=0.01, use_poll=True, count=2)
        self.assertEqual(b"".join(data), self.d) 
Example #7
Source File: test_asyncore.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_dispatcher(self):
        fd = os.open(TESTFN, os.O_RDONLY)
        data = []
        class FileDispatcher(asyncore.file_dispatcher):
            def handle_read(self):
                data.append(self.recv(29))
        s = FileDispatcher(fd)
        os.close(fd)
        asyncore.loop(timeout=0.01, use_poll=True, count=2)
        self.assertEqual(b"".join(data), self.d) 
Example #8
Source File: event.py    From bacpypes with MIT License 5 votes vote down vote up
def __init__(self):
        if _debug: WaitableEvent._debug("__init__")

        # make a pipe
        self._read_fd, self._write_fd = os.pipe()

        # continue with init
        asyncore.file_dispatcher.__init__(self, self._read_fd) 
Example #9
Source File: console.py    From bacpypes with MIT License 5 votes vote down vote up
def __init__(self, sid=None):
        if _debug: ConsoleServer._debug("__init__ sid=%r", sid)
        asyncore.file_dispatcher.__init__(self, sys.stdin)
        Server.__init__(self, sid) 
Example #10
Source File: console.py    From bacpypes with MIT License 5 votes vote down vote up
def __init__(self, cid=None):
        if _debug: ConsoleClient._debug("__init__ cid=%r", cid)
        asyncore.file_dispatcher.__init__(self, sys.stdin)
        Client.__init__(self, cid) 
Example #11
Source File: console.py    From bacpypes with MIT License 5 votes vote down vote up
def __init__(self, sid=None):
        if _debug: ConsoleServer._debug("__init__ sid=%r", sid)
        asyncore.file_dispatcher.__init__(self, sys.stdin)
        Server.__init__(self, sid) 
Example #12
Source File: trigger.py    From pledgeservice with Apache License 2.0 5 votes vote down vote up
def __init__(self, map):
            _triggerbase.__init__(self)
            r, self.trigger = self._fds = os.pipe()
            asyncore.file_dispatcher.__init__(self, r, map=map) 
Example #13
Source File: event.py    From bacpypes with MIT License 5 votes vote down vote up
def __init__(self):
        if _debug: WaitableEvent._debug("__init__")

        # make a pipe
        self._read_fd, self._write_fd = os.pipe()

        # continue with init
        asyncore.file_dispatcher.__init__(self, self._read_fd) 
Example #14
Source File: console.py    From bacpypes with MIT License 5 votes vote down vote up
def __init__(self, sid=None):
        if _debug: ConsoleServer._debug("__init__ sid=%r", sid)
        asyncore.file_dispatcher.__init__(self, sys.stdin)
        Server.__init__(self, sid) 
Example #15
Source File: console.py    From bacpypes with MIT License 5 votes vote down vote up
def __init__(self, cid=None):
        if _debug: ConsoleClient._debug("__init__ cid=%r", cid)
        asyncore.file_dispatcher.__init__(self, sys.stdin)
        Client.__init__(self, cid) 
Example #16
Source File: test_asyncore.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_dispatcher(self):
        fd = os.open(support.TESTFN, os.O_RDONLY)
        data = []
        class FileDispatcher(asyncore.file_dispatcher):
            def handle_read(self):
                data.append(self.recv(29))
        s = FileDispatcher(fd)
        os.close(fd)
        asyncore.loop(timeout=0.01, use_poll=True, count=2)
        self.assertEqual(b"".join(data), self.d) 
Example #17
Source File: test_asyncore.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_dispatcher(self):
        fd = os.open(support.TESTFN, os.O_RDONLY)
        data = []
        class FileDispatcher(asyncore.file_dispatcher):
            def handle_read(self):
                data.append(self.recv(29))
        s = FileDispatcher(fd)
        os.close(fd)
        asyncore.loop(timeout=0.01, use_poll=True, count=2)
        self.assertEqual(b"".join(data), self.d) 
Example #18
Source File: pyinotify.py    From hacker-scripts with MIT License 5 votes vote down vote up
def __init__(self, watch_manager, default_proc_fun=None, read_freq=0,
                 threshold=0, timeout=None, channel_map=None):
        """
        Initializes the async notifier. The only additional parameter is
        'channel_map' which is the optional asyncore private map. See
        Notifier class for the meaning of the others parameters.

        """
        Notifier.__init__(self, watch_manager, default_proc_fun, read_freq,
                          threshold, timeout)
        asyncore.file_dispatcher.__init__(self, self._fd, channel_map) 
Example #19
Source File: test_asyncore.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_dispatcher(self):
        fd = os.open(TESTFN, os.O_RDONLY)
        data = []
        class FileDispatcher(asyncore.file_dispatcher):
            def handle_read(self):
                data.append(self.recv(29))
        s = FileDispatcher(fd)
        os.close(fd)
        asyncore.loop(timeout=0.01, use_poll=True, count=2)
        self.assertEqual(b"".join(data), self.d) 
Example #20
Source File: test_asyncore.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_dispatcher(self):
        fd = os.open(TESTFN, os.O_RDONLY)
        data = []
        class FileDispatcher(asyncore.file_dispatcher):
            def handle_read(self):
                data.append(self.recv(29))
        s = FileDispatcher(fd)
        os.close(fd)
        asyncore.loop(timeout=0.01, use_poll=True, count=2)
        self.assertEqual(b"".join(data), self.d) 
Example #21
Source File: test_asyncore.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_dispatcher(self):
        fd = os.open(TESTFN, os.O_RDONLY)
        data = []
        class FileDispatcher(asyncore.file_dispatcher):
            def handle_read(self):
                data.append(self.recv(29))
        s = FileDispatcher(fd)
        os.close(fd)
        asyncore.loop(timeout=0.01, use_poll=True, count=2)
        self.assertEqual(b"".join(data), self.d)