<commit_before>#! /usr/bin/python3
from gi.repository import Gtk, GObject
import hashlib

class WindowMain(Gtk.Window):

    def __init__(self):
        Gtk.Window.__init__(self, title="Self Text Entry Test")

        hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.add(hbox)

        self.label = Gtk.Label(label="Enter text to be hashed: ")
        hbox.pack_start(self.label, True, True, 10)

        self.text_entry_widget = Gtk.Entry()
        hbox.pack_start(self.text_entry_widget, True, True, 0)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        hbox.pack_start(vbox, True, True, 0)

        self.get_text_button = Gtk.Button(label="Hash")
        self.get_text_button.connect("clicked", self.hash_text(self.text_entry_widget.get_text))
        vbox.pack_start(self.get_text_button, True, True, 0)

    def hash_text(self, text):
        print(hashlib.sha256(text.encode()).hexdigest())

main_window = WindowMain()<commit_msg>Finished self_text_entry_test.py<commit_after>#! /usr/bin/python3
from gi.repository import Gtk, GObject
import hashlib

class WindowMain(Gtk.Window):

    def __init__(self):
        Gtk.Window.__init__(self, title="Self Text Entry Test")

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.add(vbox)

        hbox = Gtk.Box()
        vbox.pack_start(hbox, True, True, 0)

        self.label = Gtk.Label(label="Enter text to be hashed: ")
        hbox.pack_start(self.label, True, True, 10)

        self.text_entry_widget = Gtk.Entry()
        self.text_entry_widget.connect("activate", self.hash_text)
        hbox.pack_start(self.text_entry_widget, True, True, 0)

        self.hash_button = Gtk.Button(label="Hash Text")
        self.hash_button.props.halign = Gtk.Align.END
        self.hash_button.set_size_request(150, 25)
        self.hash_button.connect("clicked", self.hash_text)
        vbox.pack_start(self.hash_button, False, False, 3)

    def hash_text(self, unknown):
        text_enc = self.text_entry_widget.get_text().encode()
        m = hashlib.sha256()
        m.update(text_enc)
        print(m.hexdigest())

main_window = WindowMain()
{'fraction_non_alphanumeric': 0.12244897959183673, 'fraction_numerical': 0.010667903525046383, 'mean_word_length': 3.2046783625730995, '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': '1344098', 'n_tokens_mistral': 766, 'n_tokens_neox': 718, 'n_words': 126}