Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/imh-pyth.../lib/python3....
File: selectors.py
"""Selectors module.
[0] Fix | Delete
[1] Fix | Delete
This module allows high-level and efficient I/O multiplexing, built upon the
[2] Fix | Delete
`select` module primitives.
[3] Fix | Delete
"""
[4] Fix | Delete
[5] Fix | Delete
[6] Fix | Delete
from abc import ABCMeta, abstractmethod
[7] Fix | Delete
from collections import namedtuple
[8] Fix | Delete
from collections.abc import Mapping
[9] Fix | Delete
import math
[10] Fix | Delete
import select
[11] Fix | Delete
import sys
[12] Fix | Delete
[13] Fix | Delete
[14] Fix | Delete
# generic events, that must be mapped to implementation-specific ones
[15] Fix | Delete
EVENT_READ = (1 << 0)
[16] Fix | Delete
EVENT_WRITE = (1 << 1)
[17] Fix | Delete
[18] Fix | Delete
[19] Fix | Delete
def _fileobj_to_fd(fileobj):
[20] Fix | Delete
"""Return a file descriptor from a file object.
[21] Fix | Delete
[22] Fix | Delete
Parameters:
[23] Fix | Delete
fileobj -- file object or file descriptor
[24] Fix | Delete
[25] Fix | Delete
Returns:
[26] Fix | Delete
corresponding file descriptor
[27] Fix | Delete
[28] Fix | Delete
Raises:
[29] Fix | Delete
ValueError if the object is invalid
[30] Fix | Delete
"""
[31] Fix | Delete
if isinstance(fileobj, int):
[32] Fix | Delete
fd = fileobj
[33] Fix | Delete
else:
[34] Fix | Delete
try:
[35] Fix | Delete
fd = int(fileobj.fileno())
[36] Fix | Delete
except (AttributeError, TypeError, ValueError):
[37] Fix | Delete
raise ValueError("Invalid file object: "
[38] Fix | Delete
"{!r}".format(fileobj)) from None
[39] Fix | Delete
if fd < 0:
[40] Fix | Delete
raise ValueError("Invalid file descriptor: {}".format(fd))
[41] Fix | Delete
return fd
[42] Fix | Delete
[43] Fix | Delete
[44] Fix | Delete
SelectorKey = namedtuple('SelectorKey', ['fileobj', 'fd', 'events', 'data'])
[45] Fix | Delete
[46] Fix | Delete
SelectorKey.__doc__ = """SelectorKey(fileobj, fd, events, data)
[47] Fix | Delete
[48] Fix | Delete
Object used to associate a file object to its backing
[49] Fix | Delete
file descriptor, selected event mask, and attached data.
[50] Fix | Delete
"""
[51] Fix | Delete
if sys.version_info >= (3, 5):
[52] Fix | Delete
SelectorKey.fileobj.__doc__ = 'File object registered.'
[53] Fix | Delete
SelectorKey.fd.__doc__ = 'Underlying file descriptor.'
[54] Fix | Delete
SelectorKey.events.__doc__ = 'Events that must be waited for on this file object.'
[55] Fix | Delete
SelectorKey.data.__doc__ = ('''Optional opaque data associated to this file object.
[56] Fix | Delete
For example, this could be used to store a per-client session ID.''')
[57] Fix | Delete
[58] Fix | Delete
[59] Fix | Delete
class _SelectorMapping(Mapping):
[60] Fix | Delete
"""Mapping of file objects to selector keys."""
[61] Fix | Delete
[62] Fix | Delete
def __init__(self, selector):
[63] Fix | Delete
self._selector = selector
[64] Fix | Delete
[65] Fix | Delete
def __len__(self):
[66] Fix | Delete
return len(self._selector._fd_to_key)
[67] Fix | Delete
[68] Fix | Delete
def __getitem__(self, fileobj):
[69] Fix | Delete
try:
[70] Fix | Delete
fd = self._selector._fileobj_lookup(fileobj)
[71] Fix | Delete
return self._selector._fd_to_key[fd]
[72] Fix | Delete
except KeyError:
[73] Fix | Delete
raise KeyError("{!r} is not registered".format(fileobj)) from None
[74] Fix | Delete
[75] Fix | Delete
def __iter__(self):
[76] Fix | Delete
return iter(self._selector._fd_to_key)
[77] Fix | Delete
[78] Fix | Delete
[79] Fix | Delete
class BaseSelector(metaclass=ABCMeta):
[80] Fix | Delete
"""Selector abstract base class.
[81] Fix | Delete
[82] Fix | Delete
A selector supports registering file objects to be monitored for specific
[83] Fix | Delete
I/O events.
[84] Fix | Delete
[85] Fix | Delete
A file object is a file descriptor or any object with a `fileno()` method.
[86] Fix | Delete
An arbitrary object can be attached to the file object, which can be used
[87] Fix | Delete
for example to store context information, a callback, etc.
[88] Fix | Delete
[89] Fix | Delete
A selector can use various implementations (select(), poll(), epoll()...)
[90] Fix | Delete
depending on the platform. The default `Selector` class uses the most
[91] Fix | Delete
efficient implementation on the current platform.
[92] Fix | Delete
"""
[93] Fix | Delete
[94] Fix | Delete
@abstractmethod
[95] Fix | Delete
def register(self, fileobj, events, data=None):
[96] Fix | Delete
"""Register a file object.
[97] Fix | Delete
[98] Fix | Delete
Parameters:
[99] Fix | Delete
fileobj -- file object or file descriptor
[100] Fix | Delete
events -- events to monitor (bitwise mask of EVENT_READ|EVENT_WRITE)
[101] Fix | Delete
data -- attached data
[102] Fix | Delete
[103] Fix | Delete
Returns:
[104] Fix | Delete
SelectorKey instance
[105] Fix | Delete
[106] Fix | Delete
Raises:
[107] Fix | Delete
ValueError if events is invalid
[108] Fix | Delete
KeyError if fileobj is already registered
[109] Fix | Delete
OSError if fileobj is closed or otherwise is unacceptable to
[110] Fix | Delete
the underlying system call (if a system call is made)
[111] Fix | Delete
[112] Fix | Delete
Note:
[113] Fix | Delete
OSError may or may not be raised
[114] Fix | Delete
"""
[115] Fix | Delete
raise NotImplementedError
[116] Fix | Delete
[117] Fix | Delete
@abstractmethod
[118] Fix | Delete
def unregister(self, fileobj):
[119] Fix | Delete
"""Unregister a file object.
[120] Fix | Delete
[121] Fix | Delete
Parameters:
[122] Fix | Delete
fileobj -- file object or file descriptor
[123] Fix | Delete
[124] Fix | Delete
Returns:
[125] Fix | Delete
SelectorKey instance
[126] Fix | Delete
[127] Fix | Delete
Raises:
[128] Fix | Delete
KeyError if fileobj is not registered
[129] Fix | Delete
[130] Fix | Delete
Note:
[131] Fix | Delete
If fileobj is registered but has since been closed this does
[132] Fix | Delete
*not* raise OSError (even if the wrapped syscall does)
[133] Fix | Delete
"""
[134] Fix | Delete
raise NotImplementedError
[135] Fix | Delete
[136] Fix | Delete
def modify(self, fileobj, events, data=None):
[137] Fix | Delete
"""Change a registered file object monitored events or attached data.
[138] Fix | Delete
[139] Fix | Delete
Parameters:
[140] Fix | Delete
fileobj -- file object or file descriptor
[141] Fix | Delete
events -- events to monitor (bitwise mask of EVENT_READ|EVENT_WRITE)
[142] Fix | Delete
data -- attached data
[143] Fix | Delete
[144] Fix | Delete
Returns:
[145] Fix | Delete
SelectorKey instance
[146] Fix | Delete
[147] Fix | Delete
Raises:
[148] Fix | Delete
Anything that unregister() or register() raises
[149] Fix | Delete
"""
[150] Fix | Delete
self.unregister(fileobj)
[151] Fix | Delete
return self.register(fileobj, events, data)
[152] Fix | Delete
[153] Fix | Delete
@abstractmethod
[154] Fix | Delete
def select(self, timeout=None):
[155] Fix | Delete
"""Perform the actual selection, until some monitored file objects are
[156] Fix | Delete
ready or a timeout expires.
[157] Fix | Delete
[158] Fix | Delete
Parameters:
[159] Fix | Delete
timeout -- if timeout > 0, this specifies the maximum wait time, in
[160] Fix | Delete
seconds
[161] Fix | Delete
if timeout <= 0, the select() call won't block, and will
[162] Fix | Delete
report the currently ready file objects
[163] Fix | Delete
if timeout is None, select() will block until a monitored
[164] Fix | Delete
file object becomes ready
[165] Fix | Delete
[166] Fix | Delete
Returns:
[167] Fix | Delete
list of (key, events) for ready file objects
[168] Fix | Delete
`events` is a bitwise mask of EVENT_READ|EVENT_WRITE
[169] Fix | Delete
"""
[170] Fix | Delete
raise NotImplementedError
[171] Fix | Delete
[172] Fix | Delete
def close(self):
[173] Fix | Delete
"""Close the selector.
[174] Fix | Delete
[175] Fix | Delete
This must be called to make sure that any underlying resource is freed.
[176] Fix | Delete
"""
[177] Fix | Delete
pass
[178] Fix | Delete
[179] Fix | Delete
def get_key(self, fileobj):
[180] Fix | Delete
"""Return the key associated to a registered file object.
[181] Fix | Delete
[182] Fix | Delete
Returns:
[183] Fix | Delete
SelectorKey for this file object
[184] Fix | Delete
"""
[185] Fix | Delete
mapping = self.get_map()
[186] Fix | Delete
if mapping is None:
[187] Fix | Delete
raise RuntimeError('Selector is closed')
[188] Fix | Delete
try:
[189] Fix | Delete
return mapping[fileobj]
[190] Fix | Delete
except KeyError:
[191] Fix | Delete
raise KeyError("{!r} is not registered".format(fileobj)) from None
[192] Fix | Delete
[193] Fix | Delete
@abstractmethod
[194] Fix | Delete
def get_map(self):
[195] Fix | Delete
"""Return a mapping of file objects to selector keys."""
[196] Fix | Delete
raise NotImplementedError
[197] Fix | Delete
[198] Fix | Delete
def __enter__(self):
[199] Fix | Delete
return self
[200] Fix | Delete
[201] Fix | Delete
def __exit__(self, *args):
[202] Fix | Delete
self.close()
[203] Fix | Delete
[204] Fix | Delete
[205] Fix | Delete
class _BaseSelectorImpl(BaseSelector):
[206] Fix | Delete
"""Base selector implementation."""
[207] Fix | Delete
[208] Fix | Delete
def __init__(self):
[209] Fix | Delete
# this maps file descriptors to keys
[210] Fix | Delete
self._fd_to_key = {}
[211] Fix | Delete
# read-only mapping returned by get_map()
[212] Fix | Delete
self._map = _SelectorMapping(self)
[213] Fix | Delete
[214] Fix | Delete
def _fileobj_lookup(self, fileobj):
[215] Fix | Delete
"""Return a file descriptor from a file object.
[216] Fix | Delete
[217] Fix | Delete
This wraps _fileobj_to_fd() to do an exhaustive search in case
[218] Fix | Delete
the object is invalid but we still have it in our map. This
[219] Fix | Delete
is used by unregister() so we can unregister an object that
[220] Fix | Delete
was previously registered even if it is closed. It is also
[221] Fix | Delete
used by _SelectorMapping.
[222] Fix | Delete
"""
[223] Fix | Delete
try:
[224] Fix | Delete
return _fileobj_to_fd(fileobj)
[225] Fix | Delete
except ValueError:
[226] Fix | Delete
# Do an exhaustive search.
[227] Fix | Delete
for key in self._fd_to_key.values():
[228] Fix | Delete
if key.fileobj is fileobj:
[229] Fix | Delete
return key.fd
[230] Fix | Delete
# Raise ValueError after all.
[231] Fix | Delete
raise
[232] Fix | Delete
[233] Fix | Delete
def register(self, fileobj, events, data=None):
[234] Fix | Delete
if (not events) or (events & ~(EVENT_READ | EVENT_WRITE)):
[235] Fix | Delete
raise ValueError("Invalid events: {!r}".format(events))
[236] Fix | Delete
[237] Fix | Delete
key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
[238] Fix | Delete
[239] Fix | Delete
if key.fd in self._fd_to_key:
[240] Fix | Delete
raise KeyError("{!r} (FD {}) is already registered"
[241] Fix | Delete
.format(fileobj, key.fd))
[242] Fix | Delete
[243] Fix | Delete
self._fd_to_key[key.fd] = key
[244] Fix | Delete
return key
[245] Fix | Delete
[246] Fix | Delete
def unregister(self, fileobj):
[247] Fix | Delete
try:
[248] Fix | Delete
key = self._fd_to_key.pop(self._fileobj_lookup(fileobj))
[249] Fix | Delete
except KeyError:
[250] Fix | Delete
raise KeyError("{!r} is not registered".format(fileobj)) from None
[251] Fix | Delete
return key
[252] Fix | Delete
[253] Fix | Delete
def modify(self, fileobj, events, data=None):
[254] Fix | Delete
try:
[255] Fix | Delete
key = self._fd_to_key[self._fileobj_lookup(fileobj)]
[256] Fix | Delete
except KeyError:
[257] Fix | Delete
raise KeyError("{!r} is not registered".format(fileobj)) from None
[258] Fix | Delete
if events != key.events:
[259] Fix | Delete
self.unregister(fileobj)
[260] Fix | Delete
key = self.register(fileobj, events, data)
[261] Fix | Delete
elif data != key.data:
[262] Fix | Delete
# Use a shortcut to update the data.
[263] Fix | Delete
key = key._replace(data=data)
[264] Fix | Delete
self._fd_to_key[key.fd] = key
[265] Fix | Delete
return key
[266] Fix | Delete
[267] Fix | Delete
def close(self):
[268] Fix | Delete
self._fd_to_key.clear()
[269] Fix | Delete
self._map = None
[270] Fix | Delete
[271] Fix | Delete
def get_map(self):
[272] Fix | Delete
return self._map
[273] Fix | Delete
[274] Fix | Delete
def _key_from_fd(self, fd):
[275] Fix | Delete
"""Return the key associated to a given file descriptor.
[276] Fix | Delete
[277] Fix | Delete
Parameters:
[278] Fix | Delete
fd -- file descriptor
[279] Fix | Delete
[280] Fix | Delete
Returns:
[281] Fix | Delete
corresponding key, or None if not found
[282] Fix | Delete
"""
[283] Fix | Delete
try:
[284] Fix | Delete
return self._fd_to_key[fd]
[285] Fix | Delete
except KeyError:
[286] Fix | Delete
return None
[287] Fix | Delete
[288] Fix | Delete
[289] Fix | Delete
class SelectSelector(_BaseSelectorImpl):
[290] Fix | Delete
"""Select-based selector."""
[291] Fix | Delete
[292] Fix | Delete
def __init__(self):
[293] Fix | Delete
super().__init__()
[294] Fix | Delete
self._readers = set()
[295] Fix | Delete
self._writers = set()
[296] Fix | Delete
[297] Fix | Delete
def register(self, fileobj, events, data=None):
[298] Fix | Delete
key = super().register(fileobj, events, data)
[299] Fix | Delete
if events & EVENT_READ:
[300] Fix | Delete
self._readers.add(key.fd)
[301] Fix | Delete
if events & EVENT_WRITE:
[302] Fix | Delete
self._writers.add(key.fd)
[303] Fix | Delete
return key
[304] Fix | Delete
[305] Fix | Delete
def unregister(self, fileobj):
[306] Fix | Delete
key = super().unregister(fileobj)
[307] Fix | Delete
self._readers.discard(key.fd)
[308] Fix | Delete
self._writers.discard(key.fd)
[309] Fix | Delete
return key
[310] Fix | Delete
[311] Fix | Delete
if sys.platform == 'win32':
[312] Fix | Delete
def _select(self, r, w, _, timeout=None):
[313] Fix | Delete
r, w, x = select.select(r, w, w, timeout)
[314] Fix | Delete
return r, w + x, []
[315] Fix | Delete
else:
[316] Fix | Delete
_select = select.select
[317] Fix | Delete
[318] Fix | Delete
def select(self, timeout=None):
[319] Fix | Delete
timeout = None if timeout is None else max(timeout, 0)
[320] Fix | Delete
ready = []
[321] Fix | Delete
try:
[322] Fix | Delete
r, w, _ = self._select(self._readers, self._writers, [], timeout)
[323] Fix | Delete
except InterruptedError:
[324] Fix | Delete
return ready
[325] Fix | Delete
r = set(r)
[326] Fix | Delete
w = set(w)
[327] Fix | Delete
for fd in r | w:
[328] Fix | Delete
events = 0
[329] Fix | Delete
if fd in r:
[330] Fix | Delete
events |= EVENT_READ
[331] Fix | Delete
if fd in w:
[332] Fix | Delete
events |= EVENT_WRITE
[333] Fix | Delete
[334] Fix | Delete
key = self._key_from_fd(fd)
[335] Fix | Delete
if key:
[336] Fix | Delete
ready.append((key, events & key.events))
[337] Fix | Delete
return ready
[338] Fix | Delete
[339] Fix | Delete
[340] Fix | Delete
class _PollLikeSelector(_BaseSelectorImpl):
[341] Fix | Delete
"""Base class shared between poll, epoll and devpoll selectors."""
[342] Fix | Delete
_selector_cls = None
[343] Fix | Delete
_EVENT_READ = None
[344] Fix | Delete
_EVENT_WRITE = None
[345] Fix | Delete
[346] Fix | Delete
def __init__(self):
[347] Fix | Delete
super().__init__()
[348] Fix | Delete
self._selector = self._selector_cls()
[349] Fix | Delete
[350] Fix | Delete
def register(self, fileobj, events, data=None):
[351] Fix | Delete
key = super().register(fileobj, events, data)
[352] Fix | Delete
poller_events = 0
[353] Fix | Delete
if events & EVENT_READ:
[354] Fix | Delete
poller_events |= self._EVENT_READ
[355] Fix | Delete
if events & EVENT_WRITE:
[356] Fix | Delete
poller_events |= self._EVENT_WRITE
[357] Fix | Delete
try:
[358] Fix | Delete
self._selector.register(key.fd, poller_events)
[359] Fix | Delete
except:
[360] Fix | Delete
super().unregister(fileobj)
[361] Fix | Delete
raise
[362] Fix | Delete
return key
[363] Fix | Delete
[364] Fix | Delete
def unregister(self, fileobj):
[365] Fix | Delete
key = super().unregister(fileobj)
[366] Fix | Delete
try:
[367] Fix | Delete
self._selector.unregister(key.fd)
[368] Fix | Delete
except OSError:
[369] Fix | Delete
# This can happen if the FD was closed since it
[370] Fix | Delete
# was registered.
[371] Fix | Delete
pass
[372] Fix | Delete
return key
[373] Fix | Delete
[374] Fix | Delete
def modify(self, fileobj, events, data=None):
[375] Fix | Delete
try:
[376] Fix | Delete
key = self._fd_to_key[self._fileobj_lookup(fileobj)]
[377] Fix | Delete
except KeyError:
[378] Fix | Delete
raise KeyError(f"{fileobj!r} is not registered") from None
[379] Fix | Delete
[380] Fix | Delete
changed = False
[381] Fix | Delete
if events != key.events:
[382] Fix | Delete
selector_events = 0
[383] Fix | Delete
if events & EVENT_READ:
[384] Fix | Delete
selector_events |= self._EVENT_READ
[385] Fix | Delete
if events & EVENT_WRITE:
[386] Fix | Delete
selector_events |= self._EVENT_WRITE
[387] Fix | Delete
try:
[388] Fix | Delete
self._selector.modify(key.fd, selector_events)
[389] Fix | Delete
except:
[390] Fix | Delete
super().unregister(fileobj)
[391] Fix | Delete
raise
[392] Fix | Delete
changed = True
[393] Fix | Delete
if data != key.data:
[394] Fix | Delete
changed = True
[395] Fix | Delete
[396] Fix | Delete
if changed:
[397] Fix | Delete
key = key._replace(events=events, data=data)
[398] Fix | Delete
self._fd_to_key[key.fd] = key
[399] Fix | Delete
return key
[400] Fix | Delete
[401] Fix | Delete
def select(self, timeout=None):
[402] Fix | Delete
# This is shared between poll() and epoll().
[403] Fix | Delete
# epoll() has a different signature and handling of timeout parameter.
[404] Fix | Delete
if timeout is None:
[405] Fix | Delete
timeout = None
[406] Fix | Delete
elif timeout <= 0:
[407] Fix | Delete
timeout = 0
[408] Fix | Delete
else:
[409] Fix | Delete
# poll() has a resolution of 1 millisecond, round away from
[410] Fix | Delete
# zero to wait *at least* timeout seconds.
[411] Fix | Delete
timeout = math.ceil(timeout * 1e3)
[412] Fix | Delete
ready = []
[413] Fix | Delete
try:
[414] Fix | Delete
fd_event_list = self._selector.poll(timeout)
[415] Fix | Delete
except InterruptedError:
[416] Fix | Delete
return ready
[417] Fix | Delete
for fd, event in fd_event_list:
[418] Fix | Delete
events = 0
[419] Fix | Delete
if event & ~self._EVENT_READ:
[420] Fix | Delete
events |= EVENT_WRITE
[421] Fix | Delete
if event & ~self._EVENT_WRITE:
[422] Fix | Delete
events |= EVENT_READ
[423] Fix | Delete
[424] Fix | Delete
key = self._key_from_fd(fd)
[425] Fix | Delete
if key:
[426] Fix | Delete
ready.append((key, events & key.events))
[427] Fix | Delete
return ready
[428] Fix | Delete
[429] Fix | Delete
[430] Fix | Delete
if hasattr(select, 'poll'):
[431] Fix | Delete
[432] Fix | Delete
class PollSelector(_PollLikeSelector):
[433] Fix | Delete
"""Poll-based selector."""
[434] Fix | Delete
_selector_cls = select.poll
[435] Fix | Delete
_EVENT_READ = select.POLLIN
[436] Fix | Delete
_EVENT_WRITE = select.POLLOUT
[437] Fix | Delete
[438] Fix | Delete
[439] Fix | Delete
if hasattr(select, 'epoll'):
[440] Fix | Delete
[441] Fix | Delete
class EpollSelector(_PollLikeSelector):
[442] Fix | Delete
"""Epoll-based selector."""
[443] Fix | Delete
_selector_cls = select.epoll
[444] Fix | Delete
_EVENT_READ = select.EPOLLIN
[445] Fix | Delete
_EVENT_WRITE = select.EPOLLOUT
[446] Fix | Delete
[447] Fix | Delete
def fileno(self):
[448] Fix | Delete
return self._selector.fileno()
[449] Fix | Delete
[450] Fix | Delete
def select(self, timeout=None):
[451] Fix | Delete
if timeout is None:
[452] Fix | Delete
timeout = -1
[453] Fix | Delete
elif timeout <= 0:
[454] Fix | Delete
timeout = 0
[455] Fix | Delete
else:
[456] Fix | Delete
# epoll_wait() has a resolution of 1 millisecond, round away
[457] Fix | Delete
# from zero to wait *at least* timeout seconds.
[458] Fix | Delete
timeout = math.ceil(timeout * 1e3) * 1e-3
[459] Fix | Delete
[460] Fix | Delete
# epoll_wait() expects `maxevents` to be greater than zero;
[461] Fix | Delete
# we want to make sure that `select()` can be called when no
[462] Fix | Delete
# FD is registered.
[463] Fix | Delete
max_ev = max(len(self._fd_to_key), 1)
[464] Fix | Delete
[465] Fix | Delete
ready = []
[466] Fix | Delete
try:
[467] Fix | Delete
fd_event_list = self._selector.poll(timeout, max_ev)
[468] Fix | Delete
except InterruptedError:
[469] Fix | Delete
return ready
[470] Fix | Delete
for fd, event in fd_event_list:
[471] Fix | Delete
events = 0
[472] Fix | Delete
if event & ~select.EPOLLIN:
[473] Fix | Delete
events |= EVENT_WRITE
[474] Fix | Delete
if event & ~select.EPOLLOUT:
[475] Fix | Delete
events |= EVENT_READ
[476] Fix | Delete
[477] Fix | Delete
key = self._key_from_fd(fd)
[478] Fix | Delete
if key:
[479] Fix | Delete
ready.append((key, events & key.events))
[480] Fix | Delete
return ready
[481] Fix | Delete
[482] Fix | Delete
def close(self):
[483] Fix | Delete
self._selector.close()
[484] Fix | Delete
super().close()
[485] Fix | Delete
[486] Fix | Delete
[487] Fix | Delete
if hasattr(select, 'devpoll'):
[488] Fix | Delete
[489] Fix | Delete
class DevpollSelector(_PollLikeSelector):
[490] Fix | Delete
"""Solaris /dev/poll selector."""
[491] Fix | Delete
_selector_cls = select.devpoll
[492] Fix | Delete
_EVENT_READ = select.POLLIN
[493] Fix | Delete
_EVENT_WRITE = select.POLLOUT
[494] Fix | Delete
[495] Fix | Delete
def fileno(self):
[496] Fix | Delete
return self._selector.fileno()
[497] Fix | Delete
[498] Fix | Delete
def close(self):
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function