query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102 values |
|---|---|---|---|---|---|---|
extension_config do |config| config.gem 'someawesomegem' config.after_initialize do run_something end end See your config/routes.rb file in this extension to define custom routes | def activate
Page.send(:include, ArchiveChildrenTags)
# tab 'Content' do
# add_item "Archive Children", "/admin/archive_children", :after => "Pages"
# end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_routes; end",
"def external_routes; end",
"def after_initialize\n super\n extension_loader.activate_extensions # also calls initialize_views\n TrustyCms::Application.config.add_controller_paths(extension_loader.paths(:controller))\n TrustyCms::Application.config.add_eager_load_pa... | [
"0.69148207",
"0.65548897",
"0.60935384",
"0.59472436",
"0.593951",
"0.58708704",
"0.57642835",
"0.56205094",
"0.5617361",
"0.5609739",
"0.56045693",
"0.5589057",
"0.55866235",
"0.5565984",
"0.55591667",
"0.55579543",
"0.55560505",
"0.55175877",
"0.55175877",
"0.55175877",
"0... | 0.0 | -1 |
Catch common beginner mistake and give a helpful error message on stderr | def execute(*)
file, line, = caller.first.split(":")
colors = SSHKit::Color.new($stderr)
$stderr.puts colors.colorize("Warning: `execute' should be wrapped in an `on' scope in #{file}:#{line}.", :red)
$stderr.puts
$stderr.puts " task :example do"
$stderr.puts colors.colorize(" on roles(:app) do", :yellow)
$stderr.puts " execute 'whoami'"
$stderr.puts colors.colorize(" end", :yellow)
$stderr.puts " end"
$stderr.puts
raise NoMethodError, "undefined method `execute' for main:Object"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(subject = nil, message)\n $stderr.puts \"#{name}: #{message}\"\n saved = $stdout\n begin\n $stdout = $stderr\n Formatter.usage(grammar)\n exit 1\n ensure\n $stdout = saved\n end\n end",
"def error(msg) $stderr.puts(\"Error: #{msg}\") end",
"def ... | [
"0.70461905",
"0.70320886",
"0.7019609",
"0.6917713",
"0.69021195",
"0.6890441",
"0.6858042",
"0.6858042",
"0.6858042",
"0.6858042",
"0.6854831",
"0.68482393",
"0.68349856",
"0.68303424",
"0.6797989",
"0.6792575",
"0.67924803",
"0.67924803",
"0.6765834",
"0.67567736",
"0.6756... | 0.0 | -1 |
FUNCTIONS a_anno 0:chr 1:pos 3:oldBase 4:newBase 5:quality 10:gene 11:/+ 12:exon/intron/promotor a_gen 1:gene 2:chr 3:+/ 4:start 5:stop 6:start_coding 7:end_coding 8:ofExons 9:ExonStarts 10:exonEnds | def mutations_effect(a_anno, a_gen)
if $locus[a_anno[10]] && a_anno[3].length == a_anno[4].length
$cdna.pos = $locus[a_anno[10]]
transcript = original()
exon_starts = a_gen[9].split(',')
exon_ends = a_gen[10].split(',')
mutation_position,exon_num = position_on_transcript(a_anno[1],a_gen[3],exon_starts,exon_ends,a_gen[6],a_gen[7])
a_anno[12] = "exon#{exon_num}"
start_triplet = (mutation_position/3 * 3) - 1
if start_triplet >= 0
code = transcript[start_triplet..start_triplet+2]
pos_in_triplet = mutation_position%3
original_aa = $codes[code]
code[pos_in_triplet] = a_anno[4]
mutated_aa = $codes[code[0..2]]
if original_aa != mutated_aa
a_anno[13] = pos_in_triplet + 1
a_anno[14] = original_aa[:name]
a_anno[15] = mutated_aa[:name]
puts a_anno.join("\t")
else
a_anno[13] = "same_AA"
STDERR.puts a_anno.join("\t")
end
end
else
if $locus_non_coding[a_anno[10]]
a_anno[13] = "ncrna"
STDERR.puts a_anno.join("\t")
else
if (a_anno[3].length > a_anno[4].length || a_anno[3].length < a_anno[4].length)
a_anno[13] = "indel"
puts a_anno.join("\t")
else
a_anno[13] = "?"
STDERR.puts a_anno.join("\t")
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def annotate\n genes={}\n File.open(ANNOTATION,'r').each do |line|\n temp=line.split\n genes[temp[9]]={}\n genes[temp[9]][\"start\"]=temp[3].to_i\n genes[temp[9]][\"end\"]=temp[4].to_i\n genes[temp[9]][\"strand\"]=temp[6]\n genes[temp[9]][\"length\"]=temp[4].to_i - 1 - temp[3].to_i\n end\n re... | [
"0.64421415",
"0.5789212",
"0.56554943",
"0.56016725",
"0.55067724",
"0.5491933",
"0.54730046",
"0.54730046",
"0.54730046",
"0.54730046",
"0.54730046",
"0.54730046",
"0.54730046",
"0.54730046",
"0.53668576",
"0.533807",
"0.530334",
"0.5302836",
"0.5302836",
"0.5301391",
"0.52... | 0.6931948 | 0 |
$ rake 2:1 Write a program that reads in two integers typed on the keybaord and outputs their sum, difference, and product Standard input will be like "9 2\n" and will expect you to print "11\n7\n18\n" to standard output. | def sum_difference_product
a , b, c = gets.split.map { |num| num.to_i }
puts a + b + c
puts a - b - c
puts a * b * c
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_difference_product\n a , b = gets.split.map { |num| num.to_i }\n puts a + b\n puts a - b\n puts a * b\n end",
"def sum_difference_product\n # your code goes here\n a , b = gets.split.map {|x| x.to_i}\n puts a + b\n puts a - b\n puts a * b\nend",
"def sum_difference_product\n # your c... | [
"0.79599655",
"0.7917274",
"0.77308846",
"0.7644165",
"0.75703704",
"0.75413847",
"0.75002897",
"0.7398552",
"0.7395946",
"0.73153496",
"0.72797805",
"0.72483873",
"0.7208441",
"0.705538",
"0.70248014",
"0.70197755",
"0.6995165",
"0.6991467",
"0.6981296",
"0.68775386",
"0.687... | 0.76710844 | 3 |
GET /slow_things GET /slow_things.json | def index
@slow_things = SlowThing.all
respond_with @slow_things if stale? @slow_things, public: true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n respond_with @slow_thing if stale? @slow_thing, public: true\n end",
"def index\n # sleep 3 # simulate a slow connection\n render json: Secret.all.reverse\n end",
"def interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAUL... | [
"0.5984558",
"0.59120774",
"0.5740068",
"0.57172483",
"0.5641928",
"0.55835277",
"0.55741984",
"0.5570309",
"0.5537178",
"0.55098784",
"0.5508085",
"0.55048484",
"0.5489543",
"0.5489199",
"0.5468746",
"0.546777",
"0.546486",
"0.54524916",
"0.54512143",
"0.5450417",
"0.5424806... | 0.7145652 | 0 |
GET /slow_things/1 GET /slow_things/1.json | def show
respond_with @slow_thing if stale? @slow_thing, public: true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @slow_things = SlowThing.all\n respond_with @slow_things if stale? @slow_things, public: true\n end",
"def show\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thing }\n end\n end",
"def index\n ... | [
"0.6930858",
"0.58509856",
"0.5813788",
"0.5804802",
"0.57894963",
"0.5727108",
"0.5678024",
"0.5666806",
"0.5627441",
"0.5572159",
"0.5568189",
"0.55662334",
"0.5565507",
"0.5562831",
"0.55625254",
"0.55625254",
"0.55449766",
"0.5539758",
"0.5525033",
"0.55235505",
"0.551996... | 0.60379285 | 1 |
POST /slow_things POST /slow_things.json | def create
@slow_thing = SlowThing.new(slow_thing_params)
respond_to do |format|
if @slow_thing.save
domain = URI(root_url)
Net::HTTP.start(domain.host, domain.port) do |http|
Rails.logger.debug "purging #{domain}"
http.request( Purge.new(domain) )
Rails.logger.debug "purging #{slow_things_url}"
http.request( Purge.new(URI(slow_things_url)) )
end
format.html { redirect_to @slow_thing, notice: 'Slow thing was successfully created.' }
format.json { render :show, status: :created, location: @slow_thing }
else
format.html { render :new }
format.json { render json: @slow_thing.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def slow_thing_params\n params.require(:slow_thing).permit(:name)\n end",
"def long_slow_post(host, rate_limit, keep_alive) \r\n\trequest = ... | [
"0.59808415",
"0.58987194",
"0.5499058",
"0.54937506",
"0.5456881",
"0.54096574",
"0.53225213",
"0.5315783",
"0.5288149",
"0.5279808",
"0.5272885",
"0.52636254",
"0.52452856",
"0.52263284",
"0.5198195",
"0.51827645",
"0.5175397",
"0.5158314",
"0.5157859",
"0.515723",
"0.51291... | 0.6336423 | 0 |
PATCH/PUT /slow_things/1 PATCH/PUT /slow_things/1.json | def update
respond_to do |format|
if @slow_thing.update(slow_thing_params)
domain = URI(root_url)
Net::HTTP.start(domain.host, domain.port) do |http|
Rails.logger.debug "purging #{domain}"
http.request( Purge.new(domain) )
Rails.logger.debug "purging #{slow_things_url}"
http.request( Purge.new(URI(slow_things_url)) )
Rails.logger.debug "purging #{slow_thing_url(@slow_thing)}"
http.request( Purge.new(URI(slow_thing_url(@slow_thing))) )
end
format.html { redirect_to @slow_thing, notice: 'Slow thing was successfully updated.' }
format.json { render :show, status: :ok, location: @slow_thing }
else
format.html { render :edit }
format.json { render json: @slow_thing.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def patch!\n request! :patch\n end",
"def update\n @thing = Thin... | [
"0.61767423",
"0.6167336",
"0.60733217",
"0.5991576",
"0.5977999",
"0.5906642",
"0.58816624",
"0.5870645",
"0.5865846",
"0.5850524",
"0.5814966",
"0.5812773",
"0.5788376",
"0.5788376",
"0.5788376",
"0.5770086",
"0.5765108",
"0.5759052",
"0.57523924",
"0.5696049",
"0.5691312",... | 0.6187133 | 0 |
DELETE /slow_things/1 DELETE /slow_things/1.json | def destroy
@slow_thing.destroy
respond_to do |format|
format.html { redirect_to slow_things_url, notice: 'Slow thing was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete!( opts = {} )\n http_... | [
"0.6906653",
"0.6830822",
"0.6699254",
"0.6637343",
"0.6631996",
"0.6631996",
"0.6583462",
"0.65665853",
"0.65101385",
"0.65005887",
"0.64581996",
"0.6431477",
"0.6429327",
"0.6394287",
"0.6376216",
"0.6370607",
"0.6327913",
"0.6327492",
"0.6314071",
"0.63041776",
"0.63016164... | 0.69605523 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_slow_thing
@slow_thing = SlowThing.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def slow_thing_params
params.require(:slow_thing).permit(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Preview this email at | def password_reset
user = User.first
user.reset_token = User.new_token
UserMailer.password_reset(user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end",
"def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end",
"def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end",
"def preview_email\r... | [
"0.71475905",
"0.71186084",
"0.70552814",
"0.6985626",
"0.6848472",
"0.6848472",
"0.6832406",
"0.6663229",
"0.64324814",
"0.631654",
"0.6304366",
"0.6181875",
"0.6167911",
"0.61338973",
"0.61305445",
"0.6115152",
"0.61100966",
"0.61100966",
"0.60882556",
"0.60132533",
"0.5982... | 0.0 | -1 |
PUT /resource We need to use a copy of the resource because we don't want to change the current user in place. | def update
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)
resource_updated = update_resource(resource, account_update_params)
error_flag = false
if resource.real_name == true
unless resource.first_name.present? && resource.last_name.present?
set_flash_message :error, :not_real_name
resource.real_name = false
resource.save!
error_flag = true
end
end
yield resource if block_given?
if resource_updated
if is_flashing_format?
flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
:update_needs_confirmation : :updated
unless error_flag == true && flash_key == :updated
set_flash_message :notice, flash_key
end
end
sign_in resource_name, resource, bypass: true
if error_flag == true
redirect_to edit_user_registration_path(resource) and return
end
respond_with resource, location: after_update_path_for(resource)
else
clean_up_passwords resource
respond_with resource
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://... | [
"0.722461",
"0.70050365",
"0.6981741",
"0.69709957",
"0.69548756",
"0.69534856",
"0.6753882",
"0.6746122",
"0.6743065",
"0.6716734",
"0.6716734",
"0.6707082",
"0.6707082",
"0.6707082",
"0.6707082",
"0.6707082",
"0.6707082",
"0.6707082",
"0.6707082",
"0.670286",
"0.6698732",
... | 0.0 | -1 |
gathers all the required information about the user to view his/her profile | def show
@member = User.find(params[:id])
conn = Connection.where(:user_id => @current_user.id).pluck(:connection_id)
user = Connection.where(:connection_id => @current_user.id).pluck(:user_id)
all = user + conn
@connections = User.where(:id => all)
@member = User.find(params[:id])
@reviews = UsersQuest.where(:assignee_id => @current_user.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile\n\t\t\n\t\tif !current_user\n\t\t\tredirect_to root_url and return\n\t\tend\n\t\t\n\t\t@user = current_user\n\t\t\n\tend",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info['query']['results'][\"profile\"]\n end",
"def show\n @user = User.find(params[:id])\n can_edit_h... | [
"0.7608364",
"0.75591236",
"0.7515988",
"0.75147974",
"0.75045276",
"0.7493715",
"0.7471606",
"0.74644065",
"0.7442741",
"0.7392975",
"0.73781127",
"0.73598516",
"0.7304206",
"0.7304206",
"0.7304206",
"0.7304206",
"0.7304206",
"0.7304206",
"0.7303646",
"0.72504574",
"0.72158"... | 0.0 | -1 |
edit user profile view | def edit
@user = User.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n\t\t@user = User.find( params[:user_id] )\n\t\t@profile = @user.profile\n\tend",
"def profile_edit\n @user = User.find(current_user.id)\n end",
"def edit\n @user = User.find (params[:user_id])\n @profile = @user.profile\n end",
"def edit\n user = User.find(params[:user_id])... | [
"0.8624624",
"0.8552577",
"0.85287625",
"0.84501415",
"0.8438943",
"0.8346119",
"0.8324389",
"0.8299431",
"0.824615",
"0.81268436",
"0.81160253",
"0.81139135",
"0.8058832",
"0.7926156",
"0.79151404",
"0.7912449",
"0.77825755",
"0.77814955",
"0.7771191",
"0.77525836",
"0.77490... | 0.0 | -1 |
add an item and optional quantity remove an item list Update quantity Print view the list Method create_list Method to create a list input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: create new list LOOP Through Items on List If Item already exists Add 1 to the quantity Else it creates it with quantity 1 End IF End Loop call the 'print_list' method to display the list. output:nothing Method to add an item to a list add_item input: item name and optional quantity steps: check if item already exists If Item already exists Add 1 to the quantity Else it creates it with quantity 1 if no quantity, quantity if there End IF output: nothing Method to remove an item from the list input: item name steps: Checks if item exists on list If it exists Delete Item Print "item" deleted Else print "item" is not on list on screen. output: Method to update the quantity of an item input: item name and quantity steps: Check if item Exists If it exists change quantity of item Print quantity item now Else Print item doesn't exist. output: nothing Method to print a list and make it look pretty input: nothing steps: Loop through list print item and quantities End Loop output: nothing INITIAL CODE: | def initialize_list(desired_start_items)
arr = desired_start_items.split(' ')
# The each loop will run once for every element in the array.
arr.each do |item_name|
add_item(item_name) # this will be updating $list_items
end
display_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item(list, item, quantity=1)\r\n# input: item name and optional quantity\r\n# steps: \r\n # Use shopping list as input\r\n # Use the item to be added as 2nd input\r\n # Use the item quantity as a 3rd input (look up whether optional input is possible)\r\n # Add the item and quantity to the shopping list... | [
"0.8221839",
"0.7965753",
"0.770645",
"0.7647205",
"0.75484306",
"0.75223047",
"0.7494351",
"0.7486487",
"0.74571157",
"0.7446799",
"0.7404277",
"0.74034816",
"0.73914915",
"0.73914915",
"0.73631907",
"0.7359511",
"0.73593175",
"0.73593175",
"0.73519444",
"0.7350253",
"0.7345... | 0.0 | -1 |
assert(FileTest.zero?('test/test_fq/_lock')) assert(FileTest.zero?('test/test_fq/_log')) assert_equal(0, Dir.glob('test/test_fq/_tmp/').length, Dir.glob('test/test_fq/_tmp')) assert_equal(1, Dir.glob('test/test_fq/que/').length) assert_equal(0, Dir.glob('test/test_fq/run/').length) assert_equal(0, Dir.glob('test/test_fq/pause/').length) assert_equal(0, Dir.glob('test/test_fq/done/').length) assert_equal(0, Dir.glob('test/test_fq/_err/').length) | def test_insert_file
job1 = @fq.insert_file(@tmp_name1)
assert(job1, 'invalid job1: false : ' + @fq.read_log)
assert_equal({:que => 1}, @fq.all_lengths)
assert_equal(1, @fq.length)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_files\n `touch ../harness/test/foo ../harness/test/bar`\n f = @td.files\n assert_equal(2, f.length)\n assert(f.find \"foo\")\n assert(f.find \"bar\")\n end",
"def test_basic_file_ops\n assert_equal(0, @dir.file_count(), \"directory should be empty\")\n assert(! @dir.exists?('filena... | [
"0.7399939",
"0.7046132",
"0.67277825",
"0.6698579",
"0.66247195",
"0.6606405",
"0.65651715",
"0.65431124",
"0.65171593",
"0.64648783",
"0.64236677",
"0.6385257",
"0.6257858",
"0.6187212",
"0.61722034",
"0.614127",
"0.6133284",
"0.610395",
"0.6097351",
"0.60643697",
"0.605500... | 0.646268 | 10 |
the actual users finish watching a video | def calendar
@videos = Video.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_video_added!\n start! if waiting?\n end",
"def video_watched?(user, video)\n @watched_video = WatchedVideo.where(user_id: user.id, video_id: video.id).first\n if @watched_video && @watched_video.watched == true\n true\n else\n false\n end\n end",
"def videos_test\n end",
... | [
"0.6808604",
"0.63277876",
"0.62168425",
"0.6162259",
"0.6148543",
"0.61454415",
"0.6127088",
"0.60524744",
"0.5973399",
"0.59597635",
"0.59560174",
"0.59123904",
"0.5903585",
"0.58820915",
"0.58287007",
"0.58057064",
"0.5805127",
"0.5775226",
"0.5756984",
"0.5750114",
"0.574... | 0.0 | -1 |
Takes an array of strings, each representing a line Draws a box around the lines, and returns a new array padding may be provided | def box_it(array_of_lines, padding = 1, _box_colour = :bc_cyan)
max_length = max_box_line_length(array_of_lines)
pad_string = "\s" * padding
box_lines = [
# Set the top box line
"#{BOX_TOP_LEFT}#{BOX_HORIZONTAL_LINE * (max_length + (padding + 1))}#{BOX_TOP_RIGHT}"
]
array_of_lines.each do |line|
line_length = line.sanitize.length
box_lines << "#{BOX_SIDE}#{pad_string}" + line.to_s + "#{"\s" * (max_length - line_length)}#{pad_string}#{BOX_SIDE}"
end
# Set the bottom box line
box_lines << "#{BOX_BOTTOM_LEFT}#{BOX_HORIZONTAL_LINE * (max_length + (padding + 1))}#{BOX_BOTTOM_RIGHT}"
box_lines
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_line(arr)\n x = TTY::Screen.width - 2\n small_items = 12\n first_item = x - 5 * small_items\n\n output = \"\"\n arr.each_with_index do |l, i|\n if i == 0\n output << l.to_s[0..first_item].ljust(first_item)\n else\n output << l.to_s[0..small_items].ljust(small_items... | [
"0.6492443",
"0.6049305",
"0.6040567",
"0.60036755",
"0.59825855",
"0.5976544",
"0.58638805",
"0.5800494",
"0.57781017",
"0.5757104",
"0.5705841",
"0.5682537",
"0.5593508",
"0.5583972",
"0.5553343",
"0.551409",
"0.54761165",
"0.54586524",
"0.54494214",
"0.54325145",
"0.543062... | 0.7717645 | 0 |
Define the installation steps | def install
# Define GOPATH
ENV["GOPATH"] = buildpath/"go"
ENV["GOBIN"] = buildpath/"go/bin"
# Create the required directory structure
(buildpath/"go/bin").mkpath
(buildpath/"go/pkg").mkpath
(buildpath/"go/src").mkpath
(buildpath/"go/src/github.com/Dids/clobber").mkpath
# Copy everything to the Go project directory (except the go/ folder)
system "rsync -a ./ go/src/github.com/Dids/clobber/"
# Switch to the Go project directory
Dir.chdir 'go/src/github.com/Dids/clobber' do
ohai "Switched to directory: #{Dir.pwd}"
# Print out target version
ohai "Building version #{version}.."
# Build the application
system "make", "deps"
system "make", "build", "BINARY_VERSION=#{version}", "BINARY_OUTPUT=#{buildpath}/clobber"
system "make", "test"
# Print the version
system buildpath/"clobber", "--version"
# Install the application
bin.install buildpath/"clobber"
# Test that the version matches
if "clobber version #{version}" != `#{bin}/clobber --version`.strip
odie "Output of 'clobber --version' did not match the current version (#{version})."
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install\n end",
"def install\n end",
"def prepare_for_installation; end",
"def install\n end",
"def install\n end",
"def install\n \n end",
"def post_install; end",
"def post_install\n end",
"def install_sequence\n commands = pre_commands(:install) + [ install_commands... | [
"0.74743325",
"0.7460755",
"0.73897916",
"0.7368869",
"0.7368869",
"0.72830504",
"0.7140854",
"0.71113795",
"0.7066509",
"0.70359045",
"0.6995226",
"0.69939077",
"0.6938373",
"0.6924086",
"0.692373",
"0.6906379",
"0.6887951",
"0.68700236",
"0.68122405",
"0.672026",
"0.657647"... | 0.0 | -1 |
MUST BE CALLED BY User.deliver_inactive_notification! | def inactive_notification(user)
setup_email(user)
@subject += subject_from_sym :inactive_notification
@body[:name] = user.full_name || 'Eternos user'
@body[:link] = account_setup_url(:id => user.perishable_token)
add_category_header "Inactive Account Notice"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inactive_message; end",
"def inactive_message; end",
"def atest_ID_25861_suspended_user_notification()\n # Need suspended account\n end",
"def atest_ID_25861_suspended_user_notification()\n # Need suspended account\n end",
"def do_notify_disabled(transition)\n if user && Rails.application.... | [
"0.70507026",
"0.70507026",
"0.70283043",
"0.70283043",
"0.69109446",
"0.6864436",
"0.6834575",
"0.6804752",
"0.679606",
"0.6727194",
"0.6695414",
"0.66756546",
"0.66666704",
"0.66268843",
"0.6583416",
"0.65809834",
"0.65647185",
"0.6552468",
"0.6536999",
"0.6518272",
"0.6498... | 0.77993435 | 0 |
MUST BE CALLED BY User.deliver_account_setup_reminder! | def account_setup_reminder(user)
setup_email(user)
@subject = subject_from_sym :account_setup_reminder
@body[:name] = user.full_name
@body[:setup_url] = account_setup_url(:id => user.perishable_token, :ref => 'asr1')
add_category_header "Account Setup Reminder"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_activation_or_reset_mail\n end",
"def after_create_action\n sign_up_lead_rescuer\n send_email_to_lead_rescuer\n end",
"def after_save(user)\n\n UserMailer.deliver_activation(user) if user.recently_activated? unless user.setup\n UserMailer.deliver_forgot_password(user) if user.recently_fo... | [
"0.6606731",
"0.6575148",
"0.6507075",
"0.6507047",
"0.64802533",
"0.6461195",
"0.641412",
"0.64070123",
"0.6403233",
"0.640216",
"0.6299094",
"0.6288094",
"0.6287524",
"0.6253214",
"0.6253214",
"0.62082803",
"0.62022585",
"0.6196795",
"0.61901027",
"0.61893815",
"0.61779714"... | 0.7663771 | 0 |
Get all users project GET /api/projects.json | def index
@projects = current_user.projects.order("created_at ASC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def projects\n request(method: 'getAllProjects')\n end",
"def listprojects\n get('listprojects.json')['projects']\n end",
"def index\n # @projects = @current_user.projects\n @projects = Project.all\n json_response(@projects)\n end",
"def all_projects()\n @endpoint = \"/projects.json?... | [
"0.8651807",
"0.83269894",
"0.8294777",
"0.81892705",
"0.8158667",
"0.8060737",
"0.8043675",
"0.8034202",
"0.79545933",
"0.7952948",
"0.7927512",
"0.7914423",
"0.79008406",
"0.7880019",
"0.78759515",
"0.78759515",
"0.78759515",
"0.78759515",
"0.78759515",
"0.78759515",
"0.787... | 0.7430357 | 63 |
Get project GET /api/projects/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get\n CircleCi.request(conf, '/projects').get\n end",
"def get_project(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:pattern] = '/projects/[ProjectName]'\n\t\targs[:query]['Action'] = 'GetProject'\n\t\targs[:region] = optional[:_region] if (optional.key? :_regio... | [
"0.81674176",
"0.80733174",
"0.8039097",
"0.7970646",
"0.7956753",
"0.7956753",
"0.7943712",
"0.7905961",
"0.7896075",
"0.78843266",
"0.7835149",
"0.7788574",
"0.7781394",
"0.7748255",
"0.77458256",
"0.77359885",
"0.7729073",
"0.7715742",
"0.7655781",
"0.76465195",
"0.7607879... | 0.0 | -1 |
Create project POST /api/projects.json | def create
@project = current_user.projects.new(project_params)
respond_to do |format|
if @project.save
format.json { render :show, status: :created }
else
format.json { render json: @project.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_project(name)\n post('projects', {:name => name})[\"project\"]\n end",
"def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: :created\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"de... | [
"0.8449553",
"0.8404636",
"0.83733124",
"0.8357639",
"0.8272967",
"0.82667786",
"0.82585603",
"0.823478",
"0.82323015",
"0.8198822",
"0.81782615",
"0.81782615",
"0.81782615",
"0.81782615",
"0.81782615",
"0.81782615",
"0.81782615",
"0.81782615",
"0.81782615",
"0.81720364",
"0.... | 0.8036626 | 48 |
Update selected project PATCH/PUT /api/projects/1.json | def update
respond_to do |format|
if @project.update(project_params)
format.json { render :show, status: :ok }
else
format.json { render json: @project.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @project.update(project_params)\n render :show, status: :ok, location: api_v1_project_url(@project)\n else\n render json: @project.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @project.update(project_params)\n render json: @project, status: 200\... | [
"0.8239176",
"0.81822395",
"0.814375",
"0.8133785",
"0.81273574",
"0.80790484",
"0.80762637",
"0.80606025",
"0.80606025",
"0.80540913",
"0.80533713",
"0.80533713",
"0.80533713",
"0.80533713",
"0.80482584",
"0.80482584",
"0.80482584",
"0.80482584",
"0.80482584",
"0.80482584",
... | 0.79767334 | 41 |
Remove selected project DELETE /api/projects/1.json | def destroy
@project.destroy
respond_to do |format|
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delproject(project)\n post('delproject.json', project: project)\n end",
"def destroy\n @project = Project.find(params[:id])\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy... | [
"0.8279231",
"0.8141084",
"0.81074184",
"0.80811274",
"0.80683035",
"0.8063254",
"0.8060939",
"0.8051967",
"0.8040429",
"0.8040429",
"0.8040429",
"0.8040429",
"0.803842",
"0.803842",
"0.803842",
"0.803842",
"0.803842",
"0.803842",
"0.803842",
"0.803842",
"0.803842",
"0.8038... | 0.8092468 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_project
@project = current_user.projects.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def project_params
params.require(:project).permit(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
Returns the current status of the state. This includes: Player status Room description Room's treasure Room's monster | def status
output = StringIO.new
output << @game.player.to_s
output << "\n"
output << "#{@game.current_room_model.description}\n"
treasure = @game.current_room_model.treasure
output << "\nThere is treasure here worth $#{treasure}.\n" if treasure && treasure > 0
monster = @game.current_room_model.monster
if monster
output << "\nDANGER... THERE IS A MONSTER HERE....\n\n"
output << "#{@game.current_room_model.monster}\n\n"
end
if @game.current_room_model.name != "Exit"
output << "\nWhat do you want to do? "
end
output.string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status\n monster = @game.current_room_model.monster\n return unless monster\n\n weapons = @game.player.weapons\n\n output = \"Fighting against #{monster.name}\\n\"\n weapons.each_with_index do |weapon, i|\n output << \"#{i + 1} - #{weapon}\\n\"\n end\n\n output\n end",
"def current... | [
"0.7418323",
"0.7196079",
"0.71288174",
"0.695458",
"0.6867524",
"0.6855135",
"0.68458354",
"0.67172885",
"0.6707165",
"0.6702644",
"0.6693608",
"0.6693608",
"0.6685253",
"0.66622025",
"0.6658545",
"0.66447294",
"0.65976554",
"0.6577174",
"0.6545302",
"0.6545302",
"0.6540487"... | 0.7400184 | 1 |
Handles a command for this state. +command+ must be a symbol Possible commands: :north : Moves you to north :south : Moves you to south :east : Moves you to east :west : Moves you to west :up : Moves you to up :down : Moves you to down :tally : Shows you the current score and number of monsters killed :run : Tries to run from the current room :magic : Uses the player's Amulet to randomly move to another room :pick_up : Picks the room's treasure if there is any :fight : Fights with the monster in the room :consume : Eats food to gain strength | def handle(command)
puts "Doing #{command}..."
method = command
case command
when :north then method = :move
when :south then method = :move
when :east then method = :move
when :west then method = :move
when :up then method = :move
when :down then method = :move
end
output = ""
if method == :move
output << self.send(method, command)
else
output << self.send(method)
end
output << "\n"
output << self.status
output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_commands(command) # rubocop:todo Metrics/CyclomaticComplexity\n case command\n when '/start'\n greet_user\n when '/stop'\n send_message \"Bye, #{message.from.first_name}\"\n when '/help'\n send_message \"Please enter any of the following commands: #{@commands}\"\n when '/ne... | [
"0.72250944",
"0.694959",
"0.68654424",
"0.68584615",
"0.6844924",
"0.68447775",
"0.6775846",
"0.66902363",
"0.6613155",
"0.65450585",
"0.65082353",
"0.6505146",
"0.64745176",
"0.6458155",
"0.6451383",
"0.6414209",
"0.6382764",
"0.6365964",
"0.6321472",
"0.63044596",
"0.63027... | 0.7829914 | 0 |
Returns the current player's score | def tally
player = @game.player
output = ""
output << "Tally at present is #{player.score}\n"
output << "You have killed #{player.monsters_killed} monsters so far...\n" if rand > 0.5
puts output
output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_score()\r\n return @player.score()\r\n end",
"def score\n \n case @points\n when 0 \n @player_score[@points] = 'Love'\n return @player_score[@points]\n when 1 \n @player_score[@points] = 'Fifteen'\n return @player_score[@points]\n wh... | [
"0.8814937",
"0.79552794",
"0.790004",
"0.7848975",
"0.7746376",
"0.7688142",
"0.76390046",
"0.75503564",
"0.7495383",
"0.7464075",
"0.7458346",
"0.7428482",
"0.7374574",
"0.73685807",
"0.73591703",
"0.7312185",
"0.7303318",
"0.7273319",
"0.72651696",
"0.723318",
"0.7214507",... | 0.0 | -1 |
Allows the player to change the current state of the game to FightingState | def fight
monster = @game.current_room_model.monster
player = @game.player
return unless monster
@game.state = FightingState.new @game
if not player.weapons.empty?
@game.state.status # Ask for weapon
else
@game.state.handle( nil ) # Start the fight directly
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fight\n @state.fight(self)\n end",
"def fight (game)\n @state.fight(self, game)\n end",
"def game_state\n end",
"def change_dealer\n game_state.dealer_seat = new_dealer_seat \n end",
"def state_on_localgame\n @log.debug(\"Net_state: change to state state_on_localgame\")\n @netw... | [
"0.6771328",
"0.6620415",
"0.6596172",
"0.6554131",
"0.65388846",
"0.6462879",
"0.64343417",
"0.6431999",
"0.633717",
"0.62915677",
"0.6248567",
"0.615463",
"0.61470455",
"0.61247337",
"0.61217886",
"0.6079126",
"0.6059814",
"0.6049907",
"0.60463655",
"0.6041183",
"0.60347587... | 0.61391 | 13 |
Moves the player to a random room using the amulet | def magic
room = Room.random
return self.magic if room.name == "Entrance" || room.name == "Exit"
@game.current_room = room.name
"You moved to another room...\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_type_toward_player\n if near_the_player?\n case rand(6)\n when 0 then move_toward_player\n when 1 then move_toward_player\n when 2 then move_toward_player\n when 3 then move_toward_player\n when 4 then move_random\n when 5 then move_forward\n end\n else\n ... | [
"0.7186484",
"0.6669484",
"0.656634",
"0.6531436",
"0.65267795",
"0.6517237",
"0.6504112",
"0.6494811",
"0.62813294",
"0.6201292",
"0.6187466",
"0.61293966",
"0.6119683",
"0.6094181",
"0.6070266",
"0.6065082",
"0.60642165",
"0.6008833",
"0.6006094",
"0.6001547",
"0.5985396",
... | 0.6589035 | 2 |
Pickup the treasure in the room if there is any | def pick_up
treasure = @game.current_room_model.treasure
has_torch = @game.player.has_torch?
return "There is no treasure to pick up\n" unless treasure && treasure > 0
return "You cannot see where it is\n" unless has_torch
@game.player.wealth += treasure
return "You picked-up gems worth $#{treasure}\n"
# TODO: update room status
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pick_up(item)\n @items.push(item) unless items_weight + item.weight > CAPACITY\n @equipped_weapon = item if item.is_a?(Weapon) \n if item.is_a?(BoxOfBolts) \n item.feed(self) if self.health <= 80\n end\n end",
"def pick_up(item_name)\n if current_room.has_item(item_name)\n item = c... | [
"0.6829087",
"0.6488601",
"0.6486497",
"0.6458919",
"0.6366758",
"0.63478595",
"0.6226282",
"0.62037694",
"0.61397445",
"0.61397445",
"0.61397445",
"0.611368",
"0.6049674",
"0.59981954",
"0.59724754",
"0.59649205",
"0.59354746",
"0.5917451",
"0.5849084",
"0.58271927",
"0.5781... | 0.75312513 | 0 |
Move from one room to another | def move(direction)
movements = @game.current_room_model.movement
monster = @game.current_room_model.monster
if direction == :north and not movements.north
return "No exit that way"
elsif direction == :south and not movements.south
return "There is no exit south"
elsif direction == :east and not movements.east
return "You cannot go in that direction"
elsif direction == :west and not movements.west
return "You cannot move through solid stone"
elsif direction == :up and not movements.up
return "You cannot go up this floor"
elsif direction == :down and not movements.down
return "You cannot go down this floor"
end
return "Monster shouts: YOU SHALL NOT PASS!!" if monster && rand < 0.1
@game.current_room = movements.send(direction)
@game.player.tally += 1
@game.player.strength -= 5
if @game.player.strength < 1
@game.state = DeadState.new @game
else
@game.state = WinnerState.new(@game) if @game.current_room == "Exit"
end
"You moved to another room..."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_room(room_id)\n if Room.get_room_by_id(room_id)\n @current_room_id = room_id\n update\n end\n end",
"def move(action, currRoom, newRoom)\n #*********************MayBe*****************\n if currRoom.has?(action)\n currRoom.remove(action)\n newRoom.add(a... | [
"0.73906124",
"0.70465314",
"0.70371914",
"0.68144166",
"0.6771611",
"0.6560597",
"0.65593183",
"0.65489525",
"0.6492228",
"0.64834535",
"0.64834535",
"0.6435682",
"0.63932604",
"0.6374353",
"0.63474596",
"0.6339119",
"0.63103056",
"0.6295871",
"0.6250104",
"0.6230288",
"0.62... | 0.6092274 | 32 |
Allows the user the probability to scape from a fight | def run(direction)
output = ""
if rand > 0.7
output << "No, you must stand and fight"
game.state = FightingState.new game
output << game.state.handle
return output
else
move direction
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gotAttack(damage)\r\n @@probsDeflects = Array['deflect', 'deflect', 'deflect', 'deflect', 'deflect',\r\n 'deflect', 'deflect', 'deflect', 'got hit', 'got hit' ]\r\n\r\n @@probs = @@probsDeflects[rand(0..9)]\r\n if @role.upcase == \"HERO\"\r\n if @@probs == 'deflect'\r\n puts \"#{@nam... | [
"0.6536238",
"0.65259504",
"0.649797",
"0.6457003",
"0.64236873",
"0.64165413",
"0.6403955",
"0.6380676",
"0.63515675",
"0.63515675",
"0.6351394",
"0.6319909",
"0.62938344",
"0.62728596",
"0.62024826",
"0.6182185",
"0.61672884",
"0.61560756",
"0.6151404",
"0.61190915",
"0.610... | 0.0 | -1 |
Allows the player to eat food | def consume
eated_food = 0;
player = @game.player
puts "you have #{player.food} Units of food"
loop do
puts "What do you Want to eat?"
eated_food = gets.to_i
break if eated_food <= player.food && eated_food >= 0
end
player.food -= eated_food
player.strength = (player.strength + 5 * eated_food).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eat(food)\n food.eat 1\n @energy += METABOLISM\n end",
"def eat\n inventory[:fish] -= @daily_appetite = 10\n\n if inventory[:fish] < 0\n @alive = false\n inventory[:fish] = 0\n end\n end",
"def eat(food)\n if food.veggie? && !@carnivore\n @hunger -= 10\n elsif food.mea... | [
"0.8032357",
"0.7786166",
"0.7517575",
"0.7176732",
"0.71376944",
"0.7037982",
"0.6990854",
"0.698429",
"0.6956305",
"0.6925741",
"0.68741566",
"0.6721797",
"0.6705704",
"0.66982865",
"0.66982865",
"0.66982865",
"0.66530955",
"0.66468847",
"0.65129995",
"0.6463032",
"0.627784... | 0.74527705 | 3 |
Transitions to the buying state | def inventory
@game.state = BuyingState.new @game
@game.state.handle
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_state_update\n return unless state_changed?\n\n return if @ignore_state_changes\n\n case state_change\n when %w(mill_build buyer_unclaimed)\n transition_mill_build_to_buyer_unclaimed\n when %w(buyer_unclaimed buyer_build)\n transition_buyer_unclaimed_buyer_build\n when %w(bu... | [
"0.61791754",
"0.5880421",
"0.5840531",
"0.5817714",
"0.57507575",
"0.5735825",
"0.56918764",
"0.5656137",
"0.5631318",
"0.5628945",
"0.56050783",
"0.5581032",
"0.556287",
"0.55328834",
"0.552604",
"0.5525676",
"0.5499529",
"0.54718024",
"0.5467789",
"0.54663014",
"0.5457844"... | 0.59932315 | 1 |
Converts +sexp+ into a Compiler::Node. | def sexp_to_node(sexp)
return nil if sexp.nil?
if node_class = Node::Mapping[sexp.first]
node_class.create(self, sexp)
else
raise Error, "Unable to resolve '#{sexp.first.inspect}'"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sexp_to_ast(sexp)\n eval sexp\n end",
"def compile_sexp(scope, *exp)\n compile_do(SexpScope.new(scope), *exp)\n end",
"def compile_sexp(scope, *exp)\n compile_do(SexpScope.new(scope), *exp)\n end",
"def expression sexp\n return nil if sexp == nil\n #pp sexp\n body = sexp.sexp_bod... | [
"0.70163244",
"0.6789324",
"0.6789324",
"0.63605344",
"0.63386464",
"0.63065004",
"0.588651",
"0.5862931",
"0.58546233",
"0.5839368",
"0.5668713",
"0.5668713",
"0.5547117",
"0.544543",
"0.5395736",
"0.53711784",
"0.53648275",
"0.5350735",
"0.53485763",
"0.52576387",
"0.523495... | 0.73390305 | 0 |
Render the XML error for a specific code | def error(code)
# Mollie codes taken from https://www.mollie.nl/support/documentatie/betaaldiensten/ideal/en/
errors = []
errors[1] = "Did not receive a proper input value."
errors[2] = "A fetch was issued without specification of 'partnerid'."
errors[3] = "A fetch was issued without (proper) specification of 'reporturl'."
errors[4] = "A fetch was issued without specification of 'amount'."
errors[5] = "A fetch was issued without specification of 'bank_id'."
errors[6] = "A fetch was issues without specification of a known 'bank_id'."
errors[7] = "A fetch was issued without specification of 'description'."
errors[8] = "A check was issued without specification of transaction_id."
errors[9] = "Transaction_id contains illegal characters. (Logged as attempt to mangle)."
errors[10] = "This is an unknown order."
errors[11] = "A check was issued without specification of your partner_id."
errors[12] = "A fetch was issued without (proper) specification of 'returnurl'."
errors[13] = "This amount is only permitted when iDEAL contract is signed and sent to Mollie."
errors[14] = "Minimum amount for an ideal transaction is 1,18 EUR."
errors[15] = "A fetch was issued for an account which is not allowed to accept iDEAL payments (yet)."
errors[16] = "A fetch was issued for an unknown or inactive profile."
haml :error, :layout => false, :locals => {
:type => "error",
:code => code,
:message => errors[code*-1]
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_xml(code, msg)\n xml = ''\n doc = Builder::XmlMarkup.new(:target => xml)\n \n doc.Response do\n doc.Errors do\n doc.Error do\n doc.Code code.to_s\n doc.Message msg\n doc.BoxUsage \"0\"\n end\n end\n \n doc.... | [
"0.7871357",
"0.7031047",
"0.6906747",
"0.6870775",
"0.6640371",
"0.6596013",
"0.65924335",
"0.64549464",
"0.64127886",
"0.62870115",
"0.62870115",
"0.62383896",
"0.62260437",
"0.62205505",
"0.6212974",
"0.6210827",
"0.61360675",
"0.61259276",
"0.6089541",
"0.607284",
"0.6054... | 0.6433133 | 8 |
get numeric ID, from possible name id | def get_assembly_and_node_id(context_params)
response = info(context_params)
unless response.ok?
raise DtkError, "Unable to retrive node information, please try again."
end
return response.data(:assembly_id), response.data(:id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id\n name.gsub /-/, '_'\n end",
"def name_to_id\n @name_to_id ||= build_hash('name', 'id')\n end",
"def id\n name.gsub(':', '-')\n end",
"def get_id(id)\n native_id = Integer(id.split(\":\")[-1])\n end",
"def id_for(_name, _id=nil)\n n = \"#{@object_na... | [
"0.74094415",
"0.7381823",
"0.7337841",
"0.72135144",
"0.70787054",
"0.70539343",
"0.70280343",
"0.7022979",
"0.69923437",
"0.6936814",
"0.6936814",
"0.69234073",
"0.6914586",
"0.68633854",
"0.6834628",
"0.68342084",
"0.68308085",
"0.68124014",
"0.6797526",
"0.6797526",
"0.67... | 0.0 | -1 |
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize | def lint(dir)
files = dir.children.select(&:file?)
no_junk?(files)
return true if supported(files).empty?
correctly_named?(dir)
all_same_filetype?(files)
expected_files?(files)
sequential_files?(files)
cover_art?(files)
cover_art_looks_ok?(arty(files))
tags = all_tags(files)
all_same_album?(tags)
all_same_genre?(tags)
all_same_year?(tags)
all_same_artist?(tags) unless various_artists?(dir)
rescue Aur::Exception::LintDirBadName
err(dir, 'Invalid directory name')
rescue Aur::Exception::LintDirBadFile => e
err(dir, "Bad file(s)\n #{e}")
rescue Aur::Exception::LintDirMixedFiles
err(dir, 'Different file types')
rescue Aur::Exception::LintDirBadFileCount => e
err(dir, "Missing file(s) (#{e})")
rescue Aur::Exception::LintDirUnsequencedFile => e
err(dir, "Missing track #{e}")
rescue Aur::Exception::LintDirCoverArtMissing
err(dir, 'Missing cover art')
rescue Aur::Exception::LintDirCoverArtUnwanted
err(dir, 'Unwanted cover art')
rescue Aur::Exception::LintDirInconsistentTags => e
err(dir, "Inconsistent #{e} tag")
rescue Aur::Exception::LintDirCoverArtTooBig,
Aur::Exception::LintDirCoverArtTooSmall,
Aur::Exception::LintDirCoverArtNotSquare => e
err(dir, "Unsuitable image size: #{e}")
rescue StandardError => e
warn "Unhandled exception #{e} in #{dir}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def offences_by; end",
"def strategy; end",
"def used?; end",
"def custo... | [
"0.76538837",
"0.62887454",
"0.62282014",
"0.62282014",
"0.61805004",
"0.6156519",
"0.6156519",
"0.6156519",
"0.6156519",
"0.612837",
"0.59572196",
"0.5944528",
"0.5892693",
"0.5819787",
"0.5819787",
"0.5808322",
"0.5808322",
"0.58052987",
"0.5795088",
"0.57326925",
"0.568785... | 0.0 | -1 |
rubocop:enable Metrics/AbcSize rubocop:enable Metrics/MethodLength | def err(dir, msg)
msglen = msg.length + 6
warn(format("%-#{TW - msglen}<dir>s %<msg>s", dir: dir, msg: msg))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def used?; end",
"def strategy; end",
"def suivre; end",
"def custom; en... | [
"0.774036",
"0.6475812",
"0.6352224",
"0.6352224",
"0.6292137",
"0.62793195",
"0.62793195",
"0.62793195",
"0.62793195",
"0.6274397",
"0.6028631",
"0.59914017",
"0.5968494",
"0.5968021",
"0.5968021",
"0.5939466",
"0.5892397",
"0.5892397",
"0.5874267",
"0.58390605",
"0.58344615... | 0.0 | -1 |
A "proper" album directory should be of the form 'artist_name.album_name', but these can have subdirectories. So, if we find content in an incorrectly named directory, we examine the parent, and return true if that looks okay. | def correctly_named?(dir, on_retry: false)
name = dir.basename.to_s
return true if name.match(/^[a-z0-9][a-z\-._0-9]+[a-z0-9]$/) &&
name.split('.').size == 2 && !name.start_with?('the_')
return correctly_named?(dir.parent, on_retry: true) if on_retry == false
raise Aur::Exception::LintDirBadName
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_directory_name?(directory_name, metadata_name)\n normalized = metadata_name.tr('/', '-').split('-').last\n normalized == directory_name\n end",
"def parent_dir_link?(link)\n link[:href] == '../'\n end",
"def root_directory?(path)\n File.directory?(path) &&\n File.expa... | [
"0.6723298",
"0.6496294",
"0.63781554",
"0.6343503",
"0.63172144",
"0.6275673",
"0.6244171",
"0.62229717",
"0.62215686",
"0.6197287",
"0.6187698",
"0.617581",
"0.6169126",
"0.61688125",
"0.6106594",
"0.60880655",
"0.6076277",
"0.60554814",
"0.60340625",
"0.60251456",
"0.60104... | 0.62603676 | 6 |
There should only be audio files and possibly cover art, and possibly a directory or two. | def no_junk?(files)
uns = files - supported(files)
uns.reject! { |f| f.basename.to_s == 'front.jpg' }
return true if uns.empty? || uns.all?(&:directory?)
raise Aur::Exception::LintDirBadFile, uns.sort.join("\n ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cover_art?(files)\n case files.first.extname\n when '.flac'\n raise Aur::Exception::LintDirCoverArtMissing unless cover_in(files)\n when '.mp3'\n raise Aur::Exception::LintDirCoverArtUnwanted if cover_in(files)\n end\n\n true\n end",
"def audio?\n ... | [
"0.687224",
"0.6592585",
"0.6533416",
"0.64984995",
"0.64200866",
"0.6114563",
"0.60932106",
"0.6083464",
"0.6059063",
"0.60468644",
"0.6032477",
"0.60230094",
"0.598636",
"0.59822816",
"0.59768146",
"0.59721226",
"0.59602976",
"0.5933056",
"0.5903965",
"0.5899825",
"0.589046... | 0.612933 | 5 |
The number of audio files in the directory should be the same as the highest track number, and track numbers should run from 01 to that highest number, with no breaks. This can get messed up by hidden tracks. | def expected_files?(files)
files = supported(files)
hn = highest_number(files)
return true if hn == files.size
raise Aur::Exception::LintDirBadFileCount, "#{files.size}/#{hn}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manageAudioFiles(maxNumFiles, folder)\n\n fileNumber = Dir[(Rails.root.to_s + \"/public/audio/#{folder}/*\")].count\n keepSeconds = 7200\n\n while fileNumber > maxNumFiles\n keepSeconds *= 0.5\n Dir[(Rails.root.to_s + \"/public/audio/#{folder}/*\")].each do |filename| \n deleteOldFile(f... | [
"0.66143453",
"0.6539918",
"0.6303062",
"0.6203977",
"0.6171165",
"0.6108003",
"0.60433143",
"0.59385604",
"0.5855106",
"0.5732454",
"0.56857014",
"0.56785727",
"0.56785727",
"0.56563485",
"0.5637522",
"0.5603094",
"0.5580981",
"0.5553235",
"0.5538801",
"0.5513338",
"0.547299... | 0.0 | -1 |
Everything should have the same album tag | def all_same_album?(tags)
all_same_tag?(tags, :album)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def album\r\n #prepare_new_album extracted for reuse from spec\r\n prepare_new_album unless @content\r\n end",
"def target_albums(picture)\n self.albums.reject{ |album| album.pictures.include?(picture) }\n end",
"def album_name_unique?(album_name, artist_name) \n album_names = self.albums.select{... | [
"0.6923608",
"0.67246413",
"0.6523389",
"0.65015626",
"0.6436978",
"0.6390941",
"0.6377134",
"0.6305919",
"0.6252742",
"0.62405795",
"0.62250346",
"0.619325",
"0.6103119",
"0.6096799",
"0.6064998",
"0.603348",
"0.6000499",
"0.5995257",
"0.5979279",
"0.59691954",
"0.5966707",
... | 0.76919574 | 0 |
Everything should have the same year tag | def all_same_year?(tags)
all_same_tag?(tags, :year)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def year() end",
"def match_year?(doc, date)\n return true unless year\n\n idate = RelatonBib.parse_date doc[\"issued-date\"], false\n idate.between? date, date.next_year.prev_day\n end",
"def year? = unit == 'year'",
"def year; end",
"def year; end",
"def could_be_year?(year); end",
... | [
"0.7077845",
"0.7006944",
"0.69565284",
"0.68290323",
"0.68290323",
"0.66205627",
"0.6616259",
"0.6578683",
"0.6476764",
"0.64315605",
"0.6416924",
"0.6416281",
"0.6391615",
"0.6381706",
"0.6340546",
"0.63311565",
"0.63275373",
"0.63248825",
"0.6311434",
"0.6299756",
"0.62830... | 0.76637894 | 0 |
And probably of the same genre. (Who cares, really, about the genre tag anyway?) | def all_same_genre?(tags)
all_same_tag?(tags, :genre)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genres\n songs.collect do |song|\n song.genre\n end\n .uniq #does not return duplicate genres if the artist has more than one song of a particular genre (artist has many genres through songs)\n end",
"def genre; end",
"def genre; end",
"def genre\n genres = tracks.... | [
"0.7438682",
"0.73783296",
"0.73783296",
"0.73542935",
"0.7340227",
"0.71654063",
"0.7084807",
"0.7070509",
"0.70590407",
"0.70494056",
"0.70195603",
"0.69873226",
"0.6970553",
"0.69408435",
"0.69408435",
"0.6923133",
"0.6910801",
"0.69086796",
"0.6896273",
"0.68304724",
"0.6... | 0.7803016 | 0 |
Hmmm. Problems with "featuring" and collaborations. This will need some thought. Let's see how it plays in everyday usage. | def all_same_artist?(tags)
all_same_tag?(tags, :artist)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scientist; end",
"def influences_these_works\n find_related_frbr_objects( :is_an_influence_on, :which_works?) \n end",
"def addFeaturesAndLabel(team, earliest_date, latest_date, examples, labels)\n home_faceoffs = Game.where(\"home_team = ? and game_date > ? and game_date <= ?\", team, ear... | [
"0.57867056",
"0.57655954",
"0.5759622",
"0.5660397",
"0.5621747",
"0.5533095",
"0.5524501",
"0.53921217",
"0.53921217",
"0.5384228",
"0.53748417",
"0.537258",
"0.5360202",
"0.5359573",
"0.5359338",
"0.5345139",
"0.5311745",
"0.52879196",
"0.524621",
"0.5230852",
"0.52249604"... | 0.0 | -1 |
Ignoring cover art, everything should be either an MP3 or a FLAC. | def all_same_filetype?(files)
return true if supported(files).map(&:extname).uniq.size <= 1
raise Aur::Exception::LintDirMixedFiles
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cover_art?(files)\n case files.first.extname\n when '.flac'\n raise Aur::Exception::LintDirCoverArtMissing unless cover_in(files)\n when '.mp3'\n raise Aur::Exception::LintDirCoverArtUnwanted if cover_in(files)\n end\n\n true\n end",
"def audio_withou... | [
"0.67632115",
"0.60676503",
"0.5811365",
"0.57060343",
"0.56701577",
"0.55040437",
"0.54708576",
"0.54346895",
"0.5416631",
"0.5405065",
"0.52625066",
"0.5200878",
"0.5188838",
"0.51738554",
"0.51483715",
"0.5139066",
"0.5120301",
"0.51178104",
"0.509229",
"0.50864613",
"0.50... | 0.0 | -1 |
Do we have a front.jpg? | def cover_in(files)
fnames = files.map { |f| f.basename.to_s }
fnames.include?('front.jpg')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_imagen?\n\t\tFile.exists?\n\tend",
"def has_image?\n\t\treturn File.exists? image_filename\n\tend",
"def picture?\n ThriveSmart::Helpers::AssetHelper::asset?(asset_type, asset_urn)\n end",
"def image?\n ext = File.extname(@path)\n case ext.downcase\n when '.png', '.jpg', '.jpeg', '... | [
"0.71890205",
"0.70424587",
"0.7027508",
"0.7014576",
"0.6923102",
"0.6923102",
"0.68960094",
"0.6862944",
"0.68539727",
"0.68206805",
"0.6802971",
"0.6744579",
"0.6739531",
"0.67010283",
"0.6687487",
"0.6671584",
"0.66455996",
"0.66449165",
"0.66317534",
"0.65993094",
"0.659... | 0.6703465 | 13 |
I want cover art for FLACs, but not MP3s. | def cover_art?(files)
case files.first.extname
when '.flac'
raise Aur::Exception::LintDirCoverArtMissing unless cover_in(files)
when '.mp3'
raise Aur::Exception::LintDirCoverArtUnwanted if cover_in(files)
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cover_art\n if @cover_art.nil?\n @cover_art = container.img(:class, 's-access-image').src\n end\n\n @cover_art\n end",
"def extract_cover(replace_cover=true)\n if cover && !replace_cover\n return false\n end\n return false if tracks.empty?\n if full_path = tracks.first.extract... | [
"0.6645724",
"0.6444185",
"0.63880914",
"0.6032172",
"0.59754974",
"0.5892336",
"0.5879069",
"0.5864103",
"0.583155",
"0.58269554",
"0.5779838",
"0.577262",
"0.57449937",
"0.57160103",
"0.5703578",
"0.56971633",
"0.5687033",
"0.56789696",
"0.565744",
"0.56429774",
"0.5639856"... | 0.6216487 | 3 |
Filter a file list for supported audio types with the correct suffix. | def supported(files)
files.select { |f| SUPPORTED_TYPES.include?(f.extname.delete('.')) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wp_get_audio_extensions\n # Filters the list of supported audio formats.\n apply_filters('wp_audio_extensions', ['mp3', 'ogg', 'flac', 'm4a', 'wav'])\n end",
"def extension_white_list\n %w(mp3 wav)\n end",
"def clean_file_list( args )\n\t\tdirtyfiles = args\n\n\t\t# only allow .mp3 files into th... | [
"0.6979946",
"0.6608501",
"0.6504056",
"0.64547306",
"0.64311016",
"0.61127734",
"0.6011407",
"0.58593744",
"0.5845251",
"0.5821931",
"0.5806645",
"0.5802867",
"0.5784186",
"0.57713264",
"0.5765068",
"0.5722019",
"0.5631711",
"0.5627494",
"0.56150115",
"0.55762094",
"0.556884... | 0.58723116 | 7 |
Get the relevant tags for all files. | def all_tags(files)
supported(files).map { |f| Aur::FileInfo.new(f).our_tags }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_all_files\n self.files.order('tag')\n end",
"def tags_used\n s = Set.new\n @selected_files.each do |file|\n s.merge file.tags\n end\n s.to_a.map { |v| v.downcase }\n end",
"def tags\n return @tags_cache if (@tags_cache ||= nil)\n ... | [
"0.7601869",
"0.7493188",
"0.7079424",
"0.70394146",
"0.69350046",
"0.68186414",
"0.6686296",
"0.66116554",
"0.6602238",
"0.6523977",
"0.6439757",
"0.64328825",
"0.6408906",
"0.6374971",
"0.6370682",
"0.63505965",
"0.63251954",
"0.63251954",
"0.6319831",
"0.62956005",
"0.6294... | 0.7838998 | 0 |
Get all tasks in all rake files that should be run, then remove any duplicates. This is the main method to run. | def files_with_tasks_to_run
# load all tasks into self.all_tasks
get_tasks_from_rakefiles
set_and_log_tasks_already_ran(self.all_tasks)
set_and_log_duplicate_tasks(self.all_tasks_not_previously_run)
close_log_if_this_created_it(log)
rakefiles_with_tasks_to_run
rescue => error
log.error("Error during #{self.class.name} #{__method__}! #{error}") unless log.nil?
raise error
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_files\r\n Dir.chdir(Rails.root.join('lib', 'tasks')) do |dir|\r\n @task_files = Dir[\"*.rake\"]\r\n end\r\n @task_files = @task_files.reject{|task|\r\n task !~ /\\Abg_worker_/}.map{|task|\r\n task.sub('bg_worker_', '')\r\n }\r\n end",
"def rakefiles_with_tasks_to_run\n\n r... | [
"0.73731107",
"0.73609394",
"0.7315574",
"0.7211704",
"0.7152086",
"0.6963042",
"0.6900817",
"0.6659179",
"0.66154623",
"0.6550801",
"0.6520932",
"0.64826125",
"0.64649296",
"0.6430665",
"0.6423117",
"0.641462",
"0.63911355",
"0.6386233",
"0.637804",
"0.6366714",
"0.63220096"... | 0.7013574 | 5 |
Get all tasks from the tasks_directory. Return a list of EvaluatedTasks | def get_tasks_from_rakefiles
# ensure we're starting out with no tasks or rakefiles
clear_all_tasks_and_rakefiles
rakefiles_to_read = onetime_rake_files
return [] if rakefiles_to_read.empty?
rakefiles_to_read.each(&method(:get_tasks_in_rakefile))
self.all_tasks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all\n return @tasks\n end",
"def all_tasks\n @all_tasks ||= []\n end",
"def task_list\n return @task_list if @task_list\n @task_list = []\n spec_file_names.each do |file_name_spec|\n next if spec_is_disabled? file_name_spec\n next if skip_globals? file_name_spec\n ... | [
"0.71893984",
"0.71407235",
"0.7087454",
"0.6891361",
"0.6854618",
"0.68474025",
"0.6811657",
"0.67816734",
"0.67816734",
"0.67582744",
"0.6741554",
"0.66742885",
"0.66622806",
"0.6654164",
"0.6642603",
"0.66316116",
"0.66316116",
"0.66316116",
"0.66090155",
"0.6600045",
"0.6... | 0.6636172 | 15 |
Return a Hash of only the rakefiles that have tasks to be run. key = rakefile name, value = EvaluatedRakeFile Add the tasks to run for each EvaluatedRakeFile | def rakefiles_with_tasks_to_run
rakefiles_with_tasks = new_hash_of_eval_rakefiles
# This isn't efficient, but it's clear:
all_tasks_to_run.each do |task_to_run|
rakefilename = task_to_run.filename
ev_rakefile_to_run = self.all_rakefiles[rakefilename]
ev_rakefile_to_run.tasks_to_run << task_to_run
rakefiles_with_tasks[rakefilename] = ev_rakefile_to_run
end
rakefiles_with_tasks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_rakefiles\n @all_rakefiles ||= new_hash_of_eval_rakefiles\n end",
"def get_tasks_from_rakefiles\n\n # ensure we're starting out with no tasks or rakefiles\n clear_all_tasks_and_rakefiles\n\n rakefiles_to_read = onetime_rake_files\n\n return [] if rakefiles_to_read.empty?\n\n ... | [
"0.7285169",
"0.66919297",
"0.66704816",
"0.66661507",
"0.65413934",
"0.63483906",
"0.63473564",
"0.6193978",
"0.6183303",
"0.6137314",
"0.604493",
"0.60397017",
"0.6003204",
"0.59804475",
"0.59750575",
"0.58867973",
"0.5878638",
"0.5859774",
"0.58397454",
"0.5805866",
"0.572... | 0.8255744 | 0 |
If there are tasks with the same name, mark them as duplicates and log them. | def set_and_log_duplicate_tasks(evaluated_tasks)
return [] if evaluated_tasks.empty?
# get all of the task_names that are duplicates (TODO ruby 2.7: replace this with .tally)
duplicated_names = evaluated_tasks.group_by(&:name).select { |_name, tasks | tasks.size > 1 }.keys
# Guard condition: no duplicate names, so just return
return [] if duplicated_names.empty?
# get the duplicated tasks for each name; return all of them
duplicated_names.map{|dup_name| duplicated_tasks_for_name(dup_name, evaluated_tasks) }.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_hardcoded_duplicates(task)\n task.add_duplicate('t1 duplicate 1')\n task.add_duplicate('t1 duplicate 2')\n end",
"def ensure_unique_tasks_names! \n for i in 0..(@tasks_params.count-2)\n for j in (i+1)..(@tasks_params.count-1)\n raise RuntimeError, 'Duplicated tasks names' if @... | [
"0.7487215",
"0.6605103",
"0.6405019",
"0.60654604",
"0.5852868",
"0.5769097",
"0.5662074",
"0.56507",
"0.56316274",
"0.5559704",
"0.5549536",
"0.5540729",
"0.5464778",
"0.54593104",
"0.54243994",
"0.5344918",
"0.53351897",
"0.53347844",
"0.5325831",
"0.5311978",
"0.5272812",... | 0.7115204 | 1 |
Determine the tasks that have already run successfully in this rakefile | def set_and_log_tasks_already_ran(evaluated_tasks)
return [] if evaluated_tasks.empty?
already_ran = []
evaluated_tasks.each do |evaluated_task|
successful_attempt = find_successful_attempt_for_task(evaluated_task)
already_ran << tasks_updater.set_and_log_task_as_already_ran(evaluated_task, successful_attempt) if successful_attempt
end
already_ran
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def successful_tasks\n @successful_tasks ||= @tasks_results.select(&:success?)\n end",
"def tasks_have_failed?\n return true if @tasks_have_failed\n failed = select do |task|\n task.failed?\n end\n if failed.any?\n debug \"Found failed tasks: #{failed.map { |t| t.name }.... | [
"0.7163444",
"0.70850396",
"0.7007369",
"0.68085676",
"0.6796838",
"0.67595315",
"0.66654855",
"0.6606955",
"0.6546945",
"0.64636683",
"0.6439367",
"0.64018196",
"0.6324853",
"0.63228333",
"0.62614465",
"0.6257521",
"0.62568927",
"0.62477475",
"0.62429225",
"0.62429225",
"0.6... | 0.58993906 | 46 |
Note how the Hash is created: If an entry for a key ( = rake file name) does not exist, then a new entry is made, with the value = EvaluatedRakefile(key).new | def all_rakefiles
@all_rakefiles ||= new_hash_of_eval_rakefiles
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_eval_task_named(task_name)\n new_ev_task = EvaluatedRakeTask.new(task_name, self.filename)\n add_eval_task(new_ev_task)\n\n new_ev_task\n end",
"def create_or_update_previous_runs!\n if previously_ran?\n current_run.each do |description, elapsed|\n new_times =... | [
"0.5577767",
"0.5351596",
"0.5329253",
"0.52678347",
"0.52233684",
"0.51036537",
"0.50883424",
"0.50806445",
"0.5062501",
"0.5035023",
"0.5030743",
"0.498997",
"0.49843746",
"0.49692017",
"0.49168378",
"0.48808083",
"0.48577598",
"0.484553",
"0.48387918",
"0.48206738",
"0.481... | 0.48441526 | 18 |
Return all of the tasks that should be run: No duplicates, no tasks that have previously been run successfully. | def all_tasks_to_run
self.all_tasks - all_tasks_previously_run - all_tasks_duplicates
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def successful_tasks\n @successful_tasks ||= @tasks_results.select(&:success?)\n end",
"def tasks\n @db[:tasks].keys.compact.uniq || []\n end",
"def incomplete_tasks\n\t\ttasks.select{ |t| !t.completed? }\n\tend",
"def failed_tasks\n each_task.select do |task|\n task.status == :fa... | [
"0.7313079",
"0.71757704",
"0.7043827",
"0.69873416",
"0.695203",
"0.69262904",
"0.68982226",
"0.68448985",
"0.677307",
"0.6768514",
"0.6734776",
"0.6730305",
"0.67107046",
"0.6672557",
"0.66699564",
"0.66674894",
"0.6662218",
"0.6659026",
"0.66383284",
"0.6623067",
"0.662127... | 0.8064616 | 0 |
All .rake files in the onetime_tasks_path | def onetime_rake_files
tasks_dir = self.tasks_directory
return [] unless Dir.exist?(tasks_dir) && !Dir.empty?(tasks_dir)
Dir.glob(File.join('**', '*.rake'), base: tasks_dir)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_rakefiles\n @all_rakefiles ||= new_hash_of_eval_rakefiles\n end",
"def task_files\r\n Dir.chdir(Rails.root.join('lib', 'tasks')) do |dir|\r\n @task_files = Dir[\"*.rake\"]\r\n end\r\n @task_files = @task_files.reject{|task|\r\n task !~ /\\Abg_worker_/}.map{|task|\r\n task.su... | [
"0.76642257",
"0.75222826",
"0.7440642",
"0.730027",
"0.72978675",
"0.71560735",
"0.7070981",
"0.67436665",
"0.6703166",
"0.6613974",
"0.6610863",
"0.6602038",
"0.65127033",
"0.65127033",
"0.6434379",
"0.6431884",
"0.6407418",
"0.6406959",
"0.6332786",
"0.6290942",
"0.6285782... | 0.8908357 | 0 |
Add a new EvaluatedRakeFile for the rakefilename if we don't already have it. Add all task names to the EvalutedRakeFile that it doesn't already have. | def add_rakefile_and_tasks(rakefilename, task_names)
# creates a new EvaluatedRakeFile entry if needed
ev_rakefile = self.all_rakefiles[rakefilename]
ev_rakefile.add_task_names(task_names)
self.all_tasks.concat(ev_rakefile.all_tasks)
ev_rakefile
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_eval_task_named(task_name)\n new_ev_task = EvaluatedRakeTask.new(task_name, self.filename)\n add_eval_task(new_ev_task)\n\n new_ev_task\n end",
"def rakefiles_with_tasks_to_run\n\n rakefiles_with_tasks = new_hash_of_eval_rakefiles\n\n # This isn't efficient, but it's clear:\n ... | [
"0.74772257",
"0.6796576",
"0.58848387",
"0.5873985",
"0.5728471",
"0.5652964",
"0.5614601",
"0.55818975",
"0.55703884",
"0.5515117",
"0.5510157",
"0.5413402",
"0.5365747",
"0.52929115",
"0.52316236",
"0.51894283",
"0.51660335",
"0.510383",
"0.5093368",
"0.50860965",
"0.50282... | 0.7244897 | 1 |
Don't cache (memoize) these. We always want the latest info from the db. | def successful_task_attempts
OneTimeTasker::SuccessfulTaskAttempt.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cached?; end",
"def refresh_db_related\n return if @table_follows.empty?\n\n @first_db_entry = @table_follows.first\n @last_follow_time = @first_db_entry[:follo... | [
"0.6651593",
"0.6651593",
"0.6651593",
"0.6651593",
"0.6651593",
"0.6651593",
"0.6651593",
"0.66125804",
"0.66006553",
"0.6380731",
"0.62917256",
"0.62245893",
"0.62245893",
"0.6193067",
"0.6193067",
"0.6111375",
"0.6048916",
"0.6005472",
"0.6002445",
"0.598984",
"0.59500194"... | 0.0 | -1 |
Find a SuccessfulAttempt for the EvaluatedTask. if a SuccessfulAttempt is found, return the first one found. else return nil if none found | def find_successful_attempt_for_task(evaluated_task)
self.successful_task_attempts.detect { |already_ran_task| already_ran_task.task_name == evaluated_task.name }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attempt(problem)\n\t\tif problem\n\t\t\treturn self.attempts.where(problem_id: problem.id).first\n\t\tend\n\tend",
"def assignment_solution(ass_id)\n self.final_completed_assignments.select{ |a| a.assignment_id == ass_id }.first\n end",
"def return_solution_found\n @open.select(&:goal).first\n ... | [
"0.59902287",
"0.54860675",
"0.5393403",
"0.5380933",
"0.5239204",
"0.5222303",
"0.5192073",
"0.51379395",
"0.51314205",
"0.50945306",
"0.5085403",
"0.50730133",
"0.5069035",
"0.5061519",
"0.5054054",
"0.5049524",
"0.50483805",
"0.5044419",
"0.50382704",
"0.49822503",
"0.4968... | 0.75626284 | 0 |
def year( y) one_year = (1..12).to_a years = (1800..2250) print years if y end endprint | def month_arg_to_s(m)
month_array = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
month_array[m - 1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dog_years(year)\n\t\tp year*7\n\tend",
"def yn(year)\n return year if year.size == 4\n\n y = Date.today.year.to_s[2..4].to_i + 1\n case year.to_i\n when 0...y then \"20#{year}\"\n when y..99 then \"19#{year}\"\n end\n end",
"def year() end",
"def leap(year1,year2)\n\n fo... | [
"0.75494283",
"0.75429296",
"0.7476533",
"0.7330234",
"0.72896326",
"0.7256799",
"0.722942",
"0.7194466",
"0.711142",
"0.7110437",
"0.71015155",
"0.7077745",
"0.7077745",
"0.7069117",
"0.7066054",
"0.70652336",
"0.70570046",
"0.70355177",
"0.70325786",
"0.70255804",
"0.701786... | 0.0 | -1 |
Tests for Vodafone EPD simulator | def test_simulate_status_frame
mqtt_client = SinapseEPDSimulatorVodafone.new(:host => $MQTT_broker, :port => $normal_port, :username => $MQTT_user, :password => $MQTT_password)
mqtt_client.connect()
# Simulating EPD
#result = mqtt_client.simulate_status_frame
#assert_equal result[0], {:topic => "LU/LUM/SEN", :message => "FFFFFF;30;1;90;150;220;60;0;60;60;0;60;50"} # RAE: To Improve
# EPD with data
status_parameters = {
id_radio: "123456",
temp: 30,
stat: 1,
dstat: 75,
voltage: 220,
current: 120,
active_power: 75,
reactive_power: 0,
apparent_power: 75,
aggregated_active_energy: 150,
aggregated_reactive_energy: 0,
aggregated_apparent_energy: 150,
frequency: 50
}
result = mqtt_client.simulate_status_frame("LU/LUM/SEN", status_parameters)
assert_equal result[0], {:topic => "LU/LUM/SEN", :message => "123456;30;1;75;120;220.0;75.0;0.0;75.0;150;0;150;50;"} # RAE: To Improve
mqtt_client.disconnect()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ios_testSVODEpisodePlay(client)\n\t\tclient.sleep(2000)\n\t\tputs \"\"\n\t\tputs \"\"\n\t\tputs \"::MSG::[iOS] STARTING TEST SVOD EPISODE PLAY@見放題エピソード再生機能\"\n\n\t\t$totalTest = $totalTest + 1\n\n\t\tclient.sleep(2000)\n\t\tbegin\n\t\t\tif client.isElementFound(\"NATIVE\", \"text=つづきを再生\")\n\t\t\t\tEpisodePlay... | [
"0.64946526",
"0.57697374",
"0.5729185",
"0.5614345",
"0.5591484",
"0.5577504",
"0.5557855",
"0.5532479",
"0.55240047",
"0.5487013",
"0.54794675",
"0.5461433",
"0.54234314",
"0.53806037",
"0.53641784",
"0.53615427",
"0.5293915",
"0.52922744",
"0.5290481",
"0.52775306",
"0.527... | 0.5758181 | 2 |
Tests for Vodafone EPD simulator | def test_simulate_status_frame_with_timestamp
mqtt_client = SinapseEPDSimulatorVodafone.new(:host => $MQTT_broker, :port => $normal_port, :username => $MQTT_user, :password => $MQTT_password)
mqtt_client.connect()
# Simulating EPD
#result = mqtt_client.simulate_status_frame
#assert_equal result[0], {:topic => "LU/LUM/SEN", :message => "FFFFFF;30;1;90;150;220;60;0;60;60;0;60;50"} # RAE: To Improve
# EPD with data
timestamp = Time.now.to_i
status_parameters = {
id_radio: "123456",
temp: 30,
stat: 1,
dstat: 75,
voltage: 220,
current: 120,
active_power: 75,
reactive_power: 0,
apparent_power: 75,
aggregated_active_energy: 150,
aggregated_reactive_energy: 0,
aggregated_apparent_energy: 150,
frequency: 50,
timestamp: timestamp
}
result = mqtt_client.simulate_status_frame("LU/LUM/SEN", status_parameters)
msg_result = "123456;30;1;75;120;220.0;75.0;0.0;75.0;150;0;150;50;" + timestamp.to_s + ";"
assert_equal result[0], {:topic => "LU/LUM/SEN", :message => msg_result} # RAE: To Improve
mqtt_client.disconnect()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ios_testSVODEpisodePlay(client)\n\t\tclient.sleep(2000)\n\t\tputs \"\"\n\t\tputs \"\"\n\t\tputs \"::MSG::[iOS] STARTING TEST SVOD EPISODE PLAY@見放題エピソード再生機能\"\n\n\t\t$totalTest = $totalTest + 1\n\n\t\tclient.sleep(2000)\n\t\tbegin\n\t\t\tif client.isElementFound(\"NATIVE\", \"text=つづきを再生\")\n\t\t\t\tEpisodePlay... | [
"0.6494648",
"0.57695836",
"0.5758841",
"0.57284546",
"0.5614557",
"0.5591371",
"0.5577651",
"0.5557862",
"0.55324453",
"0.55242133",
"0.5487116",
"0.5480146",
"0.5461753",
"0.5424026",
"0.5380782",
"0.5364412",
"0.53617185",
"0.5293567",
"0.5292122",
"0.529072",
"0.52768546"... | 0.0 | -1 |
Set/Get the api method | def method(method = nil)
return @method if method.nil?
@method = method.to_s.capitalize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_method\n @_api_method ||= \"#{method_from_class_name}.get\"\n end",
"def http_method\n METHODS[self[:method]]\n end",
"def api_method\n ''\n end",
"def http_method(v)\n endpoint_info[:http_method] = v\n end",
"def api=(value)\n @api = val... | [
"0.81487256",
"0.72420007",
"0.7237257",
"0.7098247",
"0.7008305",
"0.6984429",
"0.6951847",
"0.68471026",
"0.67859197",
"0.67583543",
"0.6729883",
"0.6723554",
"0.66738826",
"0.66738826",
"0.663073",
"0.663073",
"0.66288257",
"0.66254675",
"0.66254675",
"0.6602638",
"0.65636... | 0.6177752 | 47 |
Set response field mapping | def map(from, to)
@mapping ||= {}
@mapping[from.to_s] = to.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_response(content_type, response)\n return if content_type.nil? || response.nil?\n\n content_type._id = response['id']\n content_type.klass_name = response['klass_name']\n\n response['entries_custom_fields'].each do |remote_field|\n field = content_... | [
"0.6172235",
"0.61236566",
"0.6093752",
"0.59497976",
"0.58926696",
"0.5831095",
"0.56661344",
"0.564511",
"0.55249786",
"0.54828304",
"0.5475963",
"0.5475963",
"0.5475963",
"0.5475963",
"0.5475963",
"0.5475963",
"0.5475963",
"0.5475963",
"0.5475963",
"0.5475963",
"0.54321015... | 0.0 | -1 |
right: One angle of the triangle is a right angle (90 degrees) acute: All 3 angles of the triangle are less than 90 degrees obtuse: One angle is greater than 90 degrees. | def triangle(x, y, z)
sides = [x, y, z]
largest_side = sides.max
# binding.pry
case
when sides.inject(:+) != 180, sides.include?(0)
puts :invalid
when sides.inject(:+) == 180 && sides.include?(90)
puts :right
when sides.inject(:+) == 180 && largest_side > 90
puts :obtuse
else
puts :acute
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n largest_angle = angles.max\n\n case\n when angles.sum != 180, angles.include?(0)\n :invalid\n when largest_angle > 90\n :obtuse\n when largest_angle == 90\n :right\n else\n :acute\n end\nend",
"def triangle(*angles)\n ... | [
"0.7794518",
"0.7742498",
"0.76955456",
"0.7676879",
"0.76753485",
"0.766985",
"0.7659761",
"0.76219666",
"0.76206946",
"0.7617786",
"0.7601809",
"0.75970024",
"0.75932664",
"0.756196",
"0.7550093",
"0.75467706",
"0.75441426",
"0.7513473",
"0.7497076",
"0.7477304",
"0.7303223... | 0.68303883 | 27 |
returns Likes involving Comments INSTANCE METHODS | def get_liked_media
case likeable_type
when 'Post'
return Post.find(likeable_id)
when 'Comment'
return Comment.find(likeable_id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def likes\n Like.where(target_id:self.id, target_type:'comment')\n end",
"def liked_comments_count\n # Creating comments\n comment_ids = \"SELECT id FROM comments WHERE user_id = :user_id\"\n # Except for self like\n CommentLike.where(\"comment_id IN (#{comment_ids}) AND user_id <> :user_id\"... | [
"0.7464416",
"0.7067533",
"0.70255697",
"0.7013726",
"0.698551",
"0.69466865",
"0.6720291",
"0.6671705",
"0.6522949",
"0.645366",
"0.64297676",
"0.6402152",
"0.63944936",
"0.6372771",
"0.63526255",
"0.63436496",
"0.6314729",
"0.63088906",
"0.6282479",
"0.62554735",
"0.6217294... | 0.57478327 | 60 |
Never trust parameters from the scary internet, only allow the white list through. | def member_invite_params
params.require(:member).permit(:email)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /lessons GET /lessons.json | def index
@lessons = @section.lessons.includes(:progressions)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @lessons = Lesson.all\n\n render 'index.json'\n end",
"def index\n #@lessons = Lesson.all\n @lessons = @course.lessons.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lessons }\n end\n end",
"def index\n @lessons = Lesson... | [
"0.80362004",
"0.7878625",
"0.72607297",
"0.72607297",
"0.72607297",
"0.72607297",
"0.7183245",
"0.7105748",
"0.7048544",
"0.7004119",
"0.6789726",
"0.67773086",
"0.6726765",
"0.67260987",
"0.6724068",
"0.6722874",
"0.6716223",
"0.6640441",
"0.65512466",
"0.6479717",
"0.64051... | 0.66399705 | 18 |
GET /lessons/1 GET /lessons/1.json | def show
@progress = @lesson.progressions.find_by(:user => current_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @lessons = Lesson.all\n\n render 'index.json'\n end",
"def index\n #@lessons = Lesson.all\n @lessons = @course.lessons.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lessons }\n end\n end",
"def show\n @lesson = Lesson.f... | [
"0.7903578",
"0.76162004",
"0.72275925",
"0.71802473",
"0.70652306",
"0.7041279",
"0.7041279",
"0.7041279",
"0.7041279",
"0.6987059",
"0.6984014",
"0.6935964",
"0.6883529",
"0.67853045",
"0.6742001",
"0.67069143",
"0.6604449",
"0.65758556",
"0.65491104",
"0.6543736",
"0.65306... | 0.0 | -1 |
POST /lessons POST /lessons.json | def create
@lesson = Lesson.new(lesson_params)
respond_to do |format|
if @lesson.save
format.html { redirect_to course_section_lessons_path(@course, @section), notice: 'Lesson was successfully created.' }
format.json { render action: 'show', status: :created, location: @lesson }
else
format.html { render action: 'new' }
format.json { render json: @lesson.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #@lesson = Lesson.new(params[:lesson])\n @lesson = @course.lessons.new(params[:lesson])\n\n respond_to do |format|\n if @lesson.save\n format.html { redirect_to [@course,@lesson], :notice => 'Lesson was successfully created.' }\n format.json { render :json => @lesson, :stat... | [
"0.682627",
"0.674735",
"0.6718514",
"0.6697686",
"0.6697032",
"0.667032",
"0.667032",
"0.667032",
"0.6563873",
"0.651799",
"0.64450693",
"0.63522065",
"0.6337182",
"0.63099784",
"0.6258918",
"0.62086457",
"0.6198391",
"0.616112",
"0.6153891",
"0.612597",
"0.6121709",
"0.61... | 0.6643393 | 8 |
PATCH/PUT /lessons/1 PATCH/PUT /lessons/1.json | def update
respond_to do |format|
if @lesson.update(lesson_params)
format.html { redirect_to @course, notice: 'Lesson was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @lesson.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n #@lesson = Lesson.find(params[:id])\n @lesson = @course.lessons.find(params[:id])\n\n respond_to do |format|\n if @lesson.update_attributes(params[:lesson])\n format.html { redirect_to [@course,@lesson], :notice => 'Lesson was successfully updated.' }\n format.json { head :... | [
"0.65853786",
"0.63851297",
"0.6311894",
"0.6126403",
"0.6070752",
"0.6058629",
"0.6054614",
"0.6053014",
"0.6053014",
"0.6053014",
"0.6030143",
"0.60123265",
"0.6002697",
"0.5999764",
"0.5945133",
"0.5942412",
"0.5940565",
"0.592433",
"0.5909988",
"0.5904255",
"0.5901184",
... | 0.6150968 | 3 |
DELETE /lessons/1 DELETE /lessons/1.json | def destroy
@lesson.destroy
respond_to do |format|
format.html { redirect_to lessons_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @lesson = Lesson.find(params[:id])\n @lesson.destroy\n\n respond_to do |format|\n format.html { redirect_to lessons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lesson = Lesson.find(params[:id])\n @lesson.destroy\n\n respond_to do |format|\n... | [
"0.75589675",
"0.75589675",
"0.74921167",
"0.729321",
"0.7290526",
"0.7290526",
"0.72901374",
"0.720436",
"0.71760815",
"0.7165285",
"0.7135993",
"0.71059334",
"0.7060732",
"0.702374",
"0.7002369",
"0.6976492",
"0.6957436",
"0.69083154",
"0.6900947",
"0.6881635",
"0.68790466"... | 0.75231284 | 2 |
Use callbacks to share common setup or constraints between actions.\ | def set_section
@course = Course.find(params[:course_id])
@section = @course.sections.find(params[:section_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_hook; end",
"def callbacks; end",
"def callbacks; end",
"def run_actions; end",
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def actions; end",
"def add_actions; end",
"def define_action_hook; end",
"def define_action_helpers\n ... | [
"0.64831156",
"0.6397671",
"0.6397671",
"0.63712466",
"0.63701516",
"0.6322635",
"0.6234728",
"0.6212416",
"0.59583217",
"0.59089357",
"0.58330506",
"0.579678",
"0.5764087",
"0.5706481",
"0.5685825",
"0.56603265",
"0.56603265",
"0.56603265",
"0.5648843",
"0.5648843",
"0.56488... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def lesson_params
params.require(:lesson).permit(:name, :description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Sets up internal state, natch, and accepts a block that customizes the resulting object. | def initialize
@items = []
@item_stack = []
yield self if block_given?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(&block)\n @block = block\n end",
"def initialize(&block)\n configure(&block) if block_given?\n end",
"def initialize(&block)\n @block = block\n end",
"def initialize(&block)\n @block = block\n end",
"def initialize\n @block_args = []\n end",
... | [
"0.6856396",
"0.67710245",
"0.6750125",
"0.6750125",
"0.66565245",
"0.66492355",
"0.66492355",
"0.66492355",
"0.66492355",
"0.66492355",
"0.66492355",
"0.66492355",
"0.66492355",
"0.66492355",
"0.66492355",
"0.66492355",
"0.66492355",
"0.66492355",
"0.66492355",
"0.66492355",
... | 0.0 | -1 |
Inserts an HTML comment (eg ) | def comment!(str)
if str.include? "\n"
text! "<!--\n#{str}\n-->\n"
else
text! "<!-- #{str} -->\n"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comment(text)\n@out << \"<!-- #{text} -->\"\nnil\nend",
"def comment(text)\n @out << \"<!-- #{text} -->\"\n nil\n end",
"def add_comment comment\n \"\\n###### #{comment} ######\\n\" \n end",
"def comment(text)\n @xml << \"<!-- #{text} -->\"\n nil\n end",
"def comment(string); end",
... | [
"0.7763619",
"0.7685479",
"0.76105225",
"0.74348044",
"0.7343113",
"0.7343113",
"0.7343113",
"0.7343113",
"0.7337848",
"0.7320871",
"0.7216868",
"0.72111416",
"0.6990976",
"0.6990976",
"0.6990976",
"0.6990976",
"0.6990976",
"0.6990976",
"0.6990976",
"0.6990976",
"0.6990976",
... | 0.70936906 | 12 |
Allow pushing new elements | def <<(new_item)
if @item_stack.empty?
@items << new_item
else
@item_stack.last.html << new_item
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(element); end",
"def push(element)\r\n # IMPLEMENTME!\r\n end",
"def push_dup; end",
"def push(element)\n # IMPLEMENT ME!\n end",
"def push(elt)\n @elements << elt\n end",
"def push(item); end",
"def push(new_element)\n @collection.push(new_element)\n end",
"def... | [
"0.79241586",
"0.7751034",
"0.7641397",
"0.7558929",
"0.699",
"0.69857013",
"0.6949971",
"0.6936835",
"0.6917913",
"0.6767125",
"0.6749102",
"0.6749102",
"0.67055446",
"0.67011863",
"0.66773635",
"0.6676324",
"0.6661785",
"0.6656265",
"0.66262835",
"0.659952",
"0.6583686",
... | 0.0 | -1 |
Create a new element explicitly | def tag(tag, *args, &block)
item = Html::Element.new(tag, *args)
self << item
if block
@item_stack.push item
block.call(item)
@item_stack.pop
end
return self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_element(name, *contents_or_attrs, &block); end",
"def new_node(element)\n Node.new(element)\n end",
"def new\n @element = Element.new\n end",
"def new_element(key)\n Element.new('Key' => key)\n end",
"def new\n @element = @@model.new()\n end",
"def start_new_element(name, a... | [
"0.75434154",
"0.71173775",
"0.7096989",
"0.68765473",
"0.6745791",
"0.6736986",
"0.67275465",
"0.6501975",
"0.64983755",
"0.6442474",
"0.6370774",
"0.63694227",
"0.6364067",
"0.6274943",
"0.62178594",
"0.62094265",
"0.62063265",
"0.61668473",
"0.61467594",
"0.6127663",
"0.61... | 0.0 | -1 |
Creates a new element on any method missing calls. Returns self, so you can chain calls (eg html.div('foo').span('bar') ) | def method_missing(method, *args, &block)
parts = method.to_s.match(/^([a-z]+[0-9]?)$/)
if parts
# Assume it's a new element, create the tag
tag(parts[1], *args, &block)
else
# There really is no method...
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method, *args, &block)\n super(method, *args) unless block_given?\n options, attrs, element = (args.detect { |arg| arg.is_a?(Hash) } || {}), {}, nil\n\n # handle methods separately if they match the pre-defined elements\n if ELEMENTS.include?(method.to_sym)\n ... | [
"0.6483127",
"0.63952464",
"0.5681417",
"0.564917",
"0.56264347",
"0.560671",
"0.5602902",
"0.54857296",
"0.54509574",
"0.54509574",
"0.53960353",
"0.53789043",
"0.5373109",
"0.5336202",
"0.5317931",
"0.5313115",
"0.5299496",
"0.5299496",
"0.5297895",
"0.52955025",
"0.5293478... | 0.65207535 | 0 |
Make sure our objects advertise their support of tags | def respond_to_missing?(method, include_private)
parts = method.to_s.match(/^([a-z]+[0-9]?)$/)
if parts
true
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tagged?; end",
"def allowed_tags; end",
"def allowed_tags; end",
"def register_transitive_tags(object); end",
"def research_acts_as_taggable\n research_acts_as_taggable_on :tags\n end",
"def allowed_tags=(_arg0); end",
"def allowed_tags=(_arg0); end",
"def add_tags\n raise NotImpleme... | [
"0.6868584",
"0.677748",
"0.677748",
"0.667371",
"0.66311777",
"0.6584921",
"0.6584921",
"0.65792376",
"0.65394396",
"0.65394396",
"0.65394396",
"0.65394396",
"0.65394396",
"0.64252406",
"0.63591045",
"0.63555723",
"0.63349926",
"0.6334745",
"0.63187134",
"0.63146937",
"0.629... | 0.0 | -1 |
Renders out as html accepts depth param to indicate level of indentation | def render(depth = 0, inblock = true)
# Convert elements to strings
@items.collect do |item|
if item.is_a?(String)
if inblock
inblock = false
' '*depth + item
else
item
end
elsif item.nil?
''
else
item.render(depth,inblock)
end
end.join('')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(params={})\n level = params[:level] || 0\n indent = params[:indent] || 2\n indent_str = \" \" * indent * level\n output = \"\"\n if @comments.length > 0\n output << \"\\n\" + indent_str\n join_str = \"\\n\" + indent_str\n output << \"<!-- \" + @comments.join... | [
"0.7267937",
"0.6594751",
"0.65514535",
"0.6452624",
"0.6405705",
"0.63899523",
"0.6369388",
"0.6286185",
"0.62668234",
"0.6234819",
"0.61783546",
"0.61572",
"0.6083242",
"0.6083242",
"0.6073232",
"0.606556",
"0.60488796",
"0.60220414",
"0.60202694",
"0.6013512",
"0.59466386"... | 0.64623773 | 3 |
GET /public_repositories GET /public_repositories.json | def index
@public_repositories = PublicRepository.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repositories\n response = self.class.get('/repositories').body\n JSON.parse(response)\n end",
"def list_repositories\n JSON.parse(request(:get, ''))\n end",
"def public_repositories\n raw_repos = GitHub::API.json(\"/organizations/#{self.login}/public_repositories\")['repositories']\n ... | [
"0.78826284",
"0.77906513",
"0.7607299",
"0.75962114",
"0.7578652",
"0.75022125",
"0.7365388",
"0.7232404",
"0.72304016",
"0.7222917",
"0.71868205",
"0.7180374",
"0.7151602",
"0.70675856",
"0.706707",
"0.7039443",
"0.69558156",
"0.69347835",
"0.6913989",
"0.6825737",
"0.68147... | 0.83718145 | 0 |
GET /public_repositories/1 GET /public_repositories/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @public_repositories = PublicRepository.all\n end",
"def repositories\n response = self.class.get('/repositories').body\n JSON.parse(response)\n end",
"def list_repositories\n JSON.parse(request(:get, ''))\n end",
"def index\n @repositories = current_user.repositories.all\n\... | [
"0.7826773",
"0.7553163",
"0.74977154",
"0.7406152",
"0.7361076",
"0.73259926",
"0.7206645",
"0.7170066",
"0.7105372",
"0.7098396",
"0.7077001",
"0.70127416",
"0.6973323",
"0.6962501",
"0.69317156",
"0.6921056",
"0.6911089",
"0.68687874",
"0.6820289",
"0.6801923",
"0.6768693"... | 0.0 | -1 |
POST /public_repositories POST /public_repositories.json | def create
@public_repository = PublicRepository.new(public_repository_params)
respond_to do |format|
if @public_repository.save
format.html { redirect_to @public_repository, notice: 'Public repository was successfully created.' }
format.json { render :show, status: :created, location: @public_repository }
else
format.html { render :new }
format.json { render json: @public_repository.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @public_repositories = PublicRepository.all\n end",
"def create\n #@repo = Repo.new(repo_params)\n\n user= params[:user]\n repo= params[:repos]\n\n url = BASE_URL + \"repos/\" + user + \"/\" + repo + \"/collaborators\"\n # url = BASE_URL + \"repos/rails/rails/collaborators\"\n #... | [
"0.71290064",
"0.68316734",
"0.66983736",
"0.6648425",
"0.6557433",
"0.64827067",
"0.6468792",
"0.64037853",
"0.63793594",
"0.6345854",
"0.6336951",
"0.62572116",
"0.62235355",
"0.6174402",
"0.6172524",
"0.61462986",
"0.6130395",
"0.6120652",
"0.60852766",
"0.6064981",
"0.605... | 0.7281976 | 0 |
PATCH/PUT /public_repositories/1 PATCH/PUT /public_repositories/1.json | def update
respond_to do |format|
if @public_repository.update(public_repository_params)
format.html { redirect_to @public_repository, notice: 'Public repository was successfully updated.' }
format.json { render :show, status: :ok, location: @public_repository }
else
format.html { render :edit }
format.json { render json: @public_repository.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @repo = @user.repos.find_by_name!(params[:id])\n\n if @repo.update_attributes(params[:repo])\n head :no_content\n else\n render json: @repo.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @repo.update(repo_params)\n render json: JSONA... | [
"0.68845284",
"0.6866079",
"0.63830954",
"0.6369074",
"0.62794113",
"0.6275017",
"0.62050563",
"0.6169712",
"0.61696035",
"0.60915154",
"0.60879403",
"0.60823905",
"0.6050669",
"0.60343266",
"0.6016511",
"0.59620047",
"0.5920089",
"0.58699167",
"0.58692586",
"0.5866568",
"0.5... | 0.6650245 | 2 |
DELETE /public_repositories/1 DELETE /public_repositories/1.json | def destroy
@public_repository.destroy
respond_to do |format|
format.html { redirect_to public_repositories_url, notice: 'Public repository was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @repository = Repository.find(params[:id])\n @repository.destroy\n\n respond_to do |format|\n format.html { redirect_to repositories_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repository = @project.repositories.find(params[:id])\n @repositor... | [
"0.7298792",
"0.7293004",
"0.7288492",
"0.7246774",
"0.7238375",
"0.72131383",
"0.716087",
"0.70857424",
"0.7051341",
"0.70495045",
"0.7045577",
"0.70149195",
"0.70111895",
"0.6992315",
"0.6992315",
"0.6992315",
"0.6963399",
"0.69523406",
"0.69523406",
"0.68760896",
"0.683452... | 0.7528295 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_public_repository
@public_repository = PublicRepository.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def public_repository_params
params.require(:public_repository).permit(:name, :url, :record_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
POST /posts POST /posts.json | def create
@start_time = DateTime.parse(params["booking"]["start_time(1i)"].to_s + '-' + params["booking"]["start_time(2i)"].to_s + '-' + params["booking"]["start_time(3i)"].to_s + ' ' + params["booking"]["start_time(4i)"].to_s + ':' + params["booking"]["start_time(5i)"].to_s + ':' + '0')
@end_time = DateTime.parse(params["booking"]["end_time(1i)"].to_s + '-' + params["booking"]["end_time(2i)"].to_s + '-' + params["booking"]["end_time(3i)"].to_s + ' ' + params["booking"]["end_time(4i)"].to_s + ':' + params["booking"]["end_time(5i)"].to_s + ':' + '0')
@booking = Booking.new(:price => params[:hiddenPrice], :parking_space_id => params[:parking_space_id], :user_id => current_user.id, :start_time => @start_time, :end_time => @end_time)
@booking.save
redirect_to new_charge_path(booking: @booking, price: params[:hiddenPrice])
# after saving redirect to charges controller to make the charge. Example of how to link to a route with nested resources:
# redirect_to parking_space_booking_path(@parking_space, @booking)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n render json: Post.create(params[\"post\"])\n end",
"def create\n respond_with Post.create(params[:posts])\n end",
"def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end",
"def create\n @post = Post.new(post_params)\n @po... | [
"0.74463975",
"0.73221767",
"0.73072433",
"0.7123966",
"0.7015686",
"0.701327",
"0.69841874",
"0.6939327",
"0.69313824",
"0.69053805",
"0.68196476",
"0.6812792",
"0.6793222",
"0.6792862",
"0.6779654",
"0.6779654",
"0.67625546",
"0.67602354",
"0.67515427",
"0.6735786",
"0.6698... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_parking_space
@parking_space = ParkingSpace.find(params[:parking_space_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def booking_params
params.require(:booking).permit(:start_time, :end_time, :price, :parking_space_id, :user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Use this method in DSL methods to add a base directory to config | def add_base_dir(name, base_dir_string)
if name.to_s !~ BASE_DIR_NAME_REGEX
raise ArgumentError.new("A base dir name must match this regex: #{ BASE_DIR_NAME_REGEX.inspect }")
end
# guarantee trailing slash
bd = base_dir_string.to_s.gsub(/\/\z/, '') + '/'
@base_dirs[name.to_sym] = bd
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_config_path\n BASE_CONFIG_PATH\n end",
"def base_path\n raise NotImplementedError, \"Subclass #{self.class.name} of Configuration must implement base_path\"\n end",
"def get_base\n # See if we need to extend the base_dir\n if @config['base']\n extended_base = F... | [
"0.7167291",
"0.6974187",
"0.68447685",
"0.68133307",
"0.66286707",
"0.66286707",
"0.66286707",
"0.66286707",
"0.66286707",
"0.66286707",
"0.66286707",
"0.6516731",
"0.63902855",
"0.63769853",
"0.63632095",
"0.6300203",
"0.6238117",
"0.6217147",
"0.62078077",
"0.6200272",
"0.... | 0.6327108 | 15 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.