Add python-eventlet package to MOS 9.0 repository
[packages/trusty/python-eventlet.git] / python-eventlet / eventlet / green / selectors.py
1 import sys
2
3 from eventlet import patcher
4 from eventlet.green import select
5
6 __patched__ = [
7     'DefaultSelector',
8     'SelectSelector',
9 ]
10
11 # We only have green select so the options are:
12 # * leave it be and have selectors that block
13 # * try to pretend the "bad" selectors don't exist
14 # * replace all with SelectSelector for the price of possibly different
15 #   performance characteristic and missing fileno() method (if someone
16 #   uses it it'll result in a crash, we may want to implement it in the future)
17 #
18 # This module used to follow the third approach but just removing the offending
19 # selectors is less error prone and less confusing approach.
20 __deleted__ = [
21     'PollSelector',
22     'EpollSelector',
23     'DevpollSelector',
24     'KqueueSelector',
25 ]
26
27 patcher.inject('selectors', globals(), ('select', select))
28
29 del patcher
30
31 if sys.platform != 'win32':
32     SelectSelector._select = staticmethod(select.select)
33
34 DefaultSelector = SelectSelector