"""
def __init__(self, target, reconnect_delay=60, **kwargs):
super(Dispatcher, self).__init__()
- self._target = target
+ self.target = target
self._reconnect_delay = reconnect_delay
self._kwargs = kwargs
self._channels = Channels()
def __str__(self):
"Represent this instance as a string"
- return str(self._target)
+ return str(self.target)
def __repr__(self):
"Represent this instance as a detailed string"
- return '<{} {}>'.format(type(self).__name__, self._target)
+ return '<{} {}>'.format(type(self).__name__, self.target)
def send_message(self, target, message):
- if target.connection() != self._target.connection():
+ if target.connection() != self.target.connection():
raise ValueError('target missmatch: {} != {}'.format(
- target, self._target))
+ target, self.target))
try:
channel = self._channels[target.channel]
except KeyError:
loop = asyncio.get_event_loop()
coroutine = loop.create_connection(
protocol_factory=lambda: IRCProtocol(
- name=str(self._target),
- password=self._target.password,
- username=self._target.username,
+ name=str(self.target),
+ password=self.target.password,
+ username=self.target.username,
ready_callbacks=[self._join_channels],
channel_join_callbacks=[self._drain_queue],
channel_part_callbacks=[self._remove_channel],
connection_lost_callbacks=[self._remove_connection],
**self._kwargs),
- host=self._target.hostname,
- port=self._target.port,
- ssl=self._target.ssl)
+ host=self.target.hostname,
+ port=self.target.port,
+ ssl=self.target.ssl)
task = asyncio.Task(coroutine)
task.add_done_callback(self._connection_created)