<commit_before>from ..java import (
    Code as JavaCode, ExceptionInfo as JavaExceptionInfo, LineNumberTable,
    opcodes as JavaOpcodes, Classref
)
from .utils import (
    ArgType, OpcodePosition,
    TRY, CATCH, END_TRY,
    jump, resolve_jump,
    ICONST_val, LCONST_val, DCONST_val, ALOAD_name, ASTORE_name, free_name
)


class IgnoreBlock(Exception):
    """An escape hatch; enable a block to be flagged as ignorable"""
    pass


class Block:
    def __init__(self, parent=None, verbosity=0):
        self.parent = parent
        self.verbosity = verbosity

        self.has_self = False
        self.parameters = []
        self.local_vars = {}
        self.deleted_vars = set()

        self.generator = None
        self.yield_points = []

        self.opcodes = []
        self.try_catches = []
        self.blocks = []
        self.jumps = []
        self.loops = []
        self.unknown_jump_targets = {}
        self.returns = {
            'annotation': None
        }

        self.next_resolve_list = []
        self.next_opcode_starts_line = None

    @property
    def active_local_vars(self):
        return {
            name: index
            for name, index in self.local_vars.items()
            if index is not None
        }

    @property
    def module(self):
        return self.parent

    def store_name(self, name):
        raise NotImplementedError('Abstract class `block` cannot be used directly.')

    def store_dynamic(self):
        raise NotImplementedError('Abstract class `block` cannot be used directly.')

    def load_name(self, name):
        raise NotImplementedError('Abstract class `block` cannot be used directly.')

    def delete_name(self, name):
        raise NotImplementedError('Abstract class `block` cannot be used directly.')

    @property
    def can_ignore_empty(self):
        return False

    def add_opcodes(self, *opcodes):
        # Add the opcodes to the code list and process them.
        for opcode in opcodes:
            # print("ADD OPCODE", id(opcode), opcode)
            if opcode.process(self):
                # self.opcodes.extend([
                #     JavaOpcodes.LDC_W(str(opcode)),
                #     JavaOpcodes.INVOKESTATIC('org/Python', 'debug', '(Ljava/lang/String;)V')
                # ])

                self.opcodes.append(opcode)

                # If we've flagged a code line change, attach that to the opcode
                if self.next_opcode_starts_line:
                    opcode.starts_line = self.next_opcode_starts_line
                    self.next_opcode_starts_line = None

                # Resolve any references to the "next" opcode.
                for (obj, attr) in self.next_resolve_list:
                    # print("        resolve %s reference on %s %s with %s %s" % (attr, obj, id(obj), opcode, id(opcode)))
                    setattr(obj, attr.value, opcode)
<commit_msg>Removed commented out print line<commit_after>from ..java import (
    Code as JavaCode, ExceptionInfo as JavaExceptionInfo, LineNumberTable,
    opcodes as JavaOpcodes, Classref
)
from .utils import (
    ArgType, OpcodePosition,
    TRY, CATCH, END_TRY,
    jump, resolve_jump,
    ICONST_val, LCONST_val, DCONST_val, ALOAD_name, ASTORE_name, free_name
)


class IgnoreBlock(Exception):
    """An escape hatch; enable a block to be flagged as ignorable"""
    pass


class Block:
    def __init__(self, parent=None, verbosity=0):
        self.parent = parent
        self.verbosity = verbosity

        self.has_self = False
        self.parameters = []
        self.local_vars = {}
        self.deleted_vars = set()

        self.generator = None
        self.yield_points = []

        self.opcodes = []
        self.try_catches = []
        self.blocks = []
        self.jumps = []
        self.loops = []
        self.unknown_jump_targets = {}
        self.returns = {
            'annotation': None
        }

        self.next_resolve_list = []
        self.next_opcode_starts_line = None

    @property
    def active_local_vars(self):
        return {
            name: index
            for name, index in self.local_vars.items()
            if index is not None
        }

    @property
    def module(self):
        return self.parent

    def store_name(self, name):
        raise NotImplementedError('Abstract class `block` cannot be used directly.')

    def store_dynamic(self):
        raise NotImplementedError('Abstract class `block` cannot be used directly.')

    def load_name(self, name):
        raise NotImplementedError('Abstract class `block` cannot be used directly.')

    def delete_name(self, name):
        raise NotImplementedError('Abstract class `block` cannot be used directly.')

    @property
    def can_ignore_empty(self):
        return False

    def add_opcodes(self, *opcodes):
        # Add the opcodes to the code list and process them.
        for opcode in opcodes:
            if opcode.process(self):
                # self.opcodes.extend([
                #     JavaOpcodes.LDC_W(str(opcode)),
                #     JavaOpcodes.INVOKESTATIC('org/Python', 'debug', '(Ljava/lang/String;)V')
                # ])

                self.opcodes.append(opcode)

                # If we've flagged a code line change, attach that to the opcode
                if self.next_opcode_starts_line:
                    opcode.starts_line = self.next_opcode_starts_line
                    self.next_opcode_starts_line = None

                # Resolve any references to the "next" opcode.
                for (obj, attr) in self.next_resolve_list:
                    # print("        resolve %s reference on %s %s with %s %s" % (attr, obj, id(obj), opcode, id(opcode)))
                    setattr(obj, attr.value, opcode)

{'fraction_non_alphanumeric': 0.0928658219059191, 'fraction_numerical': 0.0003471619510501649, 'mean_word_length': 2.0583864118895967, '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': '2090486', 'n_tokens_mistral': 1708, 'n_tokens_neox': 1650, 'n_words': 450}