<commit_before>import os


import sublime
import sublime_plugin


class EnableThemeCommand(sublime_plugin.ApplicationCommand):

    def run(self):
        self.themes = []

        for theme in sublime.find_resources('*.sublime-theme'):
            if "Addon" not in theme and "tests" not in theme:
                self.themes.append(os.path.basename(theme))

        if len(self.themes) > 1:
            sublime.active_window().show_quick_panel(self.themes, self.on_done)

    def on_done(self, index):
        if index == -1:
            return

        theme = self.themes[index]

        settings = sublime.load_settings('Preferences.sublime-settings')
        settings.set('theme', theme)
        sublime.save_settings('Preferences.sublime-settings')


class EnableColorSchemeCommand(sublime_plugin.ApplicationCommand):

    def run(self):
        self.color_schemes = []

        for color_scheme in sublime.find_resources('*.tmTheme'):
            if "(SL)" not in color_scheme and "tests" not in color_scheme:
                self.color_schemes.append(color_scheme)

        if len(self.color_schemes) > 1:
            color_scheme = sublime.load_settings('Preferences.sublime-settings').get('color_scheme')
            if color_scheme not in self.color_schemes:
                self.color_schemes.insert(0, color_scheme)

            self.window = sublime.active_window()
            self.window.show_quick_panel(
                self.color_schemes,
                self.on_done,
                0,
                self.color_schemes.index(color_scheme),
                self.on_select
            )

    def on_select(self, index):
        if index == -1:
            return

        color_scheme = self.color_schemes[index]

        for group in range(0, self.window.num_groups()):
            active_view_in_group = self.window.active_view_in_group(group)
            if active_view_in_group:
                active_view_in_group.settings().set('color_scheme', color_scheme)

    def on_done(self, index):
        for view in self.window.views():
            view.settings().erase('color_scheme')

        if index == -1:
            return

        color_scheme = self.color_schemes[index]

        settings = sublime.load_settings('Preferences.sublime-settings')
        settings.set('color_scheme', color_scheme)
        sublime.save_settings('Preferences.sublime-settings')<commit_msg>Fix edge-case enable color scheme issue<commit_after>import os


import sublime
import sublime_plugin


class EnableThemeCommand(sublime_plugin.ApplicationCommand):

    def run(self):
        self.themes = []

        for theme in sublime.find_resources('*.sublime-theme'):
            if "Addon" not in theme and "tests" not in theme:
                self.themes.append(os.path.basename(theme))

        if len(self.themes) > 1:
            sublime.active_window().show_quick_panel(self.themes, self.on_done)

    def on_done(self, index):
        if index == -1:
            return

        theme = self.themes[index]

        settings = sublime.load_settings('Preferences.sublime-settings')
        settings.set('theme', theme)
        sublime.save_settings('Preferences.sublime-settings')


class EnableColorSchemeCommand(sublime_plugin.ApplicationCommand):

    def run(self):
        self.color_schemes = []

        for color_scheme in sublime.find_resources('*.tmTheme'):
            if "(SL)" not in color_scheme and "tests" not in color_scheme:
                self.color_schemes.append(color_scheme)

        if len(self.color_schemes) > 1:
            color_scheme = sublime.load_settings('Preferences.sublime-settings').get('color_scheme')
            if color_scheme not in self.color_schemes:
                self.color_schemes.insert(0, color_scheme)

            self.window = sublime.active_window()
            self.window.show_quick_panel(
                self.color_schemes,
                self.on_done,
                0,
                self.color_schemes.index(color_scheme),
                self.on_select
            )

    def on_select(self, index):
        if index == -1:
            return

        color_scheme = self.color_schemes[index]

        for group in range(0, self.window.num_groups()):
            active_view_in_group = self.window.active_view_in_group(group)
            if active_view_in_group:
                active_view_in_group.settings().set('color_scheme', color_scheme)

    def on_done(self, index):
        if index == -1:
            for view in self.window.views():
                view.settings().erase('color_scheme')
            return

        color_scheme = self.color_schemes[index]

        settings = sublime.load_settings('Preferences.sublime-settings')
        settings.set('color_scheme', color_scheme)
        sublime.save_settings('Preferences.sublime-settings')

        for view in self.window.views():
            view.settings().erase('color_scheme')
{'fraction_non_alphanumeric': 0.09985792571544551, 'fraction_numerical': 0.0032474122183884717, 'mean_word_length': 2.3073825503355705, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6223137', 'n_tokens_mistral': 1474, 'n_tokens_neox': 1389, 'n_words': 257}