<commit_before>import struct

from thinglang.compiler.opcodes import OPCODES
from thinglang.utils.tree_utils import TreeTraversal, inspects


class BytecodeSymbols(object):

    @classmethod
    def push_static(cls, id):
        return struct.pack('<BI', OPCODES['PUSH_STATIC'], id)

    @classmethod
    def call(cls, thing, idx):
        return struct.pack('<BII', OPCODES['CALL'], thing, idx)

    @classmethod
    def call_internal(cls, thing, idx):
        return struct.pack('<BII', OPCODES['CALL_INTERNAL'], thing, idx)

    @classmethod
    def method_end(cls):
        return struct.pack('<B', OPCODES['METHOD_END'])

    @classmethod
    def call_method(cls, idx):
        return struct.pack('<BI', OPCODES['CALL_METHOD'], idx)<commit_msg>Add set_static method to BytecodeSymbols<commit_after>import struct

from thinglang.compiler.opcodes import OPCODES


class BytecodeSymbols(object):

    @classmethod
    def push(cls, id):
        return struct.pack('<BI', OPCODES['PUSH'], id)

    @classmethod
    def push_static(cls, id):
        return struct.pack('<BI', OPCODES['PUSH_STATIC'], id)

    @classmethod
    def set_static(cls, idx, val):
        print('set', idx, val)
        return struct.pack('<BII', OPCODES['SET_STATIC'], idx, val)

    @classmethod
    def call(cls, thing, idx):
        return struct.pack('<BII', OPCODES['CALL'], thing, idx)

    @classmethod
    def call_internal(cls, thing, idx):
        return struct.pack('<BII', OPCODES['CALL_INTERNAL'], thing, idx)

    @classmethod
    def method_end(cls):
        return struct.pack('<B', OPCODES['METHOD_END'])

    @classmethod
    def call_method(cls, idx):
        return struct.pack('<BI', OPCODES['CALL_METHOD'], idx)
{'fraction_non_alphanumeric': 0.13742690058479531, 'fraction_numerical': 0.0, 'mean_word_length': 3.6876712328767125, 'pattern_counts': {'":': 0, '<': 15, '<?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': '496931', 'n_tokens_mistral': 553, 'n_tokens_neox': 547, 'n_words': 129}