query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Test if the two URLs are both under the same domain: => true | def urls_on_same_domain?(url1, url2)
puts "Determine if two URLs under the same domain: #{url1}, #{url2}" if @verbose
begin
host1=url_2_host(url1)
host2=url_2_host(url2)
return get_domain_root(host1) == get_domain_root(host2)
rescue => ee
puts "Error searching the object content: #{ee}" if @verb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same_domain?(other_url)\n \tother = URI.parse(other_url)\n\t\tsame_hostname?(other) and same_scheme?(other)\n end",
"def same_domain?(uri1, uri2)\n uri1 = URI.parse(uri1) unless uri1.is_a? URI\n uri2 = URI.parse(uri2) unless uri2.is_a? URI\n uri1.host == uri2.host\n end",
"def unsafe_re... | [
"0.86915827",
"0.8125794",
"0.7356703",
"0.73023236",
"0.7204953",
"0.714355",
"0.7121819",
"0.69344264",
"0.68469894",
"0.67886156",
"0.67886156",
"0.67579705",
"0.6492862",
"0.64350533",
"0.6402458",
"0.63093567",
"0.6284133",
"0.62734616",
"0.62734616",
"0.6256919",
"0.623... | 0.8713293 | 0 |
Input is host and open port, output is a URL for valid http response code or nil | def host_2_url (host,port=80)
puts "Perform simple http(s) service detection on host #{host}, port #{port}" if @verbose
begin
host=host.strip
if port.to_i == 80
url_1 = "http://" + host + "/"
elsif port.to_i ==443
url_1 = "https://" + host + "/"
else
url_1 = "http://" + host + ":" + port.to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_connect(server, endpoint)\n url= \"http://#{server}:4569/#{endpoint}\"\n #puts url\n begin \n response = open(url).read\n rescue Errno::ECONNREFUSED\n return :unreachabe\n rescue Errno::ENETUNREACH\n return :unreachabe\n rescue Errno::ETIMEDOUT\n return :unreachabe\n rescue Errno::EHOSTU... | [
"0.662047",
"0.64716303",
"0.6454896",
"0.63125604",
"0.6210963",
"0.6193635",
"0.6185186",
"0.61574334",
"0.61156964",
"0.61156964",
"0.61137927",
"0.60875386",
"0.6013021",
"0.5995669",
"0.5993404",
"0.5992335",
"0.5989611",
"0.5972381",
"0.5956844",
"0.594645",
"0.5942091"... | 0.72870827 | 0 |
numb the integer to check/make into a absolute integer. Examples absolute(1) => 1 Returns the absolute integer. | def absolute(numb)
if numb < 0
return numb * -1
end
return numb
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def absolute(num)\n return -num if is_negative(num)\n return num\nend",
"def absolute(number)\n if number > 0\n output = number\n else\n output = number * -1\n end\n return output\nend",
"def is_absolute(number)\n output= false\n if number > 0\n output= number\n ... | [
"0.76730746",
"0.7638051",
"0.7548961",
"0.75212723",
"0.7404742",
"0.7132893",
"0.70986366",
"0.7051781",
"0.6436342",
"0.64301544",
"0.64056265",
"0.6382445",
"0.6380735",
"0.63783026",
"0.63783026",
"0.63783026",
"0.63783026",
"0.6355882",
"0.632406",
"0.6322283",
"0.63062... | 0.81087536 | 0 |
fixing respond_to?() to include all replace_ methods | def respond_to?( name )
string_name = name.to_s
return true if string_name =~ /^replace_\w+/
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to?(name)\n string_name = name.to_s\n return true if string_name =~ /^replace_\\w+/\n super\nend",
"def respond_to_missing?(*_args); super; end",
"def refute_respond_to(obj, meth, msg = T.unsafe(nil)); end",
"def respond_to?(m)\n m || super\n end",
"def controller_respond_to\n render ... | [
"0.75329643",
"0.64000833",
"0.6339247",
"0.63190925",
"0.6259207",
"0.624818",
"0.6236018",
"0.613295",
"0.6088974",
"0.6081596",
"0.60715854",
"0.6070724",
"0.6065731",
"0.6055207",
"0.6045872",
"0.6045872",
"0.6045872",
"0.60334516",
"0.60281295",
"0.60274106",
"0.6024915"... | 0.73532474 | 1 |
All countries Example Country.all Returns an Array with value of all country objects | def all
countries
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def country_list\n @countries = Country.find(:all, :order => \"name\" )\n return @countries\n end",
"def all_countries \n\t\tself.class.get('/all')\n\tend",
"def countries\n collection(\"countries\")\n end",
"def country_list\n get_request( \"/api/v2_1/api/countries\")\n end",
"d... | [
"0.7931707",
"0.7602972",
"0.7344227",
"0.7314386",
"0.7275849",
"0.72513473",
"0.7217445",
"0.71887857",
"0.7164133",
"0.7045079",
"0.7001563",
"0.6983162",
"0.69286406",
"0.6884777",
"0.6882464",
"0.68702567",
"0.68297285",
"0.6764747",
"0.6760238",
"0.6758621",
"0.673499",... | 0.8838946 | 0 |
Raise errors for invalid countries. | def validate(country)
raise UnknownCountry, "Country not found." if country.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_country\n return unless country.present?\n return if country.valid?\n\n errors.add(:country, \"Is invalid: #{country.errors.full_messages}\")\n end",
"def invalid_for_country?(country)\n !valid_for_country?(country)\n end",
"def country_codes\n raise_invalid_... | [
"0.7213697",
"0.7046528",
"0.70049787",
"0.6438935",
"0.640072",
"0.6377823",
"0.6258591",
"0.6191293",
"0.60682875",
"0.60414475",
"0.5878452",
"0.5878452",
"0.5873083",
"0.5856442",
"0.58398753",
"0.5820293",
"0.57611704",
"0.57467324",
"0.5740792",
"0.5696683",
"0.568031",... | 0.7442042 | 0 |
MES A helper function for test_visibility_level | def assert_visibility_level(cal, user, level)
assert_equal level, cal.visibility_level(user), "Planner #{cal.id} has wrong visibility level for user #{user.id} when passing in user object"
assert_equal level, cal.visibility_level(user.id), "Planner #{cal.id} has wrong visibility level for user #{user.id} when... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visibility_group_for_lux\n case object.visibility\n when \"open\", \"low_res\"\n \"Public\"\n when \"emory_low\", \"authenticated\"\n \"Log In Required\"\n when \"rose_high\"\n \"Reading Room Only\"\n end\n end",
"def human_readable_visibility\n case object.visibility\n w... | [
"0.67345023",
"0.6572831",
"0.65651155",
"0.6548623",
"0.6525824",
"0.6525824",
"0.6525824",
"0.6525824",
"0.6525824",
"0.6432582",
"0.6404828",
"0.6381721",
"0.61469215",
"0.61223096",
"0.6098016",
"0.6083505",
"0.6060051",
"0.6055511",
"0.5992976",
"0.5971978",
"0.5946537",... | 0.7468586 | 0 |
Prettyprints the JSON input and writes it to the output. If the output is not STDOUT, then it is checked to see if it has changed. If not, the output file is not touched. If it has changed, the file is rewritten, and the diffs are obtained and written to STDOUT. The method logs whether the output file has been created/... | def public_json_output(info)
# format as JSON
results = JSON.pretty_generate(info)
# parse arguments for output file name
if ARGV.length == 0 or ARGV.first == '-'
# write to STDOUT
puts results
else
write_output(ARGV.first, results)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_json_output_file(info, file)\n # format as JSON\n results = JSON.pretty_generate(info)\n\n write_output(file, results)\n\nend",
"def write_info_file(option={})\n last_time = Util::LastTime.get(@info.filepaths.map{|path| @location + path})\n\n # update the scenario info file\n l... | [
"0.6853264",
"0.5962086",
"0.5847577",
"0.56515354",
"0.55793536",
"0.5516302",
"0.5485112",
"0.5435062",
"0.54257",
"0.539895",
"0.538687",
"0.5347208",
"0.534573",
"0.5233681",
"0.52097017",
"0.5148638",
"0.5088846",
"0.50878507",
"0.5085044",
"0.4983157",
"0.49614972",
"... | 0.6505006 | 1 |
Massage the strings to drop the timestamps so spurious changes are not reported/saved | def removeTimestamps(s)
# Drop the first occurrences only (but drop both)
return s.sub(/ "last_updated": "[^"]+",/, '').sub(/ "code_version": "[^"]+",/, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_data!\n convert_datetimes_intelligently!\n end",
"def normalize( str, options )\n unless options.include?( :verbatime )\n str.gsub!( /\\s+/m ){' '}\n str.gsub!( /\\A\\s+/m ) {''} if options.include?( :first )\n str.gsub!( /\\s+\\Z/m ) {''} if options.include?( :last )\n... | [
"0.61108863",
"0.59597325",
"0.58889145",
"0.58557045",
"0.5844676",
"0.57962114",
"0.5773162",
"0.5715952",
"0.56347114",
"0.55597895",
"0.549641",
"0.5466301",
"0.54554874",
"0.5443514",
"0.5418789",
"0.53807914",
"0.5286904",
"0.5264809",
"0.52510226",
"0.5228373",
"0.5223... | 0.706188 | 0 |
POST /classifieds POST /classifieds.json | def create
#@classified = Classified.new(classified_params)
@classified = current_user.classifieds.new(classified_params)
respond_to do |format|
if @classified.save
format.html { redirect_to @classified, notice: 'Classified was successfully created.' }
format.json { render :show, stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @classified = Classified.new(classified_params)\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n ... | [
"0.753544",
"0.6705766",
"0.65676266",
"0.65147823",
"0.6427566",
"0.6226739",
"0.6226739",
"0.619229",
"0.6086881",
"0.60730886",
"0.5960659",
"0.5907592",
"0.5885759",
"0.5870578",
"0.5870578",
"0.5843653",
"0.57652575",
"0.5675424",
"0.5665827",
"0.5615786",
"0.5600466",
... | 0.7053221 | 1 |
PATCH/PUT /classifieds/1 PATCH/PUT /classifieds/1.json | def update
respond_to do |format|
if @classified.update(classified_params)
format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }
format.json { render :show, status: :ok, location: @classified }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @classified = @user.classifieds.find(params[:id])\n\n respond_to do |format|\n if @classified.update_attributes(params[:classified])\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { head :no_content }\n else\n ... | [
"0.7140895",
"0.6479063",
"0.6223482",
"0.6138157",
"0.6052849",
"0.6022888",
"0.5994083",
"0.59745383",
"0.59745383",
"0.5956486",
"0.59478956",
"0.59071505",
"0.59038943",
"0.5890523",
"0.5839703",
"0.5838323",
"0.58008313",
"0.57889843",
"0.5788747",
"0.5782726",
"0.578175... | 0.6952935 | 1 |
DELETE /classifieds/1 DELETE /classifieds/1.json | def destroy
@classified.destroy
respond_to do |format|
format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @classified = @user.classifieds.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to classifieds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classified = Classified.find(params[:id])\n @classified.dest... | [
"0.7414375",
"0.73449916",
"0.7194511",
"0.70238125",
"0.6886442",
"0.68384784",
"0.67592686",
"0.67164856",
"0.66575056",
"0.66549844",
"0.66458607",
"0.6619374",
"0.66177684",
"0.6577693",
"0.6549269",
"0.6535986",
"0.65257215",
"0.65209186",
"0.6513518",
"0.65129316",
"0.6... | 0.735492 | 1 |
Execute a command composed of the given parts. Will print the command instead if the dry_run option was given. Will not raise an error if the command fails. | def execute_command(*argv)
command = argv.flatten.reject(&:blank?).join(" \\\n ")
if settings[:dry_run]
log.info("Dry run:")
puts command
else
output = `#{command}`
puts output unless output.empty?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute!\n if Mcir::Core.instance.dryrun?\n Mcir::Core.instance.debug(\"CMD: \".purple << \"#{self.to_s.gsub(\"\\r\", \"\")}\")\n \"skipped execution due to dryrun\"\n else\n case @mode\n when :exec then exec(self.to_s)\n when :open then IO.new(self).o... | [
"0.6311445",
"0.60471463",
"0.59196573",
"0.58614635",
"0.5841913",
"0.5829434",
"0.5823131",
"0.5802654",
"0.57359326",
"0.5709445",
"0.568742",
"0.5670222",
"0.56669694",
"0.56094784",
"0.5559678",
"0.55352527",
"0.54676974",
"0.5467694",
"0.54461",
"0.5443425",
"0.54092467... | 0.64377403 | 0 |
Signs all pending requests in puppet initiated by ec2 machines. | def sign_ec2_instance_requests!
# TODO: Add logging to syslog
unless @awaiting_sign_instances.blank?
get_all_ec2_instances_ids.each do |instance_id|
@awaiting_sign_instances.each do |hostname|
sign_instance(hostname) if hostname.match /#{instance_id}/
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_certificate(host)\n return if [master, dashboard, database].include? host\n \n hostname = Regexp.escape host.node_name\n \n last_sleep = 0\n next_sleep = 1\n (0..10).each do |i|\n fail_test(\"Failed to sign cert for #{hostname}\") if i == 10\n \n ... | [
"0.6013736",
"0.59874594",
"0.5983289",
"0.5348497",
"0.5173626",
"0.5040338",
"0.50160265",
"0.501303",
"0.500368",
"0.49879372",
"0.49867645",
"0.49760517",
"0.485357",
"0.48019105",
"0.47984785",
"0.4755041",
"0.4749854",
"0.47396466",
"0.47320265",
"0.4728787",
"0.4725728... | 0.7411139 | 0 |
Returns the median response time from an array of LogRecords | def median_response(records)
if records.length == 0
return 0.0
end
records = records.sort_by {|r| r.response_time}
if records.length % 2 == 0
return (records[records.length / 2].response_time +
records[records.length / 2 - 1].response_time) / 2.0
end
return records[records.length / 2]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block_median_timestamp_for_block_header(block_header)\n median_timespan = 11\n timestamps = []\n i = 0\n prev = block_header\n while i < median_timespan && prev\n timestamps << prev.time\n prev = @storage.previous_block_header_for_block_header(prev)\n i += 1\n ... | [
"0.64588803",
"0.62903285",
"0.6099505",
"0.6040428",
"0.6028773",
"0.60206324",
"0.5989761",
"0.59327644",
"0.5918031",
"0.5902398",
"0.5893257",
"0.5890583",
"0.58874416",
"0.58849657",
"0.58818305",
"0.5853168",
"0.58461446",
"0.5835909",
"0.58300304",
"0.5826848",
"0.5823... | 0.8376517 | 0 |
Returns the mean response time from an array of LogRecords | def mean_response(records)
if records.length == 0
return 0.0
end
return records.map {|r| r.response_time}.reduce(:+) / records.length.to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_response_time\n return summary_average[:average_response_time]\n end",
"def median_response(records)\n if records.length == 0\n return 0.0\n end\n\n records = records.sort_by {|r| r.response_time}\n\n if records.length % 2 == 0\n return (records[records.length / 2].response_time +\n... | [
"0.7007748",
"0.6650459",
"0.631569",
"0.59659034",
"0.5963189",
"0.5835786",
"0.57170594",
"0.5670136",
"0.55754745",
"0.55568075",
"0.5555604",
"0.55525124",
"0.54876906",
"0.54683566",
"0.54680645",
"0.54638135",
"0.54276615",
"0.5397937",
"0.53891516",
"0.53606236",
"0.53... | 0.8085116 | 0 |
Opens and parses the log file returning an array of LogRecords | def parse_log_file(file_name)
raise ArgumentError, "Log file does not exist." unless File.file?(file_name)
records = []
CSV.foreach(file_name, col_sep: " ", quote_char: "'") do |row|
# Omit any paths that do not begin with path=/api/users
if row[4].start_with?("path=/api/users/")
records.push(Log... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_log_file0(file)\n File.open(file) { |input|\n input.each_line.inject(Array.new) { |acc, text|\n entry = handling do\n handle MalformedLogEntryError do\n end\n parse_log_entry(text)\n end\n entry ? acc << entry : acc\n }\n }\nend",
"def parse_log_file(file)\n ... | [
"0.7039413",
"0.70247513",
"0.7016676",
"0.6638466",
"0.64108783",
"0.6404587",
"0.6303286",
"0.6198888",
"0.60962194",
"0.60758567",
"0.6036951",
"0.59655696",
"0.5940538",
"0.59117854",
"0.5892992",
"0.58897454",
"0.57911193",
"0.5787234",
"0.578708",
"0.5755534",
"0.573783... | 0.7417169 | 0 |
create a random pet, return its id | def prepare_pet(pet_api)
pet_id = random_id
category = Petstore::Category.new('id' => 20002, 'name' => 'category test')
tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test')
pet = Petstore::Pet.new('id' => pet_id, 'name' => "RUBY UNIT TESTING", 'photo_urls' => 'photo url',
'cate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_pet(pet_api)\n pet_id = random_id\n category = Petstore::Category.new('id' => 20002, 'name' => 'category test')\n tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test')\n pet = Petstore::Pet.new('id' => pet_id, 'name' => \"RUBY UNIT TESTING\", 'photo_urls' => 'photo url',\n ... | [
"0.7238891",
"0.654398",
"0.64019006",
"0.6393737",
"0.62222177",
"0.61844885",
"0.6183996",
"0.6175167",
"0.61723185",
"0.6169982",
"0.616525",
"0.6157854",
"0.6126829",
"0.61173576",
"0.6113287",
"0.60980934",
"0.60882396",
"0.6080561",
"0.6075345",
"0.60607976",
"0.6042117... | 0.7465083 | 0 |
Returning true if picture's width and height is equal | def square_format?
return (self.image_width == self.image_height) ? true : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def square?\n width == height\n end",
"def check_dimensions(image)\n if image.height < $max_height and image.width < $max_width\n return true\n else\n return false\n end\nend",
"def compatible?(image)\n self.pixel_width == image.pixel_width\n end",
"def square?\n ... | [
"0.7711799",
"0.756325",
"0.73517966",
"0.7340807",
"0.7244272",
"0.7207347",
"0.7052434",
"0.7027274",
"0.6941442",
"0.68949926",
"0.6888639",
"0.6795005",
"0.6779845",
"0.6706093",
"0.6667611",
"0.6607803",
"0.66011035",
"0.6595829",
"0.65796626",
"0.6558782",
"0.6547311",
... | 0.75659007 | 1 |
Returns the default centered image mask for a given size | def default_mask(size)
raise "No size given" if size.blank?
width = size.split('x')[0].to_i
height = size.split('x')[1].to_i
if (width > height)
zoom_factor = image_width.to_f / width
mask_height = (height * zoom_factor).round
x1 = 0
x2 = image_width
y1 = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center size\n x = self.x + (size.width / 2.0)\n y = self.y + (size.height / 2.0)\n CGPoint.new(x, y)\n end",
"def center(size)\n (@raw_columns - size) / 2\n end",
"def find_possible_centers(size)\n size.odd? ? [size/2] : [(size/2)-1, size/2]\nend",
"def center_origins\n return if !s... | [
"0.55453825",
"0.5477466",
"0.5395562",
"0.5353281",
"0.53262454",
"0.5243705",
"0.5224199",
"0.52099705",
"0.51867944",
"0.51867944",
"0.51625985",
"0.51365304",
"0.5032077",
"0.5019855",
"0.5002944",
"0.49667293",
"0.49280193",
"0.4921974",
"0.48942643",
"0.48872125",
"0.48... | 0.7784391 | 0 |
Returns a security token for signed picture rendering requests. Pass a params hash containing: size [String] (Optional) crop [Boolean] (Optional) crop_from [String] (Optional) crop_size [String] (Optional) to sign them. | def security_token(params = {})
@params = params.stringify_keys
@params.update({'crop' => @params['crop'] ? 'crop' : nil})
Digest::SHA1.hexdigest(secured_params)[0..15]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_preview_signature\n Sha256.new({string: generate_preview_url, salt: GlobalConstant::Base.cms[:sha256_salt]}).perform\n end",
"def signature\n # Remove 'sha_sign' key from request params and concatenate all\n # key value pairs\n params = payload.to_h\n .reject { |key, va... | [
"0.62102306",
"0.59789187",
"0.59563005",
"0.5937464",
"0.58052415",
"0.58015203",
"0.5796448",
"0.5796448",
"0.5772671",
"0.57211334",
"0.56975293",
"0.5684665",
"0.56681126",
"0.56647754",
"0.56536293",
"0.5578276",
"0.55477035",
"0.55468583",
"0.55203927",
"0.55145013",
"0... | 0.7446926 | 0 |
GET /control_families/1 GET /control_families/1.json | def show
@control_family = ControlFamily.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @control_family }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @index_action = true\n @families = Family.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @families }\n end\n end",
"def index\n @families = Family.all\n end",
"def index\n @families = Family.all\n end",
"de... | [
"0.65382195",
"0.6449711",
"0.6449711",
"0.6449711",
"0.63706326",
"0.63245946",
"0.63173276",
"0.6262958",
"0.6255917",
"0.61624444",
"0.6151295",
"0.6134212",
"0.61111414",
"0.6033346",
"0.60129875",
"0.5867219",
"0.58533204",
"0.5783942",
"0.57698643",
"0.57556",
"0.572632... | 0.7068387 | 0 |
GET /control_families/new GET /control_families/new.json | def new
@control_family = ControlFamily.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @control_family }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @control_family = ControlFamily.new(params[:control_family])\n\n respond_to do |format|\n if @control_family.save\n format.html { redirect_to @control_family, :notice => 'Control family was successfully created.' }\n format.json { render :json => @control_family, :status => :c... | [
"0.73970026",
"0.73449236",
"0.68376434",
"0.68376434",
"0.67084545",
"0.67024046",
"0.6690094",
"0.66458863",
"0.66267294",
"0.64582264",
"0.64467514",
"0.64115494",
"0.64109164",
"0.6354909",
"0.6340601",
"0.6313982",
"0.63063174",
"0.63016474",
"0.6287747",
"0.6261581",
"0... | 0.7704081 | 0 |
POST /control_families POST /control_families.json | def create
@control_family = ControlFamily.new(params[:control_family])
respond_to do |format|
if @control_family.save
format.html { redirect_to @control_family, :notice => 'Control family was successfully created.' }
format.json { render :json => @control_family, :status => :created, :lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @srg = Srg.find(params[:srg_id])\n @srg_control = @srg.srg_controls.new(get_srg_control_hash(params))\n get_nist_families.each do |nist_params|\n @srg_control.nist_familys.create(nist_params)\n end\n\n respond_to do |format|\n if @srg_control.save\n format.html { redire... | [
"0.63572204",
"0.5923508",
"0.58286583",
"0.5591946",
"0.55195594",
"0.54412204",
"0.54141766",
"0.5404284",
"0.52879095",
"0.5282722",
"0.52368283",
"0.52284634",
"0.5221432",
"0.5151642",
"0.5144682",
"0.5124663",
"0.51203763",
"0.50922334",
"0.50580597",
"0.50556916",
"0.5... | 0.6822651 | 0 |
PUT /control_families/1 PUT /control_families/1.json | def update
@control_family = ControlFamily.find(params[:id])
respond_to do |format|
if @control_family.update_attributes(params[:control_family])
format.html { redirect_to @control_family, :notice => 'Control family was successfully updated.' }
format.json { head :no_content }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @control_family = ControlFamily.new(params[:control_family])\n\n respond_to do |format|\n if @control_family.save\n format.html { redirect_to @control_family, :notice => 'Control family was successfully created.' }\n format.json { render :json => @control_family, :status => :c... | [
"0.608937",
"0.59132046",
"0.58548874",
"0.58400923",
"0.5720858",
"0.5720858",
"0.5677529",
"0.5671919",
"0.5637199",
"0.5637199",
"0.5631613",
"0.5588723",
"0.55848217",
"0.55145746",
"0.5472376",
"0.5459738",
"0.54229456",
"0.5402209",
"0.5358871",
"0.53449345",
"0.5335710... | 0.67878014 | 0 |
DELETE /control_families/1 DELETE /control_families/1.json | def destroy
@control_family = ControlFamily.find(params[:id])
@control_family.destroy
respond_to do |format|
format.html { redirect_to control_families_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @os_family.destroy\n respond_to do |format|\n format.html { redirect_to os_families_url, notice: 'Os family was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"... | [
"0.67272925",
"0.67081124",
"0.65889525",
"0.6511753",
"0.64843214",
"0.64716446",
"0.6440873",
"0.63968134",
"0.6390412",
"0.63846576",
"0.6372113",
"0.6350467",
"0.6349347",
"0.6330552",
"0.63049376",
"0.6295729",
"0.62936074",
"0.62820387",
"0.627628",
"0.6274687",
"0.6267... | 0.7412045 | 0 |
[['quick', 'lazy'], ['brown', 'black', 'grey'], ['fox', 'dog']]. Write a generalized function that prints all combinations of one word from the first vector, one word from the second vector, etc. The solution may not use recursion. | def print_combos(vector)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def possibilities(words = {})\n words.reduce(Hash.new([])) do |combos, (k,v)|\n 1.upto(v.length) do |i|\n combos[k] += v.combination(i).to_a.map {|combo| combo.sort }\n end\n combos[k].sort!\n combos\n end\nend",
"def combinations(arr1,arr2)\n combination_array = []\n arr1.each_with_index do... | [
"0.65666825",
"0.6556313",
"0.6389594",
"0.63757074",
"0.6364657",
"0.6356029",
"0.6274877",
"0.6256881",
"0.62278265",
"0.620132",
"0.6119892",
"0.60529745",
"0.6016816",
"0.5977187",
"0.59703183",
"0.5946571",
"0.59314525",
"0.59294873",
"0.57817847",
"0.57267106",
"0.57121... | 0.7003385 | 0 |
Extracts RDF from script element, or embeded RDF/XML | def extract_script(el, input, type, **options, &block)
add_debug(el, "script element of type #{type}")
begin
# Formats don't exist unless they've been required
case type.to_s
when 'application/csvm+json' then require 'rdf/tabular'
when 'application/ld+json' then require 'js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_script(script_src)\n\n\tfile = File.read(script_src)\n\n\tfile = file.sub(/<script type=\"text\\/javascript\">window\\._sharedData =/, '')\n\tfile = file.sub(/;<\\/script>/, '')\n\n\topen(script_src, 'w') do |f|\n\t\tf << file\n\tend\n\n\tjson = JSON.load(File.read(script_src))\n\tentry = json['entry_dat... | [
"0.5556227",
"0.55106765",
"0.5434684",
"0.5389626",
"0.53800374",
"0.5363063",
"0.5360616",
"0.53502285",
"0.53276205",
"0.5318726",
"0.5271063",
"0.51164365",
"0.5094688",
"0.5053044",
"0.5026888",
"0.50083715",
"0.49816066",
"0.49226218",
"0.4903735",
"0.4901832",
"0.48788... | 0.6607436 | 0 |
Iterates the given block for each RDF statement in the input. Reads to graph and performs expansion if required. | def each_statement(&block)
if block_given?
unless @processed || @root.nil?
# Add prefix definitions from host defaults
@host_defaults[:uri_mappings].each_pair do |prefix, value|
prefix(prefix, value)
end
# parse
parse_whole_document(@doc, RDF:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_statement(&block)\n if block_given?\n @input.rewind\n sample = @input.read(1000)\n if sample.match(%r(<html)i)\n # If it's HTML, parse it to improve detection\n @input.rewind\n sample = @input = ::Nokogiri::HTML.parse(@input)\n ... | [
"0.73494285",
"0.7097671",
"0.7081407",
"0.70728296",
"0.6865031",
"0.6637285",
"0.65890354",
"0.65597576",
"0.6351309",
"0.62702584",
"0.62638426",
"0.6167637",
"0.59079987",
"0.5888296",
"0.58715355",
"0.5867754",
"0.58521146",
"0.5838085",
"0.5814428",
"0.5765586",
"0.5758... | 0.77400964 | 0 |
Parsing an RDFa document (this is not the recursive method) | def parse_whole_document(doc, base)
base = doc_base(base)
if (base)
# Strip any fragment from base
base = base.to_s.split("#").first
base = uri(base)
add_debug("") {"parse_whole_doc: base='#{base}'"}
end
# initialize the evaluation context with the appropriate ba... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(stream, encoding=nil)\n _parse(stream, false, encoding)\n @tree.get_document\n end",
"def parse_doc\n @parse_started = true\n nil while @lexer.get and parse_children\n # in case there was an error and there is still data stuff\n parse_tail\n ... | [
"0.6154241",
"0.60796875",
"0.6055586",
"0.59171265",
"0.59043974",
"0.58926135",
"0.585049",
"0.5840248",
"0.579135",
"0.566436",
"0.5648926",
"0.55817354",
"0.55605185",
"0.55438",
"0.55438",
"0.55438",
"0.5540296",
"0.55315554",
"0.5521815",
"0.55199635",
"0.5513094",
"0... | 0.61578894 | 0 |
Extract the prefix mappings from an element | def extract_mappings(element, uri_mappings, namespaces)
# look for xmlns
# (note, this may be dependent on @host_language)
# Regardless of how the mapping is declared, the value to be mapped must be converted to lower case,
# and the URI is not processed in any way; in particular if it is a rela... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_prefixes hash, prefix\n prefix_matcher = Regexp.new(\"^#{prefix}\")\n hash\n .select { |name| prefix_matcher =~ name }\n .reduce({}) do |memo, name|\n memo[name[0].gsub(prefix_matcher, '')] = name[1]\n memo\n end\nend",
"def get_prefixes\n find_all{|entry| entry.type==Morpheme... | [
"0.668937",
"0.657794",
"0.63044727",
"0.63044727",
"0.6236088",
"0.6234026",
"0.6234026",
"0.6214111",
"0.60580283",
"0.598171",
"0.5916942",
"0.5916576",
"0.5900101",
"0.5845063",
"0.5835534",
"0.5749469",
"0.5731254",
"0.57256806",
"0.5699199",
"0.5687965",
"0.5656133",
... | 0.69844645 | 0 |
GET /task_results GET /task_results.json | def index
@task_results = TaskResult.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tasks = Task.all\n response = @tasks.map{|task| get_task_hash(task)}\n render json: response\n end",
"def index\n render json: {\n tasks: tasks.map(&:to_hash)\n }\n end",
"def index\n @tasks = Task.all\n\n render json: @tasks\n end",
"def index\n\n if params[:proj... | [
"0.72339004",
"0.70707995",
"0.6965154",
"0.6945513",
"0.6831892",
"0.6820482",
"0.6820482",
"0.6820482",
"0.6813139",
"0.6763303",
"0.6707386",
"0.6650458",
"0.6585899",
"0.65661496",
"0.6485827",
"0.64546233",
"0.6442437",
"0.6442437",
"0.6431725",
"0.6421604",
"0.641417",
... | 0.78630954 | 0 |
DELETE /task_results/1 DELETE /task_results/1.json | def destroy
@task_result.destroy
respond_to do |format|
format.html { redirect_to task_results_url, notice: 'Результат успешно удален.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_task\n result = @nirvana.delete @task['id']\n result = JSON.parse(result)\n\n assert result.keys.include?('results')\n assert result['results'][0]\n assert result['results'][0].keys.include?('task')\n assert \"0\" != result['results'][0]['task']['deleted'] \n e... | [
"0.7446919",
"0.7286519",
"0.72449464",
"0.71593577",
"0.7130797",
"0.71147406",
"0.7113354",
"0.70858765",
"0.7084316",
"0.70763284",
"0.70763284",
"0.70763284",
"0.70763284",
"0.70763284",
"0.70763284",
"0.70763284",
"0.70763284",
"0.70763284",
"0.70763284",
"0.70763284",
"... | 0.73071355 | 1 |
raise an exception with an integer as a filename | def test_integer_create_dict
assert_raises "TypeError: Integer as filename." do
@grapher.create_dict(1)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename\n raise\n end",
"def test_create_dict_set_integer\n assert_raises \"TypeError: Integer as filename.\" do\n @grapher.create_dict_set(1)\n end\n end",
"def filename_with_position\n fail NotImplementedError\n end",
"def error_number(exception) # :nodoc:\n rais... | [
"0.7184838",
"0.5886637",
"0.5838364",
"0.56278783",
"0.55594754",
"0.5539526",
"0.5493697",
"0.5472024",
"0.54537636",
"0.543148",
"0.5395997",
"0.5363763",
"0.5324453",
"0.5245724",
"0.5234869",
"0.51921636",
"0.5179935",
"0.5179935",
"0.5179935",
"0.5175903",
"0.5162403",
... | 0.6095327 | 1 |
UNIT TESTS FOR METHOD create_dict_set Equivalence classes: wordlist.txt does not exist > returns nil else verify not nil wordlist contains duplicates true if create_dict_set method returns a kind of Set | def test_create_dict_set_is_a_set
assert_kind_of Set, @grapher.create_dict_set('wordlist.txt')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_find_words_dict_empty\n words = ['apple','bat','candy']\n dict = Set.new\n assert_equal [], @grapher.find_words(words, dict)\n end",
"def test_dict_to_hash_not_empty\n assert_raises \"Error: Invalid integer in wordlist.txt\" do\n @grapher.dict_to_hash(Set.new([1]))\n end\n end",
... | [
"0.7359266",
"0.7146658",
"0.70702904",
"0.69857556",
"0.6836202",
"0.6740096",
"0.66905767",
"0.66660655",
"0.6534173",
"0.6311894",
"0.62535477",
"0.6156295",
"0.61329603",
"0.61066884",
"0.60766405",
"0.6055357",
"0.604831",
"0.60323817",
"0.60148877",
"0.5993834",
"0.5965... | 0.81042844 | 0 |
UNIT TESTS FOR METHOD parse_line_tokens Equivalence classes: line is empty or nil > returns (i.e. skip) line is wrong format > returns (i.e. skip) line does not include ';' > returns (i.e. skip) otherwise will split and parse the tokens and update data structures | def test_parse_line_empty
assert_nil @grapher.parse_line_tokens('')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_parse\n @parser.meta_def(:parse_line) do |line|\n line.split(/\\s+/)\n end\n\n text = \"one line\\ntwo line\"\n should = [%w{one line}, %w{two line}]\n ret = nil\n assert_nothing_raised do\n ret = @parser.parse(text)\n end\n\n assert_equal(should, ret)\n end",
"def par... | [
"0.69960666",
"0.6743749",
"0.67142224",
"0.6576527",
"0.65113455",
"0.650613",
"0.6458572",
"0.6388636",
"0.6364898",
"0.63005257",
"0.6214037",
"0.61247814",
"0.6099899",
"0.60993075",
"0.6085455",
"0.6074283",
"0.60409814",
"0.6028502",
"0.6008719",
"0.6003687",
"0.5963571... | 0.7154836 | 0 |
if word is empty, nothing to convert check if [] | def test_convert_word_empty
arr = ''
assert_equal [], @grapher.convert_word(arr)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_empty?(words = [])\nend",
"def prepare_words(words)\n return [''] if words.blank?\n a = words.split(/[,\\s]/).map(&:strip)\n a.any? ? a : ['']\n end",
"def blank?\n words.empty?\n end",
"def blank_word(word)\n @guessword2 = word.gsub(/[a-z]/, '_').split(''... | [
"0.65373117",
"0.65306926",
"0.65227413",
"0.62001824",
"0.6169192",
"0.6002078",
"0.596404",
"0.59407854",
"0.5920015",
"0.5889675",
"0.5825172",
"0.57549244",
"0.57481766",
"0.57247806",
"0.5710795",
"0.5687164",
"0.56789815",
"0.5660608",
"0.5652199",
"0.5625397",
"0.56106... | 0.67593604 | 0 |
UNIT TESTS FOR METHOD permute Equivalence classes: words is empty > returns [] words is nil > returns nil if word is a nil type, should return nil | def test_permute_isnil
word = nil
assert_nil @grapher.permute(word)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_permute_empty\n word = []\n assert_equal [], @grapher.permute(word)\n end",
"def permute(words)\n return nil if words.nil?\n return [] if words.empty?\n\n pwords = []\n words.each do |w|\n list = w.chars.to_a.permutation.map(&:join)\n pwords.concat list\n end\n pwords\... | [
"0.7208788",
"0.6602404",
"0.6497607",
"0.6061264",
"0.59501034",
"0.5891259",
"0.5846394",
"0.58371335",
"0.5688114",
"0.5626668",
"0.56046057",
"0.5589839",
"0.5572675",
"0.552336",
"0.55220956",
"0.55016303",
"0.54553103",
"0.5443224",
"0.54399955",
"0.54266155",
"0.541830... | 0.69456893 | 1 |
UNIT TESTS FOR METHOD find_words Equivalence classes: words or dict is nil > returns nil words or dict is empty > returns [] if words is nil type, we return a nil type | def test_find_words_words_nil
words = nil
dict = ['apple','bat','candy']
assert_nil @grapher.find_words(words, dict)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_find_words_words_empty\n words = []\n dict = Set['apple','bat','candy']\n assert_equal [], @grapher.find_words(words, dict)\n end",
"def test_find_words_dict_nil\n words = ['apple','bat','candy']\n dict = nil\n assert_nil @grapher.find_words(words, dict)\n end",
"def test_find_word... | [
"0.7527627",
"0.74635875",
"0.7454293",
"0.72996616",
"0.7279242",
"0.71256447",
"0.69734645",
"0.69015145",
"0.6900963",
"0.68639183",
"0.6807145",
"0.6781682",
"0.6776172",
"0.6729328",
"0.67069304",
"0.6606591",
"0.6581804",
"0.6545498",
"0.62738436",
"0.6256901",
"0.62148... | 0.7768127 | 0 |
update record while discharging | def discharge_record
@record = AdmittedRecord.find(params[:id])
if @record.update_attributes(
:is_discharged => 1,
:discharged_date => Time.now.strftime("%Y-%m-%d"),
:discharged_time => Time.now.strftime("%H:%M %p"))
flash[:notice] = "Record Updated su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def final_update_record(record,jobacct)\n # do nothing\n end",
"def update_remaining(table_type_instance)\n update_details table_type_instance.records_to_complete\n end",
"def update\n # @cancel.update\n end",
"def global_check\n\n #did release checking\n dids = Did.closed.all\n ... | [
"0.67566687",
"0.5982336",
"0.5844105",
"0.57963943",
"0.57352644",
"0.5709958",
"0.56997937",
"0.56981987",
"0.5688477",
"0.566155",
"0.5633445",
"0.56009763",
"0.5578114",
"0.5562435",
"0.5552737",
"0.55494326",
"0.55381453",
"0.5527184",
"0.55219424",
"0.5512379",
"0.55069... | 0.60777795 | 1 |
Returns the options for file size units | def selectable_size_units
[%w[MB mb], %w[GB gb], %w[TB tb], %w[PB pb], ['bytes', '']]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_size\n number_to_human_size(super)\n end",
"def get_file_size_in_mb\n mb = ::ApplicationController.helpers.number_to_human_size(self.file_size, precision: 2) \n return mb\n end",
"def file_size\n self.file_file_size\n end",
"def file_options; end",
"def size\n ['o', 'k', 'G'].i... | [
"0.6599646",
"0.6456949",
"0.64554495",
"0.6438082",
"0.64256763",
"0.637558",
"0.6352392",
"0.6352392",
"0.63379323",
"0.6302169",
"0.6278548",
"0.62730193",
"0.62610793",
"0.6235618",
"0.62065697",
"0.6173451",
"0.6143077",
"0.6143077",
"0.6109639",
"0.61054844",
"0.6100766... | 0.71536064 | 0 |
Returns the customized set of licenses for a template | def customized_licenses
@research_output.plan.template.licenses.map { |license| ["#{license.identifier} (#{license.name})", license.id] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def licenses\n @licenses ||= []\n end",
"def licenses\n licenses = []\n uris = metadata[dataset_uri][dct.license.to_s]\n if uris.nil?\n []\n else\n uris.each do |uri|\n l = metadata[uri]\n licenses << License.new(:uri => uri, :name => l[dct.... | [
"0.7014599",
"0.7012059",
"0.696897",
"0.6737693",
"0.6621404",
"0.6554412",
"0.63452464",
"0.6333059",
"0.62896377",
"0.6210405",
"0.6166634",
"0.61029506",
"0.6019517",
"0.59717065",
"0.59656054",
"0.5950078",
"0.58991385",
"0.586272",
"0.584978",
"0.58477193",
"0.58320785"... | 0.7855719 | 0 |
Returns whether or not we should capture the byte_size based on the output_type | def byte_sizable?
@research_output.audiovisual? || @research_output.sound? || @research_output.image? ||
@research_output.model_representation? ||
@research_output.data_paper? || @research_output.dataset? || @research_output.text?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bytes?\n type == \"BYTES\"\n end",
"def is_type?\n !self.output_buffer.nil?\n end",
"def getOutputSize()\n return @helper.getOutputSize()\n end",
"def getOutputSize()\n return @helper.getOutputSize()\n end",
"def getOutputSize()\n ... | [
"0.709957",
"0.64328843",
"0.61349666",
"0.61349666",
"0.61349666",
"0.61349666",
"0.61349666",
"0.61349666",
"0.61349666",
"0.6088384",
"0.600774",
"0.5947368",
"0.59321135",
"0.59295166",
"0.5905797",
"0.59025186",
"0.5881535",
"0.58805656",
"0.58800894",
"0.5854791",
"0.57... | 0.6717379 | 1 |
Returns the humanized version of the output_type enum variable | def display_type
return '' unless @research_output.is_a?(ResearchOutput)
@research_output.research_output_type.humanize.capitalize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectable_output_types\n if research_output.plan.template.customize_output_types?\n research_output.plan.template.template_output_types.map do |ot|\n [ot.research_output_type.humanize, ot.research_output_type]\n end\n else\n ResearchOutput::DEFAULT_OUTPUT_TYPES.map { |k| [k.humaniz... | [
"0.7306846",
"0.7128826",
"0.70351374",
"0.6792429",
"0.6747418",
"0.6686343",
"0.6686343",
"0.6680956",
"0.665389",
"0.66519743",
"0.6586945",
"0.6503785",
"0.6476782",
"0.64307415",
"0.6368533",
"0.6359986",
"0.6313588",
"0.6282887",
"0.6250648",
"0.6240834",
"0.6238337",
... | 0.7844373 | 0 |
Returns the display name(s) of the repository(ies) | def display_repository
return [_('None specified')] unless @research_output.repositories.any?
@research_output.repositories.map(&:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repositories\n octokit.repositories('zold-io').map { |json| json['full_name'] }\n end",
"def full_name repo\n \"#{repo.owner.login}/#{repo.name}\"\n end",
"def display_org_repos(org)\n repos = Commitchamp::Repo.where(organization: org).order(name: :asc)\n puts \"\\n## Repositories for... | [
"0.7122163",
"0.7110749",
"0.70717186",
"0.6867776",
"0.6852312",
"0.6803691",
"0.67191637",
"0.66295433",
"0.6548837",
"0.6531908",
"0.6527931",
"0.65016323",
"0.6462547",
"0.6458462",
"0.642735",
"0.64228535",
"0.64132655",
"0.63870835",
"0.63743496",
"0.63518155",
"0.63474... | 0.83138967 | 0 |
Returns the display the license name | def display_license
return _('None specified') if @research_output.license.blank?
@research_output.license.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def license_title\n case self.license\n when \"cc-by-sa-3.0\"\n \"Creative Commons Attribution ShareAlike 3.0\"\n when \"cc-by-nc-sa-2.0-uk\"\n \"Creative Commons Attribution-NonCommerical-ShareAlike 2.0 UK: England & Wales\"\n end\n end",
"def getsfLma__LicenseObjName\r\n\t\t\treturn \"sf... | [
"0.80332285",
"0.74649435",
"0.71716607",
"0.704565",
"0.6998174",
"0.6979178",
"0.6937707",
"0.68955",
"0.6865079",
"0.68224496",
"0.6818275",
"0.6818275",
"0.67972326",
"0.67585397",
"0.67573833",
"0.6755345",
"0.67333543",
"0.6712397",
"0.6650258",
"0.662167",
"0.66198397"... | 0.8617068 | 0 |
Returns the humanized version of the access enum variable | def display_access
return _('Unspecified') if @research_output.access.blank?
@research_output.access.capitalize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_level_label\n case access_level\n when ApplicationController::FEATURE_ACCESS_NONE, ApplicationController::FEATURE_ACCESS_NBP\n FEATURE_ACCESS_LEVELS[ 0 ]\n when ApplicationController::FEATURE_ACCESS_SOME\n FEATURE_ACCESS_LEVELS[ 1 ]\n when ApplicationController::FEATURE_ACCESS_IN... | [
"0.6703856",
"0.6581119",
"0.6372205",
"0.6271565",
"0.624311",
"0.61838365",
"0.6131776",
"0.6111254",
"0.60696447",
"0.6038001",
"0.6019437",
"0.60138977",
"0.5995244",
"0.5948379",
"0.5909373",
"0.5903777",
"0.579771",
"0.579063",
"0.57894295",
"0.5781165",
"0.5778317",
... | 0.6699951 | 1 |
Return 'Yes', 'No' or 'Unspecified' depending on the value | def display_boolean(value:)
return 'Unspecified' if value.nil?
value ? 'Yes' : 'No'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yes_or_no(value = false)\n value ? \"Yes\" : \"No\"\n end",
"def compute_human_value\n case @value\n when :false\n 'No'\n when :true\n 'Yes'\n when :nil\n \"N/\\A\"\n else\n @value.to_s\n end\n end",
"def cdl_label(value)\n value ? \"Y... | [
"0.8121101",
"0.75589424",
"0.7416785",
"0.740187",
"0.7302782",
"0.7166235",
"0.70368624",
"0.7032807",
"0.7029077",
"0.70261836",
"0.69931936",
"0.69818074",
"0.69272184",
"0.6904986",
"0.6862547",
"0.68390024",
"0.6799927",
"0.6799509",
"0.67926466",
"0.67689985",
"0.67306... | 0.7852256 | 1 |
Destroys built_in objects with a built_in_key not present in built_in_keys array | def destroy_removed_built_in_objects!(built_in_keys)
built_in.where.not(built_in_key: built_in_keys).destroy_all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def built_in_object_ids\n @built_in_object_ids ||= Hash.new do |hash, key|\n hash[key] = where(built_in_key: key).pick(:id)\n end\n end",
"def clear_compiler_like! *keys\n clear_compiler_like *keys\n ipcm_trigger :clear_compiler_like, *keys\nend",
"def built_in_object_id(key)\n built... | [
"0.64110136",
"0.57295275",
"0.5715604",
"0.55788565",
"0.55380905",
"0.5456428",
"0.54279727",
"0.53870094",
"0.5287718",
"0.5257553",
"0.5239009",
"0.5210185",
"0.5207759",
"0.5107403",
"0.5104451",
"0.50948834",
"0.5091145",
"0.50426126",
"0.50229675",
"0.49828488",
"0.498... | 0.8492228 | 0 |
Memoized hash of built in object ids | def built_in_object_ids
@built_in_object_ids ||= Hash.new do |hash, key|
hash[key] = where(built_in_key: key).pick(:id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"def hash_code; end",
"def hash\n object_id\n end",
"def hash\n type.hash ^ (id.hash >> 1)\n end",
"def hash(*) end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash\n [s... | [
"0.7189931",
"0.68521434",
"0.68093264",
"0.67971426",
"0.6770461",
"0.6768911",
"0.6755593",
"0.6720027",
"0.6695823",
"0.6659258",
"0.665506",
"0.665506",
"0.665506",
"0.665506",
"0.665506",
"0.665506",
"0.665506",
"0.6653321",
"0.66453516",
"0.66288656",
"0.661828",
"0.6... | 0.6871831 | 1 |
Gets the queryString property value. The search query containing the search terms. Required. | def query_string
return @query_string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query\n sanitize search_params['query']\n end",
"def qs\n if @r && @r['QUERY_STRING'] && !@r['QUERY_STRING'].empty?\n '?' + @r['QUERY_STRING']\n elsif query && !query.empty?\n '?' + query\n else\n ''\n end\n end",
"def keyword_query_... | [
"0.6878604",
"0.67763346",
"0.6760848",
"0.67451507",
"0.6721134",
"0.67151684",
"0.66903585",
"0.6591112",
"0.65596086",
"0.6531226",
"0.6528184",
"0.6457174",
"0.64139855",
"0.6409303",
"0.64069545",
"0.635622",
"0.6345538",
"0.6345538",
"0.63399315",
"0.6336687",
"0.630404... | 0.73880434 | 0 |
Sets the queryString property value. The search query containing the search terms. Required. | def query_string=(value)
@query_string = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setQuery(query) \n\t\tself.queryString = query\n end",
"def set_SearchString(value)\n set_input(\"SearchString\", value)\n end",
"def set_SearchString(value)\n set_input(\"SearchString\", value)\n end",
"def set_Query(value)\n set_input(\"Query\", value)\n en... | [
"0.7561992",
"0.6677149",
"0.6676971",
"0.66258246",
"0.66258246",
"0.66258246",
"0.66258246",
"0.66258246",
"0.6584172",
"0.6584172",
"0.6584172",
"0.6584172",
"0.6584172",
"0.6584172",
"0.6584172",
"0.6584172",
"0.6584172",
"0.6584172",
"0.6584172",
"0.6584172",
"0.6584172"... | 0.7376836 | 1 |
Gets the queryTemplate property value. Provides a way to decorate the query string. Supports both KQL and query variables. Optional. | def query_template
return @query_template
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_template=(value)\n @query_template = value\n end",
"def interal_query(query_value)\n \"_query_:\\\"#{query_value}\\\"\"\n end",
"def interal_query(query_value)\n \"_query_:\\\"#{query_value}\\\"\"\n end",
"def query_string\n return @query_string\... | [
"0.7063055",
"0.61707103",
"0.609577",
"0.5889912",
"0.5400862",
"0.53851926",
"0.5378811",
"0.5336231",
"0.53140336",
"0.53140336",
"0.52295613",
"0.5220988",
"0.522015",
"0.5186876",
"0.51646894",
"0.51630574",
"0.51585716",
"0.51313895",
"0.5120464",
"0.5098844",
"0.509856... | 0.76591504 | 0 |
Sets the queryTemplate property value. Provides a way to decorate the query string. Supports both KQL and query variables. Optional. | def query_template=(value)
@query_template = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_template\n return @query_template\n end",
"def query_string=(value)\n @query_string = value\n end",
"def query=(value)\n @query = value\n end",
"def query=(value)\n @query = value\n end",
"def ... | [
"0.6611001",
"0.593368",
"0.5757292",
"0.5757292",
"0.5757292",
"0.56875926",
"0.56162274",
"0.5584365",
"0.5584365",
"0.5584365",
"0.5584365",
"0.5584365",
"0.5564349",
"0.553198",
"0.55308414",
"0.55308414",
"0.55308414",
"0.55308414",
"0.55308414",
"0.55308414",
"0.5530841... | 0.81056595 | 0 |
is this version of the platform supported by the kitchenplan codebase? | def version_supported?
Kitchenplan::Log.debug "#{self.class} : Is platform version lower than #{@lowest_version_supported}?"
return false if self.version.to_s < @lowest_version_supported
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installable_platform?\n Gem::Platform.match_spec? spec\n end",
"def is_platform_supported?\n plf = node.platform_family.downcase\n ver = node.platform_version.to_i\n Chef::Log.info \"Checking platform support. Platform: #{plf}, version: #{ver}\"\n plf == 'rhel' && ver >= 7\n end",
... | [
"0.8040401",
"0.7945815",
"0.7945815",
"0.78793573",
"0.77807176",
"0.770943",
"0.7531014",
"0.74992234",
"0.74610114",
"0.74415714",
"0.7212959",
"0.71821976",
"0.71570873",
"0.7150403",
"0.71189237",
"0.71138734",
"0.71138734",
"0.71138734",
"0.7111255",
"0.7101279",
"0.710... | 0.85537046 | 1 |
is the user part of the admin group? | def user_is_admin?
`groups`.split.include? "admin"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_admin?\n return false unless group\n\n group.admin?(user)\n end",
"def group_admin? group\n g = group.groups_userss.detect{|i| i.user_id == session[:id]}\n g.is_admin unless g.nil?\n end",
"def user_in_admin_group?\r\n cmd_exec(\"groups `whoami`\").split(/\\s+/).include?(SUDOER... | [
"0.87835747",
"0.87119526",
"0.86865526",
"0.8671904",
"0.86498165",
"0.8616868",
"0.85990655",
"0.8485188",
"0.84224766",
"0.84114313",
"0.8398092",
"0.8316374",
"0.8287222",
"0.82828146",
"0.8216807",
"0.81947744",
"0.81782264",
"0.8150833",
"0.8031892",
"0.8015123",
"0.801... | 0.88726985 | 0 |
test to see if the Bundler gem is installed. | def bundler_installed?
`(gem spec bundler -v > /dev/null 2>&1)`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem_installed?(gem_name)\n found_gem = false\n begin\n found_gem = Gem::Specification.find_by_name(gem_name)\n rescue Gem::LoadError\n return false \n else\n return true \n end\nend",
"def gem_installed?(gem_name)\n !Gem::Specification.find_by_name(gem_name).nil?\n rescue Gem::Loa... | [
"0.7730482",
"0.76416624",
"0.7611426",
"0.7523871",
"0.74439347",
"0.73525095",
"0.73315936",
"0.7310615",
"0.7296382",
"0.7248209",
"0.7157728",
"0.712926",
"0.71062404",
"0.7081799",
"0.7038019",
"0.700891",
"0.7003697",
"0.6984675",
"0.6974927",
"0.6961212",
"0.6932208",
... | 0.8342012 | 1 |
install bundler if needed. | def install_bundler
# What we really need to do is check the result of the normaldo and then do a wrapped sudo.
# That should be good on different platforms as long as Ruby's present.
sudo "gem install bundler --no-rdoc --no-ri" unless bundler_installed?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_bundler\n\t# What we really need to do is check the result of the normaldo and then do a wrapped sudo.\n\t# That should be good on different platforms as long as Ruby's present.\n\tsudo \"#{self.omnibus_path}\\\\embedded\\\\bin\\\\gem install bundler --no-rdoc --no-ri\" unless bundler_installed?\n ... | [
"0.7748446",
"0.7567607",
"0.7320778",
"0.7221846",
"0.6949887",
"0.6883456",
"0.6801792",
"0.6794562",
"0.673973",
"0.673973",
"0.6675537",
"0.6616881",
"0.6545632",
"0.6534253",
"0.6488696",
"0.640621",
"0.63911927",
"0.6380233",
"0.63603383",
"0.6346935",
"0.6342198",
"0... | 0.784585 | 0 |
test to see if Git is installed and available. | def git_installed?
`git config > /dev/null 2>&1`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_installed?\n\tbegin\n\t `git config > /dev/null 2>&1`\n\trescue\n\t false\n\tend\n end",
"def test_git!\n result = `which git`\n if $?.exitstatus != 0\n raise IOError, \"Can't find git\"\n end\n end",
"def is_git?\n `git status 2> /dev/null` != \"\"\nend",
"def git?\n dir?... | [
"0.8617209",
"0.796379",
"0.77649444",
"0.77580184",
"0.77580184",
"0.76636386",
"0.7548779",
"0.7536171",
"0.7311589",
"0.72813493",
"0.72422326",
"0.7241243",
"0.72371674",
"0.72328305",
"0.72328305",
"0.71990544",
"0.71990544",
"0.7122231",
"0.7077387",
"0.7045269",
"0.693... | 0.84510213 | 1 |
install git using Homebrew. TODO: Homebrew? Is that a dependency we're tracking in the go script? How do we know it's installed? | def install_git
sudo "brew install git" unless git_installed?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install\n bin.install \"git-active-branches\"\n bin.install \"git-branches-containing\"\n bin.install \"git-cherry-pick-to\"\n bin.install \"git-cleanup\"\n bin.install \"git-cleave\"\n bin.install \"git-commit-to\"\n bin.install \"git-committer-info\"\n bin.install \"git-conflicts\"\n ... | [
"0.75046563",
"0.73162687",
"0.72403556",
"0.7229953",
"0.7027053",
"0.7027053",
"0.6982962",
"0.6975016",
"0.69160306",
"0.67440677",
"0.67103964",
"0.6676625",
"0.66260004",
"0.65614",
"0.6490271",
"0.63340867",
"0.63152647",
"0.63096315",
"0.6253365",
"0.61751205",
"0.6152... | 0.82266146 | 0 |
elevates and runs bundle install for kitchenplan. TODO: move up into base | def kitchenplan_bundle_install
Kitchenplan::Log.info "#{self.class} : Run kitchenplan bundle install"
sudo "bundle install --binstubs=#{self.omnibus_path}/bin --quiet"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kitchenplan_bundle_install\n\tKitchenplan::Log.info \"#{self.class} : Run kitchenplan bundle install\"\n\tsudo \"#{self.omnibus_path}\\\\embedded\\\\bin\\\\bundle.bat install --binstubs=bin --quiet\"\n end",
"def kitchenplan_bundle_install\n\tKitchenplan::Log.info \"#{self.class} : Run kitchenplan bundl... | [
"0.8500644",
"0.8448063",
"0.73326427",
"0.72456944",
"0.7209932",
"0.7149397",
"0.7142554",
"0.7005992",
"0.6886295",
"0.6884637",
"0.68420005",
"0.6826583",
"0.6826583",
"0.6822514",
"0.68147004",
"0.68060833",
"0.67809224",
"0.67809224",
"0.67486066",
"0.6712158",
"0.67093... | 0.85997885 | 0 |
GET /pmmatches GET /pmmatches.json | def index
@pmmatches = Pmmatch.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @matches = Match.page(params[:page]).per(1)\n end",
"def recent_matches\n @matches = Match.where(status: nil);\n render json: { matches: @matches }, status: :ok\n end",
"def index\n @matches = Match.all\n @recent = Match.recent\n\n respond_to do |format|\n format.html # ind... | [
"0.68909645",
"0.67349046",
"0.6709484",
"0.6706813",
"0.6546557",
"0.65226483",
"0.6439432",
"0.6439432",
"0.6439432",
"0.6439432",
"0.6439432",
"0.6400335",
"0.6398828",
"0.63652337",
"0.63530535",
"0.6279407",
"0.62728",
"0.62593454",
"0.6226538",
"0.6211175",
"0.6180796",... | 0.7394977 | 0 |
GET /raw_material_invoice_items GET /raw_material_invoice_items.json | def index
@raw_material_invoice_items = RawMaterialInvoiceItem.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @raw_material_items = RawMaterialItem.all\n end",
"def index\n @invoice_items = @invoice.invoice_items\n end",
"def set_raw_material_invoice_item\n @raw_material_invoice_item = RawMaterialInvoiceItem.find(params[:id])\n end",
"def raw_material_invoice_item_params\n params.req... | [
"0.72739714",
"0.68763846",
"0.67434573",
"0.67379093",
"0.6415341",
"0.62864506",
"0.6283882",
"0.6244196",
"0.6239747",
"0.6239747",
"0.6237331",
"0.622694",
"0.6128532",
"0.6125664",
"0.61209387",
"0.6083537",
"0.60639554",
"0.6023414",
"0.6017558",
"0.5958401",
"0.5936113... | 0.8156117 | 0 |
POST /raw_material_invoice_items POST /raw_material_invoice_items.json | def create
@raw_material_invoice_item = RawMaterialInvoiceItem.new(raw_material_invoice_item_params)
respond_to do |format|
if @raw_material_invoice_item.save
format.html { redirect_to @raw_material_invoice_item, notice: 'Raw material invoice item was successfully created.' }
format.json ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_material_invoice_item_params\n params.require(:raw_material_invoice_item).permit(:quantity, :unit, :price, :raw_material_id, :raw_material_invoice_id)\n end",
"def index\n @raw_material_invoice_items = RawMaterialInvoiceItem.all\n end",
"def set_raw_material_invoice_item\n @raw_materia... | [
"0.7384755",
"0.7186376",
"0.6824849",
"0.65402067",
"0.646912",
"0.6183374",
"0.61754566",
"0.6170464",
"0.6155567",
"0.60547405",
"0.60262483",
"0.60238695",
"0.5985506",
"0.59717065",
"0.592504",
"0.5861268",
"0.5837786",
"0.58366907",
"0.58359796",
"0.580955",
"0.57670814... | 0.7282772 | 1 |
PATCH/PUT /raw_material_invoice_items/1 PATCH/PUT /raw_material_invoice_items/1.json | def update
respond_to do |format|
if @raw_material_invoice_item.update(raw_material_invoice_item_params)
format.html { redirect_to @raw_material_invoice_item, notice: 'Raw material invoice item was successfully updated.' }
format.json { render :show, status: :ok, location: @raw_material_invoic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end",
"def update\n # too many issues trying to do strong parametesr.\n # TODO: implement strong params in the future\n params = request.parameters\n\n if !params.has_key?(:invoice_items) then\n flash[... | [
"0.7124745",
"0.7075271",
"0.6835292",
"0.6758465",
"0.65789425",
"0.6536139",
"0.65267557",
"0.65259516",
"0.6496565",
"0.6481086",
"0.64711297",
"0.6466675",
"0.6293723",
"0.6275819",
"0.62445766",
"0.62431407",
"0.62381804",
"0.62365425",
"0.62238103",
"0.62222636",
"0.617... | 0.7527964 | 0 |
DELETE /raw_material_invoice_items/1 DELETE /raw_material_invoice_items/1.json | def destroy
@raw_material_invoice_item.destroy
respond_to do |format|
format.html { redirect_to raw_material_invoice_items_url, notice: 'Raw material invoice item was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_item.destroy\n respond_with(@invoice)\n \n end",
"def destroy\n @invoice_line_item = InvoiceLineIt... | [
"0.72381544",
"0.72059506",
"0.71514225",
"0.71239847",
"0.7085036",
"0.7077326",
"0.6987666",
"0.69841844",
"0.69450444",
"0.68842196",
"0.6879942",
"0.68724245",
"0.68694913",
"0.68496805",
"0.6837281",
"0.68252534",
"0.6814706",
"0.6814706",
"0.68133044",
"0.6807125",
"0.6... | 0.7759415 | 0 |
A word is defined as a sequence of nonspace characters. The words in s will be separated by at least one space. todo: Return a string of the words in reverse order concatenated by a single space. ? Note that (s) may contain leading or trailing spaces or multiple spaces between two words. ? The returned string should on... | def reverseWords(s)
s.split(" ").reverse.join(" ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_words(s)\n s.split(/\\s+/).map\n {|w|wl=w.length-1;\n (0..wl).map{|i|w[wl-i]}.join}.join(' ')\n end",
"def reverse_words(s)\n s.split(' ').map(&:reverse!).join(' ')\nend",
"def reverse_words(s)\n strs = s.split(\" \")\n if strs.length == 0\n return \"\"\n elsif strs.length == 1\n... | [
"0.8287972",
"0.7881967",
"0.78685224",
"0.7725219",
"0.7697015",
"0.7693956",
"0.76374924",
"0.76278484",
"0.7621391",
"0.76196814",
"0.7593021",
"0.7574868",
"0.7571776",
"0.75531626",
"0.7547205",
"0.75152034",
"0.75126845",
"0.750061",
"0.7486107",
"0.7467861",
"0.7454781... | 0.7927719 | 1 |
Calculate and print the total sales volume of all the brand's toys combined | def brand_sales(brand)
brand_sales = 0
brands_items(brand).each do |item|
item["purchases"].each do |count|
brand_sales += count["price"].to_f
end
end
$report_file.puts "Total sales #{brand}: #{brand_sales.round(2)}" # Calculate and print the total sales volume of all the b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_brand_sales(brand)\n \"Total sales: $#{brand.sales}\"\n end",
"def total_sales_brand item\n\t$brand_revenue = 0.0\n\t$same_brand.each {|toy| $brand_revenue += toy[\"purchases\"].inject(0) {|m,n| m + n[\"price\"]}}\nend",
"def brand_average_price(brand) \n full_price_brand = 0 ... | [
"0.7536557",
"0.748522",
"0.7320336",
"0.72647417",
"0.72337943",
"0.6585791",
"0.65685046",
"0.6546615",
"0.65122366",
"0.6359174",
"0.6316695",
"0.62417704",
"0.6221221",
"0.62103426",
"0.6164935",
"0.6112843",
"0.6076607",
"0.60331863",
"0.6027328",
"0.601212",
"0.60099167... | 0.8412527 | 0 |
Calculate and print the average price of the brand's toys | def brand_average_price(brand)
full_price_brand = 0
brands_items(brand).each do |toy|
full_price_brand += toy["full-price"].to_f
end
$report_file.puts "Average price #{brand}: #{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_brand_price(brand)\n 'Average Product Price: $' + format('%.2f', brand.average_price)\n end",
"def average_price_brand item\n\t$brand_price = 0.0\n\t$same_brand.each {|toy| $brand_price += toy[\"full-price\"].to_f}\n\t$average_price = 0.0\n\t$same_brand.each {|toy| $average_price = ($brand_price ... | [
"0.81627935",
"0.8079495",
"0.74933726",
"0.73309404",
"0.7330579",
"0.7240651",
"0.7181182",
"0.7136213",
"0.69188994",
"0.6798309",
"0.6762968",
"0.675699",
"0.67249066",
"0.6665509",
"0.66511744",
"0.664747",
"0.6645214",
"0.66250724",
"0.6547639",
"0.653488",
"0.6531406",... | 0.8360447 | 0 |
Count and print the number of the brand's toys we stock | def total_stock_brand(brand)
total_stock_brand = 0
brands_items(brand).each do |toy|
total_stock_brand += toy["stock"].to_i
end
$report_file.puts "#{brand} in stock: #{total_stock_brand}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def brand_toy_stock item\n\t$num_stock = 0\n\t$same_brand.each {|item| $num_stock += item[\"stock\"]}\nend",
"def brand_stock(brand)\n \"Toy Stock: #{brand.stock}\"\n end",
"def stock_count(petshop)\n return petshop[:pets].size()\n end",
"def stock_count\n sql = \"SELECT * FROM cars\n WH... | [
"0.7326201",
"0.7195437",
"0.7133415",
"0.6793809",
"0.66731304",
"0.66731304",
"0.6641805",
"0.66342044",
"0.6625718",
"0.66043544",
"0.6582805",
"0.65817916",
"0.6566679",
"0.65406",
"0.65338886",
"0.65269035",
"0.6505939",
"0.6505939",
"0.6495785",
"0.6493714",
"0.6477194"... | 0.72384936 | 1 |
grabs album info once album is selected from list | def get_album_info(album)
info = UpcomingReleases::Scraper.scrape_info_page(ALBUM_URL + album.info_url)
album.add_album_info(info)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_album\n current_album_view.album\n end",
"def albums\n self.album\n end",
"def show\n\t\t@album = Album.find(params[:id])\n\tend",
"def get_album_from_event(sender, event)\n #index = sender.getItemAt(event.win_x, event.win_y)\n #return nil if index.nil?\n entry = sender.getItem(e... | [
"0.6774517",
"0.6748739",
"0.6746998",
"0.6699399",
"0.6682887",
"0.6644438",
"0.6629188",
"0.6621611",
"0.66209453",
"0.65947884",
"0.65791804",
"0.65536934",
"0.65239555",
"0.65228593",
"0.647507",
"0.64594537",
"0.6433716",
"0.64320606",
"0.6405289",
"0.63919616",
"0.63734... | 0.6779171 | 0 |
checks to see if piece has any valid moves or captures | def valid_piece_movement?(coordinates)
row = coordinates[:row]
column = coordinates[:column]
@active_piece.moves.any?([row, column]) || @active_piece.captures.any?([row, column])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_valid_piece?\n piece_to_move && right_piece_type? && right_piece_color?\n end",
"def can_capture?(_pieces, _destination)\n destination_piece = _pieces.find { |p| p.position.equals?(_destination) }\n\n !destination_piece.nil? && destination_piece.color != color\n end",
"def could_be_valid_mov... | [
"0.7562709",
"0.73544794",
"0.7168025",
"0.7162214",
"0.7100845",
"0.7095518",
"0.70927143",
"0.70796156",
"0.69879556",
"0.69707984",
"0.6932449",
"0.68907714",
"0.6888567",
"0.6879114",
"0.68621653",
"0.6844884",
"0.6839401",
"0.680035",
"0.67981344",
"0.6754286",
"0.674693... | 0.74713427 | 1 |
determines if King is IN CHECK by seeing opposing piece color can capture location that matches King's location. | def king_in_check?(color)
king = color == :white ? @white_king : @black_king
pieces = @data.flatten(1).compact
pieces.any? do |piece|
next unless piece.color != king.color
piece.captures.include?(king.location)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_check?(color)\n own_king_pos = []\n (0...grid.length).each do |row|\n (0...grid.length).each do |col|\n if grid[row][col].color == :color && grid[row][col].is_a?(King)\n own_king_pos = grid[row][col].pos\n puts \"King is at #{own_king_pos}\"\n break\n end\... | [
"0.7867516",
"0.7692622",
"0.7607699",
"0.76047355",
"0.7583151",
"0.7479056",
"0.7451492",
"0.744391",
"0.7442968",
"0.7434481",
"0.7408907",
"0.73553133",
"0.7298567",
"0.7281872",
"0.7267661",
"0.7243359",
"0.71565986",
"0.7125973",
"0.711827",
"0.7062647",
"0.7039582",
... | 0.77992165 | 1 |
selects a random black piece if it has any legal moves/captures | def random_black_piece
pieces = @data.flatten(1).compact
black_pieces = pieces.select do |piece|
next unless piece.color == :black
piece.moves.size.positive? || piece.captures.size.positive?
end
location = black_pieces.sample.location
{ row: location[0], column: location[1] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_black_move\n possible_moves = @active_piece.moves + @active_piece.captures\n location = possible_moves.sample\n { row: location[0], column: location[1] }\n end",
"def select_piece\n piece_pos = get_piece_locations.sample\n return select_piece if @board[piece_pos].valid_moves.empty?\n ... | [
"0.7670217",
"0.7161804",
"0.6891448",
"0.6710956",
"0.6572074",
"0.6539632",
"0.65391624",
"0.6447039",
"0.64166975",
"0.6401256",
"0.6352215",
"0.6314632",
"0.63121593",
"0.62980384",
"0.6266637",
"0.62249374",
"0.61858183",
"0.61728865",
"0.61701906",
"0.61512727",
"0.6088... | 0.7480927 | 1 |
GET /relatorios_colaborador GET /relatorios_colaborador.json | def index
@relatorios_colaborador = RelatorioColaborador.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @anexo_relatorios_colaborador = AnexoRelatorioColaborador.all\n end",
"def index\n @colaboradors = Colaborador.all\n end",
"def set_relatorio_colaborador\n @relatorio_colaborador = RelatorioColaborador.find(params[:id])\n end",
"def index\n @laboratorios = Laboratorio.all\n en... | [
"0.7036306",
"0.6946997",
"0.6911645",
"0.6758124",
"0.66776025",
"0.65075266",
"0.6489579",
"0.6489579",
"0.6489579",
"0.6489579",
"0.6433107",
"0.63922304",
"0.633625",
"0.6317222",
"0.63081306",
"0.6274606",
"0.62470716",
"0.6240484",
"0.6229062",
"0.6213239",
"0.61928135"... | 0.75238234 | 0 |
POST /relatorios_colaborador POST /relatorios_colaborador.json | def create
@relatorio_colaborador = RelatorioColaborador.new(relatorio_colaborador_params)
respond_to do |format|
if @relatorio_colaborador.save
format.html { redirect_to @relatorio_colaborador, notice: 'Relatorio colaborador was successfully created.' }
format.json { render :show, status... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @colaborador = current_user.empresa.colaboradors.build(colaborador_params)\n\n respond_to do |format|\n if @colaborador.save\n format.html { redirect_to colaboradors_path, notice: 'Colaborador was successfully created.' }\n format.json { render action: 'show', status: :created... | [
"0.7422058",
"0.74212486",
"0.73527706",
"0.7325629",
"0.7195746",
"0.7165132",
"0.70995766",
"0.7009287",
"0.6957571",
"0.69060975",
"0.6878167",
"0.687227",
"0.6866567",
"0.68415827",
"0.6817782",
"0.68152374",
"0.6759658",
"0.67253685",
"0.6714103",
"0.6697643",
"0.6680939... | 0.7697127 | 0 |
PATCH/PUT /relatorios_colaborador/1 PATCH/PUT /relatorios_colaborador/1.json | def update
respond_to do |format|
if @relatorio_colaborador.update(relatorio_colaborador_params)
format.html { redirect_to @relatorio_colaborador, notice: 'Relatorio colaborador was successfully updated.' }
format.json { render :show, status: :ok, location: @relatorio_colaborador }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @anexo_relatorio_colaborador.update(anexo_relatorio_colaborador_params)\n format.html { redirect_to @anexo_relatorio_colaborador, notice: 'Anexo relatorio colaborador was successfully updated.' }\n format.json { render :show, status: :ok, location: @an... | [
"0.7056599",
"0.6996041",
"0.6872532",
"0.67871886",
"0.6752394",
"0.6720319",
"0.6704558",
"0.66875553",
"0.6646831",
"0.6541279",
"0.6541211",
"0.65367466",
"0.6492142",
"0.64860594",
"0.64494634",
"0.638707",
"0.635233",
"0.6339696",
"0.6324904",
"0.6300765",
"0.629712",
... | 0.7293194 | 0 |
DELETE /relatorios_colaborador/1 DELETE /relatorios_colaborador/1.json | def destroy
@relatorio_colaborador.destroy
respond_to do |format|
format.html { redirect_to relatorios_colaborador_url, notice: 'Relatorio colaborador was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @anexo_relatorio_colaborador.destroy\n respond_to do |format|\n format.html { redirect_to anexo_relatorios_colaborador_url, notice: 'Anexo relatorio colaborador was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @laboratorio.de... | [
"0.7496716",
"0.7432907",
"0.73831975",
"0.7138987",
"0.7125222",
"0.7121388",
"0.71168035",
"0.71168035",
"0.71124315",
"0.70716083",
"0.7027432",
"0.70188564",
"0.7016607",
"0.69712645",
"0.69650346",
"0.6946897",
"0.693684",
"0.6924511",
"0.6916499",
"0.691425",
"0.6897129... | 0.75904936 | 0 |
Listen for a message and call the given block if it matches the format string. Raises an exception if the format string could not be parsed successfully. | def listen(format, &block)
matcher = @@parser.interpret(format)
raise "Could not listen for '#{format}'" unless matcher
@listeners[matcher] = block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(message)\n @block ? @block.call(message) : true\n end",
"def handle(time, sender_nick, message)\n if matchers.empty?\n raise NotImplementedError, \"Implement me in #{self.class.name}!\"\n else\n find_match(message)\n end\n end",
"def block_while_parsing(&block)\n @p... | [
"0.63777524",
"0.5868291",
"0.54251856",
"0.5415366",
"0.5381681",
"0.53806007",
"0.5314865",
"0.5314865",
"0.53133947",
"0.5312981",
"0.52572393",
"0.5232989",
"0.5232989",
"0.5228189",
"0.51937926",
"0.51835746",
"0.5177806",
"0.5164587",
"0.5152392",
"0.51332676",
"0.51259... | 0.73608476 | 0 |
Receive a message and call any blocks that have been registered with listen if the message matches the format. | def receive(message)
self.class.listeners.map do |matcher, block|
match = matcher.match(message)
block.call(match) if match
end.compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listen(format, &block)\n matcher = @@parser.interpret(format)\n raise \"Could not listen for '#{format}'\" unless matcher\n @listeners[matcher] = block\n end",
"def listen(&block)\n loop do\n block.call receive\n end\n end",
"def match(message)\n @block ... | [
"0.67405814",
"0.6552037",
"0.6400966",
"0.63166285",
"0.6205043",
"0.61838067",
"0.6174294",
"0.6107075",
"0.61012834",
"0.60803133",
"0.60290563",
"0.5979966",
"0.597824",
"0.59713197",
"0.5965837",
"0.59362155",
"0.5934447",
"0.5913117",
"0.5906731",
"0.58910793",
"0.58761... | 0.6918675 | 0 |
If none of the environment variables are empty, the configuration repository is valid, and the configuration repository has been cloned locally, then the setup is "correct" | def correct_setup?
return required_keys_and_proper_remote_configuration_repo? &&
local_configuration_repo_exists?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def required_keys_and_proper_remote_configuration_repo?\n return @setup_correctly unless @setup_correctly.nil?\n\n unless no_missing_keys?\n logger.debug(\"Missing environment variables.\")\n return false\n end\n\n unless remote_configuration_repository_valid?\n logger.debu... | [
"0.75837183",
"0.65796643",
"0.65796643",
"0.6530089",
"0.64598143",
"0.64310396",
"0.6362959",
"0.6338455",
"0.63173455",
"0.6266975",
"0.6185561",
"0.61245215",
"0.6091598",
"0.60747313",
"0.6067772",
"0.5996462",
"0.5957928",
"0.5955701",
"0.59374887",
"0.5934781",
"0.5933... | 0.7483705 | 1 |
If the user has all the required environment variables, and a valid remote configuration repository, then the only thing preventing their setup from being correct is cloning the repository locally. This helper function is used to determine if the remote configuration repository should be cloned locally on startup | def required_keys_and_proper_remote_configuration_repo?
return @setup_correctly unless @setup_correctly.nil?
unless no_missing_keys?
logger.debug("Missing environment variables.")
return false
end
unless remote_configuration_repository_valid?
logger.debug("remote config... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_setup?\n return required_keys_and_proper_remote_configuration_repo? &&\n local_configuration_repo_exists?\n end",
"def enabled?\n (super ||\n !@remote_path.nil? && @remote_path.directory? ||\n local_valid_repo?)\n end",
"def remote_repository_access?\n confi... | [
"0.7825339",
"0.72478276",
"0.7205873",
"0.710473",
"0.6733846",
"0.6617953",
"0.6538941",
"0.6534016",
"0.6492157",
"0.63621587",
"0.63529015",
"0.63384527",
"0.6262773",
"0.6227134",
"0.6226715",
"0.6216484",
"0.62108386",
"0.61753327",
"0.61676973",
"0.6143597",
"0.6127117... | 0.7818013 | 1 |
Returns `true` if the local configuration repository exists | def local_configuration_repo_exists?
unless Dir.exist?(Services.ci_config_git_repo_path)
logger.debug("local configuration repo doesn't exist")
return false
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_repository?\n @local_repository.nil? ? true : @local_repository\n end",
"def local_valid_repo?\n @local_dir_path.directory?\n end",
"def usable_repository?\n repository_cache.directory? &&\n run_and_output(\"#{git} remote -v | grep origin\").include?(uri)\n end",
"def correct_s... | [
"0.8018029",
"0.77918994",
"0.7523665",
"0.748294",
"0.73957986",
"0.73145473",
"0.7196702",
"0.7097867",
"0.7085378",
"0.702131",
"0.69543266",
"0.69259036",
"0.6904142",
"0.68944705",
"0.68944705",
"0.68706936",
"0.6853428",
"0.68506026",
"0.68000776",
"0.6765787",
"0.67203... | 0.886982 | 0 |
Wraps ActiveRecord::Basecreate_or_update and its callbacks in a transaction so that Taskfinished doesn't get out of synch with its assessments. | def create_or_update_with_transaction
Assessment.transaction do
create_or_update_without_transaction
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit_transaction\n\t super\n\t \n\t # Update the task arguments. The original\n\t # Roby::Task#commit_transaction has already translated the proxy\n\t # objects into real objects\n\t arguments.each do |key, value|\n\t\t__getobj__.arguments.update!(key, value)\n\t end\n\n execu... | [
"0.66034484",
"0.6489179",
"0.6296206",
"0.61637926",
"0.61432457",
"0.6133284",
"0.6130948",
"0.6040313",
"0.59693205",
"0.59645814",
"0.59645814",
"0.596138",
"0.5942352",
"0.5907687",
"0.5907687",
"0.5902797",
"0.5902262",
"0.5899958",
"0.5879997",
"0.587447",
"0.5827789",... | 0.70499235 | 0 |
Wraps ActiveRecord::Basedestroy and its callbacks in a transaction so that Taskfinished doesn't get out of synch with its assessments. | def destroy_with_transaction
Assessment.transaction do
destroy_without_transaction
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @task.destroy\n success_task_destroy\n end",
"def destroy\n db.transaction do\n return save_failure(:destroy) if before_destroy == false\n delete\n after_destroy\n end\n self\n end",
"def destroy\n pr = proc{all(&:destroy).length}\n mode... | [
"0.6991137",
"0.68347514",
"0.64641154",
"0.64641154",
"0.63745856",
"0.6303864",
"0.6300361",
"0.6254252",
"0.6254252",
"0.621275",
"0.621275",
"0.6194675",
"0.61877537",
"0.6156816",
"0.6141934",
"0.6127621",
"0.61057854",
"0.6082095",
"0.60500836",
"0.60427046",
"0.6039863... | 0.71402246 | 0 |
GET /community_health_workers/1 GET /community_health_workers/1.json | def show
@community_health_worker = CommunityHealthWorker.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @community_health_worker }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @community_health_worker = CommunityHealthWorker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @community_health_worker }\n end\n end",
"def create\n @community_health_worker = CommunityHealthWorker.new(params[:community_health_worker])\... | [
"0.6737358",
"0.63302827",
"0.6197872",
"0.5997239",
"0.5979925",
"0.5979925",
"0.5979925",
"0.5979925",
"0.589065",
"0.58128715",
"0.5748451",
"0.56942284",
"0.5669938",
"0.5603591",
"0.55660665",
"0.5550404",
"0.55274105",
"0.55154645",
"0.5497042",
"0.54552114",
"0.5442367... | 0.7315061 | 0 |
GET /community_health_workers/new GET /community_health_workers/new.json | def new
@community_health_worker = CommunityHealthWorker.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @community_health_worker }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @community_health_worker = CommunityHealthWorker.new(params[:community_health_worker])\n\n respond_to do |format|\n if @community_health_worker.save\n format.html { redirect_to @community_health_worker, notice: 'Community health worker was successfully created.' }\n format.jso... | [
"0.7618581",
"0.7370246",
"0.6839113",
"0.6807006",
"0.66943336",
"0.66943336",
"0.66943336",
"0.6671685",
"0.6610921",
"0.6587818",
"0.6522276",
"0.65068096",
"0.64803773",
"0.6434147",
"0.6434147",
"0.64300376",
"0.6422873",
"0.63281226",
"0.6287487",
"0.62697715",
"0.62608... | 0.79560065 | 0 |
POST /community_health_workers POST /community_health_workers.json | def create
@community_health_worker = CommunityHealthWorker.new(params[:community_health_worker])
respond_to do |format|
if @community_health_worker.save
format.html { redirect_to @community_health_worker, notice: 'Community health worker was successfully created.' }
format.json { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to tenant_workers_path, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html {... | [
"0.6250383",
"0.622729",
"0.62061197",
"0.6105649",
"0.60842705",
"0.60842705",
"0.60842705",
"0.59919924",
"0.59019613",
"0.5816997",
"0.55858856",
"0.5565404",
"0.55216813",
"0.55052507",
"0.54889864",
"0.5467491",
"0.5448646",
"0.5435112",
"0.54160726",
"0.537672",
"0.5374... | 0.72366273 | 0 |
PUT /community_health_workers/1 PUT /community_health_workers/1.json | def update
@community_health_worker = CommunityHealthWorker.find(params[:id])
respond_to do |format|
if @community_health_worker.update_attributes(params[:community_health_worker])
format.html { redirect_to @community_health_worker, notice: 'Community health worker was successfully updated.' }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @community_health_worker = CommunityHealthWorker.new(params[:community_health_worker])\n\n respond_to do |format|\n if @community_health_worker.save\n format.html { redirect_to @community_health_worker, notice: 'Community health worker was successfully created.' }\n format.jso... | [
"0.6385195",
"0.60195947",
"0.59841007",
"0.5967514",
"0.5870764",
"0.58069515",
"0.5713738",
"0.56988925",
"0.566236",
"0.5515965",
"0.54589635",
"0.5457567",
"0.5457567",
"0.5449309",
"0.53408486",
"0.53346926",
"0.53213733",
"0.53201693",
"0.5300931",
"0.5289939",
"0.52755... | 0.71706855 | 0 |
DELETE /community_health_workers/1 DELETE /community_health_workers/1.json | def destroy
@community_health_worker = CommunityHealthWorker.find(params[:id])
@community_health_worker.destroy
respond_to do |format|
format.html { redirect_to community_health_workers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @worker = Worker.find(params[:id])\n @worker.destroy\n\n respond_to do |format|\n format.html { redirect_to workers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @worker.destroy\n respond_to do |format|\n format.html { redirect_to workers_ur... | [
"0.6927002",
"0.6922473",
"0.6922473",
"0.6642029",
"0.6642029",
"0.6640711",
"0.6607985",
"0.6592013",
"0.6553687",
"0.6552781",
"0.6552781",
"0.6552781",
"0.64870894",
"0.6475948",
"0.6474758",
"0.6448457",
"0.64320624",
"0.6383426",
"0.6372262",
"0.63588035",
"0.6351544",
... | 0.78326344 | 0 |
Default middleware stack that uses default adapter as specified by configuration setup | def default_middleware(options = {})
Middleware.default(options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_middleware\n Proc.new do |builder|\n builder.use Faraday::Request::Multipart\n builder.use Faraday::Request::UrlEncoded\n builder.use Yandex::Webmaster::Request::OAuth2, config.oauth_token\n\n builder.use Faraday::Response::Logger if ENV['DEBUG']\n bu... | [
"0.6869591",
"0.64794964",
"0.6366557",
"0.63437265",
"0.6225957",
"0.6194319",
"0.6180685",
"0.61398417",
"0.61222714",
"0.6117322",
"0.6116652",
"0.60949314",
"0.5956754",
"0.5939584",
"0.59303826",
"0.58159137",
"0.5773418",
"0.5773203",
"0.5768487",
"0.57481354",
"0.57331... | 0.69624674 | 0 |
Determines the path to be requested on Blupee, incorporating an API version if specified. | def path
# if an api_version is specified and the path does not already contain
# one, prepend it to the path
api_version = raw_options[:api_version] || Blupee.config.api_version
"/#{api_version}/#{raw_path}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_path(path)\n \"/rest/v#{options[:api_version]}/#{path}\"\n end",
"def api_path\n @api_path ||= find_api_path(base_uri)\n end",
"def api_base_path\n \"/lol/platform/#{api_version}\"\n end",
"def api_path(path)\n \"#{options[:base_path]}/#{path}\" || \"/#{path}\"\n ... | [
"0.7403472",
"0.70127934",
"0.7011892",
"0.69967836",
"0.68657887",
"0.68066245",
"0.6802114",
"0.6799176",
"0.6777674",
"0.674446",
"0.6611577",
"0.6587314",
"0.64549994",
"0.64427507",
"0.6377599",
"0.6375642",
"0.63665605",
"0.63665605",
"0.6351563",
"0.6273654",
"0.626528... | 0.79405093 | 0 |
Calculates a set of request options to pass to Faraday. | def options
# figure out our options for this request
add_ssl_options(
# for GETs, we pass the params to Faraday to encode
{params: get_args}.merge(HTTPService.http_options).merge(raw_options)
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_options(opts = {})\n opts\n end",
"def faraday_request(options)\n return options[:request] if options[:request]\n\n request = options[:options]\n return unless request[:open_timeout] || request[:timeout]\n\n {\n open_timeout: request[:open_timeout],\n ... | [
"0.7452727",
"0.7264967",
"0.7217382",
"0.71806276",
"0.7179738",
"0.7163529",
"0.67132527",
"0.6660397",
"0.6452697",
"0.64118373",
"0.6373771",
"0.63609874",
"0.63551503",
"0.63457805",
"0.633319",
"0.6327489",
"0.6322065",
"0.63160914",
"0.62901527",
"0.62898445",
"0.62167... | 0.72988206 | 1 |
Whether or not this request should use JSON. | def json?
raw_options[:format] == :json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefer_json?\n prefered_http_accept == \"application/json\"\n end",
"def json?\n true\n end",
"def supports_json?\n false\n end",
"def supports_json?\n false\n end",
"def json_request?\n request.format.json?\n end",
"def json_request?()\n request.f... | [
"0.8259827",
"0.8071777",
"0.8041706",
"0.8041706",
"0.7946787",
"0.7923039",
"0.7878613",
"0.7842442",
"0.7731347",
"0.7731347",
"0.7731347",
"0.7731347",
"0.7731347",
"0.75915825",
"0.7526993",
"0.75076777",
"0.7301309",
"0.72119796",
"0.71352226",
"0.71328497",
"0.7132008"... | 0.81626135 | 1 |
POST /baz81s or /baz81s.json | def create
@baz81 = Baz81.new(baz81_params)
respond_to do |format|
if @baz81.save
format.html { redirect_to @baz81, notice: "Baz81 was successfully created." }
format.json { render :show, status: :created, location: @baz81 }
else
format.html { render :new, status: :unprocess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path, real_params = {}, 'rack.input' => rack_input\nend",
"def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_... | [
"0.6058766",
"0.60425776",
"0.5947929",
"0.58855027",
"0.5801295",
"0.5795103",
"0.5791406",
"0.56788486",
"0.5676787",
"0.5644613",
"0.5641067",
"0.56293845",
"0.5623389",
"0.5602308",
"0.5596647",
"0.55786574",
"0.5573966",
"0.55611795",
"0.5548356",
"0.5545109",
"0.5544716... | 0.613837 | 0 |
PATCH/PUT /baz81s/1 or /baz81s/1.json | def update
respond_to do |format|
if @baz81.update(baz81_params)
format.html { redirect_to @baz81, notice: "Baz81 was successfully updated." }
format.json { render :show, status: :ok, location: @baz81 }
else
format.html { render :edit, status: :unprocessable_entity }
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_pat... | [
"0.63256574",
"0.6220482",
"0.61838216",
"0.6172779",
"0.61645925",
"0.6133109",
"0.6125998",
"0.6106105",
"0.6106013",
"0.6076875",
"0.60456765",
"0.6041913",
"0.60328984",
"0.60144436",
"0.5974234",
"0.59735113",
"0.5972274",
"0.5971199",
"0.59604865",
"0.59488356",
"0.5933... | 0.62670714 | 1 |
Apply the given patch file in a particular directory | def apply_patch( patch_file, location )
Dir.chdir( location ) do
%x[ patch -p0 < #{patch_file} ]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_patch(patch_file)\n working_dir = Dir.pwd\n repo_root = `git rev-parse --show-toplevel`.strip\n ios_project_path = Pathname.new(working_dir).relative_path_from(Pathname.new(repo_root))\n\n directory_arg = (ios_project_path.to_s.eql? \".\") ? \"Pods\" : File.join(ios_project_path, 'Pods')\n\n Dir.chd... | [
"0.7319421",
"0.71288186",
"0.70775825",
"0.6845581",
"0.6655986",
"0.65863156",
"0.65256315",
"0.65095305",
"0.6451162",
"0.6159917",
"0.6159917",
"0.6159917",
"0.61411196",
"0.6130126",
"0.61149806",
"0.6065196",
"0.6055976",
"0.6053355",
"0.6016484",
"0.5885383",
"0.568210... | 0.78202224 | 0 |
GET /starts/1 GET /starts/1.xml | def show
@start = Start.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @start }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @starts = Start.all\n end",
"def start_list\n unless params[:version] == '2.0.3'\n raise ActionController::RoutingError.new('Not Found')\n end\n\t\t\n @event = Event.find(params[:id])\n respond_to do |format|\n format.xml { render :layout => false }\n end\n end",
"def... | [
"0.63196516",
"0.6204604",
"0.6097389",
"0.60433054",
"0.6032581",
"0.592449",
"0.5839446",
"0.583827",
"0.583827",
"0.5823006",
"0.5788871",
"0.5788681",
"0.57164675",
"0.56981844",
"0.5567354",
"0.5556112",
"0.5487675",
"0.5485067",
"0.5485067",
"0.54839575",
"0.5477381",
... | 0.6396482 | 0 |
GET /starts/new GET /starts/new.xml | def new
@start = Start.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @start }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @bare_start = BareStart.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bare_start }\n end\n end",
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @get_started_pag... | [
"0.6498302",
"0.63843846",
"0.61806905",
"0.6124799",
"0.6060026",
"0.6014023",
"0.5971315",
"0.58826274",
"0.58818114",
"0.58730435",
"0.58730435",
"0.58730435",
"0.5867968",
"0.5836353",
"0.58145267",
"0.5810728",
"0.57858515",
"0.576016",
"0.57600945",
"0.57419336",
"0.573... | 0.7000965 | 0 |
POST /starts POST /starts.xml | def create
@start = Start.new(params[:start])
respond_to do |format|
if @start.save
flash[:notice] = 'Start was successfully created.'
format.html { redirect_to(@start) }
format.xml { render :xml => @start, :status => :created, :location => @start }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @start = Start.new(start_params)\n\n respond_to do |format|\n if @start.save\n format.html { redirect_to @start, notice: 'Start was successfully created.' }\n format.json { render :show, status: :created, location: @start }\n else\n format.html { render :new }\n ... | [
"0.64738125",
"0.60647833",
"0.60642856",
"0.5988969",
"0.58362854",
"0.58042717",
"0.5754178",
"0.5751017",
"0.5699761",
"0.56944245",
"0.56840307",
"0.5682654",
"0.56424797",
"0.56424797",
"0.5610137",
"0.5610137",
"0.5506473",
"0.548661",
"0.5477545",
"0.54735774",
"0.5460... | 0.6542591 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.