Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for (pattern, socks) in self._server.psubscribers.items():
regex = compile_pattern(pattern)
if regex.match(channel):
msg = [b'pmessage', pattern, channel, message]
for sock in socks:
sock.responses.put(msg)
receivers += 1
return receivers
setattr(FakeSocket, 'del', FakeSocket.del_)
delattr(FakeSocket, 'del_')
setattr(FakeSocket, 'set', FakeSocket.set_)
delattr(FakeSocket, 'set_')
setattr(FakeSocket, 'exec', FakeSocket.exec_)
delattr(FakeSocket, 'exec_')
class _DummyParser(object):
def __init__(self, socket_read_size):
self.socket_read_size = socket_read_size
def on_disconnect(self):
pass
def on_connect(self, connection):
pass
# Redis <3.2 will not have a selector
try:
from redis.selector import BaseSelector
for sock in subs:
sock.responses.put(msg)
receivers += 1
for (pattern, socks) in self._server.psubscribers.items():
regex = compile_pattern(pattern)
if regex.match(channel):
msg = [b'pmessage', pattern, channel, message]
for sock in socks:
sock.responses.put(msg)
receivers += 1
return receivers
setattr(FakeSocket, 'del', FakeSocket.del_)
delattr(FakeSocket, 'del_')
setattr(FakeSocket, 'set', FakeSocket.set_)
delattr(FakeSocket, 'set_')
setattr(FakeSocket, 'exec', FakeSocket.exec_)
delattr(FakeSocket, 'exec_')
class _DummyParser(object):
def __init__(self, socket_read_size):
self.socket_read_size = socket_read_size
def on_disconnect(self):
pass
def on_connect(self, connection):
pass
receivers += 1
for (pattern, socks) in self._server.psubscribers.items():
regex = compile_pattern(pattern)
if regex.match(channel):
msg = [b'pmessage', pattern, channel, message]
for sock in socks:
sock.responses.put(msg)
receivers += 1
return receivers
setattr(FakeSocket, 'del', FakeSocket.del_)
delattr(FakeSocket, 'del_')
setattr(FakeSocket, 'set', FakeSocket.set_)
delattr(FakeSocket, 'set_')
setattr(FakeSocket, 'exec', FakeSocket.exec_)
delattr(FakeSocket, 'exec_')
class _DummyParser(object):
def __init__(self, socket_read_size):
self.socket_read_size = socket_read_size
def on_disconnect(self):
pass
def on_connect(self, connection):
pass
# Redis <3.2 will not have a selector
try:
msg = [b'message', channel, message]
subs = self._server.subscribers.get(channel, set())
for sock in subs:
sock.responses.put(msg)
receivers += 1
for (pattern, socks) in self._server.psubscribers.items():
regex = compile_pattern(pattern)
if regex.match(channel):
msg = [b'pmessage', pattern, channel, message]
for sock in socks:
sock.responses.put(msg)
receivers += 1
return receivers
setattr(FakeSocket, 'del', FakeSocket.del_)
delattr(FakeSocket, 'del_')
setattr(FakeSocket, 'set', FakeSocket.set_)
delattr(FakeSocket, 'set_')
setattr(FakeSocket, 'exec', FakeSocket.exec_)
delattr(FakeSocket, 'exec_')
class _DummyParser(object):
def __init__(self, socket_read_size):
self.socket_read_size = socket_read_size
def on_disconnect(self):
pass
def on_connect(self, connection):
pass
def _connect(self):
if not self._server.connected:
raise redis.ConnectionError(CONNECTION_ERROR_MSG)
return FakeSocket(self._server)