<commit_before>import os
import re
import sys

import collect
import gdb
import pstack

class debugger:

    def __init__(self, **kwargs):
        self.pid = kwargs.get('pid')
        self.corefile = kwargs.get('corefile')
        self.exe = kwargs.get('exe')
        self.debuglog = kwargs.get('debuglog')
        self.proc = kwargs.get('proc')
        if not self.proc:
            self.proc = process_model.process(self.pid)

        self.use_pstack = False
        self.use_gdb = False

        if self.debuglog:
            if collect.is_hdr(self.debuglog[0]):
                tool = collect.get_tool(self.debuglog[0])
                if tool == 'pstack':
                    self.use_pstack = True
                elif tool == 'gdb':
                    self.use_gdb = True
                else:
                    raise Exception("Unexpected tool %s" % tool)
            else:
                if re.search('^(\d+):[ \t]+', self.debuglog[0]) and re.search('------- +lwp', self.debuglog[1]):
                    self.use_pstack = True
                else:
                    self.use_gdb = True
        else:
            if 'sunos' in sys.platform:
                self.use_pstack = True
            else:
                self.use_gdb = True

        if self.use_pstack:
            self.x = pstack.pstack(proc = self.proc, exe = self.exe, corefile = self.corefile, debuglog = self.debuglog)
        else:
            self.x = gdb.gdb(proc = self.proc, exe = self.exe, corefile = self.corefile, debuglog = self.debuglog)

    def parse(self):
        self.x.parse()
<commit_msg>add missing import<commit_after>import os
import re
import sys

import collect
import gdb
import pstack
import process_model

class debugger:

    def __init__(self, **kwargs):
        self.pid = kwargs.get('pid')
        self.corefile = kwargs.get('corefile')
        self.exe = kwargs.get('exe')
        self.debuglog = kwargs.get('debuglog')
        self.proc = kwargs.get('proc')
        if not self.proc:
            self.proc = process_model.process(self.pid)

        self.use_pstack = False
        self.use_gdb = False

        if self.debuglog:
            if collect.is_hdr(self.debuglog[0]):
                tool = collect.get_tool(self.debuglog[0])
                if tool == 'pstack':
                    self.use_pstack = True
                elif tool == 'gdb':
                    self.use_gdb = True
                else:
                    raise Exception("Unexpected tool %s" % tool)
            else:
                if re.search('^(\d+):[ \t]+', self.debuglog[0]) and re.search('------- +lwp', self.debuglog[1]):
                    self.use_pstack = True
                else:
                    self.use_gdb = True
        else:
            if 'sunos' in sys.platform:
                self.use_pstack = True
            else:
                self.use_gdb = True

        if self.use_pstack:
            self.x = pstack.pstack(proc = self.proc, exe = self.exe, corefile = self.corefile, debuglog = self.debuglog)
        else:
            self.x = gdb.gdb(proc = self.proc, exe = self.exe, corefile = self.corefile, debuglog = self.debuglog)

    def parse(self):
        self.x.parse()

{'fraction_non_alphanumeric': 0.11819887429643527, 'fraction_numerical': 0.0025015634771732333, 'mean_word_length': 1.5653568564554932, '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': '1005909', 'n_tokens_mistral': 996, 'n_tokens_neox': 957, 'n_words': 216}