Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
This function does not return any values.
"""
global original_classes
global Redis_Patched
if Redis_Patched:
logger.info('redis.Redis class has already been patched.')
return
if dbfile:
if dbfile == os.path.basename(dbfile):
dbfile = os.path.join(os.getcwd(), dbfile)
Redis.dbdir = os.path.dirname(dbfile)
Redis.dbfilename = os.path.basename(dbfile)
Redis.settingregistryfile = os.path.join(
Redis.dbdir, Redis.dbfilename + '.settings'
)
original_classes['Redis'] = redis.Redis
redis.Redis = Redis
Redis_Patched = True
Returns:
This function does not return any values.
"""
global original_classes
global Redis_Patched
if Redis_Patched:
logger.info('redis.Redis class has already been patched.')
return
if dbfile:
if dbfile == os.path.basename(dbfile):
dbfile = os.path.join(os.getcwd(), dbfile)
Redis.dbdir = os.path.dirname(dbfile)
Redis.dbfilename = os.path.basename(dbfile)
Redis.settingregistryfile = os.path.join(
Redis.dbdir, Redis.dbfilename + '.settings'
)
original_classes['Redis'] = redis.Redis
redis.Redis = Redis
Redis_Patched = True