Format: application/octet-stream
⬇ Download File (4.7 KB)
   1  import sys
   2  from _typeshed import FileDescriptorLike
   3  from types import TracebackType
   4  from typing import Any, Iterable, List, Optional, Tuple, Type
   5  
   6  if sys.platform != "win32":
   7      PIPE_BUF: int
   8      POLLERR: int
   9      POLLHUP: int
  10      POLLIN: int
  11      POLLMSG: int
  12      POLLNVAL: int
  13      POLLOUT: int
  14      POLLPRI: int
  15      POLLRDBAND: int
  16      POLLRDNORM: int
  17      POLLWRBAND: int
  18      POLLWRNORM: int
  19  
  20  class poll:
  21      def __init__(self) -> None: ...
  22      def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
  23      def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ...
  24      def unregister(self, fd: FileDescriptorLike) -> None: ...
  25      def poll(self, timeout: Optional[float] = ...) -> List[Tuple[int, int]]: ...
  26  
  27  def select(
  28      __rlist: Iterable[Any], __wlist: Iterable[Any], __xlist: Iterable[Any], __timeout: Optional[float] = ...
  29  ) -> Tuple[List[Any], List[Any], List[Any]]: ...
  30  
  31  if sys.version_info >= (3, 3):
  32      error = OSError
  33  else:
  34      class error(Exception): ...
  35  
  36  if sys.platform != "linux" and sys.platform != "win32":
  37      # BSD only
  38      class kevent(object):
  39          data: Any
  40          fflags: int
  41          filter: int
  42          flags: int
  43          ident: int
  44          udata: Any
  45          def __init__(
  46              self,
  47              ident: FileDescriptorLike,
  48              filter: int = ...,
  49              flags: int = ...,
  50              fflags: int = ...,
  51              data: Any = ...,
  52              udata: Any = ...,
  53          ) -> None: ...
  54      # BSD only
  55      class kqueue(object):
  56          closed: bool
  57          def __init__(self) -> None: ...
  58          def close(self) -> None: ...
  59          def control(
  60              self, __changelist: Optional[Iterable[kevent]], __maxevents: int, __timeout: Optional[float] = ...
  61          ) -> List[kevent]: ...
  62          def fileno(self) -> int: ...
  63          @classmethod
  64          def fromfd(cls, __fd: FileDescriptorLike) -> kqueue: ...
  65      KQ_EV_ADD: int
  66      KQ_EV_CLEAR: int
  67      KQ_EV_DELETE: int
  68      KQ_EV_DISABLE: int
  69      KQ_EV_ENABLE: int
  70      KQ_EV_EOF: int
  71      KQ_EV_ERROR: int
  72      KQ_EV_FLAG1: int
  73      KQ_EV_ONESHOT: int
  74      KQ_EV_SYSFLAGS: int
  75      KQ_FILTER_AIO: int
  76      KQ_FILTER_NETDEV: int
  77      KQ_FILTER_PROC: int
  78      KQ_FILTER_READ: int
  79      KQ_FILTER_SIGNAL: int
  80      KQ_FILTER_TIMER: int
  81      KQ_FILTER_VNODE: int
  82      KQ_FILTER_WRITE: int
  83      KQ_NOTE_ATTRIB: int
  84      KQ_NOTE_CHILD: int
  85      KQ_NOTE_DELETE: int
  86      KQ_NOTE_EXEC: int
  87      KQ_NOTE_EXIT: int
  88      KQ_NOTE_EXTEND: int
  89      KQ_NOTE_FORK: int
  90      KQ_NOTE_LINK: int
  91      if sys.platform != "darwin":
  92          KQ_NOTE_LINKDOWN: int
  93          KQ_NOTE_LINKINV: int
  94          KQ_NOTE_LINKUP: int
  95      KQ_NOTE_LOWAT: int
  96      KQ_NOTE_PCTRLMASK: int
  97      KQ_NOTE_PDATAMASK: int
  98      KQ_NOTE_RENAME: int
  99      KQ_NOTE_REVOKE: int
 100      KQ_NOTE_TRACK: int
 101      KQ_NOTE_TRACKERR: int
 102      KQ_NOTE_WRITE: int
 103  
 104  if sys.platform == "linux":
 105      class epoll(object):
 106          if sys.version_info >= (3, 3):
 107              def __init__(self, sizehint: int = ..., flags: int = ...) -> None: ...
 108          else:
 109              def __init__(self, sizehint: int = ...) -> None: ...
 110          if sys.version_info >= (3, 4):
 111              def __enter__(self) -> epoll: ...
 112              def __exit__(
 113                  self,
 114                  exc_type: Optional[Type[BaseException]] = ...,
 115                  exc_val: Optional[BaseException] = ...,
 116                  exc_tb: Optional[TracebackType] = ...,
 117              ) -> None: ...
 118          def close(self) -> None: ...
 119          closed: bool
 120          def fileno(self) -> int: ...
 121          def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
 122          def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ...
 123          def unregister(self, fd: FileDescriptorLike) -> None: ...
 124          def poll(self, timeout: Optional[float] = ..., maxevents: int = ...) -> List[Tuple[int, int]]: ...
 125          @classmethod
 126          def fromfd(cls, __fd: FileDescriptorLike) -> epoll: ...
 127      EPOLLERR: int
 128      EPOLLET: int
 129      EPOLLHUP: int
 130      EPOLLIN: int
 131      EPOLLMSG: int
 132      EPOLLONESHOT: int
 133      EPOLLOUT: int
 134      EPOLLPRI: int
 135      EPOLLRDBAND: int
 136      EPOLLRDNORM: int
 137      EPOLLWRBAND: int
 138      EPOLLWRNORM: int
 139      EPOLL_RDHUP: int
 140  
 141  if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32":
 142      if sys.version_info >= (3, 3):
 143          # Solaris only
 144          class devpoll:
 145              if sys.version_info >= (3, 4):
 146                  def close(self) -> None: ...
 147                  closed: bool
 148                  def fileno(self) -> int: ...
 149              def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
 150              def modify(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
 151              def unregister(self, fd: FileDescriptorLike) -> None: ...
 152              def poll(self, timeout: Optional[float] = ...) -> List[Tuple[int, int]]: ...
 153