<commit_before># -*- coding: utf-8 -*-

import curses

def debug(stdscr):
	curses.nocbreak()
	stdscr.keypad(0)
	curses.echo()
	curses.endwin()
	import pdb; pdb.set_trace()<commit_msg>debug: use parent frame as entrypoint for user interaction debug now starts at the debug() function call level<commit_after># -*- coding: utf-8 -*-

import curses
import pdb
import sys

def debug(stdscr):
	curses.nocbreak()
	stdscr.keypad(0)
	curses.echo()
	curses.endwin()
	debugger = pdb.Pdb()
	debugger.reset()
	debugger.do_where(None)
	users_frame = sys._getframe().f_back # One frame up, not this function
	debugger.interaction(users_frame, None)

# Use with:
# import cursutils ; cursutils.debug(self.window)
{'fraction_non_alphanumeric': 0.1291248206599713, 'fraction_numerical': 0.005738880918220947, 'mean_word_length': 4.816666666666666, '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': '1397444', 'n_tokens_mistral': 255, 'n_tokens_neox': 252, 'n_words': 64}