本文整理匯總了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