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 |
|---|---|---|---|---|---|---|
GET /machine_total_owners/1 GET /machine_total_owners/1.xml | def show
@machine_total_owner = MachineTotalOwner.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @machine_total_owner }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_owners\n return make_request(\"#{self.endpoint}/list/owners\")\n end",
"def new\n @machine_total_owner = MachineTotalOwner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @machine_total_owner }\n end\n end",
"def show\n ... | [
"0.6501926",
"0.6119094",
"0.58848095",
"0.5762673",
"0.5761391",
"0.56927025",
"0.5616077",
"0.5608162",
"0.5492607",
"0.5419119",
"0.54171705",
"0.5388998",
"0.5379635",
"0.5369289",
"0.5368704",
"0.5356861",
"0.53260547",
"0.5322657",
"0.53082913",
"0.53082913",
"0.5271537... | 0.6894594 | 0 |
GET /machine_total_owners/new GET /machine_total_owners/new.xml | def new
@machine_total_owner = MachineTotalOwner.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @machine_total_owner }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @machine_total_owner = MachineTotalOwner.new(params[:machine_total_owner])\n\n respond_to do |format|\n if @machine_total_owner.save\n format.html { redirect_to(@machine_total_owner, :notice => 'Machine total owner was successfully created.') }\n format.xml { render :xml => @... | [
"0.7032036",
"0.70277107",
"0.64169455",
"0.6097371",
"0.59877056",
"0.59637964",
"0.595459",
"0.59182155",
"0.58719677",
"0.58628976",
"0.58223635",
"0.5802269",
"0.57879484",
"0.57713646",
"0.5730904",
"0.56772995",
"0.56370085",
"0.56234986",
"0.5544524",
"0.5536235",
"0.5... | 0.7657783 | 0 |
POST /machine_total_owners POST /machine_total_owners.xml | def create
@machine_total_owner = MachineTotalOwner.new(params[:machine_total_owner])
respond_to do |format|
if @machine_total_owner.save
format.html { redirect_to(@machine_total_owner, :notice => 'Machine total owner was successfully created.') }
format.xml { render :xml => @machine_total_owner, :status => :created, :location => @machine_total_owner }
else
format.html { render :action => "new" }
format.xml { render :xml => @machine_total_owner.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owners_count=(value)\n @owners_count = value\n end",
"def new\n @machine_total_owner = MachineTotalOwner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @machine_total_owner }\n end\n end",
"def number_of_owners\n ... | [
"0.58404577",
"0.57672024",
"0.57359636",
"0.5613227",
"0.55302656",
"0.5528535",
"0.5463702",
"0.53708345",
"0.53279436",
"0.52992266",
"0.5217112",
"0.50919485",
"0.5016713",
"0.49437276",
"0.48925456",
"0.48865107",
"0.48865107",
"0.48479763",
"0.4842613",
"0.48223314",
"0... | 0.6370827 | 0 |
PUT /machine_total_owners/1 PUT /machine_total_owners/1.xml | def update
@machine_total_owner = MachineTotalOwner.find(params[:id])
respond_to do |format|
if @machine_total_owner.update_attributes(params[:machine_total_owner])
format.html { redirect_to(@machine_total_owner, :notice => 'Machine total owner was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @machine_total_owner.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @total_owner = TotalOwner.find(params[:id])\n\n respond_to do |format|\n if @total_owner.update_attributes(params[:total_owner])\n format.html { redirect_to(@total_owner, :notice => 'Total owner was successfully updated.') }\n format.xml { head :ok }\n else\n form... | [
"0.6142214",
"0.594405",
"0.5930078",
"0.56690264",
"0.56145513",
"0.5570665",
"0.5465965",
"0.54319435",
"0.5270826",
"0.5230895",
"0.5198499",
"0.51862276",
"0.51713955",
"0.5166644",
"0.51434886",
"0.51312166",
"0.5110083",
"0.5091017",
"0.5089099",
"0.50720835",
"0.506486... | 0.6865128 | 0 |
DELETE /machine_total_owners/1 DELETE /machine_total_owners/1.xml | def destroy
@machine_total_owner = MachineTotalOwner.find(params[:id])
@machine_total_owner.destroy
respond_to do |format|
format.html { redirect_to(machine_total_owners_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @total_owner = TotalOwner.find(params[:id])\n @total_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to(total_owners_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def destroy\n ... | [
"0.6662746",
"0.64222366",
"0.6332752",
"0.62428766",
"0.62211853",
"0.6213186",
"0.6189766",
"0.61796147",
"0.60052264",
"0.60047626",
"0.59796864",
"0.5976597",
"0.59500057",
"0.5926452",
"0.5912931",
"0.59092957",
"0.58768314",
"0.584046",
"0.5832535",
"0.5830624",
"0.5825... | 0.75512 | 0 |
Perform GET request, parsing response as JSON. Autofollows redirects until redirect_limit reached. Raises Net::HTTPExceptions if response code not 2xx. | def get(path, redirect_limit=5)
parse_json do |parser|
@http_client.get(path, redirect_limit) {|chunk| parser << chunk }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_response(uri, limit = 10)\n response = Net::HTTP.get_response(uri)\n case response\n when Net::HTTPRedirection\n if limit == 0\n response\n else\n get_response(URI.parse(response['location']), limit - 1)\n end\n else\n response\n end\nend",
"def get_response(uri, limit = 5)\n ... | [
"0.6904074",
"0.67233187",
"0.6695907",
"0.6672841",
"0.6555054",
"0.6532709",
"0.6504292",
"0.6504292",
"0.64515924",
"0.64484215",
"0.64484215",
"0.6427041",
"0.6425898",
"0.6394115",
"0.63861275",
"0.6373827",
"0.63396436",
"0.63111144",
"0.63100004",
"0.6286418",
"0.62758... | 0.743483 | 0 |
Perform POST request, parsing response as JSON. Optionally takes a form_data hash. Raises Net::HTTPExceptions if response code not 2xx. | def post(path, form_data=nil)
parse_json do |parser|
@http_client.post(path, form_data) {|chunk| parser << chunk }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec_post(req, data, exit_on_fail = false)\n response_hash = exec_api_call('POST', req, data, exit_on_fail)\n response_hash[:response]\n end",
"def do_post_request(data)\n\t\tresponse = Net::HTTP.post_form(URI(@url),data)\n if response.message == \"OK\"\n\t\t\tresult = {}\n\t\t\tresponse.body.s... | [
"0.6595641",
"0.6484076",
"0.63408405",
"0.6275608",
"0.6064396",
"0.5957534",
"0.5905347",
"0.5902154",
"0.5882809",
"0.5875129",
"0.5858936",
"0.58544815",
"0.57964206",
"0.5749961",
"0.57483023",
"0.5742018",
"0.5725345",
"0.5707047",
"0.57012063",
"0.5695377",
"0.5672729"... | 0.72276425 | 0 |
TODO: Get general weather data and format it as if edubudi is talking to user | def forecast(city)
response = RestClient.get "http://api.openweathermap.org/data/2.5/forecast?q=#{city}&units=metric"
if !city
return
end
response_hash = JSON.parse response
status = response_hash.empty?
status = !status
if status
list = response_hash["list"]
message = "City: #{response_hash["city"]["name"]}\n"
list.each do |str|
str_date = str["dt_txt"]#.split(" ")
#date = str_date[0]
#time = str_date[1]
message += "Date: #{str_date}\n"
message += "Temp: #{str["main"]["temp"]}\n"
message += "Max Temp: #{str["main"]["temp_max"]}\n"
message += "Min Temp: #{str["main"]["temp_min"]}\n"
end
else
message = "Sorry your request could not be processed please try again\n"
end
puts message
message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_weather\n @single_city_data['weather']\n end",
"def weatherData \n\n icons = {\n \"clear-day\" => \"pe-7w-sun\",\n \"clear-night\" => \"pe-7w-moon\",\n \"rain\" => \"pe-7w-rain-alt\",\n \"snow\" => \"pe-7w-snow-alt\",\n \"sleet\" => \"pe-7w-snow\",\n \"w... | [
"0.76188016",
"0.7591083",
"0.73243266",
"0.72762394",
"0.7223038",
"0.71885556",
"0.71501",
"0.71404886",
"0.71367323",
"0.7116609",
"0.6979142",
"0.69399685",
"0.6896489",
"0.68915665",
"0.68451613",
"0.68407094",
"0.6827266",
"0.6781771",
"0.6734509",
"0.6723047",
"0.67054... | 0.69293463 | 12 |
Examples to_camel_case("thestealthwarrior") returns "theStealthWarrior" to_camel_case("The_Stealth_Warrior") returns "TheStealthWarrior" My solution | def to_camel_case(str)
new_str = str.gsub(/[-_]/, ' ')
new_str = new_str.split(' ')
new_str.map.with_index { |word, ind| ind == 0 ? word : word.capitalize! }
new_str.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_camel_case\n return self if self !~ /_/ && self !~ /\\s/ && self =~ /^[A-Z]+.*/\n\n gsub(/[^a-zA-Z0-9ññÑáéíóúÁÉÍÓÚüÜ_]/, \"_\")\n .split(\"_\").map(&:capitalize).join\n end",
"def camel_case(name)\n if name.include? '_'\n name.split('_').map{|e| e.capitalize}.join\n else\n unless name ... | [
"0.81743246",
"0.79699373",
"0.7871638",
"0.7852094",
"0.7838119",
"0.78298163",
"0.78226346",
"0.78017664",
"0.779104",
"0.77848494",
"0.7778789",
"0.7768038",
"0.77559114",
"0.77539676",
"0.77100134",
"0.7690132",
"0.7676062",
"0.76482534",
"0.76475424",
"0.7645292",
"0.764... | 0.74632347 | 50 |
Check to see if the input itself is in a proper format. | def valid_input?
if @move.length == 2
@move.each do |input|
if input.nil? || input < 1 || input > 3
return false
end
end
else
return false
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_format?(fmt)\n format_string_has_v_or_d?(fmt)\n format_string_does_not_have_v_and_d?(fmt)\n format_string_is_all_valid_chars?(fmt)\n format_string_has_unique_chars?(fmt)\n format_string_has_big_t_only_at_the_end?(fmt)\n end",
"def valid?\n valid_format? @format\n end... | [
"0.74235487",
"0.7366924",
"0.7170096",
"0.7104009",
"0.69347537",
"0.69230205",
"0.6903977",
"0.6897784",
"0.67248714",
"0.6643277",
"0.65020365",
"0.64758736",
"0.64690745",
"0.64670235",
"0.6443177",
"0.64419943",
"0.6413692",
"0.6338959",
"0.63290435",
"0.6244936",
"0.624... | 0.0 | -1 |
Check to see if the move is valid | def valid_move?
# Now let's make sure all of the moves are valid.
# I'll do this by seeing if the sorted version of each
# column equals the @board version.
temp_board = Marshal.load(Marshal.dump(@board))
temp = temp_board[@move_from].shift
temp_board[@move_to].unshift(temp)
temp_board.each do |column|
if column.sort != column
return false
end
end
# If they all pass, we're good!
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_move_valid(move)\n @moves.include? move\n end",
"def valid?(move)\n @board.valid_move?(move)\n end",
"def valid_move?(move)\n move.to_i.between?(1,9) && !taken?(move)\n end",
"def valid_move?\n\t\tvalid_1 = (0..2).include? (@take_from)\n\t\tvalid_2 = (0..2).include? (@move_to)\n\t\tif ... | [
"0.8372854",
"0.82477367",
"0.82145506",
"0.81842023",
"0.8150135",
"0.8121438",
"0.8058852",
"0.803944",
"0.803285",
"0.80154043",
"0.8003637",
"0.7985981",
"0.793866",
"0.79379714",
"0.7930339",
"0.79059553",
"0.7897295",
"0.7880322",
"0.78700465",
"0.7849106",
"0.7847116",... | 0.8052976 | 7 |
Did the user quit? | def quit?
if @move == "quit" || @move == "q"
true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quitting?; @quit > 0 end",
"def quit?\n @quit\n end",
"def quit; @quit = 1 end",
"def will_quit\n end",
"def quit; end",
"def quit; end",
"def exit?\n user_input == \"q\" || user_input == \"quit\"\n end",
"def quit\n end",
"def forced_exit?; @quit > 1 end",
"def does_user_quit... | [
"0.8220288",
"0.788687",
"0.7753183",
"0.77110976",
"0.76683927",
"0.76683927",
"0.7607636",
"0.7590948",
"0.75697565",
"0.74909395",
"0.7481805",
"0.74504244",
"0.74400073",
"0.7422085",
"0.7391936",
"0.73724335",
"0.73018783",
"0.7290483",
"0.7278785",
"0.7252416",
"0.72486... | 0.6954125 | 39 |
Render will display the visual output of the tower It will be represented as a nested array with board[0] being the leftmost peg and board[2] being the rightmost peg. | def render
# First let's create an output buffer. This will be
# where all of our output lines are stored.
output_buffer = ""
# The outer part of the loop will loop the @height of the board.
@height.downto(1) do |row|
# The inner loop will loop through the number of columns there are
# which will always be 3.
0.upto(2) do |column|
# I want to use another temporary buffer which will only
# send to the output_buffer when it reaches the height
# (which is also the max width) + 1.
temp_buffer = ""
# We're only going to add o's if there are numbers in the column.
if @board[column][-row]
@board[column][-row].times {temp_buffer << "o"}
end
# Either way, add _'s until we're at the right length.
until temp_buffer.length == @height+1
temp_buffer << "_"
end
# Add a space between the columns then push everything to the
# main output buffer.
if column == 2
output_buffer << temp_buffer
else
output_buffer << temp_buffer + " "
end
end
# Don't forget to add a new line after the last column
output_buffer << "\n"
end
# Now let's add the footer to the output.
1.upto(3) do |column|
temp_buffer = ""
temp_buffer << column.to_s
until temp_buffer.length == @height+1
temp_buffer << " "
end
if column == 3
output_buffer << temp_buffer + "\n\n"
else
output_buffer << temp_buffer + " "
end
end
# Finally, print the output_buffer
print output_buffer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render()\n # Display text \n puts \"Current Board: \"\n\n # array of blank strings, initialized before adding content\n render_rows = [\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]\n\n # Loop through to build the rows to render\n # Display number of rows corresponding to tower ... | [
"0.83276653",
"0.821767",
"0.76643664",
"0.75793725",
"0.75291795",
"0.74972105",
"0.74790424",
"0.74539757",
"0.7444917",
"0.74163085",
"0.73405737",
"0.72604835",
"0.72300303",
"0.721982",
"0.71990407",
"0.71639144",
"0.7154323",
"0.7139116",
"0.71254885",
"0.70243514",
"0.... | 0.7088071 | 19 |
Use callbacks to share common setup or constraints between actions. | def set_status
@status = Status.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 status_params
params.require(:status).permit(:title)
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 callbacks to share common setup or constraints between actions. | def set_tarefa_usuario_instancia
@tarefa_usuario_instancia = TarefaUsuarioInstancia.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def tarefa_usuario_instancia_params
params.require(:tarefa_usuario_instancia).permit(:tarefa_id, :usuario_insatncia_id, :conteudo_resposta, :respondido, :data_resposta)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Fibonacci sequence here is considered to start at the zeroeth element (which is 0) fibo function returns the nth element of the Fibonacci sequence | def fibo(n)
a, b, c = 0, 0, 0
for i in 1..n
c, b = b, a
a = i== 1 ? 1 : b + c
end
return a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fibo(n)\n if n==1 or n == 2 \n 1\n else\n return fibo(n-1) + fibo(n-2)\n end\nend",
"def fibo(n)\n if n <= 2\n fibo_num = 1\n else\n fibo_num = fibo(n-1) + fibo(n-2)\n end\n fibo_num\nend",
"def fibo_nth(n)\n puts \"computing fibo for n=#{n}\" if @debug\n\n case n\n ... | [
"0.8321902",
"0.82879174",
"0.82728976",
"0.8199846",
"0.8179621",
"0.8175576",
"0.81606174",
"0.8155709",
"0.81255746",
"0.8114961",
"0.80849564",
"0.8077559",
"0.80727077",
"0.80549717",
"0.8053071",
"0.8046464",
"0.8030197",
"0.80083567",
"0.8003313",
"0.79988164",
"0.7996... | 0.78987265 | 30 |
fibo_rec does the same as the fibo function, but recursively | def fibo_rec(n)
return n <= 1 ? n : fibo(n - 1) + fibo(n - 2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fiboRec(no)\n if no == 0\n return [0]\n elsif no == 1\n return fiboRec(0).push(1)\n else\n arr = fiboRec(no-1)\n return arr.push(arr[no-1] + arr[no-2])\n end\nend",
"def fib_rec(n)\n return 0 if n == 1\n return 1 if n == 2\n fib_rec(n - 1) + fib_rec(n - 2)\nend",
"def fibs_rec(n)\n n ==... | [
"0.7589294",
"0.75471646",
"0.75246876",
"0.74658644",
"0.74612075",
"0.7417537",
"0.7409339",
"0.7407692",
"0.73908246",
"0.73687744",
"0.73672754",
"0.73587453",
"0.7357443",
"0.7333702",
"0.7329575",
"0.73270816",
"0.73226243",
"0.7304224",
"0.7301747",
"0.7299018",
"0.728... | 0.8003041 | 0 |
fibs returns n members of the fibonacci sequence | def fibs(n)
a, b, c = 0, 0, 0
arr = [a]
for i in 1..(n - 1)
c, b = b, a
a = i == 1 ? 1 : b + c
arr.push(a)
end
return arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fibs (n) #Non-recursive\n\n\t# n = number of Fibonacci sequence members.\n\t# 0, 1, 1, 2, 3, 5, 8, 13, ..\t\n\tfib_seq = []\n\t(0..n).each do |i|\n\t\tif i == 0\n\t\t\tfib_seq << 0\n\t\telsif i == 1\n\t\t\tfib_seq << 1\n\t\telse\n\t\t\tfib_seq << fib_seq[i-2] + fib_seq[i-1]\n\t\tend\n\tend\n\tfib_seq\nend",
... | [
"0.838995",
"0.8125496",
"0.7992987",
"0.7992987",
"0.7992987",
"0.7992987",
"0.7992987",
"0.79717565",
"0.78579015",
"0.78397197",
"0.78368384",
"0.7821926",
"0.78104156",
"0.7777484",
"0.7773945",
"0.7752124",
"0.7734087",
"0.7722931",
"0.77144307",
"0.7714073",
"0.7709341"... | 0.7633082 | 36 |
fibs_rec does the same as fibs but recursively | def fibs_rec(n, arr = [])
arr.unshift(n - 1 <= 1 ? n - 1 : fibo(n - 2) + fibo(n - 3))
return n - 1 > 0 ? fibs_rec(n - 1, arr) : arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fibs_rec(num, fib = [0,1])\n if num == 1\n 0\n elsif num == fib.length\n fib\n else\n result = fib[fib.length - 2] + fib[fib.length - 1]\n fib.push(result)\n fibs_rec(num, fib)\n end\nend",
"def fibs_rec(n)\n\treturn n if n <= 1\n\tfibs_rec(n-1) + fibs_rec(n-2)\nend",
"def fibs_rec(n, re... | [
"0.8103076",
"0.8034783",
"0.7999035",
"0.7988903",
"0.78606236",
"0.7851647",
"0.78493947",
"0.7823167",
"0.7778283",
"0.7746128",
"0.77309036",
"0.7687901",
"0.76569295",
"0.7624164",
"0.761919",
"0.76112604",
"0.7594795",
"0.7504088",
"0.74760705",
"0.74751574",
"0.7474354... | 0.75277483 | 17 |
PATCH/PUT /sys_configs/1 PATCH/PUT /sys_configs/1.json | def update
respond_to do |format|
if @sys_config.update(sys_config_params)
format.html { redirect_to root_path, notice: 'Configuration was successfully updated.' }
else
format.html { render :edit }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @sysconfig = Sysconfig.find(params[:id])\n\n respond_to do |format|\n if @sysconfig.update_attributes(params[:sysconfig])\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html... | [
"0.71471375",
"0.7082947",
"0.6867171",
"0.6796017",
"0.6743268",
"0.63167894",
"0.6313076",
"0.62595654",
"0.625911",
"0.61927664",
"0.6085189",
"0.6067067",
"0.6045629",
"0.6017324",
"0.595621",
"0.5856663",
"0.5850057",
"0.58116645",
"0.57872164",
"0.57729304",
"0.57436514... | 0.67745334 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_sys_config
@sys_config = SysConfig.config
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 sys_config_params
params.require(:sys_config).permit(:positions_hm_range_1, :positions_hm_range_2, :positions_hm_range_3, :positions_hm_range_4,
:speed_hm_diff_range_1, :speed_hm_diff_range_2, :speed_hm_diff_range_3, :speed_hm_diff_range_4,
:speed_hm_query_range_1, :speed_hm_query_range_2, :speed_hm_query_range_3, :speed_hm_query_range_4,
:bounding_box_gap, :search_radius)
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.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
Load the page and start the subscription (assume only 1 subscription) load a view that gives a frame & some sort of no updates view | def index
# TODO pull out api key before pushing to github & pull out binding prys
res = HTTParty.get URL, headers: HEADERS
message = JSON.parse res.body, symbolize_names: true
if res.code == 200
numSubs = message[:data].count
if numSubs > 0
subId = message[:data][0][:id]
else
# Port is open in our router
params = { url: SUBSCRIPTION_URL, events: ['invitee.created', 'invitee.canceled'] }
newRes = HTTParty.post URL, body: params, headers: HEADERS
message = JSON.parse newRes.body, symbolize_names: true
# TODO need error handling
subId = message[:id]
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_load; end",
"def show\n @title = @page.title\n @pages = @page.find_related_tags\n @case_studies = CaseStudy.tagged_with(@page.tag_list, :any => true)\n @locked = REDIS.exists(\"locks:pages:#{@page.id}\")\n if params[:mercury_frame] == 'true' && !@locked\n REDIS.setex(\"locks:pages:#{... | [
"0.61157286",
"0.6002237",
"0.5973705",
"0.5784241",
"0.5776748",
"0.57329273",
"0.57253885",
"0.568328",
"0.568328",
"0.56478864",
"0.5626142",
"0.5607793",
"0.56028134",
"0.5600409",
"0.5556879",
"0.5556879",
"0.5556879",
"0.5556879",
"0.5556879",
"0.5556879",
"0.5556879",
... | 0.0 | -1 |
Endpoint to save event updates | def save
event = params
# This assumes that all keys exists. Yay no error handling...
toSave = Event.new(update_type: event[:event],
start_time: event[:payload][:event][:start_time_pretty],
end_time: event[:payload][:event][:end_time_pretty],
location: event[:payload][:event][:location],
invitee_name: event[:payload][:invitee][:name],
duration: event[:payload][:event_type][:duration],
event_kind: event[:payload][:event_type][:kind])
toSave.save
render json: {}, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_event(event)\n method = (event.id == nil || event.id == '') ? :post : :put\n query_string = (method == :put) ? \"/#{event.id}\" : ''\n @connection.send(Addressable::URI.parse(events_url + query_string), method, event.to_xml)\n end",
"def save_event(event)\n method = event.new_even... | [
"0.7199514",
"0.6966364",
"0.6937411",
"0.6875301",
"0.68403476",
"0.68078023",
"0.6786235",
"0.6781844",
"0.6756455",
"0.6698402",
"0.6654565",
"0.6646607",
"0.6617489",
"0.6617489",
"0.6599386",
"0.65940815",
"0.65940815",
"0.6581809",
"0.65687793",
"0.6525739",
"0.6516756"... | 0.75483465 | 0 |
Endpoint to load latest event updates | def load
if params[:lastId].to_i > 0
@events = Event.where("id > ? ", params[:lastId].to_i).order({ id: 'desc'})
# There is no limit on this so technically
# if a large amount of events came in, this would fail.
else
# returns nil if no records
@events = Event.order({ id: 'desc'}).last(10)
#render a view that can add on to the current home page.
end
render layout: false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def index\n @events = Event.order('updated_at DESC').page params[:page]\n end",
"def fetch\n @start_time... | [
"0.6722964",
"0.6629522",
"0.65696067",
"0.65486217",
"0.65118235",
"0.64730066",
"0.64699817",
"0.6424314",
"0.64025664",
"0.6366093",
"0.636586",
"0.6364617",
"0.6322363",
"0.62903315",
"0.62785006",
"0.62559325",
"0.622742",
"0.62156326",
"0.62154824",
"0.6209338",
"0.6202... | 0.59857494 | 41 |
Endpoint to hit manually to delete borked subscriptions Mainly to clear out subscriptions as I am testing the app. | def delete
res = HTTParty.get URL, headers: HEADERS
message = JSON.parse res.body, symbolize_names: true
if res.code == 200
numSubs = message[:data].count
if numSubs > 0
message[:data].each do |sub|
id = sub[:id]
delRes = HTTParty.delete "#{URL}/#{id}", headers: HEADERS
#TODO handle status codes
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_subscriptions\n end",
"def clear_subs\n instagram_client.subscriptions.each do |sub|\n instagram_client.delete_subscription(id: sub.id)\n end\n\n redirect_to list_subs_path\n end",
"def remove_subscription\n buyer = @current_user\n customer_id = buyer.stripe_customer_id\n cu... | [
"0.8554535",
"0.77777433",
"0.73498684",
"0.7301633",
"0.7301074",
"0.7257956",
"0.72368157",
"0.71376634",
"0.709631",
"0.70489246",
"0.70489246",
"0.7040323",
"0.703003",
"0.7024939",
"0.69780254",
"0.6962605",
"0.69370234",
"0.6899319",
"0.6874277",
"0.68586993",
"0.685468... | 0.0 | -1 |
Writer method. We want to take this value, baby_name, and write into this variable, my_name. This method allows me to give a baby a name. | def name=(the_baby_name)
@my_name = the_baby_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_the_boat(name)\n @name = name\n puts @name\n end",
"def update_boat_name=(name)\n @name = name\n puts @name\n end",
"def name=(value)\n if @playing_girl\n @name_girl = value\n else\n @name_boy = value\n end\n $game_actors[1].name = value\n end",
"def ... | [
"0.7281455",
"0.6788559",
"0.63908225",
"0.62913525",
"0.61911356",
"0.6176719",
"0.61533916",
"0.6133584",
"0.61308324",
"0.61068934",
"0.60610515",
"0.60561764",
"0.6042773",
"0.6016939",
"0.59930706",
"0.59871316",
"0.59842134",
"0.59803796",
"0.59663296",
"0.596017",
"0.5... | 0.77098846 | 0 |
Reader method. This method allows me to ask for a baby's name. | def name
@my_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gets_name\n\t\tputs \"Quel est ton blaze?\"\n\t\tname = gets.chomp\n\tend",
"def req_name\n\t\tputs \"What is your name?\"\n\t\t@name = gets.chomp\n\tend",
"def get_name \n\tputs \"What is your surname?:\"\n\tname = gets.chomp \n\tprint_thanks \n\tif check_name_ok?(name)\n\t\tthen print_new_name(name) end\... | [
"0.70643014",
"0.7015774",
"0.69390315",
"0.6937063",
"0.69319123",
"0.69174486",
"0.68904847",
"0.6849673",
"0.6839566",
"0.67826855",
"0.67786586",
"0.67406845",
"0.67299795",
"0.659823",
"0.65799487",
"0.6546953",
"0.652412",
"0.64837873",
"0.64797753",
"0.6441822",
"0.643... | 0.0 | -1 |
Groups records on the table. | def group_by(field_or_proc, &block)
proc = case field_or_proc
when String, Symbol
lambda { |obj| obj.public_send(field_or_proc) }
when Proc
field_or_proc
else
raise ArgumentError, 'group_by first argument must be a String, Symbol or Proc'
end
options[:group] = { block: block, proc: proc }
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group\n return if record.respond_to?(:where)\n record.group\n end",
"def group_by(key, records)\n records.inject({}) do |table, record|\n table[record.send(key)] ||= []\n table.tap {|x| x[record.send(key)] << record}\n end\n end",
"def group\n reco... | [
"0.6925584",
"0.67203915",
"0.65342426",
"0.6350871",
"0.6344077",
"0.63282186",
"0.629385",
"0.62315774",
"0.621344",
"0.61573315",
"0.6110336",
"0.59965926",
"0.5964053",
"0.59407884",
"0.58891433",
"0.583842",
"0.58224183",
"0.5784355",
"0.57554156",
"0.5733418",
"0.573040... | 0.0 | -1 |
Create a new feeds key | def reset_rss_key
if request.post?
if User.current.rss_token
User.current.rss_token.destroy
User.current.reload
end
User.current.rss_key
flash[:notice] = l(:notice_feeds_access_key_reseted)
end
redirect_to my_account_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_key\n self.key = Digest::MD5.hexdigest(self.official_id.to_s + self.sent_to_email)\n end",
"def create_key\n self.key = loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless Api.exists?(key: random_token)\n end\n end",
"def create_object_ke... | [
"0.6881192",
"0.6559187",
"0.6483687",
"0.6364801",
"0.63581127",
"0.62568873",
"0.6249337",
"0.62086064",
"0.61699754",
"0.6168674",
"0.6111239",
"0.59899944",
"0.5988541",
"0.5923705",
"0.59156543",
"0.5907812",
"0.58979",
"0.5892892",
"0.5875621",
"0.5866555",
"0.58312374"... | 0.0 | -1 |
Create a new API key | def reset_api_key
if request.post?
if User.current.api_token
User.current.api_token.destroy
User.current.reload
end
User.current.api_key
flash[:notice] = l(:notice_api_access_key_reseted)
end
redirect_to my_account_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_api_key(id)\n request(:post, \"/users/#{id}/make_new_api_key.json\")\n end",
"def generate_api_key\n key = Digest::SHA1.hexdigest(Time.now.to_s + rand(12345678).to_s)[1..10]\n self.api_key = self._id.to_s + key\n end",
"def generate_api_key\n key = Digest::SHA1.hexdigest(Time.now... | [
"0.81791383",
"0.7848778",
"0.7848778",
"0.76954633",
"0.7665909",
"0.76498014",
"0.76315176",
"0.75974274",
"0.75376576",
"0.75264925",
"0.74848276",
"0.74664026",
"0.74567825",
"0.74554676",
"0.74554676",
"0.744346",
"0.74207664",
"0.7400597",
"0.7399058",
"0.7375363",
"0.7... | 0.0 | -1 |
User's page layout configuration | def page_layout
@user = User.current
@blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup
@block_options = []
BLOCKS.each do |k, v|
unless @blocks.values.flatten.include?(k)
@block_options << [l("my.blocks.#{v}", :default => [v, v.to_s.humanize]), k.dasherize]
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_layout\n @user = User.current\n @blocks = @user.pref.my_page_layout\n end",
"def default_layout\n site.config.page_layout\n end",
"def layout; end",
"def layouts; end",
"def layouts; end",
"def set_layout\n if 1==1\n 'application'\n else\n 'dean'\n end\n end",
... | [
"0.8210585",
"0.7665285",
"0.7431145",
"0.73952293",
"0.73952293",
"0.7355655",
"0.72577584",
"0.72265536",
"0.71821237",
"0.71614045",
"0.7139431",
"0.7120067",
"0.70993924",
"0.7091632",
"0.7007687",
"0.6997936",
"0.6977893",
"0.6977893",
"0.69667995",
"0.69259274",
"0.6921... | 0.75134397 | 3 |
Add a block to user's page The block is added on top of the page params[:block] : id of the block to add | def add_block
block = params[:block].to_s.underscore
if block.present? && BLOCKS.key?(block)
@user = User.current
layout = @user.pref[:my_page_layout] || {}
# remove if already present in a group
%w(top left right).each {|f| (layout[f] ||= []).delete block }
# add it on top
layout['top'].unshift block
@user.pref[:my_page_layout] = layout
@user.pref.save
end
redirect_to my_page_layout_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_block\n @user = User.current\n @user.pref.add_block params[:block]\n @user.pref.save\n redirect_to my_page_layout_path\n end",
"def block(user)\n post \"blocks/create/#{user}\"\n end",
"def create\n @block = Block.new(params[:block])\n if @block.save\n redirect_to :controlle... | [
"0.8600246",
"0.71386343",
"0.7025166",
"0.6997502",
"0.69713867",
"0.69010395",
"0.6866186",
"0.6832351",
"0.6832351",
"0.6832351",
"0.6832351",
"0.6832351",
"0.68024707",
"0.67686033",
"0.6676958",
"0.6666267",
"0.66363245",
"0.6607572",
"0.6549461",
"0.65201485",
"0.646099... | 0.83090174 | 2 |
Remove a block to user's page params[:block] : id of the block to remove | def remove_block
block = params[:block].to_s.underscore
@user = User.current
# remove block in all groups
layout = @user.pref[:my_page_layout] || {}
%w(top left right).each {|f| (layout[f] ||= []).delete block }
@user.pref[:my_page_layout] = layout
@user.pref.save
redirect_to my_page_layout_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_block\n @user = User.current\n @user.pref.remove_block params[:block]\n @user.pref.save\n redirect_to my_page_layout_path\n end",
"def destroy_block(user)\n delete \"blocks/destroy/#{user}\"\n end",
"def destroy\n @block = Block.find(params[:id])\n @block.destroy\n redirect... | [
"0.87870866",
"0.7701921",
"0.72243357",
"0.7205291",
"0.7145489",
"0.7129225",
"0.70501494",
"0.69569886",
"0.67895365",
"0.67797285",
"0.6778552",
"0.67519945",
"0.6715996",
"0.66967225",
"0.6665098",
"0.6563051",
"0.65491647",
"0.6517353",
"0.6517353",
"0.6482568",
"0.6434... | 0.81826913 | 2 |
Change blocks order on user's page params[:group] : group to order (top, left or right) params[:list(top|left|right)] : array of block ids of the group | def order_blocks
group = params[:group]
@user = User.current
if group.is_a?(String)
group_items = (params["blocks"] || []).collect(&:underscore)
group_items.each {|s| s.sub!(/^block_/, '')}
if group_items and group_items.is_a? Array
layout = @user.pref[:my_page_layout] || {}
# remove group blocks if they are presents in other groups
%w(top left right).each {|f|
layout[f] = (layout[f] || []) - group_items
}
layout[group] = group_items
@user.pref[:my_page_layout] = layout
@user.pref.save
end
end
render :nothing => true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_blocks\n group = params[:group]\n @user = User.current\n if group.is_a?(String)\n group_items = (params[\"blocks\"] || []).collect(&:underscore)\n group_items.each {|s| s.sub!(/^block_/, '')}\n # remove group blocks if they are presents in other groups\n group_items.each {|s|... | [
"0.86715496",
"0.6534045",
"0.60939085",
"0.6050068",
"0.6050068",
"0.56543916",
"0.5572878",
"0.5536601",
"0.5508139",
"0.5508139",
"0.5471137",
"0.5390857",
"0.5379566",
"0.537352",
"0.5344416",
"0.5341021",
"0.529625",
"0.5292586",
"0.5248688",
"0.52297926",
"0.5215273",
... | 0.85467744 | 2 |
This smells of :reek:NilCheck because it is nil check. | def no_available_plans
plans.default.nil? && plans.published.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nil?() end",
"def nil?() end",
"def null?; false end",
"def nil?() true; end",
"def nil?; false; end",
"def returns_nil; end",
"def null?; @null; end",
"def refute_nil(obj, msg = T.unsafe(nil)); end",
"def null?\n false\n end",
"def null?\n false\n end",
"def nil?\n true\n ... | [
"0.73359126",
"0.73359126",
"0.7125035",
"0.7042454",
"0.6991258",
"0.69869155",
"0.6830135",
"0.67456585",
"0.6637218",
"0.6637218",
"0.6606068",
"0.6606068",
"0.6592574",
"0.6583866",
"0.6583866",
"0.6583866",
"0.6564176",
"0.6546475",
"0.65064675",
"0.6496761",
"0.64487326... | 0.0 | -1 |
boosters: [alphax + betay + gammaz]/normalizer, capped at 1 | def run_combiner (combiner)
combinePred = combiner[:combinePred]
normalizer = combiner[:normalizer]
coefficients = ""
parts = ""
combiner[:parts].each_with_index do |part,index|
parts += "OPTIONAL { ?target <#{part[:pred]}> ?t#{index} . }
BIND (IF (BOUND(?t#{index}), ?t#{index}, 0) AS ?p#{index}) .\n"
if index > 0
coefficients += " + "
end
coefficients += "(xsd:float(#{part[:coef]})*?p#{index})"
end
query = "PREFIX mt: <#{MT}>
DELETE {
GRAPH <#{settings.graph}> {
?target <#{combinePred}> ?oldscore .
}
}INSERT {
GRAPH <#{settings.graph}> {
?target <#{combinePred}> ?newscore .
}
} WHERE {
GRAPH <#{settings.graph}> {
?target a mt:Mapping.
OPTIONAL { ?target <#{combinePred}> ?oldscore. }
{
SELECT ?target (xsd:float(#{coefficients})/xsd:float(#{normalizer})) AS ?newscoreTemp WHERE {
?target a mt:Mapping.
#{parts}
}
}
BIND(IF(?newscoreTemp > 1, 1, ?newscoreTemp) AS ?newscore)
}
}"
sparqlUpdate(query)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boost\n 1.0\n end",
"def boost_all(factor)\n all.each do |hit|\n hit.score *= factor\n end\n end",
"def adaBoostTrainDS(dataArr,classLabels,numIt=40)\n weakClassArr = []\n m = shape(dataArr)[0]\n d = Array.new(m, 1.0/m) # init D to all equal\n aggClassEst = zeros... | [
"0.58671194",
"0.56414187",
"0.55580044",
"0.54415476",
"0.5369536",
"0.5358373",
"0.51752067",
"0.5077685",
"0.50287277",
"0.49967274",
"0.4985814",
"0.4985814",
"0.4966721",
"0.48664173",
"0.4860961",
"0.48512316",
"0.48374796",
"0.48315978",
"0.48285934",
"0.48091468",
"0.... | 0.0 | -1 |
boosters: [base + coef(max(min(1,scoretarget),MIN))+...]/maxTotal, capped at 1 | def run_booster (booster)
boosterPred = booster[:boostPred]
boosted = booster[:boosted]
coefficients = ""
max = booster[:maxTotal]
parts = ""
booster[:parts].each_with_index do |part,index|
target = part[:target]
parts += "OPTIONAL { ?target <#{part[:pred]}> ?t#{index} . }
BIND (IF (BOUND(?t#{index}), xsd:float(?t#{index}) - #{target}, 0) AS ?p#{index}) .\n"
if index > 0
coefficients += " + "
end
coef = part[:coef]
min = part[:min]
coefficients += "(xsd:float(#{coef})*(IF(?p#{index} < xsd:float(#{min}), xsd:float(#{min}), IF( ?p#{index} > 1, 1, ?p#{index}))))"
end
query = "PREFIX mt: <#{MT}>
DELETE {
GRAPH <#{settings.graph}> {
?target <#{boosterPred}> ?oldscore .
}
}INSERT {
GRAPH <#{settings.graph}> {
?target <#{boosterPred}> ?newscore .
}
} WHERE {
GRAPH <#{settings.graph}> {
?target a mt:Mapping.
OPTIONAL { ?target <#{boosterPred}> ?oldscore. }
{
SELECT ?target IF(?tempNew < 0, 0, IF(?tempNew/xsd:float(#{max}) > 1, 1, ?tempNew/xsd:float(#{max}))) AS ?newscore WHERE {
SELECT ?target xsd:float(?base + (#{coefficients})) AS ?tempNew WHERE {
?target a mt:Mapping.
OPTIONAL {
?target <#{boosted}> ?b .
}
BIND(IF(BOUND(?b), ?b, 0) as ?base)
#{parts}
}
}
}
}
}"
sparqlUpdate(query)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boost\n 1.0\n end",
"def calculate_score boosts\n @score ||= (if @combinations.empty?\n 0 # Optimization.\n else\n # Note: Was @backend.score(@combinations) - indirection for maximum flexibility.\n @combinations.score + boosts.boost_for(@combinatio... | [
"0.7086108",
"0.70011836",
"0.67556906",
"0.6742557",
"0.6509831",
"0.6509831",
"0.57990867",
"0.577759",
"0.57134575",
"0.5678173",
"0.56283814",
"0.56007963",
"0.55456495",
"0.54916656",
"0.5462748",
"0.540979",
"0.5360731",
"0.53549534",
"0.53490657",
"0.53380984",
"0.5323... | 0.5958026 | 6 |
Flood paths are connections from one mapping to another along which the given flooder is activated. These paths are built for all flooders on startup, as they only need to be built once and should provide a performance increase in the queries. The flood paths are stored in a graph for the flooder the graph uri is build by taking the flooder uri and appending /graph to it. | def build_flood_paths (flooder)
flooderURI = flooder[:flooder]
floodFrom = flooder[:floodFrom] || flooder[:path] || "<http://www.w3.org/2004/02/skos/core#broader>/^<http://www.w3.org/2004/02/skos/core#broader>"
floodTo = flooder[:floodTo] || flooder[:path] || "<http://www.w3.org/2004/02/skos/core#broader>/^<http://www.w3.org/2004/02/skos/core#broader>"
floodToInv = flooder[:floodToInv]
floodFromInv = flooder[:floodFromInv]
cleanup = "PREFIX mt: <#{MT}>
DELETE {
GRAPH <#{flooderURI}/graph> {
?target mt:floodFrom ?origin .
}
} WHERE {
GRAPH <#{flooderURI}/graph> {
?target mt:floodFrom ?origin .
}
}"
sparqlUpdate cleanup
restriction = flooder[:pathRestriction] || ""
floodToInvQ = ""
if floodToInv
floodToInvQ = "UNION {?to #{floodToInv} ?floodTo.}"
end
floodFromInvQ = ""
if floodFromInv
floodFromInvQ = "UNION {?to #{floodFromInv} ?floodTo.}"
end
flooding = " {{?floodTo #{floodTo} ?to.} #{floodToInvQ}}
{{?floodFrom #{floodFrom} ?from.} #{floodFromInvQ}}
"
query = "PREFIX mt: <#{MT}>
INSERT {
GRAPH <#{flooderURI}/graph> {
?target mt:floodFrom ?flooder .
}
} WHERE {
GRAPH <#{settings.graph}> {
?target a mt:Mapping;
mt:mapsFrom ?from;
mt:mapsTo ?to.
?flooder a mt:Mapping;
mt:mapsFrom ?floodFrom;
mt:mapsTo ?floodTo.
#{restriction}
#{flooding}
}
}"
sparqlUpdate query
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_paths_for_clearings\n CLEARING_ADJACENCY_LINKS.each do |clearing, adjacents|\n adjacents.each do |adj|\n clearings[clearing].add_path(clearings[adj])\n end\n end\n end",
"def fill_path_weights\r\n\r\n #for each vertex, each level, find the shortest pa... | [
"0.5261304",
"0.50428826",
"0.48480588",
"0.48448434",
"0.48013595",
"0.47480488",
"0.47362193",
"0.47235966",
"0.470354",
"0.46921924",
"0.46890816",
"0.46758726",
"0.46088687",
"0.4580606",
"0.45711395",
"0.45514587",
"0.4542081",
"0.45235693",
"0.45183894",
"0.4504197",
"0... | 0.792001 | 0 |
Get the all locale translations structure. | def locale_translations
@locale_scope ||= begin
locale_path = "#{@locale}.yml"
locale_path = File.join(@locales_dir, locale_path) if @locales_dir
YAML.load_file(locale_path).fetch(@locale)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translations\n translated_locales = @bindings[:object].translated_locales\n available_locales.collect do |locale|\n translated_locales.include?(locale) ? @bindings[:object].translation_for(locale) : @bindings[:object].translations.new({ locale: locale })\n end\n ... | [
"0.7555822",
"0.75394905",
"0.74821657",
"0.7149812",
"0.71381724",
"0.7101431",
"0.71011144",
"0.70982504",
"0.70965403",
"0.70718986",
"0.7014723",
"0.699985",
"0.6948834",
"0.6928673",
"0.6915516",
"0.6911936",
"0.6908458",
"0.6887416",
"0.6823913",
"0.68165743",
"0.673523... | 0.6793302 | 20 |
The root scope of the client locale, found on the locale file. | def locale_scope
I18n::Scope.new(locale_translations)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_locale\n Thread.current[:\"localite:locale\"] || base\n end",
"def get_language_root\n self_and_ancestors.find_by(language_root: true)\n end",
"def default_locale\n return nil unless localized?\n u_lc = I18n.locale.to_sym\n available_locales.include?(u_lc) ? u_lc : ... | [
"0.63497055",
"0.6079783",
"0.5964192",
"0.58889776",
"0.582838",
"0.57870376",
"0.5731655",
"0.57221025",
"0.57221025",
"0.56979865",
"0.5687736",
"0.56795007",
"0.5667674",
"0.5646845",
"0.5631991",
"0.55988264",
"0.5596214",
"0.5578557",
"0.5552365",
"0.55408305",
"0.55261... | 0.67087805 | 0 |
Il faut absolument fermer le browser pour killer la variable session[:initialized] et reinitialiser I18n.locale devrait changer la locale a 'enus' | def set_locale_from_browser
logger.debug "*** Setting locale"
if (session[:locale].nil?)
parsed_locale = extract_locale_from_accept_language_header
if ( I18n.available_locales.include?( parsed_locale.to_sym ) )
logger.debug("*** Accept-Language #{request.env['HTTP_ACCEPT_LANGUAGE']} was found")
session[:locale] = parsed_locale
else
logger.debug("*** Accept-Language #{request.env['HTTP_ACCEPT_LANGUAGE']} was not found")
session[:locale] = 'en'
end
elsif (!params[:locale].nil?)
if ( I18n.available_locales.include?( params[:locale].to_sym ) )
logger.debug("*** params[:locale] = " + params[:locale] + " is supported")
session[:locale] = params[:locale]
else
logger.debug("*** params[:locale] = " + params[:locale] + " is not supported")
session[:locale] = 'en'
end
end
I18n.locale = session[:locale]
logger.debug "*** Locale = #{I18n.locale}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_session\n init_language\n set_page_cache_directory\n init_views\n init_votes\n init_cookies\n end",
"def init_language\n # negotiate the language with the browser if not currently set \n # in the session\n session[:language] = negotiate_language if session[:language].nil?\n\n ... | [
"0.7228031",
"0.71063036",
"0.697143",
"0.69362193",
"0.6901256",
"0.6879518",
"0.67213935",
"0.66809165",
"0.66476244",
"0.66329753",
"0.6597566",
"0.6588611",
"0.654276",
"0.6508525",
"0.6487681",
"0.64797115",
"0.64507395",
"0.64380926",
"0.64295375",
"0.6406277",
"0.64038... | 0.5807172 | 66 |
rubocop:enable Metrics/AbcSize, Metrics/MethodLength rubocop:disable Metrics/MethodLength | def play_single_round
loop do
clear
deal_initial_cards
show_cards
turn_cycle
update_score
show_result
break if someone_won_tournament?
quit_early unless play_again?
reset
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def schubert; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def custom; end",
"def custom; end",
"def offences_by; end",
"def strate... | [
"0.76383394",
"0.6412278",
"0.6275317",
"0.6275317",
"0.62119263",
"0.61873007",
"0.61601406",
"0.61601406",
"0.61601406",
"0.61601406",
"0.59716433",
"0.59716433",
"0.5948495",
"0.5897722",
"0.5875557",
"0.58643574",
"0.5855076",
"0.5790321",
"0.5788935",
"0.5788935",
"0.576... | 0.0 | -1 |
rubocop:disable Style/MethodName rubocop:disable Style/OpMethod | def аватар text
Data.emoji(text, exact: false, number: 0, lang: :ru)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def operation; end",
"def operations; end",
"def operations; end",
"def op; end",
"def private_method\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def suivre; end",
"def probers; end",
"def implementation; end",
"def impleme... | [
"0.7264822",
"0.68170726",
"0.6627213",
"0.6627213",
"0.6433684",
"0.6126383",
"0.6075497",
"0.6075497",
"0.6075497",
"0.6075497",
"0.60552406",
"0.5984614",
"0.5975528",
"0.5975528",
"0.5963007",
"0.5955506",
"0.5955506",
"0.59384394",
"0.5917733",
"0.59062916",
"0.5890878",... | 0.0 | -1 |
GET /hr/config/discipline_types GET /hr/config/discipline_types.json | def index
@hr_config_discipline_types = Hr::Config::DisciplineType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def types\n configuration[:types]\n end",
"d... | [
"0.7222895",
"0.68726057",
"0.66277295",
"0.655945",
"0.6552935",
"0.6526827",
"0.6487009",
"0.63101894",
"0.6307604",
"0.626727",
"0.62545425",
"0.6218064",
"0.6177747",
"0.6176772",
"0.6016547",
"0.59945905",
"0.5944777",
"0.59345037",
"0.58687425",
"0.5845839",
"0.5815358"... | 0.7852595 | 0 |
GET /hr/config/discipline_types/1 GET /hr/config/discipline_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @hr_config_discipline_types = Hr::Config::DisciplineType.all\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def show\n @discipline_typ... | [
"0.7612647",
"0.71866477",
"0.68874454",
"0.681961",
"0.6524712",
"0.64310956",
"0.64234084",
"0.63629043",
"0.6205033",
"0.61821276",
"0.6159565",
"0.6076621",
"0.6022223",
"0.5990906",
"0.59389156",
"0.5915079",
"0.59118193",
"0.5839583",
"0.58383304",
"0.57824576",
"0.5770... | 0.0 | -1 |
POST /hr/config/discipline_types POST /hr/config/discipline_types.json | def create
@hr_config_discipline_type = Hr::Config::DisciplineType.new(hr_config_discipline_type_params)
respond_to do |format|
if @hr_config_discipline_type.save
format.html { redirect_to @hr_config_discipline_type, notice: 'Discipline type was successfully created.' }
format.json { render :show, status: :created, location: @hr_config_discipline_type }
else
format.html { render :new }
format.json { render json: @hr_config_discipline_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @hr_config_discipline_types = Hr::Config::DisciplineType.all\n end",
"def create\n @discipline_type = DisciplineType.new(params[:discipline_type])\n\n respond_to do |format|\n if @discipline_type.save\n format.html { redirect_to @discipline_type, :notice => 'Tipo de disciplina c... | [
"0.6702746",
"0.6538874",
"0.6354929",
"0.62524533",
"0.6246494",
"0.6245315",
"0.6233283",
"0.61518484",
"0.61518484",
"0.6116841",
"0.6116841",
"0.58884126",
"0.58710396",
"0.58417284",
"0.5782723",
"0.5777549",
"0.57768357",
"0.5718048",
"0.56962794",
"0.56754047",
"0.5650... | 0.7097678 | 0 |
PATCH/PUT /hr/config/discipline_types/1 PATCH/PUT /hr/config/discipline_types/1.json | def update
respond_to do |format|
if @hr_config_discipline_type.update(hr_config_discipline_type_params)
format.html { redirect_to @hr_config_discipline_type, notice: 'Discipline type was successfully updated.' }
format.json { render :show, status: :ok, location: @hr_config_discipline_type }
else
format.html { render :edit }
format.json { render json: @hr_config_discipline_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @discipline_type = DisciplineType.find(params[:id])\n\n respond_to do |format|\n if @discipline_type.update_attributes(params[:discipline_type])\n format.html { redirect_to @discipline_type, :notice => 'Tipo de disciplina atualizado com sucesso.' }\n format.json { head :no_con... | [
"0.67636883",
"0.6253525",
"0.6180455",
"0.6162052",
"0.6154335",
"0.61219496",
"0.60997987",
"0.6075615",
"0.6068102",
"0.6062248",
"0.60564446",
"0.60506326",
"0.6037525",
"0.6026557",
"0.6013677",
"0.6010247",
"0.59855956",
"0.5978234",
"0.5969341",
"0.5952249",
"0.5928074... | 0.72596556 | 0 |
DELETE /hr/config/discipline_types/1 DELETE /hr/config/discipline_types/1.json | def destroy
@hr_config_discipline_type.destroy
respond_to do |format|
format.html { redirect_to hr_config_discipline_types_url, notice: 'Discipline type was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @discipline_type = DisciplineType.find(params[:id])\n @discipline_type.destroy\n\n respond_to do |format|\n format.html { redirect_to discipline_types_url, :notice => 'Tipo de disciplina excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n ... | [
"0.7193676",
"0.6853794",
"0.67405784",
"0.6647212",
"0.66164833",
"0.6584385",
"0.6583263",
"0.6567717",
"0.6566776",
"0.6556137",
"0.65439403",
"0.65271336",
"0.6507875",
"0.6499804",
"0.6497381",
"0.64961725",
"0.6489565",
"0.64695174",
"0.6450735",
"0.6425926",
"0.6409018... | 0.7698277 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_hr_config_discipline_type
@hr_config_discipline_type = Hr::Config::DisciplineType.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def hr_config_discipline_type_params
params.require(:hr_config_discipline_type).permit(:code, :title, :khtitle, :description, :khdescription, :usercreate, :userupdate)
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 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = super
invalid_properties
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.... | [
"0.76497203",
"0.76497203",
"0.76497203",
"0.76497203",
"0.7356452",
"0.7334807",
"0.72685325",
"0.7238964",
"0.7231359",
"0.72258264",
"0.7208294",
"0.71760833",
"0.7170241",
"0.7170241",
"0.7170241",
"0.7170241",
"0.7170241",
"0.7170241",
"0.7170241",
"0.7170241",
"0.717024... | 0.7637422 | 11 |
Check to see if the all the properties in the model are valid | def valid?
return false if !super
base_justification_validator = EnumAttributeValidator.new('String', ['NotDefined', 'Top', 'Center', 'Bottom'])
return false unless base_justification_validator.valid?(@base_justification)
column_gap_rule_validator = EnumAttributeValidator.new('String', ['SingleSpacingGap', 'OneAndHalfSpacingGap', 'DoubleSpacingGap', 'Exactly', 'Multiple'])
return false unless column_gap_rule_validator.valid?(@column_gap_rule)
row_gap_rule_validator = EnumAttributeValidator.new('String', ['SingleSpacingGap', 'OneAndHalfSpacingGap', 'DoubleSpacingGap', 'Exactly', 'Multiple'])
return false unless row_gap_rule_validator.valid?(@row_gap_rule)
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :... | [
"0.78992486",
"0.78992486",
"0.70971805",
"0.70782334",
"0.7032205",
"0.7031276",
"0.69510347",
"0.6869891",
"0.6858077",
"0.6858077",
"0.68287027",
"0.6823878",
"0.6820306",
"0.68144894",
"0.6794656",
"0.6752167",
"0.66843414",
"0.6676546",
"0.6667755",
"0.66296124",
"0.6618... | 0.0 | -1 |
Custom attribute writer method checking allowed values (enum). | def base_justification=(base_justification)
validator = EnumAttributeValidator.new('String', ['NotDefined', 'Top', 'Center', 'Bottom'])
unless validator.valid?(base_justification)
fail ArgumentError, 'invalid value for "base_justification", must be one of #{validator.allowable_values}.'
end
@base_justification = base_justification
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end",
"def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n ... | [
"0.7087152",
"0.6480326",
"0.6429858",
"0.62265116",
"0.61428237",
"0.58098733",
"0.57501006",
"0.5743426",
"0.57373345",
"0.5708213",
"0.56996876",
"0.5677225",
"0.5603006",
"0.5594775",
"0.5547809",
"0.5538741",
"0.5535209",
"0.55286884",
"0.5435018",
"0.5430014",
"0.541900... | 0.0 | -1 |
Custom attribute writer method checking allowed values (enum). | def column_gap_rule=(column_gap_rule)
validator = EnumAttributeValidator.new('String', ['SingleSpacingGap', 'OneAndHalfSpacingGap', 'DoubleSpacingGap', 'Exactly', 'Multiple'])
unless validator.valid?(column_gap_rule)
fail ArgumentError, 'invalid value for "column_gap_rule", must be one of #{validator.allowable_values}.'
end
@column_gap_rule = column_gap_rule
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end",
"def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n ... | [
"0.7088127",
"0.64820594",
"0.6429773",
"0.6227689",
"0.61418885",
"0.5809922",
"0.57507086",
"0.5743216",
"0.5736045",
"0.5708027",
"0.57014966",
"0.56777334",
"0.5601988",
"0.55947953",
"0.55464065",
"0.55371004",
"0.55344343",
"0.5528221",
"0.5434983",
"0.54312384",
"0.541... | 0.0 | -1 |
Custom attribute writer method checking allowed values (enum). | def row_gap_rule=(row_gap_rule)
validator = EnumAttributeValidator.new('String', ['SingleSpacingGap', 'OneAndHalfSpacingGap', 'DoubleSpacingGap', 'Exactly', 'Multiple'])
unless validator.valid?(row_gap_rule)
fail ArgumentError, 'invalid value for "row_gap_rule", must be one of #{validator.allowable_values}.'
end
@row_gap_rule = row_gap_rule
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end",
"def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n ... | [
"0.7088127",
"0.64820594",
"0.6429773",
"0.6227689",
"0.61418885",
"0.5809922",
"0.57507086",
"0.5743216",
"0.5736045",
"0.5708027",
"0.57014966",
"0.56777334",
"0.5601988",
"0.55947953",
"0.55464065",
"0.55371004",
"0.55344343",
"0.5528221",
"0.5434983",
"0.54312384",
"0.541... | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
type == o.type &&
hide_placeholders == o.hide_placeholders &&
base_justification == o.base_justification &&
min_column_width == o.min_column_width &&
column_gap_rule == o.column_gap_rule &&
column_gap == o.column_gap &&
row_gap_rule == o.row_gap_rule &&
row_gap == o.row_gap &&
items == o.items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en... | [
"0.7291717",
"0.7188103",
"0.70395297",
"0.7007927",
"0.68874705",
"0.6861532",
"0.6707156",
"0.6660597",
"0.66147524",
"0.658478",
"0.6584619",
"0.6580019",
"0.65543133",
"0.6543933",
"0.65068495",
"0.6479513",
"0.6456241",
"0.6415999",
"0.6412208",
"0.6412208",
"0.6412208",... | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[type, hide_placeholders, base_justification, min_column_width, column_gap_rule, column_gap, row_gap_rule, row_gap, items].hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ... | [
"0.71217793",
"0.7040367",
"0.7040367",
"0.7040367",
"0.7040367",
"0.7040367",
"0.7040367",
"0.7040367",
"0.6894633",
"0.67846686",
"0.6707134",
"0.6699425",
"0.6689081",
"0.66692895",
"0.6488852",
"0.6462524",
"0.6462524",
"0.64445853",
"0.6413064",
"0.639746",
"0.63895506",... | 0.0 | -1 |
cat input.txt | xargs ruby keyword_url_formatter.rb >> output.txt | def replace_white_space keyword
keywords = []
keywords << keyword.gsub(' ', '+')
keywords << keyword.gsub(' ', '-')
keywords << keyword.gsub(' ', '_')
keywords << keyword.gsub(' ', '%20')
keywords << keyword.gsub(' ', '')
keywords
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_input source, options\n entries = if source.match /^http/\n http = Atom::HTTP.new\n\n setup_http http, options\n\n http_to_entries source, options[:complete], http\n elsif source == '-'\n stdin_to_entries\n else\n dir_to_e... | [
"0.5543128",
"0.5484294",
"0.53532255",
"0.53261036",
"0.5263071",
"0.5130488",
"0.503286",
"0.4953369",
"0.49079633",
"0.48873085",
"0.48873085",
"0.4884065",
"0.48769855",
"0.48424837",
"0.4840027",
"0.48306558",
"0.4828417",
"0.4828417",
"0.48150805",
"0.48026899",
"0.4793... | 0.0 | -1 |
Response should be consumed before sending next request via the same persistent connection. If an exception occurred, there may be no response so a connection has to be recreated. | def recreate_client
@http.close
create_client
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_response(response)\n loop do\n begin\n bytes = @client.write_nonblock(response)\n msg_response\n break if bytes >= response.size\n response.slice!(0, bytes)\n rescue Errno::EAGAIN\n IO.select(nil,[@client], nil)\n retry # spam unti... | [
"0.59073013",
"0.5902893",
"0.58891433",
"0.5851986",
"0.58250004",
"0.570546",
"0.5668195",
"0.5651887",
"0.56084377",
"0.5598241",
"0.55950975",
"0.5582975",
"0.5582975",
"0.55681133",
"0.55605686",
"0.5552956",
"0.55428916",
"0.5540625",
"0.5536135",
"0.55356866",
"0.55206... | 0.0 | -1 |
There is a queue for the selfcheckout tills at the supermarket. Your task is write a function to calculate the total time required for all the customers to check out! input customers: an array of positive integers representing the queue. Each integer represents a customer, and its value is the amount of time they require to check out. n: a positive integer, the number of checkout tills. output The function should return an integer, the total time required. | def queue_time(customers, n)
if n >= customers.length && !customers.empty?
customers.max
elsif customers.empty?
0
else
time_steps = []
current_queue = customers[0..(n - 1)]
addition_to_queue = []
until current_queue.empty?
customers.shift(n)
time_steps << current_queue.min
min_wait_time = current_queue.min
current_queue.map! { |item| item - min_wait_time }
n = current_queue.count(0)
current_queue.reject! { |x| x == 0 }
addition_to_queue = customers[0..(n - 1)]
current_queue += addition_to_queue
end
time_steps.sum
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_time(customers, n)\n return customers.inject(0, &:+) if n == 1\n time = 0\n cust_num = customers.size\n tills = Array.new(n > cust_num ? cust_num : n) \n tills = tills.map do |till|\n customers.shift\n end\n until tills.all?(&:zero?) && customers.empty?\n tills.map! do |till|... | [
"0.827027",
"0.77864546",
"0.7744593",
"0.75245076",
"0.75228417",
"0.7441975",
"0.6134081",
"0.56285244",
"0.5606069",
"0.5585157",
"0.5559285",
"0.5374144",
"0.52781135",
"0.5277836",
"0.52715844",
"0.52609646",
"0.52283406",
"0.5209606",
"0.51888263",
"0.5176638",
"0.51747... | 0.824925 | 1 |
A comment is fresh if it has a new child comment or it hasn't been viewed yet. | def fresh?(mock_viewed_at)
if !mock_viewed_at
true
elsif self.children.any?
self.children.last.created_at > mock_viewed_at
else
self.created_at > mock_viewed_at
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duplicate?\n c = Comment.find_by_trip_id_and_user_id_and_body(trip, user, body)\n # Give self the id for REST routing purposes.\n self.id = c.id unless c.nil?\n not c.nil?\n end",
"def new\r\n @comment = @commentable.comments.new\r\n end",
"def show\n @new_comment = Comment.new\n end",... | [
"0.6216144",
"0.60304254",
"0.60064423",
"0.60064423",
"0.5993338",
"0.59564763",
"0.58915186",
"0.5888356",
"0.58782506",
"0.58292323",
"0.58084977",
"0.57942724",
"0.5761055",
"0.5759193",
"0.56928337",
"0.5687451",
"0.5687451",
"0.5683364",
"0.56598675",
"0.5629711",
"0.55... | 0.5661089 | 18 |
I worked on this challenge with Gabrielle Gustilo. [] Hours Psuedocode Input: Nonnegative integer Output: A nonnegative integer that is the factorial of the input Steps: Defining a factorial method Use while loop to run until number != 0 Within loop have a total variable that is the counter, taking total number use number to count down return total Your Solution Below | def factorial(number)
total = 1
while number != 0
total *= number
number = number -1
end
total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def factorial(number)\n total = 1\n if number == 0\n total\n else \n while number > 0\n total *= number\n number -= 1\n end\n end\n return total\nend",
"def factorial(number)\n i = number\n total = number\n if number == 0 || number == 1\n return 1\n else\n while i > 1\n to... | [
"0.85383034",
"0.848233",
"0.84735453",
"0.84653205",
"0.84289515",
"0.8332719",
"0.8255819",
"0.8220938",
"0.820633",
"0.8200287",
"0.8198433",
"0.8198433",
"0.81842023",
"0.81736034",
"0.8166836",
"0.81648415",
"0.8163162",
"0.8160904",
"0.8158447",
"0.81448007",
"0.8137114... | 0.8265859 | 6 |
number of bikes at station goes down by 1 person status changes such that has_bike? == 1 declare probability that person wants to take bike | def return_bike(station)
station << @bike
@bike=nil
puts "Person: I returned a bike"
#if you have a bike, you have to return it
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bike_count\n\t\tbikes.count #+ broken_bikes.count\n\tend",
"def bike_count\n bikes.count\n end",
"def check_if_bingo\n check = CheckBingo.new(self)\n num_bingos = check.work\n self.update(num_bingos: num_bingos)\n num_bingos\n end",
"def train\n @badasspoints += 1\n end",
"def need... | [
"0.6929682",
"0.63919425",
"0.6063092",
"0.60402197",
"0.5943093",
"0.59058386",
"0.5881758",
"0.58803374",
"0.5861136",
"0.5852588",
"0.58403957",
"0.57858485",
"0.5747391",
"0.5744563",
"0.57439125",
"0.5731886",
"0.5726789",
"0.5704184",
"0.5699483",
"0.56851",
"0.5680305"... | 0.55053973 | 69 |
the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two. As an example, here are the first 10 Fibonnaci numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, and 34. | def fibonacci(sequence_up_to)
fibonacci_sequence = [0, 1]
(0...(sequence_up_to - 2)).each {
fibonacci_sequence << fibonacci_sequence.last(2).reduce(0, :+)
}
fibonacci_sequence
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def q9_fibonacci(num)\n f1 = 0\n f2 = 1\n (num-1).times {|_|\n tmp = f2\n f2 += f1 \n f1 = tmp\n }\n f2\nend",
"def iterative_fib(num)\r\n a = 0\r\n b = 1\r\n\r\n num.to_i.times do\r\n temp = a\r\n a = b\r\n # Add up previous two numbers in sequence\r\n b = temp + b\r\n end\r\n\r\n ... | [
"0.8254072",
"0.8197883",
"0.815654",
"0.81098056",
"0.8107684",
"0.8098658",
"0.80798453",
"0.8066286",
"0.80544263",
"0.80450934",
"0.80375606",
"0.80320674",
"0.80309045",
"0.79991704",
"0.7946493",
"0.79303145",
"0.79049987",
"0.79009837",
"0.7899523",
"0.7887769",
"0.788... | 0.0 | -1 |
Redirect unless user is signed in and is Admin | def admin_user
unless signed_in?
store_location
redirect_to signin_url, notice: "Please sign in."
return
end
unless current_user.admin?
redirect_to boards_path, notice: "You do not have permission for that."
return
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end",
"def redirect_unless_user_is_admin\n unless current_user_is_admin?\n flash[:alert] = \"You do no... | [
"0.8580343",
"0.8580343",
"0.8500245",
"0.8468965",
"0.8454247",
"0.8454247",
"0.8454247",
"0.84465396",
"0.84465396",
"0.84465396",
"0.84465396",
"0.8445245",
"0.84330726",
"0.83903843",
"0.83898944",
"0.83278507",
"0.8326778",
"0.8325924",
"0.83201826",
"0.8319439",
"0.8298... | 0.0 | -1 |
Should be used in place of current_user.admin? as this will check for nil user as well | def current_user_is_admin?
signed_in? && current_user.admin?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin?\n current_user && current_user.try(:admin?)\n end",
"def current_user_admin?\n current_user && current_user.admin?\n end",
"def current_admin?(user)\n current_user.admin?\n end",
"def admin_user?\n if current_user != nil\n !!current_user.admin\n end\n ... | [
"0.8811151",
"0.86681145",
"0.8654478",
"0.8605362",
"0.8585148",
"0.8545223",
"0.8511627",
"0.85088557",
"0.84958214",
"0.849493",
"0.84843516",
"0.8452096",
"0.8433075",
"0.84311754",
"0.8420576",
"0.84127706",
"0.840796",
"0.8398308",
"0.8390646",
"0.83895475",
"0.838887",... | 0.81664467 | 59 |
Returns true if the current users is a moderator of a specified board | def current_user_is_moderator?(board)
signed_in? && current_user.moderating?(board)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moderating?(board)\n\t\tself.moderating.include?(board)\n\tend",
"def owned_by? a_user\n a_user == program.moderator\n end",
"def moderator_of?(forum)\n moderatorships.where('forum_id = ?', (forum.is_a?(Forum) ? forum.id : forum)).count == 1\n end",
"def is_user_moderator?(user)\n if user\n ... | [
"0.7777761",
"0.7400253",
"0.7263338",
"0.72233444",
"0.7170496",
"0.6991256",
"0.69674605",
"0.69509107",
"0.6934332",
"0.68868303",
"0.68797916",
"0.6825884",
"0.680896",
"0.676173",
"0.6757196",
"0.6753906",
"0.66891474",
"0.6629169",
"0.66011095",
"0.65999126",
"0.658668"... | 0.84541 | 0 |
Calling this will prevent activerecord from assigning the same id (which violates constrain) | def reset_db_peak_sequence
ActiveRecord::Base.connection.tables.each do |t|
ActiveRecord::Base.connection.reset_pk_sequence!(t)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_or_update\n if self.id.is_a?(Numeric) && self.id.to_i.zero?\n self.id = nil\n @new_record = true\n end\n super\n end",
"def restrict_primary_key\n clear_setter_methods_cache\n @restrict_primary_key = true\n end",
"def restrict_primary_key\n c... | [
"0.69961417",
"0.67715216",
"0.67715216",
"0.6668621",
"0.65733707",
"0.6569348",
"0.6538434",
"0.6536068",
"0.65143126",
"0.645052",
"0.64447767",
"0.64447767",
"0.6398055",
"0.6384302",
"0.6307435",
"0.62313604",
"0.62234926",
"0.62209797",
"0.6192392",
"0.61714303",
"0.616... | 0.0 | -1 |
scope/association that is used to test eligibility TODO: use vendors association to get eligible items | def eligible_items
@eligible_items ||= ::InventoryItem.where(vendor: promotion.vendors)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_can_buy_org_item\n user = User.named(\"user\")\n org = Organization.named(\"org\")\n\n item = org.propose_item(\"Item\", 20, :fixed, nil, nil)\n item.activate\n\n assert(user.can_buy?(item))\n\n user.work_on_behalf_of(org)\n assert(!user.on_behalf_of.can_buy?(item))\n end",
"def po... | [
"0.5961624",
"0.58224463",
"0.58197266",
"0.5757219",
"0.5690592",
"0.5623458",
"0.55992377",
"0.55767703",
"0.5550145",
"0.55453277",
"0.5529154",
"0.551477",
"0.54550755",
"0.540709",
"0.540709",
"0.5405668",
"0.53671426",
"0.535982",
"0.53323686",
"0.53229696",
"0.53009075... | 0.61457 | 0 |
this will be useful if we want to `puts params` in the server log | def to_s
@params.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_debug(params)\n Rails.logger.debug(\"\\n\\n\\n\\n------------------------------------------------\\n\")\n Rails.logger.debug(params.inspect)\n Rails.logger.debug(\"\\n------------------------------------------------\\n\\n\\n\\n\")\n end",
"def log_request\n logger.info \"HTTP request rece... | [
"0.7539688",
"0.7500098",
"0.7247633",
"0.701044",
"0.70040363",
"0.67842156",
"0.676317",
"0.666582",
"0.66440433",
"0.6626347",
"0.65786785",
"0.6577528",
"0.65625983",
"0.65605503",
"0.65155727",
"0.64918655",
"0.6450838",
"0.6412487",
"0.64084923",
"0.63752234",
"0.637508... | 0.0 | -1 |
Adds this member interfaces/trunks to this VLANs. | def add_member(opts)
opts = check_params(opts,[:members])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up_vlan(options)\n\n if options[:vlan_id].nil?\n options[:vlan_id] = CONF[:start_vlan] + options[:network_id].to_i\n end\n\n options[:vlan_dev] = \"#{options[:phydev]}.#{options[:vlan_id]}\"\n\n create_bridge(options[:bridge])\n\n return... | [
"0.56737137",
"0.5555264",
"0.54524827",
"0.53126305",
"0.52655977",
"0.52565044",
"0.52488464",
"0.50965273",
"0.5039817",
"0.49505997",
"0.49320206",
"0.48905987",
"0.488331",
"0.488331",
"0.488331",
"0.4883025",
"0.48653102",
"0.48420447",
"0.47229496",
"0.46917352",
"0.46... | 0.0 | -1 |
Adds the static forwarding entries for this VLANs. | def add_static_forwarding(opts)
opts = check_params(opts,[:forwarding_entries])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_static_forwarding(opts)\n opts = check_params(opts,[:forwarding_entries])\n super(opts)\n end",
"def static_forwarding\n super\n end",
"def remove_all_static_forwardings\n super\n end",
"def add_tunnel(tunnel)\n @tunnels << tunnel\n end",
"def forward(payload... | [
"0.54614234",
"0.5177727",
"0.4971853",
"0.47495744",
"0.47224817",
"0.4719782",
"0.47196257",
"0.47119203",
"0.46118152",
"0.46044904",
"0.45643958",
"0.45531666",
"0.45353636",
"0.44721627",
"0.4454668",
"0.44535086",
"0.44512296",
"0.44436446",
"0.44371474",
"0.4425158",
"... | 0.6714846 | 0 |
Creates this VLANs with extended attributes. | def create(opts)
opts = check_params(opts,[:vlan_ids,:members,:failsafe_states,:timeouts,:mac_masquerade_addresses])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vlanCreate(nodeList)\n vlans = Array.new\n @parser.getAllLinks.each do |link|\n vlan = Vlan.new(@parser.getLinkName(link))\n @parser.getLinkInterfaces(link).each do |nameInt|\n interface = Searcher.searchInterface(nameInt, nodeList)\n if interface.nil?\n STDERR.puts \"The... | [
"0.60026324",
"0.5968759",
"0.5890731",
"0.5874628",
"0.5874628",
"0.5874628",
"0.58237654",
"0.57992566",
"0.57526624",
"0.5638849",
"0.56110984",
"0.5527059",
"0.54667336",
"0.54667336",
"0.5451686",
"0.5308851",
"0.5308851",
"0.52928567",
"0.52863246",
"0.5279987",
"0.5269... | 0.55545807 | 11 |
Retrieves the dynamic forwarding entries for this VLANs. | def dynamic_forwarding
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vapp_port_forwarding_rules(vAppId)\n params = {\n 'method' => :get,\n 'command' => \"/vApp/vapp-#{vAppId}/networkConfigSection\"\n }\n\n response, headers = send_request(params)\n\n # FIXME: this will return nil if the vApp uses multiple vApp Networ... | [
"0.5568323",
"0.5557087",
"0.5107956",
"0.5077085",
"0.50340515",
"0.5011316",
"0.50070596",
"0.50070596",
"0.4999924",
"0.4994748",
"0.49510267",
"0.49060556",
"0.47947162",
"0.47229344",
"0.46438956",
"0.4639642",
"0.46301702",
"0.45965797",
"0.4573229",
"0.45629257",
"0.45... | 0.44949645 | 24 |
Gets the failsafe actions for this VLANs. | def failsafe_action
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions\n return [] unless sipity_entity && current_ability && (current_ability.current_user.admin? || state != 'pending_deletion')\n\n actions = Hyrax::Workflow::PermissionQuery.scope_permitted_workflow_actions_available_for_current_state(entity: sipity_entity, user: current_ability.current_user)\n ... | [
"0.5821474",
"0.5662569",
"0.5631841",
"0.5631841",
"0.5574007",
"0.55452996",
"0.5544207",
"0.55002177",
"0.54950464",
"0.54918003",
"0.5411367",
"0.5394914",
"0.5353752",
"0.53408825",
"0.5332635",
"0.5304026",
"0.52914506",
"0.5235837",
"0.5235837",
"0.52221996",
"0.521750... | 0.0 | -1 |
Gets the failsafe states for this VLANs. | def failsafe_state
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failed_states\n states - success_states - transitive_states\n end",
"def get_error_states\n self.statemap['on_running'].map{|_, new_states| new_states['error']}\n end",
"def available_states\n states = []\n states << :passive if passive?\n states << :pending if passive? || pending... | [
"0.62363064",
"0.5959352",
"0.56455654",
"0.5535445",
"0.54780674",
"0.5431501",
"0.54303956",
"0.54287076",
"0.52694833",
"0.52656716",
"0.52404565",
"0.52019554",
"0.516194",
"0.51027554",
"0.5091975",
"0.5076802",
"0.50189936",
"0.493654",
"0.4910248",
"0.48973823",
"0.487... | 0.4342329 | 84 |
Gets the failsafe timeouts for this VLANs. | def failsafe_timeout
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_timeouts\n @bridge.get_timeouts\n end",
"def get_timeouts\n @bridge.get_timeouts\n end",
"def get_timeouts\n @bridge.get_timeouts\n end",
"def get_timeout\n if @valgrind\n return timeout_seconds * TestBase::VALGRIND_TIMEOUT_MULTIPLIER\n elsif... | [
"0.6452028",
"0.6452028",
"0.6452028",
"0.6142224",
"0.56409645",
"0.5618143",
"0.556115",
"0.5465547",
"0.5415735",
"0.5388452",
"0.53045243",
"0.52958727",
"0.5283572",
"0.5273252",
"0.5252263",
"0.5243264",
"0.5171844",
"0.5171844",
"0.51636845",
"0.5160336",
"0.51527566",... | 0.44976 | 87 |
Gets the configured learning modes of this VLANs. | def learning_mode
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_modes\n @_modes\n end",
"def modes\n @modes + autobuild.utilities.values.\n find_all { |u| u.enabled? }.\n map(&:name)\n end",
"def modes\n fix_mode.modes\n end",
"def modes\n @client.get('/Journey/Meta/Modes')\n end",
"def... | [
"0.5888984",
"0.55800104",
"0.53494656",
"0.51980644",
"0.51362175",
"0.51178026",
"0.5101625",
"0.5101625",
"0.48828754",
"0.48172584",
"0.48059955",
"0.47883114",
"0.47044706",
"0.46722165",
"0.46722165",
"0.46477398",
"0.46345297",
"0.45982465",
"0.45836717",
"0.45733148",
... | 0.56223226 | 2 |
Gets a list of all VLANs on this device. | def list
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all(options = {})\n data = service.get_records 'VLAN'\n load(data)\n end",
"def vlans\n if self.node_type.is_physical?\n vlan_list = self.clusters.map { |c| c.vlan }\n unless self.xen_guests.empty?\n vlan_list << self.xen_guests.map { |n| n.guest.clusters.map { |c... | [
"0.6562355",
"0.6504673",
"0.597948",
"0.56854784",
"0.55744946",
"0.5411817",
"0.52158594",
"0.51639324",
"0.51623124",
"0.5115221",
"0.5115221",
"0.5115221",
"0.5002195",
"0.49933207",
"0.4957156",
"0.49314296",
"0.48898765",
"0.4867585",
"0.48362532",
"0.47843716",
"0.4784... | 0.0 | -1 |
Gets the MAC masquerade addresses for this VLANs. | def mac_masquerade_address
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mac_addresses\n network_response = network_info\n return network_response unless network_response.successful?\n\n response = Response.new :code => 0\n response.data = network_response.data.values.collect { |n| n['mac_address'] }\n\n response\n end",
"def mac_addresses\n netwo... | [
"0.6329531",
"0.6329531",
"0.60579145",
"0.574616",
"0.5731804",
"0.5711925",
"0.56980413",
"0.5689316",
"0.55755436",
"0.55368525",
"0.5505418",
"0.5495693",
"0.5477771",
"0.53861517",
"0.5377325",
"0.53564966",
"0.53226763",
"0.5305451",
"0.52851313",
"0.52851313",
"0.52572... | 0.5900664 | 4 |
Gets the members of this VLANs. | def member
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def members\n return @members\n end",
"def members\n return @members\n end",
"def members\n return @members\n end",
"def members\n return @members\n end",
"def members\n @teams.map { |_, t|\n t.m... | [
"0.7134629",
"0.7134629",
"0.7134629",
"0.7134629",
"0.6850152",
"0.66565055",
"0.66297513",
"0.66297513",
"0.641933",
"0.6379318",
"0.6353809",
"0.6352527",
"0.634789",
"0.62448967",
"0.6161171",
"0.6091245",
"0.6091245",
"0.6057919",
"0.6034438",
"0.5985299",
"0.59671193",
... | 0.0 | -1 |
Gets the MTUs for this VLANs. | def mtu
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tlvs(type)\n\t\tif (type == TLV_TYPE_ANY)\n\t\t\treturn self.tlvs\n\t\telse\n\t\t\ttype_tlvs = []\n\n\t\t\tself.tlvs.each() { |tlv|\n\t\t\t\tif (tlv.type?(type))\n\t\t\t\t\ttype_tlvs << tlv\n\t\t\t\tend\n\t\t\t}\n\n\t\t\treturn type_tlvs\n\t\tend\n\tend",
"def get_tlvs(type)\n\t\tif (type == TLV_TYPE_ANY... | [
"0.5859951",
"0.5859951",
"0.55418754",
"0.55418754",
"0.5405953",
"0.5104202",
"0.5102757",
"0.5101221",
"0.50014144",
"0.4969589",
"0.4955504",
"0.49431306",
"0.49303082",
"0.48120266",
"0.48022577",
"0.47646767",
"0.47646767",
"0.47548485",
"0.46593374",
"0.45914376",
"0.4... | 0.0 | -1 |
Gets the source checking states for this VLANs. If enabled and auto lasthop is disabled, check that the source of the first packet of a connection is correct (correct VLAN, router, node). This is equivalent to BSD's net.inet.sourcecheck sysctl variable. | def source_check_state
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_sources(server)\n return 'Not owned by DLSS' if netdb_but_not_dlss?(server)\n return 'Only in NetDB' if only_netdb?(server)\n return 'Only in VMware' if only_vmware?(server)\n return 'Old configurations need cleaning' if only_configs?(server)\n\n ''\n end",
"def source_dest_check\n ... | [
"0.5644886",
"0.5552355",
"0.53372747",
"0.5220253",
"0.5174169",
"0.5144973",
"0.49879262",
"0.49019197",
"0.48894802",
"0.48599455",
"0.4844443",
"0.483568",
"0.48065585",
"0.4784018",
"0.47373685",
"0.47110423",
"0.46811065",
"0.4673714",
"0.46680132",
"0.46335825",
"0.461... | 0.55632234 | 1 |
Retrieves the static forwarding entries for this VLANs. | def static_forwarding
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_static_forwarding(opts)\n opts = check_params(opts,[:forwarding_entries])\n super(opts)\n end",
"def getRoutesFrom(station)\n routeList = @fromNodeMap[station]\n \n return routeList == nil ? [] : routeList\n end",
"def get_vapp_port_forwarding_rules(vAppId)\n params = {\... | [
"0.5273953",
"0.4905075",
"0.4900148",
"0.48865926",
"0.48461005",
"0.483199",
"0.47956428",
"0.47553474",
"0.47524205",
"0.47087735",
"0.46969295",
"0.46215546",
"0.45706895",
"0.45532355",
"0.44964898",
"0.4488626",
"0.44730046",
"0.44656998",
"0.44602126",
"0.44600958",
"0... | 0.4425623 | 23 |
Gets the true MAC addresses used by this VLANs. | def true_mac_address
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mac_addresses\n network_response = network_info\n return network_response unless network_response.successful?\n\n response = Response.new :code => 0\n response.data = network_response.data.values.collect { |n| n['mac_address'] }\n\n response\n end",
"def mac_addresses\n netwo... | [
"0.61659676",
"0.61659676",
"0.60150075",
"0.58307683",
"0.58307064",
"0.57870924",
"0.57729095",
"0.57158965",
"0.56380266",
"0.5620813",
"0.5620813",
"0.5572362",
"0.5553628",
"0.5512714",
"0.55121154",
"0.5482391",
"0.54082257",
"0.54022825",
"0.5338833",
"0.53335255",
"0.... | 0.54460186 | 17 |
Gets the version information for this interface. | def version
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def versions\n info[:versions]\n end",
"def get_version\n request('getVersion')\n end",
"def version\n self[:version]\n end",
"def getVersion\r\n\t\t\t\t\treturn @version\r\n\t\t\t\tend",
"def version\n @version\n end",
"def version\n return @version\n ... | [
"0.75569206",
"0.7525785",
"0.7351491",
"0.7316212",
"0.72740763",
"0.7263238",
"0.7263238",
"0.7263238",
"0.7263238",
"0.7263238",
"0.7263238",
"0.7263238",
"0.7263238",
"0.7263238",
"0.71812236",
"0.71682125",
"0.7123709",
"0.71198016",
"0.71106577",
"0.71022844",
"0.709299... | 0.0 | -1 |
Gets the ids for this VLANs. | def vlan_id
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vnet_ids\n array = Array.new\n\n self.each(\"VNETS/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end",
"def vrouter_ids\n array = Array.new\n\n self.each(\"VROUTERS/ID\") do |id|\n array <<... | [
"0.70863664",
"0.68687665",
"0.6642412",
"0.63679826",
"0.63654506",
"0.63654506",
"0.6313273",
"0.6311741",
"0.62532985",
"0.6230237",
"0.62134296",
"0.6176872",
"0.61549103",
"0.6131233",
"0.6114204",
"0.60959446",
"0.6055139",
"0.6004096",
"0.5975086",
"0.5892182",
"0.5861... | 0.58593094 | 22 |
Removes all dynamic forwarding entries from this VLANs. | def remove_all_dynamic_forwardings
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_forwarded_ports\n args = []\n read_forwarded_ports(@uuid).each do |nic, name, _, _|\n args.concat([\"--natpf#{nic}\", \"delete\", name])\n end\n\n execute(\"modifyvm\", @uuid, *args) if !args.empty?\n end",
"def remove_static_forwarding(opts)\n opts = chec... | [
"0.61871845",
"0.5740274",
"0.56061757",
"0.5411529",
"0.5411525",
"0.53052205",
"0.52229315",
"0.51910275",
"0.51542443",
"0.50242585",
"0.5024105",
"0.49246648",
"0.4903879",
"0.48783788",
"0.48524007",
"0.4846858",
"0.47903228",
"0.47868112",
"0.47828767",
"0.47702166",
"0... | 0.6753043 | 0 |
Removes all member interfaces/trunks from this VLANs. | def remove_all_members
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_all_vlans\n remove_all_bridge_domains\n remove_all_svis\n Vlan.vlans.each do |vlan, obj|\n # skip reserved vlan\n next if vlan == '1'\n next if node.product_id[/N5K|N6K|N7K/] && (1002..1005).include?(vlan.to_i)\n obj.destroy\n end\n end",
"def delete_all_vlan_groups\n ... | [
"0.61884004",
"0.6172018",
"0.58458984",
"0.5612033",
"0.55399126",
"0.55364573",
"0.5377215",
"0.537185",
"0.534396",
"0.5340216",
"0.5336359",
"0.5291025",
"0.5289791",
"0.52642655",
"0.52361894",
"0.5139215",
"0.5068705",
"0.50157195",
"0.49604613",
"0.49055025",
"0.489616... | 0.5889056 | 3 |
Removes all static forwarding entries from this VLANs. | def remove_all_static_forwardings
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_static_forwarding(opts)\n opts = check_params(opts,[:forwarding_entries])\n super(opts)\n end",
"def remove_all_dynamic_forwardings\n super\n end",
"def clear_forwarded_ports\n args = []\n read_forwarded_ports(@uuid).each do |nic, name, _, _|\n args.concat... | [
"0.63283604",
"0.586739",
"0.5837022",
"0.56149393",
"0.55367655",
"0.550825",
"0.539627",
"0.5254293",
"0.52215713",
"0.520375",
"0.5171784",
"0.51704776",
"0.51696515",
"0.5036314",
"0.5024911",
"0.5024911",
"0.5008007",
"0.49891686",
"0.4982834",
"0.48948872",
"0.48947042"... | 0.6730628 | 0 |
Removes this member interfaces/trunks from this VLANs. | def remove_member(opts)
opts = check_params(opts,[:members])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_vlan(name, vlan)\n configure_interface(name, \"no vxlan vlan #{vlan} vni\")\n end",
"def remove_all_vlans\n remove_all_bridge_domains\n remove_all_svis\n Vlan.vlans.each do |vlan, obj|\n # skip reserved vlan\n next if vlan == '1'\n next if node.product_id[/N5K|N6K|N... | [
"0.63179845",
"0.57426524",
"0.5707558",
"0.5418808",
"0.52823794",
"0.52172226",
"0.5188927",
"0.5168606",
"0.5130417",
"0.50949335",
"0.5082056",
"0.5082056",
"0.5020313",
"0.50157255",
"0.50140816",
"0.49896315",
"0.49481758",
"0.49481758",
"0.49259454",
"0.48725617",
"0.4... | 0.0 | -1 |
Removes the static forwarding entries from this VLANs. | def remove_static_forwarding(opts)
opts = check_params(opts,[:forwarding_entries])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_all_static_forwardings\n super\n end",
"def clear_forwarded_ports\n args = []\n read_forwarded_ports(@uuid).each do |nic, name, _, _|\n args.concat([\"--natpf#{nic}\", \"delete\", name])\n end\n\n execute(\"modifyvm\", @uuid, *args) if !args.empty?\n e... | [
"0.66223276",
"0.5779972",
"0.5777585",
"0.53033954",
"0.5266683",
"0.5204652",
"0.51946",
"0.5132867",
"0.5113216",
"0.51128066",
"0.5107174",
"0.51066464",
"0.509349",
"0.5050976",
"0.50097835",
"0.49552625",
"0.4953449",
"0.49200773",
"0.4915842",
"0.48526126",
"0.4849997"... | 0.6349129 | 1 |
Sets the failsafe actions for this VLANs. | def set_failsafe_action(opts)
opts = check_params(opts,[:actions])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_resource_actions=(value)\n @allowed_resource_actions = value\n end",
"def set_actions\n @actions = []\n end",
"def actions=(value)\n @actions = value\n end",
"def resource_actions=(value)\n @resource_actions = value\n ... | [
"0.5557978",
"0.5451567",
"0.54025733",
"0.5333571",
"0.5333571",
"0.52568656",
"0.49465573",
"0.49401897",
"0.49308124",
"0.49308124",
"0.4928236",
"0.48394543",
"0.47806686",
"0.4701454",
"0.46878085",
"0.4674948",
"0.46516898",
"0.46014345",
"0.4588947",
"0.45678788",
"0.4... | 0.6087308 | 0 |
Sets the failsafe states for this VLANs. | def set_failsafe_state(opts)
opts = check_params(opts,[:states])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_vlan(opts)\n opts = check_params(opts,[:vlans])\n super(opts)\n end",
"def set_vlan(opts)\n opts = check_params(opts,[:vlans])\n super(opts)\n end",
"def set_vlan(opts)\n opts = check_params(opts,[:vlan_names])\n super(opts)\n end",
"def set_across_virtual_state... | [
"0.5510336",
"0.5510336",
"0.5462976",
"0.5246599",
"0.51180726",
"0.5000983",
"0.49131224",
"0.48837385",
"0.47754562",
"0.47754562",
"0.4770132",
"0.47505707",
"0.47334623",
"0.473322",
"0.473322",
"0.47237733",
"0.4680484",
"0.46504948",
"0.4648394",
"0.4648394",
"0.464839... | 0.6018011 | 0 |
Sets the failsafe timeouts for this VLANs. | def set_failsafe_timeout(opts)
opts = check_params(opts,[:timeouts])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def set_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end",
"def timeouts_set=(_arg0); end",
"def timeout=(value)\n @timeout = value\n end",
"def ... | [
"0.6181343",
"0.6181343",
"0.6133695",
"0.612566",
"0.6039777",
"0.60108817",
"0.5971421",
"0.5963526",
"0.5929368",
"0.58751124",
"0.583962",
"0.5818067",
"0.5811619",
"0.5790336",
"0.57886356",
"0.57886356",
"0.57886356",
"0.57886356",
"0.57886356",
"0.57650316",
"0.5765031... | 0.64635533 | 0 |
Sets the learning modes for this VLANs. | def set_learning_mode(opts)
opts = check_params(opts,[:modes])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_mode\n super\n end",
"def learning_mode\n super\n end",
"def set_mode(new)\n @mode = new\n end",
"def set_vlan(opts)\n opts = check_params(opts,[:vlans])\n super(opts)\n end",
"def set_vlan(opts)\n opts = check_params(opts,[:vlans])\n super(opts)\... | [
"0.56995386",
"0.56995386",
"0.51865405",
"0.49555126",
"0.49555126",
"0.49260685",
"0.4862684",
"0.48415494",
"0.47989288",
"0.47979152",
"0.47953194",
"0.47600383",
"0.4744386",
"0.4741109",
"0.468539",
"0.4679454",
"0.46697485",
"0.46660614",
"0.46657026",
"0.4658308",
"0.... | 0.67180735 | 1 |
Sets the MAC masquerade addresses for this VLANs. | def set_mac_masquerade_address(opts)
opts = check_params(opts,[:mac_masquerade_addresses])
super(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def net_set_mac(mac_addr)\n execute(:set_network_mac, VmId: vm_id, Mac: mac_addr)\n end",
"def set_mac_address(mac)\n end",
"def set_mac_address(mac)\n execute(\"modifyvm\", @uuid, \"--macaddress1\", mac)\n end",
"def mac_masquerade_address\n super\n end",
"def mac_ma... | [
"0.6430824",
"0.63315135",
"0.6178039",
"0.5857728",
"0.5857728",
"0.5600889",
"0.5470703",
"0.54511577",
"0.5391618",
"0.53053737",
"0.5263485",
"0.5130334",
"0.5068038",
"0.50635636",
"0.50322783",
"0.49475056",
"0.494549",
"0.49177012",
"0.49131742",
"0.48951057",
"0.48512... | 0.672542 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.