<commit_before>import sublime
import sublime_plugin

import re

try:
  from Context.base import Base
except ImportError:
  sublime.error_message("Dependency import failed; please read readme for " +
   "ScopeContext plugin for installation instructions; to disable this " +
   "message remove this plugin")


class Scope(Base):
  def on_query_context(self, *args):
    callback_left = lambda view, sel: view.scope_name(sel.begin())
    callback_right = lambda view, sel: view.scope_name(sel.end() - 1)

    result = (
      self._check_sel('scope', callback_right, *args) and
      (sel.empty() or self._check_sel('scope', callback_left, *args))
    )

    return result

class ScopeB(Base):
  def on_query_context(self, *args):
    callback_right = lambda view, sel: view.scope_name(sel.b)
    callback_left = lambda view, sel: view.scope_name(sel.b - 1)

    result = (
      self._check_sel('scope_b', callback_left, *args) and
      self._check_sel('scope_b', callback_right, *args)<commit_msg>scope part added<commit_after>import sublime
import sublime_plugin

import re

try:
  from Context.base import Base
except ImportError:
  sublime.error_message("Dependency import failed; please read readme for " +
   "ScopeContext plugin for installation instructions; to disable this " +
   "message remove this plugin")


class Scope(Base):
  def on_query_context(self, *args):
    callback_left = lambda view, sel: view.scope_name(sel.begin())
    callback_right = lambda view, sel: view.scope_name(sel.end() - 1)

    result = (
      self._check_sel('scope', callback_right, *args) and
      self._check_sel('scope', callback_left, *args)
    )

    return result

class ScopePart(Base):
  def on_query_context(self, *args):
    callback_left = lambda view, sel: view.scope_name(sel.begin())
    callback_right = lambda view, sel: view.scope_name(sel.end() - 1)

    result = (
      self._check_sel('scope_part', callback_right, *args) or
      self._check_sel('scope_part', callback_left, *args)
    )

    return result

class ScopeB(Base):
  def on_query_context(self, *args):
    callback_right = lambda view, sel: view.scope_name(sel.b)
    callback_left = lambda view, sel: view.scope_name(sel.b - 1)

    result = (
      self._check_sel('scope_b', callback_left, *args) and
      self._check_sel('scope_b', callback_right, *args)
{'fraction_non_alphanumeric': 0.11234515164459632, 'fraction_numerical': 0.0021358393848782574, 'mean_word_length': 4.06926406926407, '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': '4061889', 'n_tokens_mistral': 761, 'n_tokens_neox': 740, 'n_words': 193}