本文整理匯總了Python中gevent.monkey.is_module_patched方法的典型用法代碼示例。如果您正苦於以下問題:Python monkey.is_module_patched方法的具體用法?Python monkey.is_module_patched怎麽用?Python monkey.is_module_patched使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gevent.monkey
的用法示例。
在下文中一共展示了monkey.is_module_patched方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: check_gevent_monkey_patch
# 需要導入模塊: from gevent import monkey [as 別名]
# 或者: from gevent.monkey import is_module_patched [as 別名]
def check_gevent_monkey_patch(raise_exc=True):
if not monkey.is_module_patched('socket'): # 隨便選一個檢測標誌
if raise_exc:
warnings.warn(f'檢測到 你還沒有打gevent包的猴子補丁,請在所運行的起始腳本第一行寫上 【import gevent.monkey;gevent.monkey.patch_all()】 這句話。')
raise Exception(f'檢測到 你還沒有打gevent包的猴子補丁,請在所運行的起始腳本第一行寫上 【import gevent.monkey;gevent.monkey.patch_all()】 這句話。')
else:
return 1
示例2: _condition
# 需要導入模塊: from gevent import monkey [as 別名]
# 或者: from gevent.monkey import is_module_patched [as 別名]
def _condition(self):
from gevent import monkey
if monkey.is_module_patched('threading') or self.done():
import threading
return threading.Condition()
# We can only properly work with conditions
# when we've been monkey-patched. This is necessary
# for the wait/as_completed module functions.
raise AttributeError("_condition")
示例3: initialize
# 需要導入模塊: from gevent import monkey [as 別名]
# 或者: from gevent.monkey import is_module_patched [as 別名]
def initialize(self):
super(KombuManager, self).initialize()
monkey_patched = True
if self.server.async_mode == 'eventlet':
from eventlet.patcher import is_monkey_patched
monkey_patched = is_monkey_patched('socket')
elif 'gevent' in self.server.async_mode:
from gevent.monkey import is_module_patched
monkey_patched = is_module_patched('socket')
if not monkey_patched:
raise RuntimeError(
'Kombu requires a monkey patched socket library to work '
'with ' + self.server.async_mode)
示例4: initialize
# 需要導入模塊: from gevent import monkey [as 別名]
# 或者: from gevent.monkey import is_module_patched [as 別名]
def initialize(self):
super(RedisManager, self).initialize()
monkey_patched = True
if self.server.async_mode == 'eventlet':
from eventlet.patcher import is_monkey_patched
monkey_patched = is_monkey_patched('socket')
elif 'gevent' in self.server.async_mode:
from gevent.monkey import is_module_patched
monkey_patched = is_module_patched('socket')
if not monkey_patched:
raise RuntimeError(
'Redis requires a monkey patched socket library to work '
'with ' + self.server.async_mode)
示例5: is_module_patched
# 需要導入模塊: from gevent import monkey [as 別名]
# 或者: from gevent.monkey import is_module_patched [as 別名]
def is_module_patched(*_, **__):
return False