Browse Source

Use None instead of dict default argument

pull/806/head
Sam Mosleh 4 years ago
parent
commit
26e03ca01c
  1. 4
      src/socketio/asyncio_redis_manager.py
  2. 4
      src/socketio/redis_manager.py

4
src/socketio/asyncio_redis_manager.py

@ -36,14 +36,14 @@ class AsyncRedisManager(AsyncPubSubManager): # pragma: no cover
name = 'aioredis'
def __init__(self, url='redis://localhost:6379/0', channel='socketio',
write_only=False, logger=None, redis_options={}):
write_only=False, logger=None, redis_options=None):
if aioredis is None:
raise RuntimeError('Redis package is not installed '
'(Run "pip install aioredis" in your '
'virtualenv).')
if not hasattr(aioredis.Redis, 'from_url'):
raise RuntimeError('Version 2 of aioredis package is required.')
self.redis = aioredis.Redis.from_url(url, **redis_options)
self.redis = aioredis.Redis.from_url(url, **(redis_options or {}))
self.pubsub = self.redis.pubsub(ignore_subscribe_messages=True)
super().__init__(channel=channel, write_only=write_only, logger=logger)

4
src/socketio/redis_manager.py

@ -37,12 +37,12 @@ class RedisManager(PubSubManager): # pragma: no cover
name = 'redis'
def __init__(self, url='redis://localhost:6379/0', channel='socketio',
write_only=False, logger=None, redis_options={}):
write_only=False, logger=None, redis_options=None):
if redis is None:
raise RuntimeError('Redis package is not installed '
'(Run "pip install redis" in your '
'virtualenv).')
self.redis = redis.Redis.from_url(url, **redis_options)
self.redis = redis.Redis.from_url(url, **(redis_options or {}))
self.pubsub = self.redis.pubsub(ignore_subscribe_messages=True)
super(RedisManager, self).__init__(channel=channel,
write_only=write_only,

Loading…
Cancel
Save