<commit_before># encoding: utf-8

module CitySDK
  class Layer < Sequel::Model
    # As of 8th Feb 2014, the layers with IDs 0, 1, and 2 are required
    # and cannot be deleted.
    UNDELETABLE_IDS = Set.new([0, 1, 2])


    many_to_one :owner, class: :SequelUser
    one_to_many :node_data

    def deletable?
      !UNDELETABLE_IDS.include?(id)
    end # def

    def self.for_name(name)
      where(name: name).first
    end # def
  end # class


  # Stuff the Peter has not looked at.
  class Layer < Sequel::Model
    plugin :validation_helpers
    plugin :json_serializer

    KEY_LAYER_NAMES = 'layer_names'
    KEY_LAYERS_AVAILABLE = 'layers_available'

    def validate
      super
      validates_presence [
        :category,
        :description,
        :name,
        :organization
      ]
      validates_unique :name
      validates_format /^\w+(\.\w+)*$/, :name
    end

    def self.memcache_key(id)
      "layer!!#{ id }"<commit_msg>Get layers in category helper method<commit_after># encoding: utf-8

module CitySDK
  class Layer < Sequel::Model
    # As of 8th Feb 2014, the layers with IDs 0, 1, and 2 are required
    # and cannot be deleted.
    UNDELETABLE_IDS = Set.new([0, 1, 2])


    many_to_one :owner, class: :SequelUser
    one_to_many :node_data

    def deletable?
      !UNDELETABLE_IDS.include?(id)
    end # def

    def self.for_name(name)
      where(name: name).first
    end # def

    def self.get_layers_in_category(category)
      where(Sequel.like(:category, "#{ category }%"))
    end # def
  end # class


  # Stuff the Peter has not looked at.
  class Layer < Sequel::Model
    plugin :validation_helpers
    plugin :json_serializer

    KEY_LAYER_NAMES = 'layer_names'
    KEY_LAYERS_AVAILABLE = 'layers_available'

    def validate
      super
      validates_presence [
        :category,
        :description,
        :name,
        :organization
      ]
      validates_unique :name
      validates_format /^\w+(\.\w+)*$/, :name
    end

    def self.memcache_key(id)
      "layer!!#{ id }"
{'fraction_non_alphanumeric': 0.09833659491193737, 'fraction_numerical': 0.011741682974559686, 'mean_word_length': 2.513745704467354, 'pattern_counts': {'":': 0, '<': 7, '<?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': '939820', 'n_tokens_mistral': 720, 'n_tokens_neox': 676, 'n_words': 185}