def current_state(self):
        tmap = {}
        main_thread = None
        import traceback
        from cStringIO import StringIO
        # get a map of threads by their ID so we can print their names
        # during the traceback dump
        for t in threading.enumerate():
            if getattr(t, "ident", None):
                tmap[t.ident] = t
            else:
                main_thread = t

        out = StringIO()
        sep = "=" * 49 % "\n"
        for tid, frame in sys._current_frames().iteritems():
            thread = tmap.get(tid, main_thread)
            if not thread:
                # skip old junk (left-overs from a fork)
                continue
            out.write("%s\n" % (thread.getName(), ))
            out.write(sep)
            traceback.print_stack(frame, file=out)
            out.write(sep)
            out.write("LOCAL VARIABLES\n")
            out.write(sep)
            pprint(frame.f_locals, stream=out)
            out.write("\n\n")
        self.logger.info(out.getvalue())
dataset/ETHPy150Open binarydud/pyres/pyres/horde.py/Khan.current_state/operator `+` -> `%`