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