本文整理汇总了Python中redis.VERSION属性的典型用法代码示例。如果您正苦于以下问题:Python redis.VERSION属性的具体用法?Python redis.VERSION怎么用?Python redis.VERSION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类redis
的用法示例。
在下文中一共展示了redis.VERSION属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _uninstrument
# 需要导入模块: import redis [as 别名]
# 或者: from redis import VERSION [as 别名]
def _uninstrument(self, **kwargs):
if redis.VERSION < (3, 0, 0):
unwrap(redis.StrictRedis, "execute_command")
unwrap(redis.StrictRedis, "pipeline")
unwrap(redis.Redis, "pipeline")
unwrap(
redis.client.BasePipeline, # pylint:disable=no-member
"execute",
)
unwrap(
redis.client.BasePipeline, # pylint:disable=no-member
"immediate_execute_command",
)
else:
unwrap(redis.Redis, "execute_command")
unwrap(redis.Redis, "pipeline")
unwrap(redis.client.Pipeline, "execute")
unwrap(redis.client.Pipeline, "immediate_execute_command")
示例2: test_redis_module
# 需要导入模块: import redis [as 别名]
# 或者: from redis import VERSION [as 别名]
def test_redis_module(self):
import redis
v = redis.VERSION
self.assertIsNotNone(v, "redis module does not exist")
示例3: _instrument
# 需要导入模块: import redis [as 别名]
# 或者: from redis import VERSION [as 别名]
def _instrument(self, **kwargs):
tracer_provider = kwargs.get(
"tracer_provider", trace.get_tracer_provider()
)
setattr(
redis,
"_opentelemetry_tracer",
tracer_provider.get_tracer(_DEFAULT_SERVICE, __version__),
)
if redis.VERSION < (3, 0, 0):
wrap_function_wrapper(
"redis", "StrictRedis.execute_command", _traced_execute_command
)
wrap_function_wrapper(
"redis.client",
"BasePipeline.execute",
_traced_execute_pipeline,
)
wrap_function_wrapper(
"redis.client",
"BasePipeline.immediate_execute_command",
_traced_execute_command,
)
else:
wrap_function_wrapper(
"redis", "Redis.execute_command", _traced_execute_command
)
wrap_function_wrapper(
"redis.client", "Pipeline.execute", _traced_execute_pipeline
)
wrap_function_wrapper(
"redis.client",
"Pipeline.immediate_execute_command",
_traced_execute_command,
)
示例4: get_instrument_list
# 需要导入模块: import redis [as 别名]
# 或者: from redis import VERSION [as 别名]
def get_instrument_list(self):
try:
from redis import VERSION
if VERSION[0] >= 3:
return self.instrument_list_3
return self.instrument_list
except ImportError:
return self.instrument_list