<commit_before>from PyQt4.QtCore import Qt, pyqtSignal
from PyQt4.QtGui import QGroupBox, QDoubleSpinBox, QComboBox, QLabel, \
                        QHBoxLayout, QVBoxLayout, QStandardItem
from PyQt4.Qwt5 import QwtSlider
from numpy.testing import assert_approx_equal

class ValueBox(QGroupBox):
    '''A box that sets values'''

    def __init__(self, parent, title, boxID, model):
        '''Initiallize the box and what is inside it'''
        super(QGroupBox, self).__init__(parent)
        self.setTitle(title)
        self._boxID = boxID
        self._createWidgets(model)
        self._makeConnections()
        self._initUI()
        self.paramIndx = self._boxID

    def _createWidgets(self, model):
        '''Create the widgets contained in this box'''

        # Min range spin box
        self.valueMinSpinBox = QDoubleSpinBox(self)
        self.valueMinSpinBox.setDecimals(2)

        # Max range spin box
        self.valueMaxSpinBox = QDoubleSpinBox(self)
        self.valueMaxSpinBox.setDecimals(2)

        # Set up the spin box that allows the user to choose a value manually
        self.valueSpinBox = QDoubleSpinBox(self)
        self.valueSpinBox.setDecimals(4)

        # Set up the slider that allows the user to choose a value visually
        self.valueSlider = QwtSlider(self, Qt.Horizontal)
        self.valueSlider.setMinimumWidth(500)

        # Store the underlying model
        self.model = model

        # Add the parameter chooser
        self.paramChooser = QComboBox(self)
        self.paramChooser.setModel(self.model)
        self.paramChooser.setSizeAdjustPolicy(QComboBox.AdjustToContents)

    def _makeConnections(self):
        'Connect the contained widgets to each other and set initial values'

        # If the value spinbox changes, check the bounds of the slider range
        self.valueSpinBox.valueChanged.connect(self.changeSliderVal)

        # If the slider moves, change the spinbox
        self.valueSlider.valueChanged.connect(self.valueSpinBox.setValue)

        # Change the slider range bounds if the bounds spinboxes change
        self.valueMinSpinBox.valueChanged.connect(self.changeValueMin)
        self.valueMaxSpinBox.valueChanged.connect(self.changeValueMax)

        # If the underlying model's data changes, reflect this in the sliders
        # and spin boxes
        self.model.valueChanged.connect(self.updateValue)
        self.model.maxValueChanged.connect(self.updateMax)
        self.model.minValueChanged.connect(self.updateMin)

        # If the combo box is changed, send out a signal
        self.paramChooser.currentIndexChanged.connect(self.changeParameter)

    def _initUI(self):
        '''Place the widgets in the proper locations in the box'''

        # Set up the location of all the contained widgets
        rangeLayout = QHBoxLayout()
        rangeLayout.addWidget(QLabel('Parameters'))
        rangeLayout.addWidget(self.paramChooser)
        rangeLayout.addStretch()
        rangeLayout.addWidget(QLabel('Min Value'))
        rangeLayout.addWidget(self.valueMinSpinBox)
        rangeLayout.addWidget(QLabel('Max Value'))
        rangeLayout.addWidget(self.valueMaxSpinBox)
        pickerLayout = QHBoxLayout()
        pickerLayout.addWidget(QLabel('Variable Value'))
        pickerLayout.addWidget(self.valueSpinBox)
        pickerLayout.addWidget(self.valueSlider)

        # Lay out these layouts
        valuePickerLayout = QVBoxLayout()
        valuePickerLayout.addLayout(rangeLayout)
        valuePickerLayout.addLayout(pickerLayout)
        self.setLayout(valuePickerLayout)

    #######
    # SLOTS
    #######

    def changeValueMin(self, min):<commit_msg>Added a peak chooser to the valuebox<commit_after>from PyQt4.QtCore import Qt, pyqtSignal
from PyQt4.QtGui import QGroupBox, QDoubleSpinBox, QComboBox, QLabel, \
                        QHBoxLayout, QVBoxLayout, QStandardItem
