def patch_select(aggressive=True):
 patch_module('select')
 if aggressive:
  select = __import__('select')
  remove_item(select, 'epoll')
  remove_item(select, 'kqueue')
  remove_item(select, 'kevent')
  remove_item(select, 'devpoll')
 if (sys.version_info[:2] >= (3, 4)):
  select = __import__('select')
  orig_select_select = get_original('select', 'select')
  assert (select.select is not orig_select_select)
  selectors = __import__('selectors')
  if (selectors.SelectSelector._select in (select.select, orig_select_select)):
   def _select(self, *args, **kwargs):
    return select.select(*args, **kwargs)
   selectors.SelectSelector._select = _select
   _select._gevent_monkey = True
  if aggressive:
   remove_item(selectors, 'EpollSelector')
   remove_item(selectors, 'KqueueSelector')
   remove_item(selectors, 'DevpollSelector')
   selectors.DefaultSelector = selectors.SelectSelector

def patch_select ( aggressive = True ) : patch_module ( 'select' ) if aggressive : select = __import__ ( 'select' ) remove_item ( select , 'epoll' ) remove_item ( select , 'kqueue' ) remove_item ( select , 'kevent' ) remove_item ( select , 'devpoll' ) if ( sys . version_info [ : 2 ] >= ( 3 , 4 ) ) : select = __import__ ( 'select' ) orig_select_select = get_original ( 'select' , 'select' ) assert ( select . select is not orig_select_select ) selectors = __import__ ( 'selectors' ) if ( selectors . SelectSelector . _select in ( select . select , orig_select_select ) ) : def _select ( self , * args , ** kwargs ) : return select . select ( * args , ** kwargs ) selectors . SelectSelector . _select = _select _select . _gevent_monkey = True if aggressive : remove_item ( selectors , 'EpollSelector' ) remove_item ( selectors , 'KqueueSelector' ) remove_item ( selectors , 'DevpollSelector' ) selectors . DefaultSelector = selectors . SelectSelector
replace :func:select .