<commit_before>#!/usr/bin/env python
import sys
import pprint

contexts = []
context_stack = []


def describe(name):
    def decorator(context):
        print('Registering context {0}...'.format(name))
        my_parent = context_stack[-1] if len(context_stack) else None
        contexts.append((name, context, my_parent))
        context_stack.append(context)
        context()
        context_stack.pop()

    return decorator

@describe('outermost')
def _():
    print('Inside outermost')

    @describe('innermost')
    def _():
        print('Inside innermost')<commit_msg>Added Context class<commit_after>#!/usr/bin/env python
import sys
import pprint

contexts = []
context_stack = []


class Context:
    def __init__(self, name, parent=None):
        self.name = name
        self.parent = parent

    def __str__(self):
        return self.name

    def __repr__(self):
        return 'Context({0}, {1})'.format(repr(self.name), repr(self.parent))

def describe(name):
    def decorator(fn):
        print('Registering context {0}...'.format(name))

        parent = context_stack[-1] if len(context_stack) else None
        context = Context(name, parent)

        contexts.append(context)
        context_stack.append(context)
        fn()
        context_stack.pop()

    return decorator

@describe('outermost')
def _():
    print('Inside outermost')

    @describe('innermost')
    def _():
        print('Inside innermost')
{'fraction_non_alphanumeric': 0.1325468424705066, 'fraction_numerical': 0.004163775156141568, 'mean_word_length': 2.983425414364641, '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': '6087086', 'n_tokens_mistral': 453, 'n_tokens_neox': 427, 'n_words': 96}