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
Used when additional reference numbers specific to the claim in the CLP segment are provided to identify information used in the process of adjudicating this claim
def other_claim_related_id if @eob.insurance_policy_number.present? elem = ['REF','IG', @eob.insurance_policy_number].trim_segment.join(@element_seperator) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def other_claim_related_id\n elem = []\n if !eob.insurance_policy_number.blank?\n elem << 'REF'\n elem << 'IG'\n elem << eob.insurance_policy_number\n elem = Output835.trim_segment(elem)\n elem.join(@element_seperator)\n end\n end", "def other_claim_related_id\n end", "def r...
[ "0.6337421", "0.6014893", "0.5780814", "0.57280505", "0.57280505", "0.5722685", "0.5638677", "0.56098926", "0.5599693", "0.5578289", "0.5568588", "0.5564096", "0.5562551", "0.55386055", "0.55197716", "0.5482172", "0.54294103", "0.54200155", "0.5399013", "0.5376572", "0.536161...
0.62510943
1
Specifies pertinent dates and times of the claim
def statement_from_date claim_date = claim_start_date if claim_date && can_print_service_date(claim_date.strftime("%Y%m%d")) ['DTM', '232', claim_date.strftime("%Y%m%d")].join(@element_seperator) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acquired_date_time=(value)\n @acquired_date_time = value\n end", "def set_starts_at_time_and_date\n self.starts_at_time = starts_at.strftime(\"%H:%M\")\n self.starts_at_date = starts_at.strftime(\"%Y-%m-%d\")\n end", "def claimed_at\n params['claimed_at']\n end", ...
[ "0.639774", "0.6387715", "0.6031999", "0.59773725", "0.59708434", "0.59489584", "0.59467953", "0.5913828", "0.58895594", "0.5829928", "0.5810156", "0.58087486", "0.57840437", "0.5775544", "0.57466674", "0.5738322", "0.5725611", "0.5725611", "0.5718948", "0.5704946", "0.570371...
0.5409202
69
Specifies pertinent dates and times of the claim
def statement_to_date end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acquired_date_time=(value)\n @acquired_date_time = value\n end", "def set_starts_at_time_and_date\n self.starts_at_time = starts_at.strftime(\"%H:%M\")\n self.starts_at_date = starts_at.strftime(\"%Y-%m-%d\")\n end", "def claimed_at\n params['claimed_at']\n end", ...
[ "0.639774", "0.6387715", "0.6031999", "0.59773725", "0.59708434", "0.59489584", "0.59467953", "0.5913828", "0.58895594", "0.5829928", "0.5810156", "0.58087486", "0.57840437", "0.5775544", "0.57466674", "0.5738322", "0.5725611", "0.5725611", "0.5718948", "0.5704946", "0.570371...
0.0
-1
Specifies pertinent From date of the claim
def claim_from_date if @eob.claim_from_date.present? && can_print_service_date(@eob.claim_from_date.strftime("%Y%m%d")) [ 'DTM', '232', @eob.claim_from_date.strftime("%Y%m%d")].join(@element_seperator) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def claim_from_date\n unless eob.claim_from_date.blank?\n Output835.log.info \"Claim From Date:#{eob.claim_from_date}\"\n claim_date_elements = []\n claim_date_elements << 'DTM'\n claim_date_elements << '232'\n claim_date_elements << eob.claim_from_date.strftime(\"%Y%m%d\")\n claim...
[ "0.7641909", "0.75583285", "0.7301756", "0.7301756", "0.7261059", "0.71562874", "0.7124526", "0.6807425", "0.6753635", "0.6753635", "0.6753635", "0.6753635", "0.6753635", "0.63954306", "0.63586754", "0.6248928", "0.6248928", "0.62271583", "0.6224968", "0.6162491", "0.61388904...
0.7051829
7
Specifies pertinent To dates of the claim
def claim_to_date if @eob.claim_to_date.present? && can_print_service_date(@eob.claim_to_date.strftime("%Y%m%d")) ['DTM', '233', @eob.claim_to_date.strftime("%Y%m%d")].join(@element_seperator) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def claim_to_date\n unless eob.claim_to_date.blank?\n if eob.claim_from_date.strftime(\"%Y%m%d\") == \"20000101\"\n claim_to_date = \"00000000\"\n else\n claim_to_date = eob.claim_to_date.strftime(\"%Y%m%d\")\n end\n Output835.log.info \"Claim To Date:#{eob.claim_to_date}\"\n ...
[ "0.69593406", "0.6751376", "0.67212474", "0.6312275", "0.62085336", "0.6140801", "0.61147004", "0.600482", "0.59533244", "0.57597077", "0.5709655", "0.5695636", "0.56839246", "0.56524444", "0.5650989", "0.5627358", "0.5551082", "0.5514058", "0.54903793", "0.5440202", "0.54334...
0.6372782
4
generating service level segments
def generate_services is_adjustment_line = @service.adjustment_line_is? service_segments = [] service_segments << service_payment_information unless is_adjustment_line service_segments << service_date_reference unless is_adjustment_line cas_segments, pr_amount, crosswalked_codes = Output835.ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segments; end", "def segments\n response = get 'segments'\n response.map{|item| Hashie::Mash.new(item)}\n end", "def get_segments\n return make_request(\"#{self.endpoint}/list/segments\")\n end", "def segments=(_arg0); end", "def lists_and_segments\n response = get \...
[ "0.75312275", "0.6523971", "0.64782524", "0.64646417", "0.6244528", "0.6126322", "0.60918397", "0.60620755", "0.605204", "0.60224414", "0.5968079", "0.5942922", "0.5928583", "0.59226626", "0.5916483", "0.58785135", "0.57835704", "0.57679874", "0.5737053", "0.570221", "0.56883...
0.70039004
1
supplies payment and control information to a provider for a particular service
def service_payment_information(eob = nil,service = nil,check = nil,is_claim_eob = nil,payer = nil) @service = @service.nil?? service : @service ['SVC', composite_med_proc_id, @service.amount('service_procedure_charge_amount'), @service.amount('service_paid_amount'), svc_revenue_code, @service.service_qu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_payment_info_loop\n end", "def service_payment_information(eob = nil,service = nil,check = nil,is_claim_eob = nil,payer = nil)\n @eob = @eob.nil?? eob : @eob\n @service = @service.nil?? service : @service\n ['SVC', \"RX:#{captured_or_blank_patient_account_number(@eob.patient_account_numbe...
[ "0.6717453", "0.66556394", "0.657145", "0.6368526", "0.628441", "0.6251136", "0.6223648", "0.6137595", "0.6131912", "0.6091232", "0.6087689", "0.6041838", "0.60333484", "0.6015361", "0.60099614", "0.59612507", "0.59304965", "0.59289956", "0.59230745", "0.5921717", "0.5869013"...
0.67547005
0
The DTM segment in the SVC loop is to be used to express dates and date ranges specifically related to the service identified in the SVC segment If service from and to dates are same, only print one segment with qual 472 Else print one segment each for the two dates
def service_date_reference svc_date_segments = [] from_date = @service.date_of_service_from.strftime("%Y%m%d") unless @service.date_of_service_from.blank? to_date = @service.date_of_service_to.strftime("%Y%m%d") unless @service.date_of_service_to.blank? from_eqls_to_date = (from_date == to_date) is_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_date_reference\n service_date_elements, svc_date_segments = [], []\n from_date = service.date_of_service_from.strftime(\"%Y%m%d\") unless service.date_of_service_from.blank?\n to_date = service.date_of_service_to.strftime(\"%Y%m%d\") unless service.date_of_service_to.blank? \n if from_dat...
[ "0.6629668", "0.59278655", "0.5803223", "0.565906", "0.5452688", "0.54257756", "0.52251405", "0.5195947", "0.5170736", "0.51558065", "0.5110476", "0.5109761", "0.5103426", "0.50876486", "0.5058007", "0.5046841", "0.5042525", "0.50308174", "0.5021806", "0.5013138", "0.49822974...
0.7368086
0
Method deletes the leading and trailing spaces of string. Method is called for GS03 facility name as per the requirement Feature 23701
def strip_string string string.strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_whitespace(dirty_name)\n \n return dirty_name.split(' ').join(\" \") \n \n end", "def cleanup str\n str2 = str.gsub(/[^A-Za-z]/, ' ')\n str3 = str2.gsub(/[ ]{2,}/, ' ')\nend", "def cleanup(str)\n str.gsub!(/[^0-9a-z ]/i, ' ')\n str.gsub!(/\\s+/, ' ')\nend", "def cleanup(str)\n str.gsub(/([^a...
[ "0.70609325", "0.7005709", "0.6936905", "0.68915313", "0.6854763", "0.6831271", "0.68074477", "0.6806049", "0.6802723", "0.679799", "0.67812824", "0.6748708", "0.67476606", "0.6739367", "0.67221814", "0.67209643", "0.6687914", "0.66739005", "0.66401035", "0.66086346", "0.6580...
0.0
-1
=> 1.5 This method is analogous to reduce(:+):
def my_sum(arr) accumulator = arr.first # store first element as accumulator arr.each_index do |idx| next if idx == 0 # skip first element: it's already the accumulator accumulator += arr[idx] # increment accumulator by current element end accumulator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum(element)\n element.reduce(:+)\nend", "def sum(a)\n a.reduce(&:+)\nend", "def sum\n self.inject(:+)\n end", "def sum\n reduce(0, &:+)\n end", "def sum(numbers)\r\n numbers.reduce(0, :+)\r\nend", "def sum\n\t\treturn self.reduce(:+)\n\tend", "def total(a)\n\ta.reduce(:+)\nend",...
[ "0.72864103", "0.7281918", "0.72153616", "0.7181068", "0.7059739", "0.7054298", "0.7048391", "0.70040244", "0.7001584", "0.6969846", "0.6864926", "0.68622607", "0.68506145", "0.68389815", "0.683038", "0.6816554", "0.6796375", "0.6791699", "0.6779876", "0.6779085", "0.6772911"...
0.0
-1
Invoking reduce with a block gives greater control over how to reduce the receiver. One isn't limited to binary methods or operations:
def sum_first_and_odds(arr) arr.reduce do |acc, el| if el.odd? acc + el else # this else statement is necessary because otherwise the return value of # the block would be nil if the element is even. Thus the interpreter # would reassign acc to nil. acc end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend", "def _reduce_19(val, _values, result)\n result = self.block_append val[0], val[2]\n\n result\nend", "def _reduce_19(val, _values, result)\n res...
[ "0.76151586", "0.76151586", "0.76151586", "0.76151586", "0.76151586", "0.76151586", "0.76151586", "0.76151586", "0.76151586", "0.76151586", "0.76151586", "0.76151586", "0.76151586", "0.76151586", "0.76151586", "0.7533438", "0.7533438", "0.7533438", "0.7533438", "0.7533438", "...
0.0
-1
=> 6 In Step 1's sixth practice assessment, we wrote a method that determined the longest word in a string. Here's the original solution and one using reduce: OLD SOLUTION
def old_longest_word(str) words = str.split longest_word = "" words.each do |word| if word.length > longest_word.length longest_word = word end end longest_word end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_longest_word(input_string)\n array = input_string.split(\" \")\n array.max_by {|word| word.length}\nend", "def longest_string(strings)\r\n#+++solution+++\r\n strings.inject('') { | best, this | (best.length < this.length) ? this : best }\r\n#---solution---\r\nend", "def longest_word(sen)\n words =...
[ "0.8244373", "0.82066965", "0.8192249", "0.8167795", "0.8150644", "0.8140021", "0.8123376", "0.8096654", "0.80929434", "0.8087551", "0.8062892", "0.8053171", "0.8051514", "0.80426157", "0.80282557", "0.80217296", "0.7989718", "0.7988252", "0.797876", "0.7974078", "0.7966766",...
0.8193987
2
With a Block, With an Initial Accumulator There are two differences between invoking reduce with an argument and a block versus with only a block: The interpreter initially assigns the accumulator to the given argument. The interpreter iterates through the entire receiver, i.e., it does not skip the first element. This...
def old_e_words(str) words = str.split count = 0 words.each do |word| count += 1 if word[-1] == "e" end count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def e_words(str)\n str.split.reduce(0) do |count, word|\n if word[-1] == \"e\"\n count + 1\n else\n count # return existing count from block so count isn't reassigned to nil\n end\n end\nend", "def character_count(words)\n words = words.split(' ')\n words.reduce(0) { |sum, val| sum + val.l...
[ "0.78621924", "0.68649894", "0.667658", "0.65928787", "0.65476245", "0.64105517", "0.6265147", "0.62433976", "0.62091637", "0.61969006", "0.6163417", "0.6160707", "0.6145172", "0.61261237", "0.6113959", "0.60885006", "0.6087822", "0.608003", "0.60443336", "0.6033731", "0.6029...
0.6559114
4
Take a moment to study an implementation using reduce:
def e_words(str) str.split.reduce(0) do |count, word| if word[-1] == "e" count + 1 else count # return existing count from block so count isn't reassigned to nil end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce\n _reduce = ->(acc, f, xs){\n xs == [] ? acc : _reduce.(f.(acc, xs[0]), f, xs[1..-1])\n }\n\n curry.(->(f, xs) {\n _reduce.(xs[0], f, xs[1..-1])\n })\n end", "def _reduce_1(val, _values, result); end", "def _reduce_375(val, _values, result)\n result = val[...
[ "0.75888646", "0.7562143", "0.75409055", "0.75175476", "0.75061524", "0.7471402", "0.74696386", "0.7466019", "0.74581116", "0.7457762", "0.7442165", "0.7442165", "0.7429682", "0.74285674", "0.7410794", "0.7410794", "0.74072486", "0.74072486", "0.74034387", "0.73941624", "0.73...
0.0
-1
Here's our solution as well as an implementation using reduce with an empty string as the initial accumulator: OLD SOLUTION
def old_boolean_to_binary(arr) binary = "" arr.each do |boolean| if boolean binary += "1" else binary += "0" end end binary end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_1(val, _values, result)\n paint \"| Empty String |\" , :white\n result\nend", "def _reduce_424(val, _values, result)\n result = @builder.string_compose(nil, val[0], nil)\n\n result\nend", "def _reduce_439(val, _values, result)\n result = @builder.stri...
[ "0.745299", "0.7010364", "0.7004395", "0.69815725", "0.6980433", "0.69681126", "0.69406784", "0.6932525", "0.6932525", "0.6932525", "0.6927861", "0.6922835", "0.69200784", "0.69123733", "0.68960446", "0.6886463", "0.68796694", "0.6840588", "0.6838066", "0.6834939", "0.6831415...
0.0
-1
Try to code an implementation using reduce before looking at the solution: OLD SOLUTION
def old_factors(num) factors = [] (1..num).each do |i| if num % i == 0 factors << i end end factors end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_69(val, _values, result); end", "def _reduce_375(val, _values, result)\n result = val[0].concat(val[2]).concat(val[3])\n \n result\nend", "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "def _red...
[ "0.7425461", "0.74118716", "0.73941344", "0.7391247", "0.7391247", "0.7377703", "0.73669505", "0.7366489", "0.7364236", "0.73623353", "0.7357239", "0.73557806", "0.73557806", "0.73557806", "0.73557806", "0.73557806", "0.73557806", "0.73557806", "0.73557806", "0.73557806", "0....
0.0
-1
react_port(Port port, Energy energy)
def react_port(port, energy) super(port, energy) if energy.value >= threshold energy.value = 0 try_callback(:on_react_drain, self, port, energy) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def react_port(port, energy)\n #\n try_vlog { |io| io.puts react_s(\"Rp=\", energy, port.id, port) }\n end", "def react_port(port, energy)\n super(port, energy)\n emit(OUTPUT_ID, @state ? energy : emit_energy_null)\n state_depress if state_pressed?\n end", "def emit...
[ "0.86894", "0.81447214", "0.78325343", "0.77473986", "0.7625689", "0.7624276", "0.7611039", "0.75940025", "0.6219545", "0.6185251", "0.60466623", "0.6034582", "0.592604", "0.5893094", "0.5803036", "0.5803036", "0.5798036", "0.5765309", "0.56801206", "0.5635834", "0.5610097", ...
0.67905515
8
It should return a pair of days representing the best day to buy and the best day to sell. Days start at 0.
def stock_picker(stock_prices) best_pick = 0 first_index = 0 second_index = 0 stock_prices.each_with_index do |val, idx| current_pick = stock_prices.slice((idx + 1)..(stock_prices.length - 1)) current_pick.each_with_index do |num, i| new_pick = num - val if new_pick > best_pick best...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pick_best_day(optimized, days)\n\tbuy_day = 0\n\tsell_day = 0\n\tprofit = 0\n\tdays.each do |day|\n\t\tdaily_profit = days[optimized[days.index day]] - day\n\t\tif daily_profit > profit\n\t\t\tprofit = daily_profit\n\t\t\tbuy_day = days.index day\n\t\t\tsell_day = optimized[days.index day]\n\t\tend\n\tend\n\t[...
[ "0.80740863", "0.7687703", "0.74781924", "0.74291193", "0.7358535", "0.73476434", "0.73292494", "0.7243231", "0.71886474", "0.71795917", "0.717516", "0.71716034", "0.7134846", "0.7111988", "0.7110159", "0.7081622", "0.7058404", "0.702956", "0.7027008", "0.7022063", "0.7001213...
0.6844025
31
Identifies the orionvm cloud === Return true:: If the orionvm cloud can be identified false:: Otherwise
def looks_like_orionvm? hint?('orionvm') || looks_like_orionvm_v2? || looks_like_orionvm_v3? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end", "def cloud?(node)\n node.key?('cloud')\n end", "def cloud?(node = __getnode)\n # cloud is always present, but nil if not on a cloud\n !node[\"cloud\"]...
[ "0.6731178", "0.65344596", "0.64719707", "0.6430523", "0.63247144", "0.6225154", "0.61882967", "0.61516964", "0.6135572", "0.6129361", "0.61072576", "0.6083947", "0.6081457", "0.6072907", "0.6061748", "0.60019016", "0.5980817", "0.59437996", "0.5930491", "0.5917122", "0.59110...
0.6617936
1
Identifies the orionvm v2 cloud === Return true:: If the orionvm v2 cloud can be identified false:: Otherwise
def looks_like_orionvm_v2? File.exists?('/etc/orion_base') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ec2?\n resolve_cloud_type if @ec2.nil?\n @ec2\n end", "def cloud?(node)\n node.key?('cloud')\n end", "def cloud?(node = __getnode)\n # cloud is always present, but nil if not on a cloud\n !node[\"cloud\"].nil?\n end", "def looks_like_orionvm?\n hint?('orionv...
[ "0.66103345", "0.65742433", "0.6462222", "0.64200187", "0.6402527", "0.6305493", "0.6215357", "0.6175751", "0.6167907", "0.6159091", "0.6142463", "0.6142463", "0.6125003", "0.6111821", "0.6061957", "0.60480857", "0.60310775", "0.6003999", "0.59799635", "0.5974892", "0.5940216...
0.6558422
2
Identifies the orionvm v3 cloud === Return true:: If the orionvm v3 cloud can be identified false:: Otherwise
def looks_like_orionvm_v3? File.exists?('/etc/udev/rules.d/70-contextdrive.rules') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cloud?(node)\n node.key?('cloud')\n end", "def cloud?(node = __getnode)\n # cloud is always present, but nil if not on a cloud\n !node[\"cloud\"].nil?\n end", "def looks_like_orionvm?\n hint?('orionvm') || looks_like_orionvm_v2? || looks_like_orionvm_v3?\n end", "def ma...
[ "0.6934454", "0.68639785", "0.61691487", "0.61477035", "0.61403996", "0.60824776", "0.6047192", "0.6014773", "0.601393", "0.60110945", "0.5905977", "0.5862849", "0.5858454", "0.5847134", "0.58408374", "0.58385897", "0.58172905", "0.5809941", "0.5808789", "0.5802744", "0.57973...
0.617962
2
Determines whether IP address is private (reserved) === Parameters address:: IP address to test (ie '192.168.0.1')
def is_private?(address) [ IPAddr.new('10.0.0.0/8'), IPAddr.new('172.16.0.0/12'), IPAddr.new('192.168.0.0/16'), ].any? do |i| i.include? address end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_private(ip)\n\t\tpriv = FALSE\n\t\tif (ip_int(\"10.0.0.0\")..ip_int(\"10.255.255.255\")) === ip_int(ip)\n\t\t\tpriv = TRUE\n\t\telsif (ip_int(\"172.16.0.0\")..ip_int(\"172.31.255.255\")) === ip_int(ip)\n\t\t\tpriv = TRUE\n\t\telsif (ip_int(\"192.168.0.0\")..ip_int(\"192.168.255.255\")) === ip_int(ip)\n\t\t\...
[ "0.77885616", "0.77885616", "0.7283692", "0.6809676", "0.67911214", "0.6775022", "0.65426326", "0.6536171", "0.64874506", "0.648404", "0.63889843", "0.6378189", "0.63750863", "0.6357704", "0.6354815", "0.6349172", "0.6349172", "0.632853", "0.6323603", "0.6319336", "0.63138056...
0.829832
0
Names orionvm ip address === Parameters type:: Use :public_ip or :private_ip
def get_ip_address(type) network[:interfaces].each do |iface, info| next unless info['type'] == 'eth' info[:addresses].each do |addr, detail| next unless detail['family'] == 'inet' case type when :public_ip return addr if !is_private?(addr) when :private_ip ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n ip_address\n end", "def ip\n @ip ||= select { |type,value| type == :ip }.map do |(type,value)|\n IPAddr.new(value)\n end\n end", "def name\n ip_address\n end", "def aws_get_ip (method = :internal, type = :public)\n # allowed methods: :internal...
[ "0.72197586", "0.7196706", "0.71419674", "0.68927634", "0.6867152", "0.6786188", "0.6781043", "0.67267185", "0.6722671", "0.67162526", "0.67162526", "0.67162526", "0.67162526", "0.67162526", "0.67162526", "0.6716069", "0.669638", "0.669638", "0.66857624", "0.6661724", "0.6647...
0.697365
3
This object should contain: bibnumber, title, summary, cast, language, rating, note poster_url?
def initialize(bibnumber) @bibnumber = bibnumber load_marc_record # get_poster_url if @title and whatever other fields we need to do the search end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_bibtex\n\n @bibtex.key = self.accession_number\n @bibtex.title = self.title\n if self.bib_authors_list.length > 0\n @bibtex.author = self.bib_authors_list.join(' and ').chomp\n end\n @bibtex.year = self.publication_year.to_i\n\n # bibtex type\n ...
[ "0.6491546", "0.6231178", "0.6039356", "0.60168743", "0.5929667", "0.5821091", "0.58083063", "0.5790656", "0.57471186", "0.5736013", "0.57207006", "0.56932", "0.5640132", "0.56179243", "0.560729", "0.55908453", "0.557538", "0.5567378", "0.5539262", "0.55297214", "0.5525825", ...
0.6225129
2
Load information for marc record. marc record is going to be in json format
def load_marc_record @@sierra_api = SierraApi.new unless @@sierra_api marc_record = @@sierra_api.bibs(id: @bibnumber) relavent_tags = ['245', '500', '511', '520', '521', '546'] tags = {} marc_record.each do |i| tag = i['tag'] if relavent_tags.include?(tag) tags...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def marc_record_from_json\n return if marc_source.blank?\n\n begin\n marc_json = JSON.parse(marc_source)\n rescue JSON::ParserError => json_error\n Rails.logger.error \"#{self.class}: Failed to parse the MARC JSON: #{json_error}\"\n return\n ...
[ "0.7291279", "0.7245152", "0.67138", "0.6338884", "0.6319931", "0.6259898", "0.60112524", "0.5970355", "0.58653146", "0.5814023", "0.58040243", "0.5630739", "0.5559458", "0.54400927", "0.5402423", "0.5353813", "0.53187424", "0.53108114", "0.5279091", "0.52457726", "0.5221166"...
0.66911083
3
Override to disable heartbeat
def run unless @heartbeat_type == :none super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown\n\t\tself.stop_heartbeat\n\t\tsuper\n\tend", "def stop_heartbeat\n\t\tself.reactor.remove_timer( @heartbeat_timer )\n\tend", "def restart\n\t\tself.stop_heartbeat\n\t\tsuper\n\t\tself.start_heartbeat\n\tend", "def heartbeat\n end", "def cancel_heartbeat(&blk)\n raise 'This API endpoint c...
[ "0.7354459", "0.7045265", "0.6943713", "0.6819915", "0.68168664", "0.67524", "0.67507195", "0.63720876", "0.6358187", "0.6228595", "0.62069905", "0.61533964", "0.61050314", "0.6088258", "0.60571915", "0.6044343", "0.60402095", "0.60318863", "0.59869087", "0.5922061", "0.59107...
0.7274086
1
Override: I change weight algorithm
def rebuild_weight_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight; end", "def set_weights(weights); self;end", "def update_weights\n @weights_set.each_weights_with_index do |weights, i|\n weights.each_with_index do |wl, j|\n wl.each_with_index do |w, k|\n wl[k] = w - (@learning_rate * @layers[i].nodes[j].this_output * @layers[i+1].n...
[ "0.7771894", "0.7350258", "0.73358625", "0.72151726", "0.72122884", "0.7201554", "0.71247655", "0.69367415", "0.69367415", "0.6872903", "0.68283975", "0.6809486", "0.67984533", "0.6765138", "0.6759455", "0.66842264", "0.668246", "0.6656651", "0.6633924", "0.6616403", "0.65592...
0.66801476
17
This is just a partial copy from ForwardOuputrebuild_weight_array
def build_weight_array(nodes) weight_array = [] gcd = nodes.map {|n| n.weight }.inject(0) {|r,w| r.gcd(w) } nodes.each {|n| (n.weight / gcd).times { weight_array << n } } weight_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebuild_weight_array\n end", "def init_weight\n # (J, 1)\n @b = Matrix.columns([Array.new(@size) { 0.0 }])\n\n # (J, I)\n @W = Array.new(@J) do\n Array.new(@I) { Sabina::Utils.box_muller }\n end.tap { |ary| break Matrix[*ary] }\n end", "def initialize_weight_change\n ...
[ "0.890922", "0.64295125", "0.6135029", "0.60382813", "0.596401", "0.5890184", "0.58395296", "0.5710417", "0.5702419", "0.56929415", "0.56827074", "0.5675019", "0.5639994", "0.56141794", "0.5597027", "0.55936295", "0.5583926", "0.5578726", "0.5577199", "0.5553593", "0.55495054...
0.62761456
2
Get nodes (a regular_node and a standby_node if available) using hash algorithm
def nodes(tag) if nodes = @cache_nodes[tag] return nodes end hash_key = @hash_key_slice ? perform_hash_key_slice(tag) : tag regular_index = @regular_weight_array.size > 0 ? get_index(hash_key, @regular_weight_array.size) : 0 standby_index = @standby_weight_array.size > 0 ? get_index(hash_key, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_subhashes(node)\n l_hash = node.left ? node.left._hash : self.class.null_hash_at(node.depth + 1)\n r_hash = node.right ? node.right._hash : self.class.null_hash_at(node.depth + 1)\n [l_hash, r_hash]\n end", "def node_hash(node_id)\n \n end", "def hash_nodes(statements, nodes, grounded_ha...
[ "0.69388294", "0.6933611", "0.6772091", "0.6542052", "0.6268432", "0.624462", "0.62066424", "0.6096661", "0.6095306", "0.60625297", "0.60625297", "0.6060467", "0.6044555", "0.60007113", "0.5966244", "0.5960455", "0.5942243", "0.59072876", "0.5894821", "0.5880932", "0.5868486"...
0.63879544
4
the simplest hashing ever
def str_hash(key) key.bytes.inject(&:+) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash(*) end", "def hash(key); end", "def gnu_hash(s)\n s.bytes.reduce(5381) { |acc, elem| (acc * 33 + elem) & 0xffffffff }\n end", "def do_hash(input)\n a...
[ "0.83535093", "0.83535093", "0.83535093", "0.83535093", "0.83535093", "0.83535093", "0.83535093", "0.81338674", "0.7614914", "0.76110756", "0.75337726", "0.7368831", "0.72189116", "0.7218189", "0.7121973", "0.71174353", "0.71089965", "0.7096447", "0.7096447", "0.70950156", "0...
0.0
-1
Returns an ordidinal date eg July 22 2007 > July 22nd 2007
def ordinalize(date) date = datetime(date) d = "<span class='date-month'>#{date.strftime('%b')}</span> " d = "<span class='date-day'>#{date.strftime('%e')}</span> " d += "<span class='date-suffix'>#{ordinal_suffix(date)}</span>, " d += "<span class='date-year'>#{date.strftime('%Y')}</span>...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ordinal_date(date)\n date - date.beginning_of_year\n end", "def ordinalDate\n ordinal = DAYS_THUS_FAR[@month].to_i + @day.to_i\n if leapYear? && @month > 2\n ordinal = ordinal + 1\n end\n return ordinal\n end", "def ordinalize(date)\n\t date = datetime(date)\n\t \"#{date.strftime('%...
[ "0.70651805", "0.6544691", "0.6328653", "0.6306783", "0.62496173", "0.6229167", "0.6201334", "0.61696476", "0.6149758", "0.6097611", "0.60683614", "0.6061975", "0.6058672", "0.6047912", "0.6009844", "0.60011184", "0.5972587", "0.5970493", "0.5957971", "0.59431934", "0.5940677...
0.61111826
9
Returns an ordinal number. 13 > 13th, 21 > 21st etc.
def ordinal_suffix(date) number = date.strftime('%e').to_i if (11..13).include?(number % 100) "th" else case number % 10 when 1; "st" when 2; "nd" when 3; "rd" else "th" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ordinal; end", "def ordinal\n self.to_s +\n if (11..13).include?(self % 100)\n \"th\"\n else\n case self % 10\n when 1 then \"st\"\n when 2 then \"nd\"\n when 3 then \"rd\"\n else \"th\"\n end\n end\n end", "def ordinal( number )\n\t\tcase...
[ "0.7952719", "0.77893436", "0.7652014", "0.76424587", "0.76253253", "0.7611344", "0.7590462", "0.74581045", "0.7259988", "0.72439486", "0.71933925", "0.71654654", "0.716448", "0.7158124", "0.71265537", "0.71008736", "0.7089188", "0.70479774", "0.70152426", "0.70152426", "0.69...
0.6189238
40
short title for lists and callback for ...ables
def list_title(n=40) st = title[0..n].to_s st += "..." unless title.length <= n st end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title_for_list(object)\n return \"List of \" + MyAdmin.prepare_title(object)\n end", "def title=(_arg0); end", "def title=(_arg0); end", "def title=(_arg0); end", "def title_name; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title;...
[ "0.68663794", "0.6500497", "0.6500497", "0.6500497", "0.64935803", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", "0.6426945", ...
0.0
-1
TODO: Check if user allowed to read this posting This callback is used by tagables and therefor it is defined as this simple placeholder yet
def read_allowed?(user) return true unless self.group_restrictions.any? || (user.nil? && self.categories.detect { |c| !c.public }) return false unless user group_restrictions.each do |r| unless user.group_memberships.find_by_usergroup_id(r.usergroup.id).nil? logger.info("\n**** GRANT ACCESS T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_post; end", "def process_post(post)\n # No-op.\n end", "def post_reader; end", "def process_post\n true\n end", "def fetch_create_post\n end", "def view_post\n content \n end", "def force_post\n @type = \"post\"\n @post = \"\"\n end", "def post; end", "def po...
[ "0.6901791", "0.65994835", "0.63145477", "0.61551404", "0.6060221", "0.59365666", "0.5908595", "0.59006", "0.58948976", "0.5867928", "0.5842847", "0.57946175", "0.5772395", "0.5694198", "0.5686122", "0.5663522", "0.5640944", "0.5637536", "0.5626762", "0.55764174", "0.5574192"...
0.0
-1
Notifies all of the translators on the translators' mailing list that there is a new commit that has finished loading. CC's the creator of the commit.
def request_screenshot(commit, user) @commit = commit @project = commit.project @user = user mail to: commit_requesters(@commit), cc: @user.email, subject: t('mailer.screenshot.request_screenshot.subject', sha: @commit.revision_prefix) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_translation_finished(commit)\n @commit = commit\n if @commit.user.try!(:email)\n mail to: @commit.user.email, subject: t('mailer.commit.notify_translation_finished.subject')\n end\n end", "def notify_translators(commit)\n @commit = commit\n\n mail to: Shuttle::Configuration.m...
[ "0.72352576", "0.6816291", "0.56302714", "0.54987997", "0.54884744", "0.53118765", "0.5310627", "0.529286", "0.5290504", "0.52576375", "0.5225784", "0.521971", "0.52022433", "0.5191036", "0.5176706", "0.51608896", "0.5146049", "0.51422894", "0.51341", "0.5087248", "0.5086057"...
0.0
-1
Notifies all of the translators on the translators' mailing list that there is a new commit that has finished loading. CC's the creator of the commit.
def commit_requesters(commit) [commit.user.try(:email), commit.author_email].compact.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_translation_finished(commit)\n @commit = commit\n if @commit.user.try!(:email)\n mail to: @commit.user.email, subject: t('mailer.commit.notify_translation_finished.subject')\n end\n end", "def notify_translators(commit)\n @commit = commit\n\n mail to: Shuttle::Configuration.m...
[ "0.723171", "0.6812909", "0.5627617", "0.5495406", "0.5486109", "0.5310931", "0.53092414", "0.52934015", "0.5289982", "0.52562934", "0.5224683", "0.52192616", "0.5202396", "0.51896894", "0.51769894", "0.5159606", "0.51432633", "0.51409966", "0.5133543", "0.5085821", "0.508409...
0.0
-1
Helper method that will give you a joined pods/metrics query proxy.
def metrics pods.outer_join(:github_pod_metrics).on(:id => :pod_id).join(:cocoadocs_pod_metrics).on(:id => :pod_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pods\n\nend", "def joined\n meta(joined: true)\n end", "def joins\n @joins\n end", "def joins(args={})\n # If showing pending, do not joins question responses\n return args[:show_pending] ? nil : :question_responses\n end", "def query(metric_name, options={})\n key = build...
[ "0.5139953", "0.48673347", "0.48086137", "0.48034048", "0.47497684", "0.47373617", "0.46751404", "0.46732417", "0.46656635", "0.46642977", "0.4595197", "0.4592289", "0.45597503", "0.45221573", "0.45056468", "0.44869015", "0.44813332", "0.44614044", "0.4454043", "0.4454043", "...
0.7241363
0
Use callbacks to share common setup or constraints between actions.
def set_today_fortune @today_fortune = TodayFortune.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def today_fortune_params params.require(:today_fortune).permit(:tdate, :love, :health, :career, :color, :star, :number, :summary, :presummary, :money, :astro_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Time Complexity O(log10(n)): n is the numer of digits for input integer Space Complexity O(log10(n)): call stack for recursion, number of digits
def super_digit(n) return n if n.digits.length == 1 n = n.digits.sum return super_digit(n) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def super_digit(n)\n while n >= 10\n n = n % 10 + super_digit(n / 10)\n end\n return n\nend", "def super_digit(n)\n return n if n/10 == 0\n \n sum = n % 10\n while n/10 != 0\n n = n/10\n sum += n % 10\n end\n return super_digit(sum)\nend", "def super_digit(n)\n # base cas...
[ "0.76064175", "0.7572277", "0.756658", "0.75640917", "0.7548796", "0.7534563", "0.7510628", "0.7418562", "0.738462", "0.7366499", "0.7363857", "0.73187095", "0.73167896", "0.7298477", "0.7289312", "0.7285796", "0.7285796", "0.7265134", "0.7264091", "0.7257486", "0.72562885", ...
0.67671233
59
Time Complexity O(log10(n) + log10(k)): n is input n, k is the input k Space Complexity O(log10(n) + log10(k)): call stack for recursion
def refined_super_digit(n, k) n = super_digit(n) * k return super_digit(n) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nck_recursive(n, k)\n if k == 0 || k == n\n return 1\n else\n return nck_recursive(n-1, k) + nck_recursive(n-1, k-1)\n end\nend", "def refined_super_digit(n, k)\n return n if n < 10\n super_digit(n.digits.sum * k) # k magic hint from https://www.hackerrank.com/challenges/super-digit/forum\nend", ...
[ "0.757688", "0.6850021", "0.6794845", "0.67890966", "0.67831254", "0.67831254", "0.6782363", "0.67401606", "0.67246234", "0.6587007", "0.6579726", "0.65709376", "0.65500194", "0.64705616", "0.6400164", "0.63972986", "0.6397034", "0.6392878", "0.6390915", "0.63798076", "0.6377...
0.61071724
50
Only allow a trusted parameter "white list" through.
def update_version if (VersionControl.any?) obj = VersionControl.all.first else obj = VersionControl.create(version: 3.0) end obj.version += 0.1 obj.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_raport @raport = Raport.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def raport_params params.require(:raport).permit(:meeting_id, :name, :module, :this_week_work, :need_help, :next_week_work, :share_tech) 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
method for initialize instance of customer
def initialize(id, email, address) @id = id # this is an integer @email = email # this is a string @address = address # this is a hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(customer_id:)\n @customer_id = customer_id\n end", "def initialize(custId, custName,custAddr)\r\n\t\t\t@cust_id=custId\r\n\t\t\t@cust_name=custName\r\n\t\t\t@cust_addr=custAddr\r\n\t\tend", "def initialize(customer, bartender)\n @customer = customer\n @bartender = bartender\nend", "def i...
[ "0.80713916", "0.79566497", "0.77988416", "0.7751268", "0.7642828", "0.7597428", "0.75824094", "0.7410488", "0.7387024", "0.7376654", "0.73161626", "0.723311", "0.71722984", "0.71566457", "0.7081231", "0.7034602", "0.7030591", "0.6978455", "0.6963194", "0.68392575", "0.683726...
0.0
-1
Idempotent Behaviour This endpoint is idempotent and will respond with an appropriate HTTP status code to indicate the actual result 200 OK specified tag was found, result available 400 BAD_REQUEST problem occurred, check message parameter for detailed information 401 UNAUTHORIZED user not authorized Input HTTP Headers...
def get_tag_metadata_definition(tag_id, name_like = nil) # prepare query url _query_builder = Configuration.base_uri.dup _query_builder << '/rest/tag/properties/definition/{tagId}' _query_builder = APIHelper.append_url_with_template_parameters _query_builder...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag(id, params = {})\n get \"tags/#{id}\", {query: params}\n end", "def return_tag_infos(tag, language_code)\n if tag.nil?\n render :status => 400, :json => { :error => { :message => 'Tag not found', :code => 'InvalidRequest' }}\n else\n tag_infos = create_tag_infos(tag, language_...
[ "0.62386", "0.62061876", "0.6096252", "0.6047302", "0.5955964", "0.5827314", "0.57999873", "0.57780904", "0.57511", "0.5750471", "0.5722747", "0.5693817", "0.5662055", "0.5622788", "0.5598687", "0.5595545", "0.55918217", "0.55580986", "0.55385274", "0.55338955", "0.5523899", ...
0.0
-1
Look up an array of the first count tag IDs with the specified batch URN. Output parameters tagIds (array of string, `E12345678912345678`) ... Array of RFID tag identifiers
def get_query_tags(batch_urn, count = 100000) # prepare query url _query_builder = Configuration.base_uri.dup _query_builder << '/rest/tag/queryTags' _query_builder = APIHelper.append_url_with_query_parameters _query_builder, { 'batchUrn' => batch_urn, 'c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_tag_return_IDs(tag)\n # Split and strip the tags\n tags = tag.split(\",\").collect{|x| x.strip}\n i = 0\n iDs = []\n while i < tags.count do\n # Check if tag exist, if not - add it\n if Teg.find_by_teg(tags[i]).nil?\n\tTeg.new(:teg => tags[i]).save\n end\n # Insert into...
[ "0.56860304", "0.5434679", "0.5181921", "0.50575536", "0.5054888", "0.5050918", "0.49435166", "0.49434254", "0.48474193", "0.48370224", "0.48253968", "0.4819892", "0.48113188", "0.47977632", "0.4770586", "0.47623456", "0.47452334", "0.47428283", "0.47323185", "0.47195017", "0...
0.55195796
1
Get a message to a single numeric tag code. Idempotent Behaviour This endpoint is idempotent and will respond with an appropriate HTTP status code to indicate the actual result 200 OK message available 400 BAD_REQUEST problem occurred, check message parameter for detailed information 401 UNAUTHORIZED user not authorize...
def create_get_single_tag_code_message(body) # prepare query url _query_builder = Configuration.base_uri.dup _query_builder << '/rest/tag/message' _query_url = APIHelper.clean_url _query_builder # prepare headers _headers = { 'accept' => 'application/json', 'content...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_tag_infos(tag, language_code)\n if tag.nil?\n render :status => 400, :json => { :error => { :message => 'Tag not found', :code => 'InvalidRequest' }}\n else\n tag_infos = create_tag_infos(tag, language_code)\n\n render :status => 200, :json => { :tags => [tag_infos] }\n end\n en...
[ "0.60959977", "0.57663137", "0.5558536", "0.5535623", "0.5480762", "0.54005903", "0.5275106", "0.5274505", "0.5243674", "0.52152926", "0.51961714", "0.5186899", "0.51346874", "0.51182544", "0.5117271", "0.50756985", "0.5074947", "0.5067514", "0.50588506", "0.5043754", "0.5035...
0.6652409
0
Writes application data to tags, which updated the existing application data in Profiles. This function also supports setting the lock state of the application data, which prevents further changes of the application data. Writing application data to a tag is permitted under following conditions only: The tag with the g...
def update_tag_values(body) # prepare query url _query_builder = Configuration.base_uri.dup _query_builder << '/rest/tag/value' _query_url = APIHelper.clean_url _query_builder # prepare headers _headers = { 'accept' => 'application/json', 'content-type' => 'applicat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_app data={}\n put '/app', data\n end", "def update_appdata(person_id, appId, key, value)\n @restv9.update_appdata(person_id, appId, key, value)\n end", "def update\n if @app && @tag\n @tag.update(tag_params)\n if @tag.valid?\n head :no_content\n else...
[ "0.5814049", "0.56065583", "0.5387194", "0.5197366", "0.5123045", "0.49927306", "0.49708614", "0.49653965", "0.48894238", "0.481939", "0.47946137", "0.4789572", "0.4789572", "0.47737172", "0.47618505", "0.47555834", "0.4755378", "0.4737808", "0.4736944", "0.4712892", "0.47105...
0.0
-1
Get application data from tags, which returns data encoded on the tags. This function also returns the lock state of the application data. Idempotent Behaviour This endpoint is idempotent and will respond with an appropriate HTTP status code to indicate the actual result 200 OK tags found and result available (also ret...
def create_get_application_data_from_tags(body) # prepare query url _query_builder = Configuration.base_uri.dup _query_builder << '/rest/tag/value' _query_url = APIHelper.clean_url _query_builder # prepare headers _headers = { 'accept' => 'application/json', 'conten...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read\n return unless locks\n\n result = locks.find(data_bag_id)\n\n result.to_hash if result\n end", "def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n incl...
[ "0.55413246", "0.5264963", "0.5183926", "0.5049842", "0.49332815", "0.48925203", "0.48829582", "0.48625067", "0.48625067", "0.48252925", "0.48252925", "0.48252925", "0.48252925", "0.48252925", "0.48176304", "0.47612125", "0.4760161", "0.46976382", "0.46687907", "0.46677804", ...
0.60995173
0
Look up an array of the first count batchUrns with the specified customer PO. NOTE: Only one customerPO can be specified. Output parameters batchUrns (array of string, `urn:uuid:smartracgroup:batch:99990001`) ... Array of batch URNs
def get_query_batches(customer_po, count = 100000) # prepare query url _query_builder = Configuration.base_uri.dup _query_builder << '/rest/tag/queryBatches' _query_builder = APIHelper.append_url_with_query_parameters _query_builder, { 'customerPO' => customer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_path\n if @discovery_document['batchPath']\n return @batch_path ||= (\n self.document_base.join(Addressable::URI.parse('/' +\n @discovery_document['batchPath']))\n ).normalize\n else\n return nil\n end\n end", "def send_batc...
[ "0.5252995", "0.506197", "0.49939978", "0.4865306", "0.47606206", "0.47280714", "0.47027403", "0.47027403", "0.4661356", "0.46523502", "0.4650074", "0.46288314", "0.4604309", "0.4570969", "0.45338106", "0.44704163", "0.4467058", "0.44465417", "0.44348732", "0.44220415", "0.44...
0.61496884
0
Idempotent Behaviour This endpoint is idempotent and will respond with an appropriate HTTP status code to indicate the actual result 200 OK minimum 1 tag found and result available 400 BAD_REQUEST problem occurred, check message parameter for detailed information 401 UNAUTHORIZED user not authorized Input HTTP Headers:...
def create_get_tag_metadata(body) # prepare query url _query_builder = Configuration.base_uri.dup _query_builder << '/rest/tag/properties' _query_url = APIHelper.clean_url _query_builder # prepare headers _headers = { 'accept' => 'application/json', 'content-type' =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_monkey_multi_enhanced_mip_setting_tags\n # Setup\n image1 = upload_and_link_image('int_xxid', @int_xxid, @user.oauth_token)\n image2 = upload_and_link_image('int_xxid', @int_xxid, @user.oauth_token)\n tags1 = {\n 'cover' => true,\n 'profile' => true,\n 'logo' => true,\n ...
[ "0.56413084", "0.55885226", "0.5511644", "0.54882455", "0.5234055", "0.5233752", "0.5233752", "0.5230774", "0.5216666", "0.5214635", "0.5196251", "0.51062655", "0.5085874", "0.5028116", "0.5018077", "0.5008001", "0.49817613", "0.49708486", "0.49469638", "0.49455932", "0.49432...
0.5111493
11
Get authentication keys for encoded tags, which can be used to access the tag memory. The key names, content and access rules need to be defined when ordering the tags. It is possible to have several applications with their corresponding keys on a tag. Idempotent Behaviour This endpoint is idempotent and will respond w...
def create_get_keys_used_for_tag_authentication(body) # prepare query url _query_builder = Configuration.base_uri.dup _query_builder << '/rest/tag/key' _query_url = APIHelper.clean_url _query_builder # prepare headers _headers = { 'accept' => 'application/json', 'co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authentication_keys\n @authentication_keys ||= [mapping.to.token_authentication_key]\n end", "def keys\n @tags.nil? ? [] : @tags.keys\n end", "def fetch_signing_keys\n response = JSON.parse(Net::HTTP.get(URI(signing_keys_url)))\n response['keys']\n rescue JSON::Parser...
[ "0.58994526", "0.57494795", "0.566004", "0.5653021", "0.5609994", "0.560411", "0.5559515", "0.5545213", "0.54951394", "0.5490269", "0.54600674", "0.54600674", "0.54400295", "0.53958005", "0.5394449", "0.53844446", "0.53773034", "0.53699875", "0.53424716", "0.531775", "0.53154...
0.71602386
0
Return a string representation of the point
def to_s to_a.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @points.join(' ')\n end", "def to_s\n \"#{self.point.x},#{self.point.y},#{self.width},#{self.height}\"\n end", "def to_s\n \"Point3: x #{x} y #{y} z #{z}\"\n end", "def to_s\n \"#{@x}x#{@y}\"\n end", "def to_s\n\t\tres = @x + \" \" + @p + \" \" + @o\n\t\tres\n\tend"...
[ "0.8156014", "0.77980584", "0.74595326", "0.74361134", "0.7407275", "0.73738533", "0.73225415", "0.7311288", "0.72720766", "0.72513616", "0.72445565", "0.7189561", "0.71260697", "0.7121916", "0.7109155", "0.70897114", "0.70413196", "0.70413196", "0.7039846", "0.6978337", "0.6...
0.0
-1
Stash the setting directive and its value into the configuration file using the default settings group.
def set key_name, key_value raise ArgumentError, "Cannot set a Nil (section)" if @section.nil? raise ArgumentError, "Cannot set a Nil key name." if key_name.nil? raise ArgumentError, "Cannot set a Nil key value" if key_value.nil? create_entry( @section, key_name, key_value ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def settings=(value)\n @settings = value\n end", "def settings=(value)\n @settings = value\n end", "def set_defaultsettings\n AppSettings.item.to_hash.each do |setting, value|\n s = RailsSettings::Settings.new \n s.var = setting.to_s\n ...
[ "0.61635673", "0.61635673", "0.611656", "0.60383666", "0.60383666", "0.60204613", "0.6017294", "0.59521437", "0.59242684", "0.59076154", "0.5905986", "0.58562183", "0.581113", "0.581113", "0.5778953", "0.5773501", "0.57558894", "0.5753522", "0.57330954", "0.5728939", "0.57269...
0.0
-1
Create a new key value entry inside a dictionary with the specified name at the root of this database. Successful completion means the named dictionary will contain one more entry than it need even if it did not previously exist.
def create_entry( dictionary_name, key_name, value ) KeyError.not_new( dictionary_name, self ) KeyError.not_new( key_name, self ) KeyError.not_new( value, self ) self[ dictionary_name ] = {} unless self.has_key?( dictionary_name ) self[ dictionary_name ][ key_name ] = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(name, key)\n issueKey_test(key)\n fetch({:method => :post, :body => name, :body_override => true, :parent => parent_name, :parent_key => key})\n end", "def add_to_hash(storage_hash, name, new_name)\r\n storage_hash[name] = new_name\r\nend", "def add_a_key_value_pair\n new_has...
[ "0.62424123", "0.62326896", "0.6038395", "0.6015353", "0.58742636", "0.58257085", "0.5825289", "0.57322586", "0.57258356", "0.57099384", "0.5690248", "0.5648871", "0.56229466", "0.5587205", "0.55508864", "0.5550361", "0.54747695", "0.5461193", "0.544079", "0.5432273", "0.5416...
0.7587017
0
Does this database have an entry in the root dictionary named with the key_name parameter?
def has_entry?( dictionary_name, key_name ) KeyError.not_new( dictionary_name, self ) KeyError.not_new( key_name, self ) return false unless self.has_key?( dictionary_name ) return self[ dictionary_name ].has_key?( key_name ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_key?(key)\n @db.each_key do\n\t|k|\n\treturn true if k == key\n end\n end", "def contains(name)\n database.has_key? name\n end", "def exist? _key\n store.transaction(:read_only) do |s|\n s.roots.any? { |r| r.to_sym == _key.to_sym }\n end\n end", "def dictionary_ex...
[ "0.7601805", "0.76012224", "0.75092226", "0.7088865", "0.70441115", "0.70197386", "0.70197386", "0.70006055", "0.6958498", "0.69516647", "0.69493943", "0.6919207", "0.6919207", "0.6919207", "0.6919207", "0.6919207", "0.6919207", "0.68896073", "0.68807375", "0.68740773", "0.68...
0.68269765
20
Delete an existing key value entry inside the dictionary with the specified name at the root of this database. Successful completion means the named dictionary will contain one less entry if that key existed.
def delete_entry( dictionary_name, key_name ) KeyError.not_new( dictionary_name, self ) KeyError.not_new( key_name, self ) self[ dictionary_name ].delete( key_name ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(name)\r\n key = convert_key(name)\r\n return false unless has(key)\r\n @p.delete(key)\r\n true\r\n end", "def delete(name)\n name = name.to_sym\n if @values.key? name\n delete_name name\n @values.delete name\n end\n end", "def delete_key_pair(key_name)\n return if...
[ "0.69060516", "0.66039443", "0.63256794", "0.6323323", "0.62871385", "0.6269157", "0.6244237", "0.6190668", "0.6190668", "0.6121008", "0.6113571", "0.6081636", "0.6077545", "0.6021239", "0.59702116", "0.59452933", "0.59302396", "0.5922024", "0.58857733", "0.5864068", "0.58592...
0.7690513
0
get first state of all models in the database
def initialize(database_file) @database_file = database_file @data = get_all() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first\n self.all.first\n end", "def first\n @model_class.first\n end", "def first\n @model_class.first\n end", "def first\n self.all.first\n end", "def first\n all.first\n end", "def first; self.objects.first end", "def first\n all.first\n ...
[ "0.6705962", "0.66695285", "0.66695285", "0.65365225", "0.64858747", "0.6473638", "0.64353824", "0.64353824", "0.64353824", "0.64353824", "0.63323516", "0.63323516", "0.63323516", "0.6331306", "0.6305375", "0.6199527", "0.61174804", "0.6027006", "0.5920959", "0.5886116", "0.5...
0.0
-1
convert hash into json and save to file
def save() File.write(@database_file, @data.to_json) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_hash_to_file(hash, file_path)\n File.open(file_path, 'w') do |f|\n f.puts hash.to_json\n end\nend", "def writeHashToJSON(hash, filename)\n File.open(\"./\" + filename,\"w\") do |f|\n f.write(JSON.pretty_generate(hash))\n end\nend", "def write_fund_hash(fund_hash)\n File.write(\"save....
[ "0.7775292", "0.76422435", "0.74232256", "0.7187349", "0.71720624", "0.7124088", "0.6991568", "0.6972617", "0.6871131", "0.68537474", "0.68434983", "0.6817205", "0.6779963", "0.67663616", "0.6760551", "0.66414696", "0.66293204", "0.65549237", "0.6541955", "0.6532362", "0.6517...
0.0
-1
add info in the json file
def add(class_name, object) @data = get_all() @data[class_name].push(object.to_hash()) save() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_json(file)\n new_json = parse_json_file(file)\n store_all_cities(new_json)\n store_all_routes(new_json)\n end", "def add_user_to_json\n hash = JSON.load File.new 'user_information/user_data.json'\n hash[@username] = Hash.new\n hash[@username]['email'] = @email\n hash[@username]['spo...
[ "0.73534614", "0.71178865", "0.7101964", "0.63882226", "0.62845576", "0.6174899", "0.61630577", "0.6126698", "0.61131954", "0.6105447", "0.61017364", "0.61017364", "0.609724", "0.60946155", "0.6085512", "0.6063037", "0.6058491", "0.60304344", "0.5997716", "0.5976724", "0.5966...
0.0
-1
edit item in the json file and save
def edit(class_name, object) begin @data = get_all() # go through all items in the file @data[class_name].map!{|item| if item["id"] == object["id"] object else item end } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n require 'ruby-debug'; debugger\n if storage.respond_to?(\"json_file\")\n output \"#{cyan(\"Boom!\")} #{Platform.edit(storage.json_file)}\"\n else\n output \"This storage backend #{red storage.class} does not store #{cyan(\"Boom!\")} data on your computer\"\n ...
[ "0.6637274", "0.6297716", "0.628253", "0.6248859", "0.6248859", "0.61671454", "0.61314636", "0.61131", "0.6110778", "0.60771143", "0.6028917", "0.6001276", "0.59909153", "0.59732217", "0.5968674", "0.59677356", "0.5940953", "0.5914207", "0.5912161", "0.59079623", "0.5871321",...
0.6591906
1
delete item in the json file and save
def delete(class_name, id) @data = get_all() for item in @data[class_name] if item["id"] == id @data[class_name].delete(item) end end save() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_category(name)\n data_array = JSON.parse(File.read(File_path))\n category_item = find_category(name)\n data_array.delete(category_item)\n File.open(File_path, 'w') { |f| f.write(data_array.to_json) }\nend", "def remove_user_from_json\n hash = JSON.load File.new 'user_information/user_data.json'...
[ "0.710266", "0.69492525", "0.6783052", "0.67735845", "0.67085266", "0.66362226", "0.65042526", "0.6467084", "0.64320314", "0.636976", "0.62376195", "0.6206556", "0.61719835", "0.61638486", "0.6157596", "0.61488765", "0.6143981", "0.6142705", "0.6125897", "0.6103811", "0.60939...
0.0
-1
get item from json file and return it
def get_by_id(class_name, id) @data = get_all() for item in @data[class_name] if item["id"] == id return item end end raise "#{class_name} id #{id} not found." 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 read_file(path, key)\n file = IO.read(path)\n JSON.parse(file)[key]\n end", "def e...
[ "0.6940929", "0.6846219", "0.68115294", "0.6722442", "0.6720814", "0.6720814", "0.67011225", "0.65319675", "0.6495636", "0.6461876", "0.6451821", "0.64309067", "0.6414099", "0.6324142", "0.63058877", "0.626974", "0.62653255", "0.62653255", "0.62273043", "0.61910844", "0.61874...
0.0
-1
get from json file class data
def get_data(class_name) return JSON.parse(File.read(@database_file))[class_name] # error handling rescue Errno::ENOENT File.open(@database_file, 'w+') File.write(@database_file, []) retry end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data\n json_file = Egd::Builder.new(File.read(@file)).to_json\n data = JSON.parse(json_file)\n end", "def parse json; return JSON.parse File.read json end", "def parse json; return JSON.parse File.read json end", "def load_json(filename); end", "def extract_datas_from_json(path)\n ...
[ "0.66772264", "0.6600513", "0.6600513", "0.6553418", "0.6527646", "0.64734405", "0.6402046", "0.63097805", "0.62799823", "0.6276879", "0.6248767", "0.62441224", "0.6220357", "0.62017393", "0.6178706", "0.61314386", "0.6080928", "0.6075665", "0.60620433", "0.60620433", "0.6060...
0.67145586
0
get from json file all data
def get_all() return JSON.parse(File.read(@database_file)) # error handling rescue Errno::ENOENT File.open(@database_file, 'w+') File.write(@database_file, []) retry end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data\n json_file = Egd::Builder.new(File.read(@file)).to_json\n data = JSON.parse(json_file)\n end", "def parse json; return JSON.parse File.read json end", "def parse json; return JSON.parse File.read json end", "def extract_datas_from_json(path)\n file = File.read(path)\n data_de...
[ "0.7711639", "0.7429094", "0.7429094", "0.7421307", "0.7212593", "0.7078496", "0.70626694", "0.6901446", "0.6874973", "0.68389195", "0.6815595", "0.67915535", "0.6782154", "0.6752352", "0.67179996", "0.67160785", "0.66762614", "0.6659185", "0.66371727", "0.6634206", "0.662141...
0.63527805
32
get pets client from json using client id and returning it
def get_pet_list_by_client_id(client_id) pet_list = [] for pet in get_data("pets") if client_id == pet["client_id"] pet_list.push(pet) end end return pet_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client_by_id client_id\n @clients[client_id]\n end", "def client\n query[\"client_id\"]\n end", "def details\n response = CreateSend.get \"/clients/#{client_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def clientid\n @obj['clientid']\n end", "def get_cli...
[ "0.7090033", "0.6448273", "0.64082104", "0.63319725", "0.6240005", "0.6225158", "0.61930263", "0.61827374", "0.612321", "0.60829383", "0.6053361", "0.60049856", "0.597459", "0.5973641", "0.5966523", "0.5965348", "0.5952586", "0.593579", "0.59046054", "0.589576", "0.5886216", ...
0.6550511
1
get tasks list of the jobs from json using job id and returning it
def get_task_list_by_job_id(job_id) list_tasks = [] for task in get_data("tasks") if job_id == task["job_id"] list_tasks.push(task) end end return list_tasks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_job(id)\n conn = @client.get do |req|\n req.url \"/api/v2/job/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end", "def get_task_list(id)\n response = request(\n :expects => 200,\n :idempotent => true,\n ...
[ "0.70621973", "0.70516574", "0.7019634", "0.6913135", "0.6864184", "0.68169725", "0.6705907", "0.6658707", "0.660234", "0.65161216", "0.6499095", "0.6459582", "0.6438981", "0.64238316", "0.640044", "0.6377937", "0.63242865", "0.63006", "0.6291554", "0.62880915", "0.6284512", ...
0.8324479
0
get jobs from json using difference of job date and local date now returning jobs for next 7 days
def get_jobs_last_7_days() @data = get_all() now = Time.now.to_date jobs = [] for job in @data["jobs"] parsed_date = Date.strptime(job["date"], "%d/%m/%Y") days_difference = (parsed_date - now).to_i if days_difference <= 7 && days_difference >= 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_jobs(from, to)\n\n job_info = get_job_info(from)\n total_page = job_info[:x_total_pages].to_i\n new_to = (to == nil || to < total_page) ? to : total_page\n puts \">> total page : \" + total_page.to_s\n\n jobs = []\n (from..new_to).each do |page|\n job_api = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/...
[ "0.6125629", "0.60991776", "0.59484947", "0.5701662", "0.56686306", "0.56597656", "0.55676115", "0.5542194", "0.5455431", "0.5447028", "0.5437113", "0.54125005", "0.5384319", "0.53822505", "0.5379135", "0.5376243", "0.5372504", "0.52999395", "0.5286573", "0.5278726", "0.52742...
0.7609672
0
find latest id used and return one more
def get_new_id(class_name) @data = get_all() # if array is empty return first id 0 if @data[class_name].length == 0 return 0 end # go to last item of the array, get the id and sum +1 return @data[class_name][-1]["id"] + 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_id\n # hashs are ordered, so just return the latest entry\n @entries.keys.last\n end", "def last_id()\n #This is a stub, used for indexing\n end", "def next_id\n self.latest_id += 1\n end", "def next_available_id\n last_id = all_ids.map do |key|\n k...
[ "0.6822227", "0.6787379", "0.6654494", "0.6616846", "0.6608423", "0.6594121", "0.6583088", "0.6534386", "0.63375986", "0.6298152", "0.6265369", "0.62585557", "0.6218582", "0.6213207", "0.62062615", "0.61847484", "0.6178633", "0.6178633", "0.6170388", "0.614789", "0.6146838", ...
0.5583029
96
get jobs list from json using client id and returning it
def get_jobs_by_client_id(client_id) jobs = [] for job in get_data("jobs") if client_id == job["client_id"] jobs.push(job) end end return jobs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end", "def get_jobs_sample(client)\n response = client['jobs'].get\n\n p ''\n...
[ "0.75944084", "0.7242146", "0.7060586", "0.7045959", "0.697496", "0.6934144", "0.687525", "0.687062", "0.68623453", "0.68386525", "0.68298477", "0.6782991", "0.66781485", "0.6672076", "0.66154945", "0.65406626", "0.64549214", "0.6443678", "0.64298946", "0.63978434", "0.639107...
0.81782615
0
GET /maps GET /maps.json
def index f = File.open(Rails.root.join("datas","map2.yml")) globalMap = Array.new f.each_line {|line| globalMap << line.split(' ')} x0 = Integer(params["x0"]) y0 = Integer(params["y0"]) width = Integer(params["width"]) height = Integer(params["height"]) x1 = x0 + width y1 = y0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @maps = Map.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maps }\n end\n end", "def show\n @map = Map.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n e...
[ "0.7427695", "0.7178213", "0.7178213", "0.70878315", "0.6988663", "0.68295646", "0.68295646", "0.68179923", "0.6803804", "0.67981774", "0.67656773", "0.67599326", "0.67171216", "0.6691221", "0.6691221", "0.6672195", "0.6645913", "0.66430634", "0.6585168", "0.65780514", "0.653...
0.0
-1
GET /maps/1 GET /maps/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @map = Map.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end", "def show\n @map = Map.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ma...
[ "0.73820543", "0.73820543", "0.7327266", "0.70087975", "0.69374716", "0.6908471", "0.68881756", "0.68755263", "0.68641496", "0.6743594", "0.66934305", "0.6665792", "0.6614371", "0.658524", "0.6571455", "0.6547247", "0.6526637", "0.6526637", "0.6526531", "0.64916086", "0.64783...
0.0
-1
POST /maps POST /maps.json
def create @map = Map.new(map_params) respond_to do |format| if @map.save format.html { redirect_to @map, notice: 'Map was successfully created.' } format.json { render action: 'show', status: :created, location: @map } else format.html { render action: 'new' } forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @map = Map.new(map_params)\n\n respond_to do |format|\n if @map.save\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n else\n format.html { redirect_to maps_url }\n format.json { render json: @map.errors, status: :unprocessable_enti...
[ "0.7212553", "0.7138659", "0.6951056", "0.6834763", "0.6787495", "0.6705789", "0.6688713", "0.66695493", "0.64213216", "0.6291679", "0.62671787", "0.626585", "0.6244168", "0.6213005", "0.617959", "0.6146989", "0.61075234", "0.60626465", "0.60482705", "0.6043759", "0.60301626"...
0.69105744
3
PATCH/PUT /maps/1 PATCH/PUT /maps/1.json
def update respond_to do |format| if @map.update(map_params) format.html { redirect_to @map, notice: 'Map was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @map.errors, status: :unprocessabl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n get_map\n\n respond_to do |format|\n if @map.update_attributes(params[:map])\n format.html { redirect_to @map, notice: 'Map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { rende...
[ "0.70746547", "0.6998199", "0.6817516", "0.67588663", "0.66274744", "0.65701574", "0.6525709", "0.6506678", "0.64493203", "0.63272375", "0.6307453", "0.6298193", "0.6294906", "0.6251651", "0.624511", "0.6242917", "0.62242275", "0.6203368", "0.6198653", "0.61868566", "0.618094...
0.68956316
2
DELETE /maps/1 DELETE /maps/1.json
def destroy @map.destroy respond_to do |format| format.html { redirect_to maps_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @map.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n get_map\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n ...
[ "0.7911548", "0.79039186", "0.78826916", "0.78655976", "0.7747663", "0.77391475", "0.7611366", "0.75712115", "0.75712115", "0.75580025", "0.7534935", "0.75003856", "0.74753237", "0.74296445", "0.7412231", "0.7392506", "0.7362247", "0.73536247", "0.732479", "0.7284501", "0.726...
0.78474283
6
Use callbacks to share common setup or constraints between actions.
def set_map @map = Map.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def map_params params[:map] 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
In production this route kicks in, and in dev we load /assets/modejson.js from the /app/assets/javascripts/modejson.js location..
def mode_json path = 'node_modules/ace-builds/src-min-noconflict/mode-json.js' file_contents = File.read(path) render js: file_contents, content_type: Mime::Type.lookup('application/javascript') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_js\n [\n src_config_path.join('routes.js').to_s,\n src_config_path.join('router.js').to_s,\n src_config_path.join('app.js').to_s\n ]\n end", "def request_debug_assets?; end", "def request_debug_assets?; end", "def ext\n respond_to do |fo...
[ "0.6038718", "0.5915775", "0.5915775", "0.5853893", "0.58435315", "0.57701534", "0.57312936", "0.56733334", "0.566905", "0.56350577", "0.55973816", "0.55973816", "0.55973816", "0.5539291", "0.55279535", "0.5499255", "0.5488297", "0.5468895", "0.54674774", "0.54142076", "0.534...
0.6993085
0
Gets a single environment.
def environment(project, id) get("/projects/#{url_encode project}/environments/#{id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_environment ()\n service_data = query_for_services()\n return service_data[\"environment\"]\n end", "def find(id)\n unless environment = ridley.environment.find(id)\n abort EnvironmentNotFound.new(id)\n end\n\n environment\n end", "def get_environment\n\n fetc...
[ "0.7837903", "0.7415855", "0.73646104", "0.71620494", "0.701538", "0.69937277", "0.695861", "0.6910788", "0.6859292", "0.6824686", "0.6776314", "0.6752937", "0.6747443", "0.67369485", "0.67336947", "0.67184985", "0.6673791", "0.6661677", "0.66139203", "0.6599444", "0.6594449"...
0.6583128
21
Delegate to the configuration objects
def method_missing(meth, *args, &blk) c.key?(meth.to_s) ? c[meth.to_s] : super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configurations; end", "def configuration; end", "def configuration; end", "def configuration; end", "def configuration; end", "def configuration; end", "def configure\n end", "def configure\n\t\t\tyield configuration\n\t\tend", "def config=(config); end", "def config; end", "def conf...
[ "0.7509297", "0.74577075", "0.74577075", "0.74577075", "0.74577075", "0.74577075", "0.7263984", "0.71717584", "0.7135995", "0.70785147", "0.70785147", "0.70785147", "0.70785147", "0.70785147", "0.70785147", "0.70785147", "0.70785147", "0.70785147", "0.70785147", "0.70785147", ...
0.0
-1
Creates a static route in EOS. May add or overwrite an existing route. ===Commands ip route [router_ip] [distance] [tag ] [name ]
def create(destination, nexthop, opts = {}) cmd = "ip route #{destination} #{nexthop}" cmd << " #{opts[:router_ip]}" if opts[:router_ip] cmd << " #{opts[:distance]}" if opts[:distance] cmd << " tag #{opts[:tag]}" if opts[:tag] cmd << " name #{opts[:name]}" if opts[:name] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aws_subnet_route_table_route_to_nat_create(opts)\n AWS::EC2.new.subnets[opts[:subnet_id]].route_table.create_route(\"0.0.0.0/0\", { instance: opts[:instance_id] } )\n end", "def route(*args)\n Route.new(self, *args)\n end", "def add_route(station, line)\n Neo4j::Transaction.run do\n rel = N...
[ "0.6502786", "0.6321983", "0.61906475", "0.6159985", "0.61007744", "0.5989231", "0.5970386", "0.59586877", "0.58476424", "0.5817613", "0.5803689", "0.57613295", "0.57404864", "0.573992", "0.57376033", "0.56921756", "0.5672304", "0.5646193", "0.5639679", "0.5638072", "0.562105...
0.7125344
0
Removes a given route from EOS. May remove multiple routes if nexthop is not specified. ===Commands no ip route [nexthop]
def delete(destination, nexthop = nil) cmd = "no ip route #{destination}" cmd << " #{nexthop}" if nexthop configure cmd end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_route(route={})\n request :delete, '/routes', route\n end", "def remove(route)\n @route_map.delete(route)\n nil\n end", "def delete_station_in_route\n if @routes.empty?\n routes_void\n else\n request = [\"Enter route name [#{@routes.keys.join(', ')}]: \"]\n ...
[ "0.733061", "0.7047446", "0.63307446", "0.63004726", "0.6192135", "0.618163", "0.6146836", "0.6108581", "0.6082754", "0.6015169", "0.5966243", "0.57931566", "0.5768936", "0.57113594", "0.5670663", "0.56609005", "0.56481063", "0.5642889", "0.5642889", "0.56135625", "0.55898654...
0.7019449
2
Validates that role exists in config file
def role_valid if (APP_CONFIG["user_roles"]+SYSTEM_DATA["user_roles"]).select{|role| role["name"] == self.role}.empty? errors.add(:role, "Role does not exist in config") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(role, _environments, cookbooks, roles) # rubocop:disable CyclomaticComplexity\n # validate the role passed in match the name of either the .rb or .json\n file = %W{roles/#{role}.rb roles/#{role}.json}.find { |f| File.exist?(f) }\n role = role.split(\"/\").last if role =~ /\\// # pull ou...
[ "0.71491146", "0.6838999", "0.66361266", "0.652407", "0.6522044", "0.6417222", "0.6404501", "0.64042354", "0.6400524", "0.6400524", "0.6331413", "0.6306299", "0.6306245", "0.62876153", "0.628089", "0.6269485", "0.62663954", "0.624251", "0.6239899", "0.6208354", "0.62056535", ...
0.8173761
0
Clear all tokens that have expired
def clear_expired_tokens access_tokens.where("token_expire < ?", Time.now).destroy_all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expire_tokens!\n update_tokens(nil)\n end", "def purge_old_tokens\n auth_tokens.desc(:last_used_at).offset(20).destroy_all\n end", "def delete_all_expired_for(time)\n expired_for(time).delete_all\n end", "def revoke!\n return if revoked?\n update(revoked_at: Time.now...
[ "0.8014729", "0.7826364", "0.72858053", "0.7003844", "0.6984809", "0.6972976", "0.6952847", "0.6942722", "0.6909779", "0.6869758", "0.6833584", "0.6825665", "0.6772656", "0.6762896", "0.6756962", "0.67244494", "0.6688539", "0.66881764", "0.6640788", "0.6582605", "0.65643376",...
0.88821876
0
Returns role hash from config file
def role_object (APP_CONFIG["user_roles"]+SYSTEM_DATA["user_roles"]).select{|role| role["name"] == self.role}.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def role_data\n APP_CONFIG['roles'].find { |role| role['name'] == self.role }\n end", "def token\n File.read(config_file)\n end", "def read\n unless File.exist?(config_file)\n raise UserError, \"Kitchen YAML file #{config_file} does not exist.\"\n end\n\n Util.symb...
[ "0.6470133", "0.5945538", "0.59347224", "0.5742012", "0.57084733", "0.5553579", "0.55347407", "0.54963243", "0.54862905", "0.5434629", "0.5419047", "0.54066336", "0.5402064", "0.53946984", "0.53723645", "0.53501713", "0.5349991", "0.5344727", "0.5328685", "0.53208214", "0.531...
0.5306723
22
Checks if users role has given right value
def has_right?(right_value) role_object["rights"].include? right_value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def role?(value)\n roles.include?(value.to_s)\n end", "def role?(role_name)\n role == role_name\n \n end", "def role?(r)\n self.role == r.to_s\n end", "def role?(role)\n self.role == role.to_s ? true : false\n end", "def has_role(r)\n self.role == r\n end", "def role?(role)\n se...
[ "0.8040441", "0.77134573", "0.7711028", "0.76543105", "0.76199436", "0.7612789", "0.76101804", "0.76101804", "0.75220317", "0.75215846", "0.7516382", "0.7504229", "0.74994576", "0.74955463", "0.7475736", "0.7469369", "0.74452645", "0.7440596", "0.74216753", "0.7417727", "0.74...
0.70434284
83
First clear all invalid tokens. Then look for our provided token. If we find one, we know it is valid, and therefor update its validity further into the future
def validate_token(provided_token, extend_expire = true) clear_expired_tokens token_object = access_tokens.find_by_token(provided_token) return false if !token_object if extend_expire token_object.update_attribute(:token_expire, Time.now + DEFAULT_TOKEN_EXPIRE) end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_valid_token(name, token)\n token = find_token(name, token)\n return unless token\n !token.expired? && token\n end", "def invalidate_token\n update_attribute(:token, nil)\n update_attribute(:token_created_at, Time.now)\n end", "def validate_tokens!\n tokens...
[ "0.6805831", "0.6804558", "0.67512935", "0.67468435", "0.66581714", "0.66581714", "0.66271526", "0.6603434", "0.6603434", "0.66029185", "0.65269786", "0.6505263", "0.64926445", "0.6206626", "0.61235684", "0.61097026", "0.6086967", "0.6067329", "0.6059277", "0.595322", "0.5948...
0.5867835
26
Authenticate user against password sources
def authenticate(provided_password, force_authenticate=false) if force_authenticate token_object = generate_token return token_object.token end auth_status = authenticate_local(provided_password) auth_status end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate!\n username_password_hash = username_password\n \n username = username_password_hash['username']\n password = username_password_hash['password']\n\n user = User.find_by_email(username)\n if user.nil? || user.password != password\n fail! :message => \"strategies.password.fail...
[ "0.7542667", "0.72435147", "0.7234556", "0.7230701", "0.7218011", "0.7214323", "0.72076756", "0.71991116", "0.7153465", "0.7032604", "0.70288247", "0.6983232", "0.6978997", "0.6938965", "0.6933271", "0.69056565", "0.6851127", "0.68439", "0.68439", "0.6822622", "0.6809123", ...
0.0
-1
Authenticate against passwords in database
def authenticate_local(provided_password) if self.password.blank? return false end pass = BCrypt::Password.new(self.password) if(pass == provided_password) token_object = generate_token return token_object.token end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end", "def authenticate password\n if self.password == password\n true\n else\n false\n end\n end", "def authenticate(user, password)\n salt = user.password_salt \n\n ...
[ "0.74291587", "0.73806864", "0.73486435", "0.7331528", "0.7313712", "0.727355", "0.7256975", "0.72473866", "0.7238763", "0.71585363", "0.7110982", "0.7086134", "0.7049169", "0.7008752", "0.6975806", "0.6969461", "0.6969461", "0.6956913", "0.6950632", "0.68854356", "0.6868332"...
0.0
-1
Generate a random token
def generate_token token_hash = SecureRandom.hex token_hash.force_encoding('utf-8') access_tokens.create(token: token_hash, token_expire: Time.now + DEFAULT_TOKEN_EXPIRE) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_token\n 32.times.map{ rand(36).to_s(36) }.join # 32 alphanumeric characters\n end", "def rand_token\n\t\ttok = rand(36**8).to_s(36)\n\t\tif tok.length < 8\n\t\t\trand_token\n\t\telse\n\t\t\ttok\n\t\tend\n\tend", "def generate_token\n UUIDTools::UUID.random_create.to_s\n ...
[ "0.848953", "0.84795976", "0.8477234", "0.845374", "0.8431042", "0.8409435", "0.83842605", "0.83466655", "0.83185303", "0.82754123", "0.8212093", "0.8150419", "0.8132802", "0.81114125", "0.80903524", "0.80601895", "0.8052892", "0.804667", "0.80160993", "0.8008536", "0.7966040...
0.7461941
71
create new FantasyStat load_tournament_list load_tournament_game_data create_leagues load_player_data
def load_fantasy_stats load_tournament_list load_tournament_game_data create_leagues load_player_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @game = Game.new(params[:game])\n\t\n #First update the players table to indicate who is playing this game\n set_player_availability(params)\n \n #Create a team to hold the home team players\n home_team = Team.new\n home_team.name = params[:home_team_name]\n home_team.save\n ...
[ "0.67178106", "0.6679277", "0.6521614", "0.6490447", "0.64522433", "0.6435048", "0.6409999", "0.6368255", "0.63620615", "0.6346649", "0.63338155", "0.63176423", "0.62978214", "0.62587976", "0.62456095", "0.62323886", "0.621037", "0.61967593", "0.6187602", "0.6168517", "0.6140...
0.758154
0
The default 'sync' method only selects among a list of registered values.
def sync unless self.class.values self.devfail "No values defined for %s" % self.class.name end # Set ourselves to whatever our should value is. self.set(self.should) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync=(arg0)\n end", "def sync=(p1)\n #This is a stub, used for indexing\n end", "def sync_list(options, force = false)\n (get_list(options, force)['ID'] rescue nil) || create_list(options)\n end", "def sync= sync_list\n cur_list = sync \n @removed_from_sync_list = cur_list[:with] -...
[ "0.5767916", "0.56994826", "0.5566776", "0.5537269", "0.55282736", "0.55224544", "0.5499396", "0.5482373", "0.54822874", "0.54822874", "0.54822874", "0.5458811", "0.5404174", "0.53347", "0.5268865", "0.5262589", "0.52565765", "0.51960444", "0.51954657", "0.51954657", "0.51721...
0.53846395
13
==== Insert 'presenter'like methods below if necessary
def delete_user user user.deleted? ? @view.restore_user_link(user, 'data-turbolinks'=> false) : @view.delete_link(user, 'data-turbolinks'=> false) if user.deleted? @view.restore_user_link(user, 'data-turbolinks' => false) else "<i class='far fa-lg fa-trash-alt cursor-pointer' id='kt_swe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def presenter\n self\n end", "def show_presenter\n TextPresenter\n end", "def presenters\n raise NotImplementedError\n end", "def implementation; end", "def implementation; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def metho...
[ "0.73215747", "0.64770687", "0.6407835", "0.62353384", "0.62353384", "0.6227446", "0.6227446", "0.6227446", "0.6227446", "0.6208145", "0.6196868", "0.61720157", "0.60887784", "0.6047495", "0.60456544", "0.5983047", "0.597256", "0.597256", "0.5960645", "0.59560406", "0.5932622...
0.0
-1
Directly create pieces and add them to the pieces collection.
def initialize_board # Non-pawns for black player: Rook.create(x_position: 1, y_position: 1, game_id: id, color: "black", player_id: black_player_id) Knight.create(x_position: 2, y_position: 1, game_id: id, color: "black", player_id: black_player_id) Bishop.create(x_position: 3, y_position: 1, game_id: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_pieces(color)\n 8.times { @pieces << Pawn.new(color) }\n 2.times do\n @pieces << Rook.new(color)\n @pieces << Bishop.new(color)\n @pieces << Knight.new(color)\n end\n @pieces << Queen.new(color)\n @pieces << King.new(color)\n end", "def create_piece\n @in_play = @curr...
[ "0.7112517", "0.7023218", "0.693004", "0.6795472", "0.66683185", "0.6631119", "0.65143687", "0.6312446", "0.6307387", "0.62863356", "0.62477255", "0.6214159", "0.6166898", "0.6122845", "0.6111234", "0.6048086", "0.6046464", "0.58704525", "0.5864113", "0.5790549", "0.5783542",...
0.0
-1
A pull request has been closed
def process_closed_pull_request(pull_request) pr_name = pull_request['base']['repo']['full_name'].to_s pr_number = pull_request['number'].to_s pr_key = pr_name + ":" + pr_number current_commit_hash = pull_request['head']['sha'].to_s # Delete the PR from the redis store @redis.del(pr_key) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_closed_pull_request(pull_request)\n pr_name = pull_request['base']['repo']['full_name'].to_s\n pr_number = pull_request['number'].to_s\n current_commit_hash = pull_request['head']['sha'].to_s\n\n # Delete the PR from the redis store\n @redis.del(pr_name + \":\" + pr_number)\n return 2...
[ "0.7414636", "0.7151129", "0.68429697", "0.66125697", "0.6273422", "0.6244567", "0.62148625", "0.60994726", "0.6068718", "0.60340863", "0.60178643", "0.5998116", "0.5937435", "0.5903284", "0.58645415", "0.58507925", "0.58493114", "0.58197975", "0.5797524", "0.57844937", "0.57...
0.74483526
0
An issue comment has been reported
def process_created_issue_comment(issue_comment_payload) pr_name = issue_comment_payload['repository']['full_name'].to_s pr_number = issue_comment_payload['issue']['number'].to_s comment_user = issue_comment_payload['comment']['user']['id'].to_s approvals = parse_comment_body(issue_comment_payload['comm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_comment_to_issue(issue, author)\n comment= RemoteComment.new(\"#{Time.now} , #{author} make a commit on this issue\")\n @tracker.addComment(issue.key,comment)\n end", "def comment\n @comment ||= client.issue_comments(repository, pr_id).detect do |comment|\n UrlSectionBuilder.match?...
[ "0.70737815", "0.69501215", "0.68452954", "0.6840894", "0.68098", "0.6767442", "0.67499447", "0.66790026", "0.66107583", "0.6589401", "0.6564454", "0.6521666", "0.6515517", "0.64913505", "0.64690477", "0.6453413", "0.64386034", "0.64009255", "0.6387006", "0.6346783", "0.63445...
0.6461348
15
A PR review has been reported
def process_created_review(review_payload) pr_name = review_payload['repository']['full_name'].to_s pr_number = review_payload['pull_request']['number'].to_s comment_user = review_payload['review']['user']['id'].to_s approvals = evaluate_review_state(review_payload['review']['state']) current_commit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply(pr, pull_request_hash)\n if !previously_applied?(pr) && matches?(pull_request_hash)\n add_reviewer(pr)\n end\n end", "def review\n end", "def review; end", "def develop_pr_check\n\n result = CheckResult.new(\"Develop PR Check Result\")\n\n ## PR should be sent from a branch that ...
[ "0.66692436", "0.66381574", "0.6536634", "0.65272343", "0.63813394", "0.6380718", "0.6373571", "0.6368497", "0.6365946", "0.6359939", "0.6359239", "0.63352484", "0.62968254", "0.62817", "0.62776655", "0.626592", "0.6251442", "0.6240455", "0.6236603", "0.6208171", "0.61667466"...
0.69937253
0
Evaluates and submits a status for the commodus review
def submit_status(pr_name, pr_number, current_commit_hash, comment_user, approvals) pr_key = pr_name + ":" + pr_number # Grab the stored payload stored_payload_value = @redis.hget(pr_key, current_commit_hash) # Ensure that a key actually exists if !stored_payload_value.nil? stored_payload = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluation\n @api_v1_reservation.evaluate(evaluation_params[:comment], evaluation_params[:rating].to_i) unless @api_v1_reservation.evaluation\n render json: { success: true }, status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end", "def process_created...
[ "0.6502814", "0.64420223", "0.6370287", "0.6361855", "0.63438636", "0.62839556", "0.6064108", "0.59603673", "0.5960339", "0.5909844", "0.5909808", "0.5893468", "0.58838636", "0.5882186", "0.5855061", "0.5848491", "0.58448297", "0.5834676", "0.5825427", "0.58159834", "0.579943...
0.6651151
0
Evaluates the PR review state
def evaluate_review_state(state) net_pluses = 0 if state == "approved" net_pluses = 1 elsif state == "changes_requested" net_pluses = -1 end return net_pluses end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reviewed?\n @status == :reviewed\n end", "def check_plagiarism_state(auto_metareview, count_copies, rev_array, scores)\n if count_copies > 0 #resetting review_array only when plagiarism was found\n auto_metareview.review_array = rev_array\n\n\n if count_copies == scores.length\n return AL...
[ "0.65369254", "0.6394565", "0.6209691", "0.6142017", "0.61167043", "0.6020812", "0.60189486", "0.59366703", "0.59245205", "0.58845884", "0.5877376", "0.5865738", "0.58540964", "0.5825794", "0.5823771", "0.5814638", "0.5794821", "0.5783649", "0.575532", "0.571283", "0.57127154...
0.7546724
0