<commit_before>from sublime_plugin import TextCommand

try:
    from .git_gutter_handler import GitGutterHandler
    from .git_gutter_compare import (
        GitGutterCompareCommit, GitGutterCompareBranch, GitGutterCompareTag,
        GitGutterCompareHead, GitGutterCompareOrigin, GitGutterShowCompare,
        GitGutterCompareFileCommit)
    from .git_gutter_jump_to_changes import GitGutterJumpToChanges
    from .git_gutter_popup import show_diff_popup
    from .git_gutter_show_diff import GitGutterShowDiff
except (ImportError, ValueError):
    from git_gutter_handler import GitGutterHandler
    from git_gutter_compare import (
        GitGutterCompareCommit, GitGutterCompareBranch, GitGutterCompareTag,
        GitGutterCompareHead, GitGutterCompareOrigin, GitGutterShowCompare,
        GitGutterCompareFileCommit)
    from git_gutter_jump_to_changes import GitGutterJumpToChanges
    from git_gutter_popup import show_diff_popup
    from git_gutter_show_diff import GitGutterShowDiff


class GitGutterCommand(TextCommand):
    def __init__(self, *args, **kwargs):
        TextCommand.__init__(self, *args, **kwargs)
        self.is_valid_view = self.view.settings().get('is_widget') is not True
        self.git_handler = None
        self.show_diff_handler = None

    def is_enabled(self, **kwargs):
        return self.is_valid_view

    def run(self, edit, **kwargs):
        if not self.git_handler:
            self.git_handler = GitGutterHandler(self.view)
        if not self.show_diff_handler:<commit_msg>Fix Issue #189: Disable GitGutter for binary files and scratch views.<commit_after>from sublime_plugin import TextCommand

try:
    from .git_gutter_handler import GitGutterHandler
    from .git_gutter_compare import (
        GitGutterCompareCommit, GitGutterCompareBranch, GitGutterCompareTag,
        GitGutterCompareHead, GitGutterCompareOrigin, GitGutterShowCompare,
        GitGutterCompareFileCommit)
    from .git_gutter_jump_to_changes import GitGutterJumpToChanges
    from .git_gutter_popup import show_diff_popup
    from .git_gutter_show_diff import GitGutterShowDiff
except (ImportError, ValueError):
    from git_gutter_handler import GitGutterHandler
    from git_gutter_compare import (
        GitGutterCompareCommit, GitGutterCompareBranch, GitGutterCompareTag,
        GitGutterCompareHead, GitGutterCompareOrigin, GitGutterShowCompare,
        GitGutterCompareFileCommit)
    from git_gutter_jump_to_changes import GitGutterJumpToChanges
    from git_gutter_popup import show_diff_popup
    from git_gutter_show_diff import GitGutterShowDiff


class GitGutterCommand(TextCommand):
    def __init__(self, *args, **kwargs):
        """Initialize `git_gutter` command object."""
        TextCommand.__init__(self, *args, **kwargs)
        self.is_valid_view = self.view.settings().get('is_widget') is not True
        self.git_handler = None
        self.show_diff_handler = None

    def is_enabled(self, **kwargs):
        """Determine if `git_gutter` command is enabled to execute."""
        is_enabled = self.is_valid_view
        if is_enabled:
            # Don't handle scratch views
            is_enabled = self.view.is_scratch() is not True
        if is_enabled:
            # Don't handle binary files
            is_enabled = self.view.encoding() not in ('Hexadecimal')
        return is_enabled

    def run(self, edit, **kwargs):
        if not self.git_handler:
            self.git_handler = GitGutterHandler(self.view)
        if not self.show_diff_handler:
{'fraction_non_alphanumeric': 0.06081273088945723, 'fraction_numerical': 0.0008525149190110827, 'mean_word_length': 3.8418156808803303, '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': '4281717', 'n_tokens_mistral': 1030, 'n_tokens_neox': 1027, 'n_words': 235}