<commit_before>module Gritano
  class Permission < ActiveRecord::Base
    belongs_to :user
    belongs_to :repository
    
    def add_access(access)
      if access == :read
        self.access = 1 | (self.access || 0)
      elsif access == :write
        self.access = 2 | (self.access || 0)
      else
        return false
      end
      return true
    end
    
    def remove_access(access)
      if access == :read
        self.access = (self.access || 0) & (~1)
      elsif access == :write
        self.access = (self.access || 0) & (~2)
      else
        return false
      end
      return true
    end
  end
end<commit_msg>impriving readability<commit_after>module Gritano
  class Permission < ActiveRecord::Base
    belongs_to :user
    belongs_to :repository
    
    READ = 1
    WRITE = 2
    
    def add_access(access)
      if access == :read
        self.access = READ | (self.access || 0)
      elsif access == :write
        self.access = WRITE | (self.access || 0)
      else
        return false
      end
      return true
    end
    
    def remove_access(access)
      if access == :read
        self.access = (self.access || 0) & (~ READ)
      elsif access == :write
        self.access = (self.access || 0) & (~ WRITE)
      else
        return false
      end
      return true
    end
  end
end
{'fraction_non_alphanumeric': 0.09487951807228916, 'fraction_numerical': 0.010542168674698794, 'mean_word_length': 1.7861635220125787, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7464809', 'n_tokens_mistral': 418, 'n_tokens_neox': 405, 'n_words': 118}