Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(41)  |  Call(36)  |  Derive(0)  |  Import(5)

src/t/r/trollius-0.2/asyncio/windows_events.py   trollius(Download)
from .coroutines import From, Return
from .log import logger
from .py33_exceptions import wrap_error, get_error_class, ConnectionRefusedError
 
 
        if first:
            flags |= _winapi.FILE_FLAG_FIRST_PIPE_INSTANCE
        h = wrap_error(_winapi.CreateNamedPipe,
            self._address, flags,
            _winapi.PIPE_TYPE_MESSAGE | _winapi.PIPE_READMODE_MESSAGE |
    def recv(self, conn, nbytes, flags=0):
        self._register_with_iocp(conn)
        ov = _overlapped.Overlapped(NULL)
        if isinstance(conn, socket.socket):
            wrap_error(ov.WSARecv, conn.fileno(), nbytes, flags)
        else:
            wrap_error(ov.ReadFile, conn.fileno(), nbytes)
 
        def finish_recv(trans, key, ov):
            return wrap_error(ov.getresult)

src/t/r/trollius-0.2/asyncio/selectors.py   trollius(Download)
import sys
 
from .py33_exceptions import wrap_error, InterruptedError
from .compat import integer_types
 
    def select(self, timeout=None):
        timeout = None if timeout is None else max(timeout, 0)
        ready = []
        try:
            r, w, _ = wrap_error(self._select,
            ready = []
            try:
                fd_event_list = wrap_error(self._poll.poll, timeout)
            except InterruptedError:
                return ready
            ready = []
            try:
                fd_event_list = wrap_error(self._epoll.poll, timeout, max_ev)
            except InterruptedError:
                return ready
            ready = []
            try:
                kev_list = wrap_error(self._kqueue.control,
                                      None, max_ev, timeout)
            except InterruptedError:

src/t/r/trollius-0.2/asyncio/selector_events.py   trollius(Download)
from .compat import flatten_bytes
from .log import logger
from .py33_exceptions import (wrap_error,
    BlockingIOError, InterruptedError, ConnectionAbortedError, BrokenPipeError,
    ConnectionResetError)
    def _read_from_self(self):
        try:
            wrap_error(self._ssock.recv, 1)
        except (BlockingIOError, InterruptedError):
            pass
 
    def _write_to_self(self):
        try:
            wrap_error(self._csock.send, b'x')
    def _accept_connection(self, protocol_factory, sock,
                           sslcontext=None, server=None):
        try:
            conn, addr = wrap_error(sock.accept)
            conn.setblocking(False)
            return
        try:
            data = wrap_error(sock.recv, n)
        except (BlockingIOError, InterruptedError):
            self.add_reader(fd, self._sock_recv, fut, True, sock, n)

src/t/r/trollius-0.2/asyncio/unix_events.py   trollius(Download)
from .coroutines import From, Return
from .log import logger
from .py33_exceptions import (
    reraise, wrap_error,
    BlockingIOError, BrokenPipeError, ConnectionResetError,
    def _read_ready(self):
        try:
            data = wrap_error(os.read, self._fileno, self.max_size)
        except (BlockingIOError, InterruptedError):
            pass
            # Attempt to send it right away first.
            try:
                n = wrap_error(os.write, self._fileno, data)
            except (BlockingIOError, InterruptedError):
                n = 0
        del self._buffer[:]
        try:
            n = wrap_error(os.write, self._fileno, data)
        except (BlockingIOError, InterruptedError):
            self._buffer.append(data)
        while True:
            try:
                pid, status = wrap_error(os.waitpid, -1, os.WNOHANG)
            except ChildProcessError:
                # No more child processes exist.

src/t/r/trollius-0.2/asyncio/windows_utils.py   trollius(Download)
 
from . import py33_winapi as _winapi
from .py33_exceptions import wrap_error, BlockingIOError, InterruptedError
 
 
    csock.setblocking(False)
    try:
        wrap_error(csock.connect, (addr, port))
    except (BlockingIOError, InterruptedError):
        pass
        else:
            # _overlapped module
            wrap_error(ov.getresult, True)
        return h1, h2
    except: