<commit_before>import json
import time
import stomp
import sys

class GDAspy(stomp.ConnectionListener):
  def __init__(self):
    self._conn = stomp.Connection([('sci-serv5.diamond.ac.uk', 61613)])
    self._queues = {
      'status': '/queue/scisoft.xia2.STATUS_QUEUE',
#     'status-topic': '/topic/scisoft.xia2.STATUS_TOPIC',
      'submission': '/queue/scisoft.xia2.SUBMISSION_QUEUE'
    }
    self._conn.set_listener('', self)
    self._conn.start()
    self._conn.connect(wait=True)

    self._queues = {
      q: {'queue': self._queues[q],
          'id': n,
          'list': [],
          'closed': False}
        for q, n in zip(self._queues.iterkeys(), range(len(self._queues)))
    }

    for q in self._queues.itervalues():
      print "Subscribing to %s (%d)" % (q['queue'], q['id'])
      self._conn.subscribe(destination=q['queue'], id=q['id'], ack='auto', browser='true')

    while any([not q['closed'] for q in self._queues.itervalues()]):
      time.sleep(0.2)<commit_msg>Use generator expression with any/all<commit_after>import json
import time
import stomp
import sys

class GDAspy(stomp.ConnectionListener):
  def __init__(self):
    self._conn = stomp.Connection([('sci-serv5.diamond.ac.uk', 61613)])
    self._queues = {
      'status': '/queue/scisoft.xia2.STATUS_QUEUE',
#     'status-topic': '/topic/scisoft.xia2.STATUS_TOPIC',
      'submission': '/queue/scisoft.xia2.SUBMISSION_QUEUE'
    }
    self._conn.set_listener('', self)
    self._conn.start()
    self._conn.connect(wait=True)

    self._queues = {
      q: {'queue': self._queues[q],
          'id': n,
          'list': [],
          'closed': False}
        for q, n in zip(self._queues.iterkeys(), range(len(self._queues)))
    }

    for q in self._queues.itervalues():
      print "Subscribing to %s (%d)" % (q['queue'], q['id'])
      self._conn.subscribe(destination=q['queue'], id=q['id'], ack='auto', browser='true')

    while any( not q['closed'] for q in self._queues.itervalues()):
      time.sleep(0.2)
{'fraction_non_alphanumeric': 0.17887394120577976, 'fraction_numerical': 0.01096163428001993, 'mean_word_length': 3.1746361746361744, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4194660', 'n_tokens_mistral': 735, 'n_tokens_neox': 711, 'n_words': 132}