def maybe_patch_concurrency(argv=sys.argv, short_opts=[u'-P'], long_opts=[u'--pool'], patches={u'eventlet': _patch_eventlet, u'gevent': _patch_gevent}):
 try:
  pool = _find_option_with_arg(argv, short_opts, long_opts)
 except KeyError:
  pass
 else:
  try:
   patcher = patches[pool]
  except KeyError:
   pass
  else:
   patcher()
  from celery import concurrency
  concurrency.get_implementation(pool)

def maybe_patch_concurrency ( argv = sys . argv , short_opts = [ u'-P' ] , long_opts = [ u'--pool' ] , patches = { u'eventlet' : _patch_eventlet , u'gevent' : _patch_gevent } ) : try : pool = _find_option_with_arg ( argv , short_opts , long_opts ) except KeyError : pass else : try : patcher = patches [ pool ] except KeyError : pass else : patcher ( ) from celery import concurrency concurrency . get_implementation ( pool )
apply eventlet/gevent monkeypatches .