query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102 values |
|---|---|---|---|---|---|---|
=begin Based on what params user selected or if they were not passed based params saved in session return status, that should be filtered for financial statements. Params +session_options+ hash including :status, might be nil Returns +status+ string, one of valid_status_values, by default 'all' =end | def financial_statements_status(session_options)
not_params_clear = !params[:clear]
params_status, session_options_status = [params[:status], session_options.try(:[], [:status])]
if (@valid_status_values.include? params_status) && not_params_clear
params_status
elsif session_options && (@valid_status_values.include? session_options_status) && not_params_clear
session_options_status
else
'all'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sessionStatus(options = {})\n assert_valid_keys(options, :sessionId, :transactionId, :date, :type, :amount, :description)\n assert_keys_exists(options, :sessionId, :transactionId, :date, :type, :amount, :description)\n #type => [ \"BOOKING\", \"REVERSAL\", \"BACKPAY\", \"EXTERNAL\", \"REFU... | [
"0.67327684",
"0.6095276",
"0.6050061",
"0.5843157",
"0.57345873",
"0.5653833",
"0.5494783",
"0.54440266",
"0.536635",
"0.5289625",
"0.52812344",
"0.5276167",
"0.5262529",
"0.52620155",
"0.5231291",
"0.5221503",
"0.5203766",
"0.5185905",
"0.51485497",
"0.51177555",
"0.5104264... | 0.803171 | 0 |
=begin convert prices in statements from default system currency to currency that is set in session Params +statement+ iterable of financial stement data(they rices should be in system currency) Returns +statement+ same object that was passed only it's prices recalculated in user selected currency =end | def convert_to_user_currency(statements)
exchange_rate = Currency.count_exchange_rate(session[:default_currency], session[:show_currency])
statements.each { |statement|
statement.price = statement.price.to_d * exchange_rate
statement.price_with_vat = statement.price_with_vat.to_d * exchange_rate
}
statements
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currency_conversion(price = 0.0)\n exchange = 6.98\n price * exchange\nend",
"def convert_curr\n curr = {\"USD\" => 1.0, \"CAN\" => 1.9, \"CHF\" => 0.91, \"EUR\" => 0.74, \"HKD\" => 7.75}\n curr.each do |key, value|\n if key == @currency\n @con = @price * value\n end\n end\n end"... | [
"0.6251829",
"0.62362576",
"0.6193996",
"0.60850334",
"0.60850334",
"0.5972156",
"0.59646547",
"0.5933741",
"0.587779",
"0.5779791",
"0.5758355",
"0.5719037",
"0.5708182",
"0.5656747",
"0.56557554",
"0.5612184",
"0.5584094",
"0.55549437",
"0.5552312",
"0.55353147",
"0.5524599... | 0.7560532 | 0 |
=begin financial data returned by invoice, credit notes or payments may lack some information, this method's purpose is to retrieve information from part of financial statement(let's say financial stetement is devided in three parts: credit note, invoice and payments) about paid/unpaid financial data. if there is no such data return default, default meaning that there is no paid/unpaid part, so it's count and price is 0. TODO should rename valiable names, cause they dont make much sense. maybe event method name should be renamed Note that price and price including taxes will be converted from default system currency to user selected Params +statement+ part of financial statement +status+ whatever valid status might have the statement Returns +paid/unpaid_statement+ if there is such statement that satisfies condition(status) returns it, else returns default statement. =end | def get_financial_statement(statements, status)
statements.each { |statement|
if statement.status == status
return statement
end
}
#Return default financial data if required stetement was not found
Struct.new('We', :count, :price, :price_with_vat, :status)
return Struct::We.new(0, 0, 0, status)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_value(attendance, payment_type)\n quota = find_quota\n if payment_type == 'statement_agreement'\n full_price\n elsif attendance.price_band?\n attendance.band_value * attendance.discount\n elsif period_for.present?\n period_for.price * attendance.discount\n elsif quota.firs... | [
"0.6476749",
"0.58315426",
"0.5766122",
"0.57264704",
"0.5682658",
"0.564321",
"0.5589904",
"0.5571895",
"0.5559602",
"0.5557696",
"0.55138016",
"0.5460454",
"0.5450075",
"0.5446995",
"0.5440988",
"0.54402226",
"0.54148614",
"0.5411447",
"0.540227",
"0.5397451",
"0.5397199",
... | 0.71730596 | 0 |
=begin Only one who may not have permissions to view financial statements is accountant. If he does not have 'can see finances', 'invoices manage' and 'manage payments' permissions to read he cannot view financial statements. In any other case everyone can view treyr user's invoices, credit notes and payments. =end | def can_view_financial_statements?
if accountant? and (not current_user.accountant_allow_read('can_see_finances') or not current_user.accountant_allow_read('payments_manage') or not current_user.acoutnant_alllow_read('invoices_manage'))
return false
else
return true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_see_finances?\n accountant_allow_read('see_financial_data')\n end",
"def account_not_owner_or_deputy\n errors.add( :account_id, I18n.t( 'sir_members.msg.own_account_id' )) \\\n if sir_log_id && account_id && sir_log.user_is_owner_or_deputy?( account_id )\n end",
"def ensure_is_authorized_t... | [
"0.6406249",
"0.6271701",
"0.622199",
"0.6074152",
"0.6052165",
"0.60480934",
"0.59924597",
"0.59908026",
"0.5982115",
"0.59774834",
"0.59516144",
"0.5915345",
"0.58944535",
"0.5889123",
"0.58816105",
"0.5878048",
"0.5851751",
"0.5850404",
"0.5848907",
"0.5847218",
"0.5831487... | 0.7303169 | 0 |
Read & return the first available config. | def load_config_files
[
Pathname.new(ENV['GUIGNOL_YML'] || '/var/nonexistent'),
Pathname.new('guignol.yml'),
Pathname.new('config/guignol.yml'),
Pathname.new(ENV['HOME']).join('.guignol.yml')
].each do |pathname|
next unless pathname.exist?
return YAML.load(pathname.read)
end
return {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_config(name)\n read_config_file[name]\n end",
"def config\n @config ||= read_config\n end",
"def read_configuration\n\t\t@config = YAML.load_file(\"config.yml\")\n\t\treturn @config\n\tend",
"def read_config_entry(key)\n if $has_config.call then\n curr_config = YAML.load(File.read($c... | [
"0.7179085",
"0.70498407",
"0.69606197",
"0.6943784",
"0.6925549",
"0.6855029",
"0.679109",
"0.67331976",
"0.66777253",
"0.664706",
"0.66129273",
"0.66123533",
"0.65960664",
"0.65883416",
"0.6578148",
"0.6533667",
"0.6521787",
"0.6521725",
"0.64785165",
"0.6472886",
"0.646611... | 0.0 | -1 |
Perform any final checks that our content is sane, for things that could be misordered in the DSL. | def finalize
@checks.each {|check| check.finalize(self) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_up_contents()\n # very minimal\n # elements = ['p', 'b', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'], attributes={})\n\n if self.contents?\n html = self.contents\n email_regex = /<p>Email:\\s+((\\w|\\-|\\_|\\.)+\\@((\\w|\\-|\\_)+\\.)+[a-zA-Z]{2,})/i\n\n html.gsub! /\\[endif\\]--/ , ''\n ... | [
"0.5912322",
"0.5490652",
"0.5483633",
"0.5385859",
"0.52697223",
"0.5243227",
"0.5238788",
"0.52343786",
"0.52296",
"0.52176046",
"0.51921797",
"0.51770526",
"0.51381975",
"0.5101896",
"0.50921446",
"0.50918025",
"0.50628525",
"0.5059682",
"0.50581104",
"0.5057526",
"0.50539... | 0.0 | -1 |
Consider adding utility fields with chunk processing here | def capabilities_array(browser_csv)
unless File.exists?(browser_csv)
puts "Please provide a browser csv file and try again."
finish
end
capabilities = SmarterCSV.process(browser_csv,:convert_values_to_numeric => false)
capabilities.map do |caps|
SauceGrabber::CapabilitiesFactory.new(caps, options[:tunnel])
end
capabilities
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ignore_bad_chunking; end",
"def ignore_bad_chunking; end",
"def ignore_bad_chunking=(_arg0); end",
"def preprocess(&block); end",
"def each_chunk; end",
"def processor; end",
"def chunked?; end",
"def read_chunk(chunk)\n puts \"[ESP DEBUG] - Read chunk #{chunk.name}...\" if @debug\n descrip... | [
"0.6671021",
"0.6671021",
"0.6603519",
"0.6285503",
"0.62636757",
"0.6160636",
"0.60494447",
"0.60108024",
"0.59924805",
"0.5938699",
"0.58650154",
"0.58187866",
"0.57767785",
"0.5699688",
"0.55931973",
"0.55931973",
"0.55931973",
"0.55931973",
"0.55931973",
"0.55931973",
"0.... | 0.0 | -1 |
Argument: integer, num Side effects: None Return: String. Alterating 1's and 0's. A total of num 1's and 0's Edge cases: i/p: 0 Algorithm: str = '' Do the folllowing num times to index = 1, 2, 3, ..., num if index is odd str << '1' otherwise str << '0' Return str | def stringy(num)
str = ''
1.upto(num) do |index|
if index.odd?
str << '1'
else
str << '0'
end
end
str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringy(num)\n str = ''\n num.times do |indx|\n indx % 2 == 0 ? str += '1' : str += '0'\n end\n return str\nend",
"def stringy(number)\n result = ''\n number.times do |idx|\n result << (idx.even? ? '1' : '0')\n end\n result\nend",
"def stringy(num)\n (1..num).map { |idx| idx.odd? ? '1' : '0'... | [
"0.8219545",
"0.8055982",
"0.8000005",
"0.78760594",
"0.78541046",
"0.7704706",
"0.76879984",
"0.76773953",
"0.7644177",
"0.7641257",
"0.76312363",
"0.76232964",
"0.76101303",
"0.7602515",
"0.7578583",
"0.7576514",
"0.7554433",
"0.75305223",
"0.7511593",
"0.74953",
"0.7494292... | 0.8182242 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_followed
@followed = Customer.find(params[:followed_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
crops a screenshot and reads from relevant sections | def readText(qxd = 915, qyd = 76, axd = 388, ayd = 42, qx0 = 335, qy0 = 659, aAx0 = 366, aAy0 = 765, aDx0 = 913, aDy0 = 840) #for default measurements to function correctly, left edge of game screen should be around 190 pixels in.
#r = rand(100000).to_s
#system('screencapture /Users/rorycampbell/Documents/smallfrybeta/screenshot' + r + '.jpg')
#img = Magick::Image.read('screenshot' + r + '.jpg').first
img = Magick::Image.read('screenshotPNI.jpg').first
question = img.crop(qx0, qy0, qxd, qyd, true).bilevel_channel(17000)
answerA = img.crop(aAx0, aAy0, axd, ayd, true).bilevel_channel(17000)
answerB = img.crop(aDx0, aAy0, axd, ayd, true).bilevel_channel(17000)
answerC = img.crop(aAx0, aDy0, axd, ayd, true).bilevel_channel(17000)
answerD = img.crop(aDx0, aDy0, axd, ayd, true).bilevel_channel(17000)
question.write('question.jpg')
answerA.write('answerA.jpg')
answerB.write('answerB.jpg')
answerC.write('answerC.jpg')
answerD.write('answerD.jpg')
e = Tesseract::Engine.new {|e|
e.language = :eng
e.blacklist = '|_'
}
q = e.text_for('question.jpg').strip.gsub(/\n/," ")
aA = e.text_for('answerA.jpg').strip
aB = e.text_for('answerB.jpg').strip
aC = e.text_for('answerC.jpg').strip
aD = e.text_for('answerD.jpg').strip
qAndA = []
qAndA << q << aA << aB << aC << aD
qAndA.each do |text|
text.gsub!(')’','y')
end
return qAndA
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_graphic\n if !Cache.screenshot(@save_number, header).nil?\n bitmap_screenshot = Cache.screenshot(@save_number, header)\n @screenshot.zoom_x = 2\n @screenshot.zoom_y = 2\n else @virtualb = DataManager.load_screenshot(@save_number)\n if @virtualb.nil?\n bitmap_screenshot = bl... | [
"0.66480505",
"0.63476115",
"0.5793085",
"0.57910705",
"0.57661664",
"0.5760912",
"0.56414205",
"0.56041145",
"0.55915797",
"0.5577264",
"0.55597204",
"0.55393744",
"0.5534194",
"0.5517928",
"0.5472978",
"0.53833055",
"0.5370933",
"0.5348407",
"0.5343125",
"0.52989435",
"0.52... | 0.5674084 | 6 |
returns htmls of kiwix answer searches | def kiwixAnswerSearch(aA, aB, aC, aD)
htmls = []
begin
address1 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aA) + '.html'
rescue
puts "address1 not encoded"
end
begin
address2 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aB) + '.html'
rescue
puts "address1 not encoded"
end
begin
address3 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aC) + '.html'
rescue
puts "address1 not encoded"
end
begin
address4 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aD) + '.html'
rescue
puts "address1 not encoded"
end
begin
htmls << HTTParty.get(address1)
rescue
puts "address1 not gotten"
end
begin
htmls << HTTParty.get(address2)
rescue
puts "address2 not gotten"
end
begin
htmls << HTTParty.get(address3)
rescue
puts "address3 not gotten"
end
begin
htmls << HTTParty.get(address4)
rescue
puts "address4 not gotten"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kitties_search( q )\r\n \"https://www.cryptokitties.co/search?include=sale,sire,other&search=#{q}\"\r\nend",
"def search_results\r\n @browser.divs(class: 'rc').collect do |div|\r\n div.h3.a.text\r\n end\r\n end",
"def txt_from_answer\n search_result = QueryForKeywords.new(skills_in_request).... | [
"0.6179074",
"0.59999126",
"0.59540224",
"0.58022946",
"0.5747085",
"0.5736522",
"0.5724279",
"0.56304294",
"0.5622335",
"0.5519854",
"0.5513782",
"0.5509408",
"0.5470092",
"0.5463009",
"0.5447612",
"0.5445428",
"0.5422556",
"0.5419947",
"0.5419365",
"0.5395516",
"0.5390178",... | 0.62700886 | 0 |
returns html of keywords kiwix search | def kiwixKeywordSearch(question, acc)
if acc[-1] == '2'
puts 'end with 2'
if acc.length == 2
acc = acc[0..-2]
puts acc
term = question.scan(/\b#{acc[0]}\w*/)[1]
else
acc = acc[0..-2]
puts acc
term = question.scan(/\b#{acc[0]}\w*\s#{acc[1]}\w*/)[1]
end
elsif acc[-1] == '3'
if acc.length == 2
acc = acc[0..-2]
puts acc
term = question.scan(/\b#{acc[0]}\w*/)[2]
else
acc = acc[0..-2]
puts acc
term = question.scan(/\b#{acc[0]}\w*\s#{acc[1]}\w*/)[2]
end
elsif acc.length == 1
term = question[/\b#{acc[0]}\w*/]
elsif acc.length == 2
term = question[/\b#{acc[0]}\w*\s#{acc[1]}\w*/]
elsif acc.length == 3
term = question[/\b#{acc[0]}\w*\s#{acc[1]}\w*\s#{acc[2]}\w*/]
elsif acc.length == 4
term = question[/\b#{acc[0]}\w*\s#{acc[1]}\w*\s#{acc[2]}\w*\s#{acc[3]}\w*/]
elsif acc.length == 5
term = question[/\b#{acc[0]}\w*\s#{acc[1]}\w*\s#{acc[2]}\w*\s#{acc[3]}\w*\s#{acc[0]}\w*/]
elsif acc.length == 6
term = question[/\b#{acc[0]}\w*\s#{acc[1]}\w*\s#{acc[2]}\w*\s#{acc[3]}\w*\s#{acc[0]}\w*\s#{acc[0]}\w*/]
else
term = question[/\b#{acc[0]}\w*\s#{acc[1]}\w*\s#{acc[2]}\w*\s#{acc[3]}\w*\s#{acc[0]}\w*\s#{acc[0]}\w*\s#{acc[0]}\w*/]
end
print "term = " + term.to_s + "\n\n"
begin
address ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(term) + '.html'
rescue
puts "address encoding error"
#---------------------------To be removed?
html = HTTParty.get(address)
#puts html +"\n\n\n"
return html
end
# puts a colour aided wikipedia article to screen, with pnum the number of the paragraph
def paras(text, q, aA, aB, aC, aD, pnum = 0)
common_words = ["the", "be", "of", "and", "a", "is", "to", "in", "he", "have", "it", "that", "for", "they", "I", "with", "as", "not", "on", "she", "at", "by", "this", "we", "you", "do", "but", "from", "or", "which", "one", "would", "all", "will", "there", "say", "who", "make", "when", "can", "more", "if", "no", "man", "out", "other", "so", "what", "time", "up", "go", "about", "than", "into", "could", "only", "these", "come", "these", "some", "then", "any"] #, "state", "only", "new", "year", "some", "take", "come", "these", "know", "see", "use", "get", "like", "then", "first", "any", "work", "now", "may", "such", "give", "over", "think", "most", "even", "find", "day", "also", "after", "way", "many", "must", "look", "before", "great", "back", "through", "long", "where", "much", "should", "well", "people", "down", "own", "just", "because", "good", "each", "those", "feel", "seem", "how", "high", "too", "place", "little", "world", "very", "still", "nation", "hand", "old", "life", "tell", "write", "become", "here", "show", "house", "both"]
numberWords = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety", "hundred", "thousand", "million", "billion", "trillion"]
numberWords = Regexp.union(numberWords)
aWords = []
aWords << aA << aB << aC << aD
qWords = q.split(" ")
allWords = aWords + qWords
text = text.scan(/(\<p\>)(.*?)(\<\/p\>)/m).map(&:join)[pnum]
writtenNumbers = []
puts "allWords = " + allWords.to_s
text.gsub!(/<\/?[^>]*>/,"")
text.gsub!(/( )/,"")
text.gsub!(/(\[\d+\])/,"")
writtenNumbers = text.downcase.scan(/\b#{numberWords}(?:(?:\s+and\s+|\s+)#{numberWords})*\b/i)
writtenNumbers.concat text.scan(/\b[\d\.*,*]+\b/)
puts "writtenNumbers = " + writtenNumbers.to_s
aWords.each do |i|
i2 = i.gsub(/(\?|\.|\,|\!)/,"")
if common_words.include?(i2) == false
text.gsub!(/\b#{i2}\b/i, orange(i2))
end
end
qWords.each do |i|
i2 = i.gsub(/(\?|\.|\,|\!)/,"")
if common_words.include?(i2) == false
text.gsub!(/\b#{i2}\b/i, pink(i2))
end
end
writtenNumbers.each do |wnum|
if wnum.numberize != 0
puts "wnum = " + wnum.numberize.to_s
end
allWords.each do |qora|
if qora.numberize != 0
puts "qora = " + qora.numberize.to_s
end
if wnum.numberize < qora.numberize * 1.05 and wnum.numberize > qora.numberize * 0.95
text.gsub!(/\b#{wnum.to_s}\b/i, blue(wnum.to_s))
end
end
end
return text
end
#returns list of uris from a google search
def googleSearch(q, n = 5)
search = Google::Search::Web.new do |search|
search.query = q
search.size = :small
end
begin
uris = search.first(n).map(&:uri)
rescue
"uri fault"
end
return uris
end
#iterably counts number of hits of each answer in a list of uris
def hitCount(uris, aA, aB, aC, aD)
hitCountStart = Time.now
aAll = []
aAll << aA << aB << aC << aD
countA = 0
countB = 0
countC = 0
countD = 0
aA = aA.downcase
aB = aB.downcase
aC = aC.downcase
aD = aD.downcase
aTotal = []
bTotal = []
cTotal = []
dTotal = []
plaintexts=[]
n = uris.size
n.times {|i|
if Time.now - hitCountStart < 8
begin
begin
doc = Nokogiri::HTML(open(uris[i]))
doc.css('script, link').each { |node| node.remove }
plaintexts << doc.css('body').text.downcase.split("\n"). collect { |line| line.strip }.join("\n")
rescue
puts "Nokogiri could not read"
end
#rescue
# "Nokogiri fault"
plaintexts[i].each_line { |bar|
begin
countA += bar.scan(/\b#{aA}\b/i).size
rescue
end
begin
countB += bar.scan(/\b#{aB}\b/i).size
rescue
end
begin
countC += bar.scan(/\b#{aC}\b/i).size
rescue
end
begin
countD += bar.scan(/\b#{aD}\b/i).size
rescue
end
}
puts "A = " + countA.to_s + " B = " + countB.to_s + " C = " + countC.to_s + " D = " + countD.to_s
end
end
}
end
def definitionAnswers(aA, aB, aC, aD)
aAll = []
aAll << aA << aB << aC << aD
aAll.each do |answer|
if Dictionary.key?(answer)
puts "\n" + answer + ": " + Dictionary[answer] +"\n\n"
else
puts "\n" + answer + ' not found' +"\n\n"
end
end
end
def dots(q, aA, aB, aC, aD)
dotA = q.sub(/\.\.\./," " + aA)[/(‘|').*?(‘|')/][1..-2]
dotB = q.sub(/\.\.\./," " + aB)[/(‘|').*?(‘|')/][1..-2]
dotC = q.sub(/\.\.\./," " + aC)[/(‘|').*?(‘|')/][1..-2]
dotD = q.sub(/\.\.\./," " + aD)[/(‘|').*?(‘|')/][1..-2]
address1 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(dotA) + '.html'
address2 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(dotB) + '.html'
address3 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(dotC) + '.html'
address4 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(dotD) + '.html'
htmls = []
htmls << HTTParty.get(address1) << HTTParty.get(address2) << HTTParty.get(address3) << HTTParty.get(address4)
return htmls
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keywords(page_keywords) \n content_for(:keywords){\"<meta name=\\\"keywords\\\" content=\\\"#{page_keywords}\\\" />\\n\"} \n end",
"def keywords\n my_nodes_tagged(:querykeywordexpr)\n end",
"def keywords\n my_nodes_tagged(:querykeywordexpr)\n end",
"def get_keywords(site)\... | [
"0.6724493",
"0.6713757",
"0.6713757",
"0.66945124",
"0.66886145",
"0.6437545",
"0.6437545",
"0.6419276",
"0.6298172",
"0.62597424",
"0.6202679",
"0.6199342",
"0.6177509",
"0.6115119",
"0.60829496",
"0.6081127",
"0.6070663",
"0.606858",
"0.6061767",
"0.60485655",
"0.6038458",... | 0.5773334 | 37 |
puts a colour aided wikipedia article to screen, with pnum the number of the paragraph | def paras(text, q, aA, aB, aC, aD, pnum = 0)
common_words = ["the", "be", "of", "and", "a", "is", "to", "in", "he", "have", "it", "that", "for", "they", "I", "with", "as", "not", "on", "she", "at", "by", "this", "we", "you", "do", "but", "from", "or", "which", "one", "would", "all", "will", "there", "say", "who", "make", "when", "can", "more", "if", "no", "man", "out", "other", "so", "what", "time", "up", "go", "about", "than", "into", "could", "only", "these", "come", "these", "some", "then", "any"] #, "state", "only", "new", "year", "some", "take", "come", "these", "know", "see", "use", "get", "like", "then", "first", "any", "work", "now", "may", "such", "give", "over", "think", "most", "even", "find", "day", "also", "after", "way", "many", "must", "look", "before", "great", "back", "through", "long", "where", "much", "should", "well", "people", "down", "own", "just", "because", "good", "each", "those", "feel", "seem", "how", "high", "too", "place", "little", "world", "very", "still", "nation", "hand", "old", "life", "tell", "write", "become", "here", "show", "house", "both"]
numberWords = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety", "hundred", "thousand", "million", "billion", "trillion"]
numberWords = Regexp.union(numberWords)
aWords = []
aWords << aA << aB << aC << aD
qWords = q.split(" ")
allWords = aWords + qWords
text = text.scan(/(\<p\>)(.*?)(\<\/p\>)/m).map(&:join)[pnum]
writtenNumbers = []
puts "allWords = " + allWords.to_s
text.gsub!(/<\/?[^>]*>/,"")
text.gsub!(/( )/,"")
text.gsub!(/(\[\d+\])/,"")
writtenNumbers = text.downcase.scan(/\b#{numberWords}(?:(?:\s+and\s+|\s+)#{numberWords})*\b/i)
writtenNumbers.concat text.scan(/\b[\d\.*,*]+\b/)
puts "writtenNumbers = " + writtenNumbers.to_s
aWords.each do |i|
i2 = i.gsub(/(\?|\.|\,|\!)/,"")
if common_words.include?(i2) == false
text.gsub!(/\b#{i2}\b/i, orange(i2))
end
end
qWords.each do |i|
i2 = i.gsub(/(\?|\.|\,|\!)/,"")
if common_words.include?(i2) == false
text.gsub!(/\b#{i2}\b/i, pink(i2))
end
end
writtenNumbers.each do |wnum|
if wnum.numberize != 0
puts "wnum = " + wnum.numberize.to_s
end
allWords.each do |qora|
if qora.numberize != 0
puts "qora = " + qora.numberize.to_s
end
if wnum.numberize < qora.numberize * 1.05 and wnum.numberize > qora.numberize * 0.95
text.gsub!(/\b#{wnum.to_s}\b/i, blue(wnum.to_s))
end
end
end
return text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paragraphs(number: T.unsafe(nil), supplemental: T.unsafe(nil)); end",
"def print_piece(piece, row_i, col_i, p_color, bg_color)\n if cursor?(row_i, col_i) # fuck yes let's refactor this even better, this changes the print color if the current position is the cursor position and two more choices on whet... | [
"0.57774705",
"0.57359457",
"0.57242054",
"0.56784844",
"0.56662875",
"0.5664254",
"0.5614964",
"0.55788887",
"0.5556479",
"0.55162376",
"0.55161834",
"0.5494357",
"0.5483319",
"0.54402363",
"0.5412794",
"0.54030675",
"0.5401995",
"0.53697616",
"0.5349648",
"0.5344584",
"0.53... | 0.0 | -1 |
returns list of uris from a google search | def googleSearch(q, n = 5)
search = Google::Search::Web.new do |search|
search.query = q
search.size = :small
end
begin
uris = search.first(n).map(&:uri)
rescue
"uri fault"
end
return uris
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_urls(search_results)\n # A Google search_result looks like:\n # <a href=\"/url?q=https://www.scienceexchange.com/\">Science Exchange<b>...</b></a>\n # To get the actual page URL, use the 'href' and get the query param 'q' term.\n urls = []\n search_results.each do |result|\n ... | [
"0.7798854",
"0.7328244",
"0.710184",
"0.68942004",
"0.68099004",
"0.66551125",
"0.6574467",
"0.6551397",
"0.64066684",
"0.6397626",
"0.6377852",
"0.6367629",
"0.63197404",
"0.6306135",
"0.6273118",
"0.6234024",
"0.62063926",
"0.62023795",
"0.61490846",
"0.610605",
"0.6058003... | 0.7487712 | 1 |
iterably counts number of hits of each answer in a list of uris | def hitCount(uris, aA, aB, aC, aD)
hitCountStart = Time.now
aAll = []
aAll << aA << aB << aC << aD
countA = 0
countB = 0
countC = 0
countD = 0
aA = aA.downcase
aB = aB.downcase
aC = aC.downcase
aD = aD.downcase
aTotal = []
bTotal = []
cTotal = []
dTotal = []
plaintexts=[]
n = uris.size
n.times {|i|
if Time.now - hitCountStart < 8
begin
begin
doc = Nokogiri::HTML(open(uris[i]))
doc.css('script, link').each { |node| node.remove }
plaintexts << doc.css('body').text.downcase.split("\n"). collect { |line| line.strip }.join("\n")
rescue
puts "Nokogiri could not read"
end
#rescue
# "Nokogiri fault"
plaintexts[i].each_line { |bar|
begin
countA += bar.scan(/\b#{aA}\b/i).size
rescue
end
begin
countB += bar.scan(/\b#{aB}\b/i).size
rescue
end
begin
countC += bar.scan(/\b#{aC}\b/i).size
rescue
end
begin
countD += bar.scan(/\b#{aD}\b/i).size
rescue
end
}
puts "A = " + countA.to_s + " B = " + countB.to_s + " C = " + countC.to_s + " D = " + countD.to_s
end
end
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_results\n output = {}\n answer_choices.each do |answer|\n output[answer.body] = answer.responses.count\n end\n output\n end",
"def results\n responses\n .includes(answer_choices)\n .group(:answer)\n .count\n end",
"def popular_links\n result = {}\n urls[0...5].e... | [
"0.65483403",
"0.6428427",
"0.6323355",
"0.62579435",
"0.6139667",
"0.6139667",
"0.6139667",
"0.61366606",
"0.6043841",
"0.58811486",
"0.58738434",
"0.5853516",
"0.5851835",
"0.5850476",
"0.5849726",
"0.58431166",
"0.58113873",
"0.58081096",
"0.58022124",
"0.58003354",
"0.579... | 0.67984104 | 0 |
Return dataset with the given name | def dataset(name)
fetch_or_store(name) { Dataset.new(rql.table(name), rql, self) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataset(name)\n datasets[name] = Dataset.new(connection.fetch(name.to_s))\n end",
"def dataset(name)\n @datasets[name.to_sym] = Dataset.new(session, *split(name))\n end",
"def dataset(name)\n datasets[name] = Dataset.new(sources.fetch(name.to_s))\n end",
"def dataset(name)... | [
"0.84334975",
"0.8422005",
"0.83347017",
"0.8170036",
"0.8077305",
"0.7997254",
"0.7929371",
"0.7929371",
"0.7284001",
"0.7161996",
"0.7161996",
"0.7031044",
"0.69914156",
"0.69255304",
"0.68359625",
"0.6785029",
"0.67391485",
"0.6720411",
"0.66996145",
"0.6573739",
"0.651471... | 0.82509345 | 3 |
Runs the ReQL query and returns the data. | def run(query)
@connections.with { |c| query.run(c) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute\n # build the query string\n # run the query\n # return the results\n end",
"def run_query()\n return nil unless @query\n \n gres = @query.execute()\n if @filterClass \n fres = @filterClass.filter(gres)\n res = fres.kind_of?(... | [
"0.78596234",
"0.7210642",
"0.6920141",
"0.69122",
"0.6911778",
"0.68728006",
"0.6846096",
"0.6818708",
"0.67548347",
"0.6672281",
"0.66603124",
"0.6624447",
"0.6617163",
"0.66022366",
"0.654135",
"0.65218645",
"0.6511164",
"0.6507046",
"0.6497194",
"0.6491645",
"0.6468839",
... | 0.0 | -1 |
Check if dataset exists | def dataset?(name)
run rql.db(options[:db]).table_list.contains(name.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_set_exists?\n !BasicInterfaceRegister[@data_lib][@data_set_name].nil?\n end",
"def dataset?(name)\n datasets.key?(name)\n end",
"def dataset?(name)\n datasets.key?(name)\n end",
"def dataset?\n true\n end",
"def dataset?(name)\n self[name] ? true : ... | [
"0.77756715",
"0.76729727",
"0.76729727",
"0.7485334",
"0.7222245",
"0.7217729",
"0.7126817",
"0.70769954",
"0.69693553",
"0.6865814",
"0.68518114",
"0.67660475",
"0.67051184",
"0.6578466",
"0.6511874",
"0.6496559",
"0.6471039",
"0.64251673",
"0.63682663",
"0.634212",
"0.6337... | 0.724006 | 4 |
TODO: Barf if the value.object_id already exists in the cache. | def set key, value
@reverse_cache[value.object_id] = key
@cache[key] = value.object_id
ObjectSpace.define_finalizer(value, @finalize)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache( object = nil )\n return @cache unless object\n @cache[ object.id ] = object\n end",
"def cache_value?; end",
"def set_object(obj_name,obj)\n key = obj_name.to_s\n raise \"object '#{key}' already exists in context\" if @cache.keys.include?(key)\n @cache[key] = obj\n ... | [
"0.689305",
"0.6372419",
"0.627967",
"0.62704235",
"0.6264789",
"0.6241681",
"0.61904246",
"0.6151235",
"0.6124853",
"0.6118342",
"0.60959333",
"0.6095859",
"0.6095859",
"0.6095686",
"0.6090118",
"0.592281",
"0.5881422",
"0.584228",
"0.5818082",
"0.5818082",
"0.58088946",
"... | 0.61970407 | 6 |
GET /v1/items GET /v1/items.json | def index
render json: Item.paginate(page: params[:page], per_page: 25)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def getItems()\n return mergeWithAPI(@item_json)['data']\n end",
"def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend",
"def index\n @api_v1_... | [
"0.7773328",
"0.7592684",
"0.7517988",
"0.74378526",
"0.7406908",
"0.73971874",
"0.7386319",
"0.7334292",
"0.73057455",
"0.7289742",
"0.7267684",
"0.7248754",
"0.7241995",
"0.72209555",
"0.72209555",
"0.72209555",
"0.72209555",
"0.7198973",
"0.7184844",
"0.71540976",
"0.71519... | 0.0 | -1 |
GET /v1/items/1 GET /v1/items/1.json | def show
render json: @item, status: :ok
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end",
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def index\n @api_v1... | [
"0.75331855",
"0.7518009",
"0.74525225",
"0.7375193",
"0.7284233",
"0.708277",
"0.7070093",
"0.70205986",
"0.7002268",
"0.6976945",
"0.69586676",
"0.69368213",
"0.69368213",
"0.69368213",
"0.69368213",
"0.69368213",
"0.69368213",
"0.69368213",
"0.69368213",
"0.69368213",
"0.6... | 0.65709233 | 57 |
PATCH/PUT /items/1 PATCH/PUT /items/1.json | def update
if @item.update_attributes(item_params)
render json: @item, status: :ok
else
render_error(@item, :unprocessable_entity)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end",
"def update\n\n #update the item of request_item\n if (par... | [
"0.7442021",
"0.71437544",
"0.7139624",
"0.70026696",
"0.69958323",
"0.6980672",
"0.69373846",
"0.69218457",
"0.68723136",
"0.6832834",
"0.68177253",
"0.6805765",
"0.6805765",
"0.6794939",
"0.67887527",
"0.67887527",
"0.67887527",
"0.67887527",
"0.67887527",
"0.67887527",
"0.... | 0.70251447 | 3 |
DELETE /items/1 DELETE /items/1.json | def destroy
@item.destroy
head :no_content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end",
"def destroy\n @item = Item.find(params[:id... | [
"0.7907001",
"0.76884055",
"0.76040095",
"0.7585583",
"0.75851166",
"0.75851166",
"0.75851166",
"0.75851166",
"0.75851166",
"0.75851166",
"0.75851166",
"0.75851166",
"0.75851166",
"0.75851166",
"0.75851166",
"0.75851166",
"0.75851166",
"0.75851166",
"0.75851166",
"0.7547564",
... | 0.0 | -1 |
This action is usually accessed with the root path, normally '/' | def home
# @landing=Refinery::Redirects::Redirect.find(1)
#require 'uri'
#url=@landing.Mainpage_url
@headline = Refinery::Headlines::Headline.find(2)
@side_headline=Refinery::SideHeadlines::SideHeadline.order('position ASC')
@editors_pick=Refinery::EditorsPicks::EditorsPick.order('position DESC')
@editors_pick_1=@editors_pick[0]
@editors_pick_2=@editors_pick[1]
@editors_pick_3=@editors_pick[2]
@editors_pick_4=@editors_pick[3]
@south=Refinery::SouthernMinutes::SouthernMinute.order('position DESC')
@south_1=@south[0]
@south_2=@south[1]
@south_3=@south[2]
@south_4=@south[3]
@elephants=Refinery::Elephants::Elephant.order('position DESC')
@elephant=@elephants.first
@ears=Refinery::Ears::Ear.order('position DESC')
@ear=@ears.first
@latest=Refinery::Latests::Latest.order('position DESC')
@politics=Refinery::Politics::Politic.order('position DESC')
@news=Refinery::NewsSections::NewsSection.order('position DESC')
@blog=Refinery::Blogs::Blog.order('position DESC')
@sports=Refinery::Socials::Social.order('position DESC')
@enter=Refinery::Entertainments::Entertainment.order('position DESC')
@opinion=Refinery::OpinionMainpages::OpinionMainpage.order('position DESC')
@money=Refinery::Lives::Life.order('position DESC')
@tech=Refinery::Technologies::Technology.order('position DESC')
@world=Refinery::Worlds::World.order('position DESC')
@random=Refinery::Randoms::Random.order('position DESC')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root\n get \"/\"\n end",
"def root\n get \"/\"\n end",
"def root\n get '/'\n end",
"def root; resource :path => '/'; end",
"def index; redirect_to '/'; end",
"def root_path; end",
"def root_path; end",
"def root_path; end",
"def root\n super\n if @remai... | [
"0.7531063",
"0.7531063",
"0.7515997",
"0.72867143",
"0.7275563",
"0.7167966",
"0.7167966",
"0.7167966",
"0.694337",
"0.68838537",
"0.6827716",
"0.6827716",
"0.6827716",
"0.68201363",
"0.67963713",
"0.67963713",
"0.67963713",
"0.67963713",
"0.67963713",
"0.6764896",
"0.675091... | 0.0 | -1 |
This action can be accessed normally, or as nested pages. Assuming a page named "mission" that is a child of "about", you can access the pages with the following URLs: GET /pages/about GET /about GET /pages/mission GET /about/mission | def show
if should_skip_to_first_child?
redirect_to refinery.url_for(first_live_child.url) and return
elsif page.link_url.present?
redirect_to page.link_url and return
elsif should_redirect_to_friendly_url?
redirect_to refinery.url_for(page.url), :status => 301 and return
end
render_with_templates?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pages\n end",
"def site_pages \n Rails.application.reload_routes!\n page_routes = Rails.application.routes.routes.select do |route|\n route.verb == \"GET\" && !route.name.blank? && !route.name.match(/^edit/) && !route.name.match(\"translat\") && !route.name.match(\"external_author\")\n end\... | [
"0.67851895",
"0.64786476",
"0.6406917",
"0.63388294",
"0.63023776",
"0.628124",
"0.62661594",
"0.6212805",
"0.6209668",
"0.6202497",
"0.61961836",
"0.6161291",
"0.6130504",
"0.6095448",
"0.60627615",
"0.6053716",
"0.6053716",
"0.6053716",
"0.6053716",
"0.6053716",
"0.6053716... | 0.0 | -1 |
Action to show GDPR policies Author: Pankaj Date: 24/05/2018 Reviewed By: | def gdpr_policy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @approval = Approval.find(params[:id])\n @recommendation = Recommendation.find(@approval.recommendation_id)\n @approvals = @recommendation.approvals.find(:all, :order => \"created_at ASC\")\n @rec_user = User.find(@recommendation.user_id)\n\n respond_to do |format|\n format.html # sh... | [
"0.6199804",
"0.6181252",
"0.60196257",
"0.5981883",
"0.57254666",
"0.5705658",
"0.5682662",
"0.56805104",
"0.56760716",
"0.56722987",
"0.5662241",
"0.56539416",
"0.5643725",
"0.5642592",
"0.56399417",
"0.563479",
"0.56250286",
"0.5620185",
"0.5601667",
"0.559414",
"0.5591851... | 0.54392415 | 39 |
GET /equipes def index | def new
@equipe = Equipe.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @equipes = Equipe.all\n end",
"def index\n @equities = Equity.all\n end",
"def index\n @equities = Equity.all\n end",
"def index\n @equipamentos = Equipamento.all\n end",
"def index\r\n # @equipamentos = Equipamento.all\r\n @equipamentos = @laboratorio.equipamentos\r\n en... | [
"0.8578233",
"0.7888159",
"0.7888159",
"0.76703185",
"0.7377632",
"0.7351626",
"0.7231717",
"0.7173024",
"0.71285295",
"0.7087004",
"0.70676094",
"0.70458007",
"0.7038506",
"0.70334077",
"0.7024051",
"0.7009689",
"0.7005986",
"0.6978737",
"0.69531596",
"0.69450504",
"0.694094... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_equipe
@equipe = Equipe.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def equipe_params
params.require(:equipe).permit(:nomeEq, :mb_1_id, :mb_2_id, :mb_3_id, :mb_S_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Valida a equipe quanto a sua composicao | def validar_equipe(equipe)
equipe_valida = true
if is_raikage_membro(equipe)
equipe_valida = false
flash[:warning] = "O Raikage não pode estar em uma equipe."
elsif !is_anbu_equipe(equipe)
equipe_valida = false
flash[:warning] = "Os ninjas ANBU só podem estar em uma equipe em que todos os membros são ANBU"
elsif is_medico_membro(equipe)
unless is_medico_equipe(equipe)
equipe_valida = false
flash[:warning] = "Os ninjas médicos devem estar em uma equipe formada por 3 ninjas médicos, sendo um deles o superior, e 1 ninja chuunin ou jounin."
end
end
equipe_valida
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validar(orden_abono_excedente_arrime, fecha_registro_cheque, numero_cheque)\n logger.debug \"ENTRE A LA VALIDACION EN MI MODELOS ---- \" << orden_abono_excedente_arrime.inspect.to_s\n logger.debug \"ENTRE A LA VALIDACION EN MI MODELOS ---- \" << orden_abono_excedente_arrime_id.inspect.to_s\n \n l... | [
"0.6502186",
"0.6484966",
"0.64467585",
"0.6206665",
"0.60198426",
"0.60147375",
"0.59823704",
"0.5975454",
"0.5969201",
"0.59583974",
"0.5950263",
"0.5950263",
"0.5950263",
"0.5950263",
"0.5950263",
"0.59331906",
"0.5915364",
"0.59121513",
"0.5911753",
"0.5875695",
"0.587466... | 0.6216527 | 3 |
verifica se ha um medico na equipe | def is_medico_membro(equipe)
membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]
val_is_medico = false
for i in 0..3
if Pessoa.find(membros[i]).rank.downcase == 'medico'
val_is_medico = true
end
end
val_is_medico
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_medico_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n count_medicos = 0\n\n for i in 0..3\n if Pessoa.find(membros[i]).rank.downcase == 'medico'\n count_medicos += 1\n elsif Pessoa.find(membros[i]).rank.downcase != 'chuunin' and\n ... | [
"0.71335375",
"0.63187194",
"0.6280906",
"0.6140651",
"0.6104769",
"0.6053609",
"0.599745",
"0.5810091",
"0.57612264",
"0.57186514",
"0.565802",
"0.5656227",
"0.5632812",
"0.556337",
"0.55513775",
"0.5518658",
"0.5488609",
"0.54824775",
"0.5458807",
"0.54491657",
"0.54483855"... | 0.6813841 | 1 |
verifica se a equipe e uma equipe com 3 medicos e um Chunnin ou Jounin | def is_medico_equipe(equipe)
membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]
count_medicos = 0
for i in 0..3
if Pessoa.find(membros[i]).rank.downcase == 'medico'
count_medicos += 1
elsif Pessoa.find(membros[i]).rank.downcase != 'chuunin' and
Pessoa.find(membros[i]).rank.downcase != 'jounin'
return false
end
end
((count_medicos == 3) and (Pessoa.find(membros[3]).rank.downcase == 'medico'))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def three_of_a_kind?\n repeat_counts.include? 3\n end",
"def pbIsMedicine?(item)\n return [1, 2, 6, 7].include?(GameData::Item.get(item).battle_use) && !GameData::Item.get(item).is_berry?\nend",
"def is_anbu_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]... | [
"0.5887564",
"0.5872823",
"0.58314246",
"0.57727623",
"0.57575995",
"0.56924975",
"0.56728464",
"0.56701833",
"0.56420714",
"0.5625229",
"0.559234",
"0.5590583",
"0.55346924",
"0.5525686",
"0.55248404",
"0.55190116",
"0.5514819",
"0.5493433",
"0.54716146",
"0.54691833",
"0.54... | 0.6530351 | 0 |
Verifica se a equipe e formada por anbus | def is_anbu_equipe(equipe)
membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]
val_is_anbu = true
for i in 0..3
val_is_anbu = (val_is_anbu and (Pessoa.find(membros[i]).rank.downcase == 'anbu'))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atributos\n valid = false\n if self.interreps_vencidos.any?\n valid = true\n\n elsif presente_reunioes == true\n valid = true\n end\n\n # elsif Time.now.year - ano_de_fundacao <= 1 \n # valid = true\n # end\n\n valid\n end",
"def in_us1?\n self.nro_remision.to_s == \"... | [
"0.61227363",
"0.61119676",
"0.5956062",
"0.5900061",
"0.58191097",
"0.57942384",
"0.5776025",
"0.5761631",
"0.57422954",
"0.57241946",
"0.57154757",
"0.571249",
"0.56876665",
"0.56815845",
"0.56770325",
"0.56759876",
"0.5651228",
"0.56451845",
"0.56422955",
"0.56384426",
"0.... | 0.64007896 | 0 |
verifica se o raikage e um membro da equipe | def is_raikage_membro(equipe)
membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]
val_is_raikage = false
for i in 0..3
if Pessoa.find(membros[i]).rank.downcase == 'raikage'
val_is_raikage = true
end
end
val_is_raikage
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_medico_membro(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n val_is_medico = false\n\n for i in 0..3\n if Pessoa.find(membros[i]).rank.downcase == 'medico'\n val_is_medico = true\n end\n end\n\n val_is_medico\n end",
"def is_anbu_equ... | [
"0.63769585",
"0.6215567",
"0.59823006",
"0.59507364",
"0.57318103",
"0.5691622",
"0.56687886",
"0.5649539",
"0.5636041",
"0.5622538",
"0.5571581",
"0.55539227",
"0.5516401",
"0.55153126",
"0.5459029",
"0.54582447",
"0.54577106",
"0.5439558",
"0.54235655",
"0.5363398",
"0.536... | 0.6939452 | 0 |
GET /outsides GET /outsides.json | def index
@outsides = Outside.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @outside_requests = OutsideRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @outside_requests }\n end\n end",
"def show\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n format.html # sho... | [
"0.7206014",
"0.6473625",
"0.62521267",
"0.604241",
"0.58839136",
"0.5812773",
"0.5803857",
"0.5749467",
"0.5746146",
"0.57460946",
"0.5731855",
"0.5710762",
"0.568336",
"0.56589067",
"0.56425095",
"0.56366575",
"0.5617454",
"0.5603409",
"0.55973506",
"0.55856144",
"0.5579769... | 0.7273749 | 0 |
GET /outsides/1 GET /outsides/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @outsides = Outside.all\n end",
"def index\n @outside_requests = OutsideRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @outside_requests }\n end\n end",
"def show\n @outside_request = OutsideRequest.find(params[:id])\n\n... | [
"0.7178046",
"0.7072017",
"0.68050486",
"0.6356096",
"0.6105625",
"0.6019694",
"0.59967834",
"0.59271353",
"0.5925148",
"0.5902146",
"0.5819847",
"0.579884",
"0.5747183",
"0.5710198",
"0.5702882",
"0.56906503",
"0.56338906",
"0.5618759",
"0.5616345",
"0.56067294",
"0.56034875... | 0.0 | -1 |
POST /outsides POST /outsides.json | def create
@outside = Outside.new(outside_params)
respond_to do |format|
if @outside.save
format.html { redirect_to @outside, notice: 'Outside was successfully created.' }
format.json { render :show, status: :created, location: @outside }
else
format.html { render :new }
format.json { render json: @outside.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @outside_request = OutsideRequest.new(params[:outside_request])\n\n respond_to do |format|\n if @outside_request.save\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully created.' }\n format.json { render json: @outside_request, status: :cre... | [
"0.66772705",
"0.59353036",
"0.58822435",
"0.58407235",
"0.58234125",
"0.57617736",
"0.5621812",
"0.56048375",
"0.5383108",
"0.5230245",
"0.522127",
"0.5192642",
"0.51777333",
"0.5142969",
"0.51319873",
"0.51284647",
"0.506584",
"0.50647056",
"0.5045443",
"0.50443745",
"0.502... | 0.73897415 | 0 |
PATCH/PUT /outsides/1 PATCH/PUT /outsides/1.json | def update
respond_to do |format|
if @outside.update(outside_params)
format.html { redirect_to @outside, notice: 'Outside was successfully updated.' }
format.json { render :show, status: :ok, location: @outside }
else
format.html { render :edit }
format.json { render json: @outside.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n if @outside_request.update_attributes(params[:outside_request])\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully updated.' }\n format.json { head :no_content... | [
"0.71002495",
"0.66152906",
"0.6301283",
"0.60681796",
"0.5881588",
"0.5788512",
"0.5781755",
"0.57469463",
"0.5740863",
"0.5698779",
"0.56936884",
"0.5679568",
"0.56731504",
"0.5628998",
"0.56122684",
"0.5594861",
"0.55859846",
"0.5583535",
"0.5559398",
"0.5559398",
"0.55008... | 0.71156347 | 0 |
DELETE /outsides/1 DELETE /outsides/1.json | def destroy
@outside.destroy
respond_to do |format|
format.html { redirect_to outsides_url, notice: 'Outside was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @outside_request = OutsideRequest.find(params[:id])\n @outside_request.destroy\n\n respond_to do |format|\n format.html { redirect_to outside_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inside.destroy\n respond_to do |format|\n f... | [
"0.72267324",
"0.71534765",
"0.69241786",
"0.6888711",
"0.68458116",
"0.66099954",
"0.66034967",
"0.659944",
"0.659944",
"0.659944",
"0.659944",
"0.6529414",
"0.6503784",
"0.65024984",
"0.6438971",
"0.63768625",
"0.637046",
"0.63635933",
"0.6345375",
"0.63303816",
"0.633015",... | 0.7406521 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_outside
@outside = Outside.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def outside_params
params.fetch(:outside, {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Fixes RDoc behaviour with ++ only supporting alphanumeric text. | def fix_typewriter(text)
code_tags = 0
text.gsub(%r{<(/)?(pre|code|tt)|(\s|^|>)\+(?! )([^\n\+]{1,900})(?! )\+}) do |str|
closed = $1
tag = $2
first_text = $3
type_text = $4
if tag
code_tags += (closed ? -1 : 1)
next str
end
next str unless code_tags == 0
first_text + '<tt>' + type_text + '</tt>'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_text\n text.tr(\"'@_\", '').gsub(/\\W/, ' ').gsub(/[0-9]/, '').downcase\n end",
"def prog_alphanum_description\n if description !~ /[[:alnum:]]/\n errors.add(:description, \"can only contain letters or numbers\")\n end\n end",
"def remove_private\n # Workaround for gsub encodin... | [
"0.6228587",
"0.61733824",
"0.6089831",
"0.6011499",
"0.5984648",
"0.5976928",
"0.59172875",
"0.5830568",
"0.58111066",
"0.58084667",
"0.5723059",
"0.5712835",
"0.56935495",
"0.564261",
"0.5619697",
"0.56172353",
"0.56150955",
"0.56021625",
"0.55821913",
"0.55645615",
"0.5563... | 0.52781963 | 55 |
Don't allow to turn into &8212; element. The chances of this being some option is far more likely than the typographical meaning. | def fix_dash_dash(text)
text.gsub(/—(?=\S)/, '--')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_breaking(text, show_symbols: false, **opt)\n value = super(text, **opt)\n show_symbols ? value : hide_symbols(value)\n end",
"def indicate_when_missing(value = nil) \n value.blank? ? \"—\" : value\n end",
"def starred\n '★'\n end",
"def unstarred\n '☆'\n ... | [
"0.6206546",
"0.6163841",
"0.5966966",
"0.5703777",
"0.56582975",
"0.55576384",
"0.5514348",
"0.55070126",
"0.5506799",
"0.5440216",
"0.53787667",
"0.5374548",
"0.5316483",
"0.5315723",
"0.5289512",
"0.52755105",
"0.52734506",
"0.52443695",
"0.5243715",
"0.5239792",
"0.523266... | 0.5720888 | 3 |
Disable autolink of URLs | def handle_special_HYPERLINK(special) # rubocop:disable Style/MethodName
@hyperlink ? special.text : super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_link\n @disable_link = true\n end",
"def inline_docbook_autolink_urls(text)\n text.gsub!(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $5\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n %(#{a}<ulink url=\"#{b==\"ww... | [
"0.73262614",
"0.7054189",
"0.68969154",
"0.66482574",
"0.663192",
"0.6608967",
"0.6462471",
"0.6454002",
"0.6426111",
"0.64056444",
"0.63993037",
"0.6385632",
"0.6370344",
"0.63682795",
"0.62857306",
"0.62850344",
"0.62417364",
"0.62333274",
"0.62333274",
"0.62333274",
"0.62... | 0.0 | -1 |
create a uri with prefix and hash of the address | def uri
uri_prefix + Digest::MD5.hexdigest(self.address)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_uri\n end",
"def build_uri(uri)\n return uri if @region.nil? && @edge.nil?\n\n parsed_url = URI(uri)\n pieces = parsed_url.host.split('.')\n product = pieces[0]\n domain = pieces[-2, 2]\n new_edge = @edge\n new_region = @region\n\n case pieces... | [
"0.7466742",
"0.72674334",
"0.7150649",
"0.7096401",
"0.70315844",
"0.68572295",
"0.6830236",
"0.67291194",
"0.6698104",
"0.6697446",
"0.66700625",
"0.66591734",
"0.66591734",
"0.662171",
"0.6602459",
"0.6564329",
"0.648367",
"0.64670515",
"0.64364815",
"0.64042497",
"0.63900... | 0.75669867 | 0 |
process each line in the file | def process_line(line)
# get the details from each line
elements = line.split(';').each { |e| e.strip! }
name = elements[0]
address = elements[1]
phone = elements[2]
fax = elements[3]
email = elements[4]
# get the postcode from the address
temp = address.split(',').each { |e| e.strip! }
postcode = temp.last
# remove the period
if (postcode.end_with?("."))
postcode = postcode[0..-2]
end
#lookup the latitude and longitude from the postcode
point = PostCodeLookup.new(postcode.sub(/ /, '')).lookup
location = LibraryLocation.new($bcc_library, name, address, point)
@@address_list << location
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_lines(input_file)\n for line in input_file\n process_line(line)\n end\n end_of_file\n end",
"def process_input_file \n File.open(@file, 'r') do |f|\n f.each_line do |line|\n parse_line(line)\n end\n end\n end",
"def each(&block)\n File.open(@fil... | [
"0.81827724",
"0.80716854",
"0.697013",
"0.6831404",
"0.675477",
"0.6689327",
"0.6667099",
"0.66430736",
"0.66412354",
"0.6545855",
"0.65414196",
"0.6533216",
"0.64889157",
"0.6443003",
"0.63662827",
"0.6365553",
"0.6356345",
"0.62659013",
"0.6243177",
"0.619193",
"0.618939",... | 0.0 | -1 |
Returns prefixes split on the namespace pattern. | def prefixes
prefix.split(NAMESPACE_PATTERN)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end",
"def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end",
"def split_prefix\n [$1, $2, $3] if @prefix =~ PREFIX_PAT\n end",
"def parts\n namespace.split(SEPARATOR)\n end",
"def prefixes\n @prefix... | [
"0.7407533",
"0.7407533",
"0.72848666",
"0.6980872",
"0.6971747",
"0.6595333",
"0.6568921",
"0.624414",
"0.624414",
"0.6192974",
"0.60950315",
"0.5989826",
"0.5929457",
"0.59197074",
"0.5910274",
"0.5889009",
"0.5793063",
"0.5739296",
"0.5739296",
"0.5708575",
"0.57040274",
... | 0.84440666 | 1 |
Returns namespaces split on the namespace pattern. | def namespaces
namespace.split(NAMESPACE_PATTERN)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parts\n namespace.split(SEPARATOR)\n end",
"def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end",
"def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end",
"def namespaces\n map(&:namespace).map(&:prefix).map(&:to_s).map(&:downcase).uniq\n end",
"def list_name... | [
"0.70319545",
"0.6985385",
"0.6985385",
"0.6575446",
"0.6484162",
"0.6256091",
"0.61773086",
"0.6169401",
"0.60568917",
"0.6001959",
"0.5954219",
"0.5883592",
"0.5760462",
"0.57480645",
"0.57124037",
"0.57095504",
"0.56629884",
"0.5641671",
"0.5640766",
"0.5631009",
"0.559781... | 0.81508726 | 1 |
Returns targets split on the namespace pattern. | def targets
target.split(NAMESPACE_PATTERN)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def targets\n name.split(\"_\")\n end",
"def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end",
"def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end",
"def all_targets\n targets = []\n find('').sort.each do |file|\n targets << File.basename(file)\... | [
"0.6638572",
"0.65504056",
"0.65504056",
"0.58468294",
"0.5797391",
"0.5797391",
"0.56284827",
"0.5456567",
"0.5355485",
"0.5295086",
"0.52468276",
"0.5243942",
"0.52298576",
"0.5226278",
"0.52173454",
"0.52150553",
"0.516638",
"0.5159453",
"0.5114256",
"0.5112964",
"0.511296... | 0.8098817 | 1 |
Returns targets split on the namespace pattern. | def keys_for(key = EMPTY_STRING)
key.split(NAMESPACE_PATTERN)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def targets\n target.split(NAMESPACE_PATTERN)\n end",
"def targets\n target.split(NAMESPACE_PATTERN)\n end",
"def targets\n name.split(\"_\")\n end",
"def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end",
"def namespaces\n namespace.split(NAMESPACE_PATTE... | [
"0.8098817",
"0.8098817",
"0.6638572",
"0.65504056",
"0.65504056",
"0.58468294",
"0.5797391",
"0.5797391",
"0.56284827",
"0.5456567",
"0.5355485",
"0.5295086",
"0.52468276",
"0.5243942",
"0.52298576",
"0.5226278",
"0.52173454",
"0.52150553",
"0.516638",
"0.5159453",
"0.511425... | 0.45631236 | 64 |
Returns a key to be used in looking up an environment variable that contains the prefix, namespace, target and provided keys. | def with_prefixes_namespaces_targets_key_for(keys = EMPTY_ARRAY)
[*prefixes, *namespaces, *targets, *keys].join('_').upcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qualified_key\n [@env.namespace.to_s, @key].reject(&:empty?).compact.join('.')\n end",
"def env_name(key); end",
"def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n end",
"def namespaced_key(key)\n \"#{@namespace}_#{key}\"\n end",
"def key_for(key)\n key_parts =... | [
"0.6690438",
"0.6534368",
"0.64823955",
"0.6377689",
"0.63060886",
"0.6255373",
"0.62345046",
"0.6119168",
"0.60117877",
"0.60109055",
"0.60046905",
"0.5959405",
"0.59422994",
"0.58430666",
"0.5834619",
"0.5833815",
"0.5828168",
"0.58011943",
"0.57771015",
"0.57764065",
"0.57... | 0.57519114 | 24 |
Returns a key to be used in looking up an environment variable that contains namespace, target and provided keys. | def with_namespaces_targets_key_for(keys = EMPTY_ARRAY)
[*namespaces, *targets, *keys].join('_').upcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_name(key); end",
"def qualified_key\n [@env.namespace.to_s, @key].reject(&:empty?).compact.join('.')\n end",
"def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n end",
"def get_cache_key(target_name)\n if Rscons.phony_target?(target_name)\n PHONY_PREFIX + targ... | [
"0.66161656",
"0.6599544",
"0.64446086",
"0.6372229",
"0.6336621",
"0.62620974",
"0.6204556",
"0.61549103",
"0.6120054",
"0.59826624",
"0.5961457",
"0.58220994",
"0.58220994",
"0.5799912",
"0.57733727",
"0.5772401",
"0.5756669",
"0.5726982",
"0.5724572",
"0.57225335",
"0.5657... | 0.56391555 | 22 |
Returns a key to be used in looking up an environment variable that contains prefix, namespace and provided keys. | def with_prefixes_namespaces_key_for(keys = EMPTY_ARRAY)
[*prefixes, *namespaces, *keys].join('_').upcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qualified_key\n [@env.namespace.to_s, @key].reject(&:empty?).compact.join('.')\n end",
"def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n end",
"def namespaced_key(key)\n \"#{@namespace}_#{key}\"\n end",
"def key_with_namespace(key)\n return key if namespace.ni... | [
"0.7169322",
"0.70105785",
"0.6975438",
"0.68354785",
"0.67595005",
"0.6699968",
"0.6581302",
"0.6493663",
"0.6420136",
"0.625901",
"0.625901",
"0.6199994",
"0.61409706",
"0.61072487",
"0.61072487",
"0.60862523",
"0.60562915",
"0.6034817",
"0.6028828",
"0.600027",
"0.59687525... | 0.56806517 | 42 |
Returns a key to be used in looking up an environment variable that contains namespace and provided keys. | def with_namespaces_key_for(keys = EMPTY_ARRAY)
[*namespaces, *keys].join('_').upcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qualified_key\n [@env.namespace.to_s, @key].reject(&:empty?).compact.join('.')\n end",
"def namespace_key(name)\n namespaces[name][:key]\n end",
"def namespaced_key(key)\n \"#{@namespace}_#{key}\"\n end",
"def full_key(namespace, key)\n \"#{namespace}:#{key}\"\n en... | [
"0.72297466",
"0.70708716",
"0.70441324",
"0.7018022",
"0.6987711",
"0.68105304",
"0.67816097",
"0.63192475",
"0.61887234",
"0.61762613",
"0.61762613",
"0.60776365",
"0.60659045",
"0.6040541",
"0.6032469",
"0.60021764",
"0.60020125",
"0.59961647",
"0.59668356",
"0.5940021",
"... | 0.5625951 | 39 |
Returns a key to be used in looking up an environment variable that contains prefix and provided keys. | def with_prefixes_key_for(keys = EMPTY_ARRAY)
[*prefixes, *keys].join('_').upcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def environment_item prefix, key, value\n {Oaf::Util.prepare_key(prefix, key) => Oaf::Util.flatten(value)}\n end",
"def qualified_key\n [@env.namespace.to_s, @key].reject(&:empty?).compact.join('.')\n end",
"def prepare_key prefix, key\n \"oaf_#{prefix}_#{key.gsub('-', '_').downcase}\"\n en... | [
"0.6844324",
"0.671606",
"0.64431065",
"0.63991284",
"0.638942",
"0.638942",
"0.6369225",
"0.63652045",
"0.63355213",
"0.633547",
"0.62950987",
"0.62266463",
"0.6183097",
"0.6073376",
"0.60113984",
"0.5983722",
"0.59718144",
"0.59591836",
"0.59541476",
"0.5947115",
"0.5945495... | 0.58030295 | 43 |
Returns a key to be used in looking up an environment variable that contains the provided keys. | def with_key_for(keys = EMPTY_ARRAY)
[*keys].join('_').upcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_name(key); end",
"def get_env_var key\n key = key.to_s\n exec(Beaker::Command.new(\"env | grep ^#{key}=\"), :accept_all_exit_codes => true).stdout.chomp\n end",
"def get_env(key)\n\n end",
"def [](key)\n @env[key]\n end",
"def [](key)\n @env[key]\n end",
"def qualified_key... | [
"0.6881525",
"0.6597435",
"0.64072",
"0.6345259",
"0.6345259",
"0.63299143",
"0.62887466",
"0.62720126",
"0.62068343",
"0.6181634",
"0.6142602",
"0.6075876",
"0.60445076",
"0.5964742",
"0.59280294",
"0.5899827",
"0.57967794",
"0.57951295",
"0.57826555",
"0.5743313",
"0.574264... | 0.0 | -1 |
Returns a set of keys to be used in looking up an environment variable from the provided keys. | def fetch_keys_for(keys = EMPTY_ARRAY)
return [
with_prefixes_namespaces_targets_key_for(keys),
with_namespaces_targets_key_for(keys),
with_prefixes_namespaces_key_for(keys),
with_namespaces_key_for(keys),
with_prefixes_key_for(keys),
with_key_for(keys)
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_keys\n mapping.values\n end",
"def variable_names()\n @var_set.keys\n end",
"def get_environment_strings\n env_ptr = GetEnvironmentStringsW()\n\n # pass :invalid => :replace to the Ruby String#encode to use replacement characters\n pairs = env_ptr.read_arbitrary_wide_string_up_to(6... | [
"0.6655213",
"0.6197443",
"0.6083288",
"0.6008368",
"0.59666985",
"0.59622127",
"0.59620655",
"0.59447426",
"0.581394",
"0.5810972",
"0.5748481",
"0.57121944",
"0.5659076",
"0.5642188",
"0.5582867",
"0.5577952",
"0.55763423",
"0.5549064",
"0.55395037",
"0.5509973",
"0.5503577... | 0.58811796 | 9 |
Creates a new instance of the resolver with a different target and yields it to a block. The return value of the block is then passed back as a string. | def with(target = DEFAULT_TARGET)
yield(self.class.new(options.merge(target: target)))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve(&blk)\n @context = blk.binding.receiver\n instance_exec(&blk)\n end",
"def capture_block(target=StringIO.new)\r\n current = @target\r\n\r\n begin\r\n @target = target\r\n yield\r\n ensure\r\n @target = current\r\n end\r\n\r\n ... | [
"0.5933616",
"0.54643095",
"0.54549134",
"0.54114133",
"0.53234625",
"0.52446145",
"0.5225343",
"0.5220903",
"0.5213191",
"0.52057123",
"0.5185784",
"0.51732653",
"0.5156367",
"0.5155563",
"0.51521206",
"0.5126637",
"0.51148623",
"0.50680816",
"0.5027215",
"0.5025179",
"0.499... | 0.5279368 | 5 |
Returns true if the tree is old enough to bear fruit (6), false otherwise | def mature?
self.age > 5
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotten?\n @hatched > 3 ? true : false\n end",
"def berzerk?\n @woot_count >= 5\n end",
"def any_apples?\n # code to check if tree has any oranges goes here\n @apples.length > 0\n end",
"def hungry?\n\t\t@stuff_in_belly <= 2\n\tend",
"def hungry?\n\t\t@stuff_in_belly <= 2\n\tend",
"... | [
"0.69488615",
"0.6628299",
"0.6388284",
"0.6330351",
"0.6330351",
"0.6326121",
"0.6324284",
"0.6314839",
"0.62715006",
"0.62715006",
"0.62715006",
"0.6269346",
"0.62524325",
"0.62421614",
"0.62367034",
"0.6201152",
"0.6200187",
"0.6199781",
"0.61414737",
"0.6139496",
"0.61077... | 0.0 | -1 |
Returns +true+ if there are any oranges on the tree, +false+ otherwise | def has_oranges?
self.oranges.count > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def any_oranges?\n true if @oranges_in_tree.length > 0\n end",
"def any_oranges?\n # code to check if tree has any oranges goes here\n @oranges.length > 0\n end",
"def any_apples?\n # code to check if tree has any oranges goes here\n @apples.length > 0\n end",
"def any_pears?\n # code to... | [
"0.87968343",
"0.8710332",
"0.8137579",
"0.8052434",
"0.67939556",
"0.67730993",
"0.6763185",
"0.6763185",
"0.674341",
"0.6731151",
"0.67241985",
"0.67233485",
"0.669742",
"0.66838396",
"0.66340935",
"0.6619967",
"0.6610139",
"0.6566619",
"0.65491647",
"0.6511804",
"0.6502294... | 0.6904058 | 4 |
if validations arent met, code crashes | def username
self.trip.user.username
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def check_validity!\n # nothing\n end",
"def validate\r\n validate! rescue false\r\n end",
"def validate!\n # pass\n end",
"def valid?\n \n \n... | [
"0.7357118",
"0.73022324",
"0.73022324",
"0.73022324",
"0.73022324",
"0.73022324",
"0.7229241",
"0.72059757",
"0.7198521",
"0.7188602",
"0.71753293",
"0.7170723",
"0.7163341",
"0.71394134",
"0.70927286",
"0.70927286",
"0.7060906",
"0.70368886",
"0.7020898",
"0.7011744",
"0.70... | 0.0 | -1 |
Note that we always have a cascaded event join for the model that the event actually belongs to, even if it's not cascadable. I know this is bad terminology, but it seems better to do this way so that we can get all events for an object directly from the cascaded events join table. | def maybe_cascade
CascadedEventJoin.find_or_create_by(cascaded_eventable: self.eventable, event_id: self.id)
if self.cascadable and self.eventable.respond_to?(:cascade_event)
self.eventable.cascade_event(self)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events\n # FIXME this logic belongs in the Event model. stop leaking AR outside of the model\n @events ||= Event.includes(:upcoming_observances).where(\"observances.start_on >= ?\", Date.current).references(:observances)\n end",
"def related_events\n find_related_frbr_objects( :is_related_to,... | [
"0.64219326",
"0.6222262",
"0.60331595",
"0.5831709",
"0.58291835",
"0.577701",
"0.5764571",
"0.5707574",
"0.5642834",
"0.56223303",
"0.55735326",
"0.550983",
"0.5488459",
"0.54418063",
"0.54418063",
"0.54395103",
"0.5420702",
"0.53794605",
"0.5376009",
"0.5334593",
"0.533122... | 0.6757708 | 0 |
Get name of the element | def element_name
adapter.element_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(element)\n get(element)[:name]\n end",
"def name\n @elements[:name]\n end",
"def element_name\n @element_name ||= Utils.string_underscore(Utils.string_demodulize(name))\n end",
"def element_name; end",
"def element_name() @stag.element_name end",
"def elem_name\n ... | [
"0.8999219",
"0.8527474",
"0.84551555",
"0.8320638",
"0.80881417",
"0.7841808",
"0.7622297",
"0.7616019",
"0.74770665",
"0.73897123",
"0.7344094",
"0.7335176",
"0.7327624",
"0.729434",
"0.729434",
"0.72068185",
"0.718877",
"0.7107599",
"0.7100965",
"0.70793396",
"0.70766777",... | 0.81602675 | 4 |
Convenience for getting element blueprints | def element_blueprints(composite_object = nil)
adapter.element_blueprints(composite_object)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMethodsInElement(element)\n\treturn element.inspect;\nend",
"def element_render_naming\n OBJ_ELEMENT_RENDER_NAMING\n end",
"def blueprint_value\n Blueprints::RootNamespace.root.build @name => @options\n @registry.inject(Blueprints::RootNamespace.root.context.instance_variable_get(:\"@#{@iv_nam... | [
"0.5650715",
"0.5597755",
"0.5554425",
"0.5522174",
"0.54490626",
"0.5446046",
"0.54126674",
"0.5401665",
"0.53939074",
"0.53799003",
"0.5357485",
"0.5303517",
"0.5283296",
"0.5280536",
"0.52704984",
"0.5252942",
"0.5252942",
"0.5252942",
"0.5252942",
"0.5247162",
"0.52180487... | 0.6912869 | 0 |
Gets the mode from the data and calls the API. Returns the response from the API. | def checkModes(data)
mode = data['mode']
call_features=Array.new(1) { Hash.new }
if mode=="labels"
call_features<<{
type:"LABEL_DETECTION",
maxResults:1
}
end
return apiRequest(data['image'],call_features)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mode\n send_request(FUNCTION_GET_MODE, [], '', 1, 'C')\n end",
"def get_node_mode_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNsxComponentAdministrationApplianceApi.get_node_mode ...'\n end\n #... | [
"0.6840591",
"0.6233038",
"0.61994016",
"0.6002883",
"0.5982736",
"0.5899628",
"0.58765423",
"0.58264744",
"0.57625484",
"0.5727748",
"0.5701499",
"0.5638133",
"0.5566128",
"0.5559126",
"0.55128413",
"0.54956806",
"0.54717624",
"0.5466703",
"0.5466703",
"0.5448566",
"0.541934... | 0.64006984 | 1 |
Starts the webserver that takes images and sends them to the API. html server runs on | def start_webserver()
server = TCPServer.new('localhost', DEFAULT_PORT)
puts "Vision server running on http://localhost:#{DEFAULT_PORT}/"
while session = server.accept
time = Time.new
puts "New connection #{time.inspect}"
if File.exist?(DEFAULT_HTML_PATH) && !File.directory?(DEFAULT_HTML_PATH)
File.open(DEFAULT_HTML_PATH, "rb") do |file|
session.print "HTTP/1.1 200 OK\r\n" +
"Content-Type: text/html\r\n" +
"Content-Length: #{file.size}\r\n" +
"Connection: close\r\n"
session.print "\r\n"
# write the contents of the file to the session
IO.copy_stream(file, session)
end
else
message = "HTML File not found\n"
# respond with a 404 error code to indicate the file does not exist
session.print "HTTP/1.1 404 Not Found\r\n" +
"Content-Type: text/plain\r\n" +
"Content-Length: #{message.size}\r\n" +
"Connection: close\r\n"
session.print "\r\n"
session.print message
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_webserver\n stop_webserver\n Webserver.run!\n end",
"def start\n # we trap CTRL+C in the console and kill the server\n trap(\"INT\") { BeEF::Core::Server.instance.stop }\n \n # starts the web server\n @http_server.start\n end",
"def start()\n mime_types... | [
"0.70235085",
"0.686838",
"0.6537886",
"0.6487472",
"0.6483164",
"0.6259526",
"0.6257935",
"0.6135462",
"0.61339027",
"0.6118243",
"0.6113428",
"0.6106488",
"0.6095311",
"0.6076044",
"0.6068171",
"0.5976807",
"0.5968253",
"0.5954785",
"0.59322405",
"0.5920989",
"0.5916576",
... | 0.6983412 | 1 |
Starts server for the API. POST server runs on takes the packageBody as a jsonString | def start_post_server()
server = TCPServer.new('localhost', DEFAULT_POST_PORT)
puts "POST Server running on http://localhost:#{DEFAULT_POST_PORT}/"
while session = server.accept
method, path = session.gets.split # In this case, method = "POST" and path = "/"
headers = {}
while line = session.gets.split(' ', 2) # Collect HTTP headers
puts line
break if line[0] == "" # Blank line means no more headers
headers[line[0].chop] = line[1].strip # Hash headers by type
end
puts headers["Content-Length"].to_i
data = JSON.parse(session.read(headers["Content-Length"].to_i)) # Read the POST data as specified in the header
response = checkModes(data) # Do what you want with the POST data
session.print "HTTP/1.1 200\r\n" # 1
session.print "Content-type:application/json\r\n" # 2
session.print "\r\n" # 3
session.print response #4
session.close
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n uri = URI.parse server\n http = Net::HTTP.new uri.host, uri.port\n response = http.post '/documents', input\n if response.is_a?(Net::HTTPOK)\n data = JSON.parse(response.body)\n STDOUT.puts \"#{server}/#{data['key']}\"\n else\n STDERR.puts \"failure uploadi... | [
"0.6209023",
"0.5988249",
"0.5955258",
"0.59408844",
"0.57800984",
"0.57246405",
"0.5661725",
"0.5651595",
"0.5540543",
"0.5540126",
"0.55316967",
"0.5490168",
"0.5456818",
"0.5414596",
"0.5413823",
"0.5400585",
"0.53938323",
"0.5378367",
"0.53769135",
"0.5370635",
"0.533978"... | 0.5787154 | 4 |
from lesson: all_odd = [1,3].all? do |number| number.odd? Will evaluate to true for 1, true for 3 end => true all_odd | def draw?(board)
#must be true for a draw, false for in progress,<<so use full? then && so that both sides must evauluate true and since it must be false for a won game >> !won?
full?(board) && !won?(board)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_odd?(array)\n\t\n\tif array.all? {|i| i % 2 != 0} \n\t puts \"true\"\n else\n \tputs \"false\"\n end\nend",
"def any_is_odd?(arr)\n arr.each do |el|\n return true if el.odd?\n end\n\n false\nend",
"def some_odd(numbers)\n # Your code goes here\n return numbers.any? {|a| a % 2 == 1}\n e... | [
"0.83679456",
"0.80103326",
"0.7931707",
"0.77038246",
"0.76762354",
"0.7669432",
"0.7577311",
"0.7560292",
"0.7558668",
"0.7505849",
"0.74830496",
"0.7465547",
"0.7465547",
"0.7382132",
"0.7339305",
"0.7312849",
"0.73062766",
"0.72450924",
"0.72391224",
"0.72303945",
"0.7230... | 0.0 | -1 |
This is needed to be able to pass arbitrary arguments to Log4r outputters. Missing methods / bad arguments are caught in the ObjectBuilderparse method. | def method_missing(name, value=nil)
if value.nil?
result.send(name.to_sym)
else
@args[name.to_sym] = value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_arguments=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def logger=(_arg0); end",
"def format_arguments; end",
"def log _args\n \"log _args;\" \n ... | [
"0.6171324",
"0.6126246",
"0.6126246",
"0.6126246",
"0.6126246",
"0.6126246",
"0.6126246",
"0.6126246",
"0.60920024",
"0.6089016",
"0.59634787",
"0.5919662",
"0.5895448",
"0.5853793",
"0.584473",
"0.584473",
"0.584473",
"0.584268",
"0.5837847",
"0.5786818",
"0.5782683",
"0.... | 0.0 | -1 |
Set up the new logger | def builder_setup
@result = Log4r::Logger['Mauve'] || Log4r::Logger.new('Mauve')
@default_format = nil
@default_level = Log4r::RootLogger.instance.level
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n self.logger.reopen(File.open(File.join(Lokii::Config.root, Lokii::Config.log), \"a\")) if daemon? && self.logger\n self.logger ||= ::Logger.new(File.join(Lokii::Config.root, Lokii::Config.log))\n end",
"def configure_logging\n @logger = Logging.logger[self]\n end",
"def i... | [
"0.83539116",
"0.7562431",
"0.7397762",
"0.7332645",
"0.7331687",
"0.73219746",
"0.71980953",
"0.71724755",
"0.7157071",
"0.71523345",
"0.71433127",
"0.7140595",
"0.71370775",
"0.70798486",
"0.7079525",
"0.70785266",
"0.70785266",
"0.70785266",
"0.7078464",
"0.707144",
"0.707... | 0.71233004 | 13 |
Set the default format. Syntax erros are caught in the ObjectBuilderparse method. | def default_format(f)
@default_formatter = Log4r::PatternFormatter.new(:pattern => f)
#
# Set all current outputters
#
result.outputters.each do |o|
o.formatter = @default_formatter if o.formatter.is_a?(Log4r::DefaultFormatter)
end
@default_formatter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_format=(format)\n @default_format = format\n end",
"def reset_format!\n self.format = @default_format\n end",
"def default_format(*value)\n set_format(@entry_format_default, *value)\n end",
"def default_format\n @default_format ||= :html\n end",
"def set_de... | [
"0.75442713",
"0.694752",
"0.69266033",
"0.68541497",
"0.6829331",
"0.6792507",
"0.6790205",
"0.67543834",
"0.675183",
"0.66753274",
"0.66524476",
"0.66274256",
"0.65580046",
"0.6511294",
"0.6508249",
"0.6498025",
"0.64804655",
"0.6408066",
"0.6385714",
"0.63794136",
"0.63794... | 0.5912983 | 65 |
This is called once an outputter has been created. It sets the default formatter and level, if these have been already set. | def created_outputter(outputter)
#
# Set the formatter and level for any newly created outputters
#
if @default_formatter
outputter.formatter = @default_formatter if outputter.formatter.is_a?(Log4r::DefaultFormatter)
end
if @default_level
outputter.level = @default_level if outputter.level == Log4r::RootLogger.instance.level
end
result.outputters << outputter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outputter(value = nil)\n setget(:@formatter, value)\n end",
"def initialize\n @formatter = method(:default_formatter)\n end",
"def configure\n yield self\n\n # Ensure every appender has a formatter and a level configuration.\n #\n appenders.each do |appender|\n append... | [
"0.7170814",
"0.69238234",
"0.68924767",
"0.64659834",
"0.6427268",
"0.6384431",
"0.6359677",
"0.6338683",
"0.6313853",
"0.62974",
"0.62230897",
"0.6218285",
"0.6173541",
"0.61664784",
"0.6150814",
"0.6150814",
"0.6116878",
"0.60889846",
"0.6086099",
"0.6086099",
"0.6086099",... | 0.7372929 | 0 |
read key as a string or from file(eg. pub_key.pem) | def read_key(key)
if File.exist?(key.to_s) && File.file?(key.to_s)
File.read(File.absolute_path(key))
else
key
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_key(type, key=nil, passphrase=nil)\n return key if key.nil?\n\n raise \"Could not find key #{key}\" unless File.exist?(key)\n\n if type == :public\n return OpenSSL::PKey::RSA.new(File.read(key))\n elsif type == :private\n return OpenSSL::PKey::RSA.new(File.read(key), pass... | [
"0.7665029",
"0.7504883",
"0.7479482",
"0.7419644",
"0.71676993",
"0.7140331",
"0.70959246",
"0.69676566",
"0.69471055",
"0.6920051",
"0.68965715",
"0.68662006",
"0.6846193",
"0.66990745",
"0.6673823",
"0.66323",
"0.6624135",
"0.6595776",
"0.6555211",
"0.65393186",
"0.6507661... | 0.7208378 | 4 |
Defines a Hash where the settings shall be stored. | def initialize
@settings = Hash.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_settings_hash\n fail 'sub class to implement'\n end",
"def get_hash()\n\t\t\treturn @config.clone()\n\t\tend",
"def settings\n @settings ||= {}\n end",
"def settings\n @settings ||= {}\n end",
"def settings\n @settings ||= {}\n end",
"def hash\n {... | [
"0.6881182",
"0.6396867",
"0.6324798",
"0.6324722",
"0.6324722",
"0.62126184",
"0.6186993",
"0.61590725",
"0.6141547",
"0.61076856",
"0.61076856",
"0.6092059",
"0.6077155",
"0.6067312",
"0.60390234",
"0.6017331",
"0.6014908",
"0.6010474",
"0.6008598",
"0.5987738",
"0.59783596... | 0.70030916 | 0 |
GET /massive_loads/1 GET /massive_loads/1.json | def show
@massive_load = MassiveLoad.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @massive_load }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @massive_load = MassiveLoad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @massive_load }\n end\n end",
"def index\n @loads = Load.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json... | [
"0.6614423",
"0.63849837",
"0.5849659",
"0.5806505",
"0.5799708",
"0.5758163",
"0.57466066",
"0.5668211",
"0.5652232",
"0.5619108",
"0.56074744",
"0.55833936",
"0.556982",
"0.55687624",
"0.5548165",
"0.5544466",
"0.55070823",
"0.54761946",
"0.547418",
"0.5439974",
"0.54199725... | 0.73428476 | 0 |
GET /massive_loads/new GET /massive_loads/new.json | def new
@massive_load = MassiveLoad.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @massive_load }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @test = LoadTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test }\n end\n end",
"def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n ... | [
"0.6653466",
"0.661421",
"0.661421",
"0.6576677",
"0.6502705",
"0.6500868",
"0.6484898",
"0.647852",
"0.6468913",
"0.6437501",
"0.64248705",
"0.64048356",
"0.6403324",
"0.64030945",
"0.63934",
"0.63902986",
"0.63883716",
"0.63881004",
"0.63863873",
"0.63793063",
"0.6378045",
... | 0.7823574 | 0 |
POST /massive_loads POST /massive_loads.json | def create
@massive_load = MassiveLoad.new(params[:massive_load])
respond_to do |format|
if @massive_load.save
read_excel
format.html { redirect_to @massive_load, notice: t(:successfully_created) }
format.json { render json: @massive_load, status: :created, location: @massive_load }
else
format.html { render action: "new" }
format.json { render json: @massive_load.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @massive_load = MassiveLoad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @massive_load }\n end\n end",
"def price_bulk_load\n logger.info 'PRICE BULK LOAD REQUESTED.'\n FeedWorker.perform_async('price_bulk_load')\n head :accepted\... | [
"0.61830246",
"0.584981",
"0.5474589",
"0.546201",
"0.5459581",
"0.5434217",
"0.52626705",
"0.5225691",
"0.5123715",
"0.51197374",
"0.5107366",
"0.51032346",
"0.50720054",
"0.5051213",
"0.5042481",
"0.50387454",
"0.5034641",
"0.5022982",
"0.50104886",
"0.49985647",
"0.4961837... | 0.62794626 | 0 |
DELETE /massive_loads/1 DELETE /massive_loads/1.json | def destroy
@massive_load = MassiveLoad.find(params[:id])
@massive_load.destroy
respond_to do |format|
format.html { redirect_to massive_loads_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @load.destroy\n respond_to do |format|\n format.html { redirect_to loads_url, notice: 'Load was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_... | [
"0.6751452",
"0.66983056",
"0.6636599",
"0.65260077",
"0.64616525",
"0.6438764",
"0.64364034",
"0.6380624",
"0.6367704",
"0.6367389",
"0.6344745",
"0.6316303",
"0.62940687",
"0.62778735",
"0.62730956",
"0.62583184",
"0.62558186",
"0.6249699",
"0.62424827",
"0.621869",
"0.6210... | 0.7864766 | 0 |
Fetches aggregates for a specific field key (:title, :location, etc). | def get(key)
self.send(key)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_values(records, field)\n summarize_field(records, field).keys\nend",
"def fetch_by_slug(field_name, slugs, example_count, example_fields)\n searches = facet_example_searches(field_name, slugs, example_count, example_fields)\n responses = @index.msearch(searches)\n response_list = response... | [
"0.57637197",
"0.555474",
"0.5535456",
"0.5493557",
"0.5434582",
"0.5427361",
"0.5422831",
"0.53900945",
"0.53623265",
"0.53473926",
"0.5331648",
"0.5298213",
"0.5271002",
"0.52702135",
"0.52376336",
"0.52242035",
"0.52080107",
"0.52056706",
"0.51577044",
"0.5091681",
"0.5085... | 0.0 | -1 |
To do: add the option of a maximum number of results | def do_reporting(sorting_method, minimum_threshold, string_method, result)
local_pages = pages
local_pages = pages.reject {|page| page.send(sorting_method) < minimum_threshold} unless minimum_threshold.nil?
local_pages = local_pages.sort_by {|page| page.send(sorting_method)}
local_pages.each do |page|
addition = page.send(string_method)
result << addition << "\n" unless addition.empty?
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def results_limit\n # max number of search results to display\n 10\n end",
"def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end",
"def set_MaxResults(value)\n set_input(\"MaxResults\", value)\n end",
"def set_MaxResults(value)\n set_input(\"MaxRe... | [
"0.78867054",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7573124",
"0.7508982",
... | 0.0 | -1 |
GET /audit_trails or /audit_trails.json | def index
@audit_trails = AuditTrail.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_audit_logs_for_date_range_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/auditlog\", args)\nend",
"def index\n @audits = Audit.all\n end",
"def index\n @audits = Audit.all\n end",
"def index\n @audits = Audit.all\n respond_with @audits\n end",
"def audit\n render... | [
"0.66580135",
"0.6385138",
"0.6385138",
"0.63822293",
"0.63697207",
"0.6366581",
"0.6263181",
"0.62566763",
"0.6154855",
"0.6138832",
"0.612162",
"0.6113776",
"0.60886186",
"0.60850495",
"0.60850495",
"0.60813457",
"0.5997738",
"0.5952176",
"0.59378254",
"0.592521",
"0.591977... | 0.7250993 | 0 |
GET /audit_trails/1 or /audit_trails/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @audit_trails = AuditTrail.all\n end",
"def list_audit_logs_for_date_range_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/auditlog\", args)\nend",
"def audit\n render :json=>@generic_file.audit\n end",
"def index\n @audits = Audit.all\n respond_with @audits\n end",... | [
"0.7039732",
"0.6517776",
"0.6421505",
"0.6342881",
"0.6322114",
"0.6322114",
"0.6319611",
"0.63087136",
"0.6240088",
"0.62063384",
"0.61208993",
"0.60995895",
"0.6047986",
"0.598885",
"0.59826857",
"0.59645563",
"0.59282625",
"0.58875096",
"0.58716434",
"0.5806168",
"0.58021... | 0.0 | -1 |
POST /audit_trails or /audit_trails.json | def create
@audit_trail = AuditTrail.new(audit_trail_params)
respond_to do |format|
if @audit_trail.save
format.html { redirect_to @audit_trail, notice: "Audit trail was successfully created." }
format.json { render :show, status: :created, location: @audit_trail }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @audit_trail.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @audit = Audit.new(audit_params)\n\n respond_to do |format|\n if @audit.save\n format.html { redirect_to @audit, notice: 'Audit was successfully created.' }\n format.json { render :show, status: :created, location: @audit }\n else\n format.html { render :new }\n ... | [
"0.6490603",
"0.6252091",
"0.62465477",
"0.6207349",
"0.60456467",
"0.5947956",
"0.5947367",
"0.5907201",
"0.5907201",
"0.5906645",
"0.588364",
"0.5812184",
"0.5754486",
"0.56969583",
"0.56921333",
"0.56430846",
"0.56300545",
"0.56103617",
"0.55918",
"0.5553551",
"0.55512244"... | 0.65162694 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_audit_trail
@audit_trail = AuditTrail.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def audit_trail_params
params.require(:audit_trail).permit(:user, :description, :controller, :action, :browser, :ip_address)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
GET /moto_registration_numbers/1 GET /moto_registration_numbers/1.xml | def show
@moto_registration_number = MotoRegistrationNumber.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @moto_registration_number }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @registration_number = RegistrationNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @registration_number }\n end\n end",
"def new\n @moto_registration_number = MotoRegistrationNumber.new\n\n respond_to do |format... | [
"0.63621014",
"0.6296374",
"0.61198634",
"0.6035799",
"0.5863261",
"0.5816839",
"0.58105224",
"0.5703169",
"0.5699908",
"0.56630635",
"0.565772",
"0.565772",
"0.55978006",
"0.558874",
"0.558034",
"0.55021095",
"0.55021095",
"0.55021095",
"0.55021095",
"0.55021095",
"0.5494253... | 0.6877038 | 0 |
GET /moto_registration_numbers/new GET /moto_registration_numbers/new.xml | def new
@moto_registration_number = MotoRegistrationNumber.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @moto_registration_number }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @registration_number = RegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_number }\n end\n end",
"def create\n @moto_registration_number = MotoRegistrationNumber.new(params[:moto_registration_number])\n\n ... | [
"0.7343106",
"0.71727914",
"0.68572235",
"0.67511237",
"0.6723272",
"0.6723272",
"0.6723272",
"0.66050434",
"0.65170324",
"0.64593613",
"0.64371705",
"0.642602",
"0.63808715",
"0.6379689",
"0.63650733",
"0.6320624",
"0.6313821",
"0.629728",
"0.6294342",
"0.6283128",
"0.625822... | 0.754073 | 0 |
POST /moto_registration_numbers POST /moto_registration_numbers.xml | def create
@moto_registration_number = MotoRegistrationNumber.new(params[:moto_registration_number])
respond_to do |format|
if @moto_registration_number.save
format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully created.') }
format.xml { render :xml => @moto_registration_number, :status => :created, :location => @moto_registration_number }
else
format.html { render :action => "new" }
format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @registration_number = RegistrationNumber.new(params[:registration_number])\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully created.') }\n format.xml { render :xml => ... | [
"0.6318721",
"0.61666036",
"0.58160335",
"0.5770177",
"0.568772",
"0.5672143",
"0.56667924",
"0.55571985",
"0.5534425",
"0.55306256",
"0.5525559",
"0.549139",
"0.5455797",
"0.5386861",
"0.53574884",
"0.5356498",
"0.532488",
"0.5319848",
"0.5310284",
"0.52507955",
"0.52374285"... | 0.6672994 | 0 |
PUT /moto_registration_numbers/1 PUT /moto_registration_numbers/1.xml | def update
@moto_registration_number = MotoRegistrationNumber.find(params[:id])
respond_to do |format|
if @moto_registration_number.update_attributes(params[:moto_registration_number])
format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @registration_number = RegistrationNumber.find(params[:id])\n\n respond_to do |format|\n if @registration_number.update_attributes(params[:registration_number])\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully updated.') }\n fo... | [
"0.62140137",
"0.6025058",
"0.5943858",
"0.5885716",
"0.5861695",
"0.56930923",
"0.56733656",
"0.5445109",
"0.5432394",
"0.53746146",
"0.5352155",
"0.5300324",
"0.5295653",
"0.52790403",
"0.5226414",
"0.52107775",
"0.5176867",
"0.5154576",
"0.5083715",
"0.5061558",
"0.5055035... | 0.6782747 | 0 |
DELETE /moto_registration_numbers/1 DELETE /moto_registration_numbers/1.xml | def destroy
@moto_registration_number = MotoRegistrationNumber.find(params[:id])
@moto_registration_number.destroy
respond_to do |format|
format.html { redirect_to(moto_registration_numbers_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @registration_number = RegistrationNumber.find(params[:id])\n @registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(registration_numbers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/content... | [
"0.6785442",
"0.6525029",
"0.63755083",
"0.63554126",
"0.6328032",
"0.6322757",
"0.6310833",
"0.6310833",
"0.6310833",
"0.6310833",
"0.6310833",
"0.6248103",
"0.6242309",
"0.6198912",
"0.61402214",
"0.6101365",
"0.60624576",
"0.60268134",
"0.60031545",
"0.59856653",
"0.597231... | 0.72625786 | 0 |
has_many :bikes, :favorite_bikes, :favorites | def current_user
scope == object
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_favorites\n\tend",
"def favourited_items\n self.favourites.each do |f|\n f.favouritable\n end\n end",
"def include_objects\n ActsAsFavable::Favorite.includes(:favable)\n end",
"def favorited_items\n User.first.favorites.map {|fi| fi.product}\n end"... | [
"0.64640605",
"0.64286697",
"0.6360204",
"0.6214893",
"0.61960393",
"0.6182329",
"0.6174362",
"0.6145989",
"0.60928816",
"0.608533",
"0.60635984",
"0.6055706",
"0.6024451",
"0.60170233",
"0.60170233",
"0.596829",
"0.59469014",
"0.59195256",
"0.59105134",
"0.5908065",
"0.58956... | 0.0 | -1 |
Creates a DSL instance for a given scenario | def initialize(waw_kernel, scenario)
@waw_kernel = waw_kernel
@scenario = scenario
@browser = Browser.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scenario(scenario_name, &block)\n @scenarios[scenario_name] = Scenario.new(@_method_name, &block)\n end",
"def scenario(description, &block)\n @scenarios ||= []\n\n # instantiate scenario\n scenario = Scenario.new(\n script: self,\n context: context,\n description:... | [
"0.6202684",
"0.60801154",
"0.586003",
"0.5757599",
"0.57109356",
"0.5663901",
"0.56305623",
"0.5595193",
"0.54649854",
"0.53710634",
"0.53421205",
"0.5255694",
"0.5247726",
"0.5180668",
"0.5177201",
"0.5157452",
"0.51307076",
"0.5071125",
"0.5032288",
"0.5032288",
"0.5001597... | 0.5155574 | 16 |
Semiprivate utilities Executes some code | def __execute(&block)
self.instance_eval(&block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec; end",
"def exec; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def execute; end",
"def execute; end",
"def run() end",
"def execute!; end",
"def run(_); end",
"def run(_); end",
"def proceed!; end",
"def proceed!; end",
"def execute\n end",
"def exec... | [
"0.71493167",
"0.71493167",
"0.66987455",
"0.66987455",
"0.66987455",
"0.6626813",
"0.6626813",
"0.6455461",
"0.63495046",
"0.6346872",
"0.6346872",
"0.6306767",
"0.6306767",
"0.62303793",
"0.62303793",
"0.62301135",
"0.62152153",
"0.62152153",
"0.62152153",
"0.62152153",
"0.... | 0.0 | -1 |
A stack of execution context | def __stack
@stack ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __stack\n @stack\n end",
"def stack\n @stack\n end",
"def callstack\n @callstack.dup\n end",
"def stack; end",
"def stack; end",
"def context\n @context_stack.last\n end",
"def load_stack\n @load_stack\n end",
"def stack(new_scope = T.unsafe(nil)); en... | [
"0.75630933",
"0.7329161",
"0.7325653",
"0.72959393",
"0.72959393",
"0.7098576",
"0.7002565",
"0.6987988",
"0.6970865",
"0.69289863",
"0.6876051",
"0.68440896",
"0.6827373",
"0.6795982",
"0.67606175",
"0.6734768",
"0.65897477",
"0.65723693",
"0.65723693",
"0.65723693",
"0.656... | 0.711802 | 5 |
Returns the last because clause | def __last_because
__stack.last || @scenario.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_last\n select($game_cooking.recipes.index($game_cooking.recipe) || 0)\n end",
"def remaining_sql\n @stmt_api.remaining_sql\n end",
"def select_last\n select($game_party.members.index($game_cooking.cook) || 0)\n end",
"def last_results\n $sql_multi ? $sql_results.last : $sql_result... | [
"0.55473876",
"0.551409",
"0.54015404",
"0.5291644",
"0.5284842",
"0.5213991",
"0.51791143",
"0.5145713",
"0.51230544",
"0.5112969",
"0.50898117",
"0.5031334",
"0.49881768",
"0.49668208",
"0.49495912",
"0.49472678",
"0.49396676",
"0.49339023",
"0.49238932",
"0.49217942",
"0.4... | 0.57852954 | 0 |
About scoping Delegates to waw ressources | def method_missing(name, *args, &block)
if args.empty? and resources and resources.has_resource?(name)
resources[name]
else
super(name, *args, &block)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope() yield end",
"def scope() binding end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def _rewire_sub_resources!\n rewire_map = {\n ... | [
"0.6027531",
"0.6016457",
"0.58524644",
"0.58524644",
"0.58524644",
"0.58524644",
"0.58524644",
"0.58524644",
"0.58524644",
"0.58524644",
"0.58524644",
"0.58524644",
"0.57704353",
"0.5698452",
"0.55746156",
"0.5534097",
"0.552936",
"0.552225",
"0.5518918",
"0.5489653",
"0.546... | 0.0 | -1 |
About browser Returns the current browser instance | def browser
@browser
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def browser\n BrowserInst.browser\n end",
"def browser\n BrowserInst.browser\n end",
"def browser\n @web_browser\n end",
"def browser\r\n @web_browser\r\n end",
"def browser\n @options[:browser] ||= self.class.create_browser\n end",
"def browser\n if @browser.ni... | [
"0.8857251",
"0.85572404",
"0.8423291",
"0.8390459",
"0.8097408",
"0.7919255",
"0.7904366",
"0.77523535",
"0.7618304",
"0.737277",
"0.7299733",
"0.7289403",
"0.7288935",
"0.72253805",
"0.72228724",
"0.7216117",
"0.7121903",
"0.7068331",
"0.70648044",
"0.7026999",
"0.7024905",... | 0.8708791 | 1 |
Returns current browser contents (used by HTMLAnalysis) | def browser_contents
browser.contents
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html\n @browser.html()\n end",
"def page_source\n @web_browser.page_source\n end",
"def page_source\r\n @web_browser.page_source\r\n end",
"def page_source\r\n @browser.page_source\r\n end",
"def page_text\n @web_browser.text\n end",
"def page_text\r\n @we... | [
"0.7415785",
"0.73982435",
"0.7389971",
"0.7362739",
"0.7320327",
"0.7306944",
"0.7032243",
"0.6924672",
"0.6915532",
"0.67538255",
"0.6713682",
"0.6677867",
"0.6613712",
"0.6601149",
"0.65201885",
"0.6517126",
"0.65090144",
"0.63786966",
"0.6308013",
"0.61830354",
"0.6159587... | 0.8520767 | 0 |
Returns the URL of the index page (the web_base actually) This method returns nil unless the Waw application has been loaded | def index_page
config && config.web_base
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url\n if @website_file.in_blog?\n blog_folder.currentpath + @name + \"index.html\"\n else\n siteroot.currentpath + @name + \"index.html\"\n end\n end",
"def url\n File.join(environment.config.url, @logical_path).sub /(index)?\\.html?$/, ''\n end",
"def base_web_u... | [
"0.6724639",
"0.6653207",
"0.64598393",
"0.6378341",
"0.6378341",
"0.6378341",
"0.6232984",
"0.6219353",
"0.61208874",
"0.60584456",
"0.60562205",
"0.60562205",
"0.60562205",
"0.6021297",
"0.58808696",
"0.5865468",
"0.586272",
"0.5845733",
"0.58402205",
"0.5838838",
"0.582754... | 0.7930575 | 0 |
Goes to a given location and returns the HTTPResponse object | def go(location)
browser.location = location
browser.response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location\n @client.get(\"#{path}/location\")\n end",
"def get(location)\n begin\n response = Net::HTTP.get_response(url(location))\n response.body if response.is_a?(Net::HTTPSuccess)\n rescue ::Timeout::Error\n raise GoogleWeather::Connection::Timeout, \"The connection time... | [
"0.69599456",
"0.6857647",
"0.6798658",
"0.66855085",
"0.65320235",
"0.65223557",
"0.64424884",
"0.64424884",
"0.6421709",
"0.63974744",
"0.63886577",
"0.6373973",
"0.6327607",
"0.62899446",
"0.62790936",
"0.6191266",
"0.61763734",
"0.61744225",
"0.61729985",
"0.614848",
"0.6... | 0.60751545 | 26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.