from PyQt4.Qwt5 import QwtSlider
from numpy.testing import assert_approx_equal

class ValueBox(QGroupBox):
    '''A box that sets values'''

    def __init__(self, parent, title, boxID, model):
        '''Initiallize the box and what is inside it'''
        super(QGroupBox, self).__init__(parent)
        self.setTitle(title)
        self._boxID = boxID
        self._createWidgets(model)
        self._makeConnections()
        self._initUI()
        self.paramIndx = self._boxID

    def _createWidgets(self, model):
        '''Create the widgets contained in this box'''

        # Min range spin box
        self.valueMinSpinBox = QDoubleSpinBox(self)
        self.valueMinSpinBox.setDecimals(2)

        # Max range spin box
        self.valueMaxSpinBox = QDoubleSpinBox(self)
        self.valueMaxSpinBox.setDecimals(2)

        # Set up the spin box that allows the user to choose a value manually
        self.valueSpinBox = QDoubleSpinBox(self)
        self.valueSpinBox.setDecimals(4)

        # Set up the slider that allows the user to choose a value visually
        self.valueSlider = QwtSlider(self, Qt.Horizontal)
        self.valueSlider.setMinimumWidth(500)

        # Store the underlying model
        self.model = model

        # Add the peak chooser
        self.peakChooser = QComboBox(self)
        self.peakChooser.setModel(self.model)
        self.peakChooser.setSizeAdjustPolicy(QComboBox.AdjustToContents)

        # Add the parameter chooser
        self.paramChooser = QComboBox(self)
        self.paramChooser.setModel(self.model)
        self.paramChooser.setSizeAdjustPolicy(QComboBox.AdjustToContents)

    def _makeConnections(self):
        'Connect the contained widgets to each other and set initial values'

        # If the value spinbox changes, check the bounds of the slider range
        self.valueSpinBox.valueChanged.connect(self.changeSliderVal)

        # If the slider moves, change the spinbox
        self.valueSlider.valueChanged.connect(self.valueSpinBox.setValue)

        # Change the slider range bounds if the bounds spinboxes change
        self.valueMinSpinBox.valueChanged.connect(self.changeValueMin)
        self.valueMaxSpinBox.valueChanged.connect(self.changeValueMax)

        # If the underlying model's data changes, reflect this in the sliders
        # and spin boxes
        self.model.valueChanged.connect(self.updateValue)
        self.model.maxValueChanged.connect(self.updateMax)
        self.model.minValueChanged.connect(self.updateMin)

        # If the combo box is changed, send out a signal
        self.paramChooser.currentIndexChanged.connect(self.changeParameter)

    def _initUI(self):
        '''Place the widgets in the proper locations in the box'''

        # Set up the location of all the contained widgets
        rangeLayout = QHBoxLayout()
        rangeLayout.addWidget(QLabel('Peak'))
        rangeLayout.addWidget(self.peakChooser)
        rangeLayout.addWidget(QLabel('Parameters'))
        rangeLayout.addWidget(self.paramChooser)
        rangeLayout.addStretch()
        rangeLayout.addWidget(QLabel('Min Value'))
        rangeLayout.addWidget(self.valueMinSpinBox)
        rangeLayout.addWidget(QLabel('Max Value'))
        rangeLayout.addWidget(self.valueMaxSpinBox)
        pickerLayout = QHBoxLayout()
        pickerLayout.addWidget(QLabel('Variable Value'))
        pickerLayout.addWidget(self.valueSpinBox)
        pickerLayout.addWidget(self.valueSlider)

        # Lay out these layouts
        valuePickerLayout = QVBoxLayout()
        valuePickerLayout.addLayout(rangeLayout)
        valuePickerLayout.addLayout(pickerLayout)
        self.setLayout(valuePickerLayout)

    #######
    # SLOTS
    #######

    def changeValueMin(self, min):
{'fraction_non_alphanumeric': 0.07928823760303545, 'fraction_numerical': 0.0026167735182519953, 'mean_word_length': 2.936148300720906, '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': '4892225', 'n_tokens_mistral': 2216, 'n_tokens_neox': 2098, 'n_words': 517}