<commit_before>#!/usr/bin/env python
import sys
from PySide import QtGui, QtCore


class HardReload(QtGui.QDialog):

    def __init__(self, parent=None):
        super(HardReload, self).__init__(parent)
        self.initUI()

    def initUI(self):
        self.ui_lineEdit = QtGui.QLineEdit(self)
        ui_completer = QtGui.QCompleter(
            [i.split(".")[0] for i in sys.modules.keys()], self)
        ui_completer.setCompletionMode(QtGui.QCompleter.InlineCompletion)
        ui_completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
        self.ui_lineEdit.setCompleter(ui_completer)
        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self.ui_lineEdit)
        self.setLayout(hbox)
        self.setWindowTitle("Hard Reload")
        self.ui_lineEdit.returnPressed.connect(self.accept)

    def accept(self, *args, **kwds):
        module = str(self.ui_lineEdit.text())
        if len(module):
            for k in sys.modules.keys():
                if k.startswith(module):
                    del sys.modules[k]
        super(HardReload, self).close(*args, **kwds)


def show():
    parent = QtGui.QApplication.activeWindow()
    if parent:
        _ = parent.parent()
        while _:
            parent = _
            _ = parent.parent()
    w = HardReload(parent)
    position_window(w)
    w.exec_()


def position_window(window):
    pos = QtGui.QCursor.pos()
    window.move(pos.x(), pos.y())


if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    show()
    sys.exit()<commit_msg>main function as __main__<commit_after>#!/usr/bin/env python
import sys
from PySide import QtGui, QtCore


class HardReload(QtGui.QDialog):

    def __init__(self, parent=None):
        super(HardReload, self).__init__(parent)
        self.initUI()

    def initUI(self):
        self.ui_lineEdit = QtGui.QLineEdit(self)
        ui_completer = QtGui.QCompleter(
            [i.split(".")[0] for i in sys.modules.keys()], self)
        ui_completer.setCompletionMode(QtGui.QCompleter.InlineCompletion)
        ui_completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
        self.ui_lineEdit.setCompleter(ui_completer)
        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(self.ui_lineEdit)
        self.setLayout(hbox)
        self.setWindowTitle("Hard Reload")
        self.ui_lineEdit.returnPressed.connect(self.accept)

    def accept(self, *args, **kwds):
        module = str(self.ui_lineEdit.text())
        if len(module):
            for k in sys.modules.keys():
                if k.startswith(module):
                    del sys.modules[k]
        super(HardReload, self).close(*args, **kwds)


def show():
    parent = QtGui.QApplication.activeWindow()
    if parent:
        _ = parent.parent()
        while _:
            parent = _
            _ = parent.parent()
    w = HardReload(parent)
    position_window(w)
    w.exec_()


def position_window(window):
    pos = QtGui.QCursor.pos()
    window.move(pos.x(), pos.y())


def __main__():
    QtGui.QApplication(sys.argv)
    show()
    sys.exit()


if __name__ == "__main__":
    __main__()
{'fraction_non_alphanumeric': 0.12423164024587512, 'fraction_numerical': 0.0006470397929472663, 'mean_word_length': 2.5256556442417333, 'pattern_counts': {'":': 2, '<': 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': '7079338', 'n_tokens_mistral': 1046, 'n_tokens_neox': 1014, 'n_words': 174}