def __init__(
        self,
        mode,
        target_file=None,
        buffer_list=(),
        offset=0,
        # pylint: disable=redefined-outer-name
        eventfd=None,
        # pylint: enable=redefined-outer-name
        onCompletion=lambda block, res, res2: None,
        rw_flags=0,
        io_priority=None,
        event_mask=0,
    ):
        """
        mode (AIOBLOCK_MODE_*)
            The action this block represents.
        target_file (file-ish)
            The file to read from/write to.
        buffer_list (list of mutable buffer instances: mmap, bytearray, ...)
            Buffers to use.
            Must be empty in AIOBLOCK_MODE_POLL.
        offset (int)
            Where to start reading from/writing to.
            Must be zero in AIOBLOCK_MODE_POLL.
        eventfd (EventFD)
            An eventfd file, so AIO completion can be waited upon by
            select/poll/epoll.
        onCompletion (callable)
            Receives as arguments:
            - the AIOBlock instance which completed
            - res (int)
            - res2 (int)
            For forward compatibility, should return None.
        rw_flags (int)
            OR-ed RWF_* constants, see aio_rw_flags in io_submit(2) manpage.
            Must be zero in AIOBLOCK_MODE_POLL.
        io_priority (int)
            Request io priority & class, as returned by IOPRIO_PRIO_VALUE.
            "class" may be one of:
                IOPRIO_CLASS_RT: real-time
                IOPRIO_CLASS_BE: best-effort
                IOPRIO_CLASS_IDLE: idle
            "data" meaning depends on class, see ioprio_set(2) manpage.
        event_mask (int)
            OR-ed select.EPOLL* constants. EPOLLERR and EPOLLHUP are always
            enabled.
        """
        self._iocb = iocb = libaio.iocb()
        libaio.zero(iocb)
        self.mode = mode
        self.target_file = target_file
        self.io_priority = io_priority
        if mode is AIOBLOCK_MODE_POLL:
            self.event_mask = event_mask
        else:
            self.buffer_list = buffer_list
            self.offset = offset
            self.rw_flags = rw_flags
        self.eventfd = eventfd
        self.onCompletion = onCompletion
def __init__ ( self , mode , target_file = None , buffer_list = ( ) , offset = 0 , eventfd = None , onCompletion = lambda block , res , res2 : None , rw_flags = 0 , io_priority = None , event_mask = 0 , ) : self . _iocb = iocb = libaio . iocb ( ) libaio . zero ( iocb ) self . mode = mode self . target_file = target_file self . io_priority = io_priority if mode is AIOBLOCK_MODE_POLL : self . event_mask = event_mask else : self . buffer_list = buffer_list self . offset = offset self . rw_flags = rw_flags self . eventfd = eventfd self . onCompletion = onCompletion
mode (AIOBLOCK_MODE_*)
            The action this block represents.
        target_file (file-ish)
            The file to read from/write to.
        buffer_list (list of mutable buffer instances: mmap, bytearray, ...)
            Buffers to use.
            Must be empty in AIOBLOCK_MODE_POLL.
        offset (int)
            Where to start reading from/writing to.
            Must be zero in AIOBLOCK_MODE_POLL.
        eventfd (EventFD)
            An eventfd file, so AIO completion can be waited upon by
            select/poll/epoll.
        onCompletion (callable)
            Receives as arguments:
            - the AIOBlock instance which completed
            - res (int)
            - res2 (int)
            For forward compatibility, should return None.
        rw_flags (int)
            OR-ed RWF_* constants, see aio_rw_flags in io_submit(2) manpage.
            Must be zero in AIOBLOCK_MODE_POLL.
        io_priority (int)
            Request io priority & class, as returned by IOPRIO_PRIO_VALUE.
            "class" may be one of:
                IOPRIO_CLASS_RT: real-time
                IOPRIO_CLASS_BE: best-effort
                IOPRIO_CLASS_IDLE: idle
            "data" meaning depends on class, see ioprio_set(2) manpage.
        event_mask (int)
            OR-ed select.EPOLL* constants. EPOLLERR and EPOLLHUP are always
            enabled.