本文整理汇总了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