<commit_before># A CallTip window class for Tkinter/IDLE.
# After ToolTip.py, which uses ideas gleaned from PySol

# Used by the CallTips IDLE extension.
import os
from Tkinter import *

class CallTip:

    def __init__(self, widget):
        self.widget = widget
        self.tipwindow = None
        self.id = None
        self.x = self.y = 0

    def showtip(self, text):
        self.text = text
        if self.tipwindow or not self.text:
            return
        self.widget.see("insert")
        x, y, cx, cy = self.widget.bbox("insert")
        x = x + self.widget.winfo_rootx() + 2
        y = y + cy + self.widget.winfo_rooty()
        self.tipwindow = tw = Toplevel(self.widget)
        tw.wm_overrideredirect(1)
        tw.wm_geometry("+%d+%d" % (x, y))
        label = Label(tw, text=self.text, justify=LEFT,
                      background="#ffffe0", relief=SOLID, borderwidth=1,
                      font = self.widget['font'])
        label.pack()

    def hidetip(self):<commit_msg>SF bug 546078:  IDLE calltips cause application error. Assorted crashes on Windows and Linux when trying to display a very long calltip, most likely a Tk bug.  Wormed around by clamping the calltip display to a maximum of 79 characters (why 79? why not ...).<commit_after># A CallTip window class for Tkinter/IDLE.
# After ToolTip.py, which uses ideas gleaned from PySol

# Used by the CallTips IDLE extension.
import os
from Tkinter import *

class CallTip:

    def __init__(self, widget):
        self.widget = widget
        self.tipwindow = None
        self.id = None
        self.x = self.y = 0

    def showtip(self, text):
        # SF bug 546078:  IDLE calltips cause application error.
        # There were crashes on various Windows flavors, and even a
        # crashing X server on Linux, with very long calltips.
        if len(text) >= 79:
            text = text[:75] + ' ...'
        self.text = text

        if self.tipwindow or not self.text:
            return
        self.widget.see("insert")
        x, y, cx, cy = self.widget.bbox("insert")
        x = x + self.widget.winfo_rootx() + 2
        y = y + cy + self.widget.winfo_rooty()
        self.tipwindow = tw = Toplevel(self.widget)
        tw.wm_overrideredirect(1)
        tw.wm_geometry("+%d+%d" % (x, y))
        label = Label(tw, text=self.text, justify=LEFT,
                      background="#ffffe0", relief=SOLID, borderwidth=1,
                      font = self.widget['font'])
        label.pack()

    def hidetip(self):
{'fraction_non_alphanumeric': 0.10739856801909307, 'fraction_numerical': 0.011933174224343675, 'mean_word_length': 2.1755050505050506, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '5688592', 'n_tokens_mistral': 820, 'n_tokens_neox': 775, 'n_words': 243}