'Emit all stored warnings.'

def flush(self):

    for ((filename, lineno, category), messages) in sorted(self._warnings.items()):
        for msg in sorted(messages):
            warnings.warn_explicit(msg, category, filename, lineno)
    self._warnings.clear()
