<commit_before># coding=utf-8
from __future__ import absolute_import

__author__ = "<NAME> <<EMAIL>>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'

from octoprint.settings import settings

import octoprint.plugin


class CustomControlPlugin(octoprint.plugin.SettingsPlugin,
                          octoprint.plugin.TemplatePlugin,
                          octoprint.plugin.AssetPlugin):
    def get_template_configs(self):
        if "editorcollection" in self._plugin_manager.enabled_plugins:
            return [
                dict(type="plugin_editorcollection_EditorCollection", template="customControl_hookedsettings.jinja2",
                     custom_bindings=True)
            ]
        else:
            return [
                dict(type="settings", template="customControl_hookedsettings.jinja2", custom_bindings=True)
            ]

    def on_settings_load(self):
        return dict(
            controls=settings().get(["controls"])
        )

    def on_settings_save(self, data):
        settings().set(["controls"], data["controls"])

    def get_assets(self):
        return dict(
            js=[
                "js/jquery.ui.sortable.js",
                "js/customControl.js",
                "js/customControlDialog.js",
            ],
            css=["css/customControls.css"],
            less=["less/customControls.less"]
        )

    def get_update_information(self):
        return dict(
            customcontrol=dict(
                displayName="Custom Control Editor Plugin",
                displayVersion=self._plugin_version,

                # version check: github repository
                type="github_release",
                user="Salandora",
                repo="octoprint-customControl",
                current=self._plugin_version,

                # update method: pip
                pip="https://github.com/Salandora/octoprint-customControl/archive/{target_version}.zip"
            )
        )


__plugin_name__ = "Custom Control Editor"


def __plugin_load__():
    global __plugin_implementation__
    __plugin_implementation__ = CustomControlPlugin()

    global __plugin_hooks__
    __plugin_hooks__ = {
        "octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
    }

    global __plugin_license__
    __plugin_license__ = "AGPLv3"<commit_msg>Python 3 compatibility<commit_after># coding=utf-8
from __future__ import absolute_import

__author__ = "<NAME> <<EMAIL>>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'

from octoprint.settings import settings

import octoprint.plugin


class CustomControlPlugin(octoprint.plugin.SettingsPlugin,
                          octoprint.plugin.TemplatePlugin,
                          octoprint.plugin.AssetPlugin):
    def get_template_configs(self):
        if "editorcollection" in self._plugin_manager.enabled_plugins:
            return [
                dict(type="plugin_editorcollection_EditorCollection", template="customControl_hookedsettings.jinja2",
                     custom_bindings=True)
            ]
        else:
            return [
                dict(type="settings", template="customControl_hookedsettings.jinja2", custom_bindings=True)
            ]

    def on_settings_load(self):
        return dict(
            controls=settings().get(["controls"])
        )

    def on_settings_save(self, data):
        settings().set(["controls"], data["controls"])

    def get_assets(self):
        return dict(
            js=[
                "js/jquery.ui.sortable.js",
                "js/customControl.js",
                "js/customControlDialog.js",
            ],
            css=["css/customControls.css"],
            less=["less/customControls.less"]
        )

    def get_update_information(self):
        return dict(
            customcontrol=dict(
                displayName="Custom Control Editor Plugin",
                displayVersion=self._plugin_version,

                # version check: github repository
                type="github_release",
                user="Salandora",
                repo="octoprint-customControl",
                current=self._plugin_version,

                # update method: pip
                pip="https://github.com/Salandora/octoprint-customControl/archive/{target_version}.zip"
            )
        )


__plugin_name__ = "Custom Control Editor"
__plugin_pythoncompat__ = ">=2.7,<4"


def __plugin_load__():
    global __plugin_implementation__
    __plugin_implementation__ = CustomControlPlugin()

    global __plugin_hooks__
    __plugin_hooks__ = {
        "octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information
    }

    global __plugin_license__
    __plugin_license__ = "AGPLv3"
{'fraction_non_alphanumeric': 0.09327280231118448, 'fraction_numerical': 0.0024762690879075525, 'mean_word_length': 2.242140468227425, 'pattern_counts': {'":': 2, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '5198387', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1267, 'n_words': 207}