<commit_before>import sublime
import sublime_plugin
import view_collection

class GitGutterCommand(sublime_plugin.TextCommand):
  def run(self, edit):
    self.clear_all()

    (inserted, modified, deleted) = view_collection.ViewCollection.diff(self.view)

    self.lines_removed(deleted)
    self.lines_added(inserted)
    self.lines_modified(modified)

  def clear_all(self):
    self.view.add_regions('git_gutter_deleted_top',    [], '')
    self.view.add_regions('git_gutter_deleted_bottom', [], '')
    self.view.add_regions('git_gutter_inserted',       [], '')
    self.view.add_regions('git_gutter_changed',        [], '')

  def lines_to_regions(self, lines):
    regions = []
    for line in lines:
      position = self.view.text_point(line-1, 0)
      region   = sublime.Region(position,position)
      regions.append(region)
    return regions

  def lines_removed(self, lines):
    bottom_lines = []
    for line in lines:
      bottom_lines.append(line-1)
    self.lines_removed_top(lines)
    self.lines_removed_bottom(bottom_lines)

  def lines_removed_top(self, lines):
    regions = self.lines_to_regions(lines)
    scope   = "markup.deleted"
    icon    = '../GitGutter/icons/deleted_top'
    self.view.add_regions('git_gutter_deleted_top', regions, scope, icon)

  def lines_removed_bottom(self, lines):<commit_msg>Use built in methods for clear_all<commit_after>import sublime
import sublime_plugin
import view_collection

class GitGutterCommand(sublime_plugin.TextCommand):
  def run(self, edit):
    self.clear_all()

    (inserted, modified, deleted) = view_collection.ViewCollection.diff(self.view)

    self.lines_removed(deleted)
    self.lines_added(inserted)
    self.lines_modified(modified)

  def clear_all(self):
    self.view.erase_regions('git_gutter_deleted_top')
    self.view.erase_regions('git_gutter_deleted_bottom')
    self.view.erase_regions('git_gutter_inserted')
    self.view.erase_regions('git_gutter_changed')

  def lines_to_regions(self, lines):
    regions = []
    for line in lines:
      position = self.view.text_point(line-1, 0)
      region   = sublime.Region(position,position)
      regions.append(region)
    return regions

  def lines_removed(self, lines):
    bottom_lines = []
    for line in lines:
      bottom_lines.append(line-1)
    self.lines_removed_top(lines)
    self.lines_removed_bottom(bottom_lines)

  def lines_removed_top(self, lines):
    regions = self.lines_to_regions(lines)
    scope   = "markup.deleted"
    icon    = '../GitGutter/icons/deleted_top'
    self.view.add_regions('git_gutter_deleted_top', regions, scope, icon)

  def lines_removed_bottom(self, lines):
{'fraction_non_alphanumeric': 0.11014711429649189, 'fraction_numerical': 0.002263296869105998, 'mean_word_length': 4.159533073929961, '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': '5644936', 'n_tokens_mistral': 891, 'n_tokens_neox': 883, 'n_words': 140}