

def send_messages(self, messages):
    'Write all messages to the stream in a thread-safe way.'
    if (not messages):
        return
    self._lock.acquire()
    try:
        try:
            stream_created = self.open()
            for message in messages:
                self.stream.write(render_message(message))
                self.stream.write('\n')
                self.stream.write(('-' * 79))
                self.stream.write('\n')
                self.stream.flush()
            if stream_created:
                self.close()
        except:
            if (not self.fail_silently):
                raise
    finally:
        self._lock.release()
    return len(self)

dataset/ETHPy150Open stefanfoulis/django-sendsms/sendsms/backends/console.py SmsBackend.send_messages/VarMisuse@156/201 `messages`->`self`