<commit_before># vim: set et sw=2 sts=2 fileencoding=utf-8:

#
# Simple pastebin-like application using Sinatra with OpenID authentication
#
# Author: <NAME>

$KCODE = 'u' if RUBY_VERSION < '1.9'

require 'rubygems'
require 'sinatra/base'
require 'openid'
require 'openid/store/filesystem'
require 'openid/extensions/sreg'
require 'haml'
require 'sass'
require 'dm-core'
require 'dm-validations'
require 'dm-timestamps'
require 'uv'

class Pastiche < Sinatra::Base

  class User
    include DataMapper::Resource
    property :id,         Serial
    property :openid,     String,   :required => true, :length => 128, :unique_index => :openid
    property :nickname,   String,   :required => true, :length => 16, :unique_index => :nickname
    property :fullname,   String,   :length => 128
    property :email,      String,   :length => 128
    property :created_at, DateTime, :required => true, :auto_validation => false
    property :updated_at, DateTime, :required => true, :auto_validation => false

    has n, :snippets

    validates_is_unique :nickname
    validates_format :nickname, :with => /\A[\w\-]+\z/
    validates_format :email,    :as => :email_address
  end

  class Snippet
    include DataMapper::Resource
    property :id,          Serial
    property :user_id,     Integer,  :required => true
    property :created_at,  DateTime, :required => true, :auto_validation => false, :index => :created
    property :updated_at,  DateTime, :required => true, :auto_validation => false, :index => :updated
    property :type,        String,   :required => true, :length => 40
    property :filename,    String,   :required => true, :length => 128
    property :description, String,   :length => 512
    property :tabstop,     Integer,  :required => true, :default => 8
    property :text,        Text,     :required => true, :length => 65536

    belongs_to :user

    validates_within :tabstop, :set => (2..8)
    validates_format :filename, :with => /\A[^\/\r\n]+\z/
  end

  # options
  enable :sessions
  set :path_prefix, ''
  set :haml, :escape_html => true
  set :sass, :style => :expanded
  set :root, '.'
  set :static, true

  set :uv_theme, 'iplastic'<commit_msg>Fixed for DataMapper 1.0.0.<commit_after># vim: set et sw=2 sts=2 fileencoding=utf-8:

#
# Simple pastebin-like application using Sinatra with OpenID authentication
#
# Author: <NAME>

$KCODE = 'u' if RUBY_VERSION < '1.9'

require 'rubygems'
require 'sinatra/base'
require 'openid'
require 'openid/store/filesystem'
require 'openid/extensions/sreg'
require 'haml'
require 'sass'
require 'dm-core'
require 'dm-validations'
require 'dm-timestamps'
require 'dm-migrations'
require 'uv'

class Pastiche < Sinatra::Base

  class User
    include DataMapper::Resource
    property :id,         Serial
    property :openid,     String,   :required => true, :length => 128, :unique_index => :openid
    property :nickname,   String,   :required => true, :length => 16, :unique_index => :nickname
    property :fullname,   String,   :length => 128
    property :email,      String,   :length => 128
    property :created_at, DateTime, :required => true, :auto_validation => false
    property :updated_at, DateTime, :required => true, :auto_validation => false

    has n, :snippets

    validates_uniqueness_of :nickname
    validates_format_of :nickname, :with => /\A[\w\-]+\z/
    validates_format_of :email,    :as => :email_address
  end

  class Snippet
    include DataMapper::Resource
    property :id,          Serial
    property :user_id,     Integer,  :required => true
    property :created_at,  DateTime, :required => true, :auto_validation => false, :index => :created
    property :updated_at,  DateTime, :required => true, :auto_validation => false, :index => :updated
    property :type,        String,   :required => true, :length => 40
    property :filename,    String,   :required => true, :length => 128
    property :description, String,   :length => 512
    property :tabstop,     Integer,  :required => true, :default => 8
    property :text,        Text,     :required => true, :length => 65536

    belongs_to :user

    validates_within :tabstop, :set => (2..8)
    validates_format_of :filename, :with => /\A[^\/\r\n]+\z/
  end

  # options
  enable :sessions
  set :path_prefix, ''
  set :haml, :escape_html => true
  set :sass, :style => :expanded
  set :root, '.'
  set :static, true

  set :uv_theme, 'iplastic'
{'fraction_non_alphanumeric': 0.13254919701425016, 'fraction_numerical': 0.015154942320741913, 'mean_word_length': 3.4397590361445785, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 73, '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': '1814487', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1401, 'n_words': 414}