# Path: debugger/debugee.py
# class Breakpoint(object):
#     """
#     Represents a breakpoint.
#     """
#     def __init__(self, number, location, line):
#         """
#         @type number: int
#         @type location: str
#         @type line: int
#         """
#         self.number = number
#         self.location = location
#         self.line = line
# 
#     def __repr__(self):
#         return "BP #{0}: {1}:{2}".format(self.number, self.location, self.line)
# 
# class InferiorThread(object):
#     """
#     Represents a thread of the debugged process.
#     """
#     def __init__(self, id, name, state, frame=None):
#         """
#         @type id: int
#         @type name: str
#         @type state: enums.ProcessState
#         @type frame: Frame
#         """
#         self.id = id
#         self.name = name
#         self.state = state
#         self.frame = frame
# 
#     def __repr__(self):
#         return "Thread #{0} ({1}): {2}".format(self.id, self.name, self.state)
# 
# class ThreadInfo(object):
#     """
#     Represents thread state (list of threads and the selected thread) of the
#     debugged process.
#     """
#     def __init__(self, selected_thread, threads):
#         """
#         @type selected_thread: InferiorThread
#         @type threads: list of InferiorThread
#         """
#         self.selected_thread = selected_thread
#         self.threads = threads
# 
#     def __repr__(self):
#         return "Thread info: active: {0}, threads: {1}".format(
#             str(self.selected_thread), str(self.threads))
# 
# class Frame(object):
#     """
#     Represents a stack frame of the debugged process.
#     """
#     def __init__(self, level, func, file, line):
#         """
#         @type level: int
#         @type func: str
#         @type file: str
#         @type line: int
#         """
#         self.level = level
#         self.func = func
#         self.file = file
#         self.line = line
#         self.variables = []
#         """@type variables: debugger.debugee.Variable"""
# 
#     def __repr__(self):
#         return "Frame #{0} ({1} at {2}:{3}".format(self.level, self.func,
#                                                    self.file, self.line)
# 
# Path: debugger/enums.py
# class ThreadState(Enum):
#     """
#     Represents thread state.
#     """
#     Running = 1
#     Stopped = 2
#     Exited = 3


import json
import re
from debugger.debugee import Breakpoint, InferiorThread, ThreadInfo, Frame
from debugger.enums import ThreadState
        pass

    def parse_breakpoint(self, data):
        return self._instantiate_breakpoint(self.parse(data)["bkpt"])

    def parse_breakpoints(self, data):
        return [self._instantiate_breakpoint(bp)
                for bp
                in self.parse(data)["BreakpointTable"]["body"]]

    def parse_thread_info(self, data):
        """
        @type data: str
        @rtype: debugee.ThreadInfo
        """
        data = self.parse(data)
        if "current-thread-id" in data:
            current_thread_id = int(data["current-thread-id"])
        else:
            current_thread_id = 0
        current_thread = None
        threads = []

        for thread in data["threads"]:
            th = self._instantiate_thread(thread)
            threads.append(th)

            if th.id == current_thread_id:
                current_thread = th


# Path: debugger/debugee.py
# class Breakpoint(object):
#     """
#     Represents a breakpoint.
#     """
#     def __init__(self, number, location, line):
#         """
#         @type number: int
#         @type location: str
#         @type line: int
#         """
#         self.number = number
#         self.location = location
#         self.line = line
# 
#     def __repr__(self):
#         return "BP #{0}: {1}:{2}".format(self.number, self.location, self.line)
# 
# class InferiorThread(object):
#     """
#     Represents a thread of the debugged process.
#     """
#     def __init__(self, id, name, state, frame=None):
#         """
#         @type id: int
#         @type name: str
#         @type state: enums.ProcessState
#         @type frame: Frame
#         """
#         self.id = id
#         self.name = name
#         self.state = state
#         self.frame = frame
# 
#     def __repr__(self):
#         return "Thread #{0} ({1}): {2}".format(self.id, self.name, self.state)
# 
# class ThreadInfo(object):
#     """
#     Represents thread state (list of threads and the selected thread) of the
#     debugged process.
#     """
#     def __init__(self, selected_thread, threads):
#         """
#         @type selected_thread: InferiorThread
#         @type threads: list of InferiorThread
#         """
#         self.selected_thread = selected_thread
#         self.threads = threads
# 
#     def __repr__(self):
#         return "Thread info: active: {0}, threads: {1}".format(
#             str(self.selected_thread), str(self.threads))
# 
# class Frame(object):
#     """
#     Represents a stack frame of the debugged process.
#     """
#     def __init__(self, level, func, file, line):
#         """
#         @type level: int
#         @type func: str
#         @type file: str
#         @type line: int
#         """
#         self.level = level
#         self.func = func
#         self.file = file
#         self.line = line
#         self.variables = []
#         """@type variables: debugger.debugee.Variable"""
# 
#     def __repr__(self):
#         return "Frame #{0} ({1} at {2}:{3}".format(self.level, self.func,
#                                                    self.file, self.line)
# 
# Path: debugger/enums.py
# class ThreadState(Enum):
#     """
#     Represents thread state.
#     """
#     Running = 1
#     Stopped = 2
#     Exited = 3


# Path: debugger/mi/parser.py
import json
import re
from debugger.debugee import Breakpoint, InferiorThread, ThreadInfo, Frame
from debugger.enums import ThreadState

        pass

    def parse_breakpoint(self, data):
        return self._instantiate_breakpoint(self.parse(data)["bkpt"])

    def parse_breakpoints(self, data):
        return [self._instantiate_breakpoint(bp)
                for bp
                in self.parse(data)["BreakpointTable"]["body"]]

    def parse_thread_info(self, data):
        """
        @type data: str
        @rtype: debugee.ThreadInfo
        """
        data = self.parse(data)
        if "current-thread-id" in data:
            current_thread_id = int(data["current-thread-id"])
        else:
            current_thread_id = 0
        current_thread = None
        threads = []

        for thread in data["threads"]:
            th = self._instantiate_thread(thread)
            threads.append(th)

            if th.id == current_thread_id:
                current_thread = th


        return ThreadInfo(current_thread, threads)