<commit_before>from hoomd import _hoomd
from hoomd.custom import (
    _CustomOperation, _InternalCustomOperation, Action)
from hoomd.operation import _Tuner


class _TunerProperty:
    @property
    def updater(self):
        return self._action

    @updater.setter
    def updater(self, updater):
        if isinstance(updater, Action):
            self._action = updater
        else:
            raise ValueError(
                "updater must be an instance of hoomd.custom.Action")


class CustomTuner(_CustomOperation, _TunerProperty, _Tuner):
    """Tuner wrapper for `hoomd.custom.Action` objects.

    For usage see `hoomd.custom._CustomOperation`.
    """
    _cpp_list_name = 'tuners'
    _cpp_class_name = 'PythonTuner'

    def attach(self, simulation):
        self._cpp_obj = getattr(_hoomd, self._cpp_class_name)(
            simulation.state._cpp_sys_def, self.trigger, self._action)
        super().attach(simulation)
        self._action.attach(simulation)


class _InternalCustomTuner(
        _InternalCustomOperation, _TunerProperty, _Tuner):
    _cpp_list_name = 'tuners'
    _cpp_class_name = 'PythonTuner'<commit_msg>Fix attaching on custom tuners<commit_after>from hoomd import _hoomd
from hoomd.operation import _Operation
from hoomd.custom import (
    _CustomOperation, _InternalCustomOperation, Action)
from hoomd.operation import _Tuner


class _TunerProperty:
    @property
    def tuner(self):
        return self._action

    @tuner.setter
    def tuner(self, tuner):
        if isinstance(tuner, Action):
            self._action = tuner
        else:
            raise ValueError(
                "updater must be an instance of hoomd.custom.Action")


class CustomTuner(_CustomOperation, _TunerProperty, _Tuner):
    """Tuner wrapper for `hoomd.custom.Action` objects.

    For usage see `hoomd.custom._CustomOperation`.
    """
    _cpp_list_name = 'tuners'
    _cpp_class_name = 'PythonTuner'

    def attach(self, simulation):
        self._cpp_obj = getattr(_hoomd, self._cpp_class_name)(
            simulation.state._cpp_sys_def, self.trigger, self._action)
        self._action.attach(simulation)
        _Operation.attach(self, simulation)


class _InternalCustomTuner(
        _InternalCustomOperation, _TunerProperty, _Tuner):
    _cpp_list_name = 'tuners'
    _cpp_class_name = 'PythonTuner'

    def attach(self, simulation):
        self._cpp_obj = getattr(_hoomd, self._cpp_class_name)(
            simulation.state._cpp_sys_def, self.trigger, self._action)
        self._action.attach(simulation)
        _Operation.attach(self, simulation)
{'fraction_non_alphanumeric': 0.08635312259059368, 'fraction_numerical': 0.0, 'mean_word_length': 3.1586538461538463, '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': '4792669', 'n_tokens_mistral': 832, 'n_tokens_neox': 820, 'n_words': 174}