query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
builds up coordinates to interpolate between two coord pairs, based on which axis changed and whether we should subtract or add to move from point 1 to point 2
def build_replacement_coords(coords1, coords2, changed_sym) point_one = coords1[changed_sym] point_two = coords2[changed_sym] greater_than = point_one > point_two new_values = if greater_than point_one.downto(point_two + 1).to_a else point_one.upto(point_two - 1).to_a ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lerp(x1, y1, x2, y2, x)\n return y1 + (x - x1) * ((y2 - y1) / (x2 - x1))\nend", "def interpolate stroke\n current = stroke.first\n new_stroke = [current]\n\n index = 1\n last_index = 0\n while index < stroke.length do\n point = stroke[index]\n\n #only consider point ...
[ "0.6394441", "0.62365985", "0.59970653", "0.57060343", "0.56742424", "0.56585735", "0.5613269", "0.5606583", "0.55712", "0.5542732", "0.5483703", "0.5412795", "0.5402706", "0.53994566", "0.5382542", "0.53468186", "0.53425556", "0.5334001", "0.53278226", "0.53011405", "0.52930...
0.6730998
0
This helps us reference all unique references by collection e.g. all VM targets
def references(collection) target.manager_refs_by_association&.dig(collection, :ems_ref)&.to_a&.compact || [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def references(collection)\n target.try(:references, collection) || []\n end", "def name_references(collection)\n target.try(:name_references, collection) || []\n end", "def references; end", "def references; end", "def references(collection)\n manager_refs_by_association.try(:[], coll...
[ "0.73237604", "0.6841899", "0.6772536", "0.6772536", "0.6760671", "0.6349265", "0.6312122", "0.62698424", "0.62692195", "0.6266564", "0.61625355", "0.61625355", "0.60551155", "0.60545015", "0.604809", "0.60089916", "0.5984876", "0.5913685", "0.5897947", "0.5878525", "0.587640...
0.71261626
1
The path to the current ruby interpreter. Adapted from Rake's FileUtils.
def ruby_path ext = ((RbConfig::CONFIG['ruby_install_name'] =~ /\.(com|cmd|exe|bat|rb|sh)$/) ? "" : RbConfig::CONFIG['EXEEXT']) File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'] + ext).sub(/.*\s.*/m, '"\&"') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby_interpreter_path\n Pathname.new(\n File.join(Config::CONFIG[\"bindir\"],\n Config::CONFIG[\"RUBY_INSTALL_NAME\"]+Config::CONFIG[\"EXEEXT\"])\n ).realpath\n end", "def ruby_path\r\n File.join janus_path, 'ruby'\r\n end", "def g...
[ "0.78348446", "0.6657744", "0.65563154", "0.6524134", "0.64435935", "0.6430483", "0.6418614", "0.6390923", "0.63816", "0.63672125", "0.6362747", "0.63023263", "0.6271103", "0.62705463", "0.6263798", "0.62570107", "0.62274843", "0.6192331", "0.6184631", "0.61580527", "0.615805...
0.698191
1
Complete the matchingStrings function below.
def matchingStrings(strings, queries) counting_hash = {} counting_hash.default = 0 # For Cache strings.each do |s| counting_hash[s] ? counting_hash[s] += 1 : counting_hash[s] = 1 end res = [] queries.each do |q| res << counting_hash[q] end res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_strings(matched_lines)\n matched_strings = []\n\n matched_lines.each do |line|\n check_patterns.each do |pattern|\n line.scan(pattern).each do |matched|\n matched_strings += matched\n end\n end\n end\n\n return matched_strings\n end", "d...
[ "0.67352813", "0.67103964", "0.6667851", "0.65556383", "0.6410246", "0.63663805", "0.6356838", "0.6344567", "0.6343699", "0.6270859", "0.62588984", "0.62501204", "0.62209517", "0.6203152", "0.61696494", "0.6145451", "0.61334294", "0.6121198", "0.6109607", "0.6103552", "0.6098...
0.680719
0
A numeric score for the result increasing by the number of terms in the result that match terms in the search
def relevance_score(result) @term_keys.find_all { |key| result.title =~ /\b#{Regexp.quote(key)}\b/i }.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_relevance(result, count)\n result_string, score = result\n exact_match = 0\n exact_match = 100_000 if result_string =~ search_regex\n exact_match + (count * 100) + Math.log(score.to_i)\n end", "def match(search)\n search_words = words(search)\n haystack_words = words(hayst...
[ "0.7690968", "0.73570377", "0.72660667", "0.722035", "0.7083337", "0.70749533", "0.7015532", "0.7005711", "0.6981445", "0.6966298", "0.69461256", "0.693133", "0.68602955", "0.6814524", "0.6804345", "0.6770098", "0.6767439", "0.67461556", "0.67164975", "0.6709123", "0.66916996...
0.750584
1
GET /range_types GET /range_types.json
def index @range_types = RangeType.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema_range_type(db_type)\n :range\n end", "def set_range_type\n @range_type = RangeType.find(params[:id])\n end", "def range_type_params\n params.require(:range_type).permit(:name, :description)\n end", "def create_range_data( rng, minrng=0, type=0, direction=2 )\n return...
[ "0.6910227", "0.65247434", "0.633836", "0.5942356", "0.59230435", "0.5844601", "0.5826053", "0.580808", "0.5760518", "0.5738374", "0.5722325", "0.570473", "0.56332505", "0.55493104", "0.55460465", "0.5528226", "0.55187535", "0.5498575", "0.549653", "0.54770696", "0.5474432", ...
0.77056473
0
POST /range_types POST /range_types.json
def create @range_type = RangeType.new(range_type_params) respond_to do |format| if @range_type.save format.html { redirect_to @range_type, notice: 'Range type was successfully created.' } format.json { render :show, status: :created, location: @range_type } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def range_type_params\n params.require(:range_type).permit(:name, :description)\n end", "def set_range_type\n @range_type = RangeType.find(params[:id])\n end", "def index\n @range_types = RangeType.all\n end", "def schema_range_type(db_type)\n :range\n end", "def update\n ...
[ "0.72083634", "0.66499317", "0.6637968", "0.6200566", "0.59384835", "0.5699741", "0.5681202", "0.56561345", "0.56114733", "0.55582255", "0.54988724", "0.5482133", "0.54004824", "0.5392447", "0.5368214", "0.5348899", "0.53270024", "0.53085744", "0.5275576", "0.527013", "0.5244...
0.71564907
1
PATCH/PUT /range_types/1 PATCH/PUT /range_types/1.json
def update respond_to do |format| if @range_type.update(range_type_params) format.html { redirect_to @range_type, notice: 'Range type was successfully updated.' } format.json { render :show, status: :ok, location: @range_type } else format.html { render :edit } format.jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_range_type\n @range_type = RangeType.find(params[:id])\n end", "def range_type_params\n params.require(:range_type).permit(:name, :description)\n end", "def update\n @range_specification = RangeSpecification.find(params[:id])\n\n respond_to do |format|\n if @range_specificati...
[ "0.6729508", "0.634386", "0.60597175", "0.6035519", "0.60247993", "0.5847654", "0.58002967", "0.57722676", "0.57665735", "0.5685583", "0.5668331", "0.5661962", "0.5658185", "0.5624353", "0.55753565", "0.5566175", "0.55358", "0.5534198", "0.55278134", "0.5526518", "0.55249465"...
0.74981564
0
DELETE /range_types/1 DELETE /range_types/1.json
def destroy @range_type.destroy respond_to do |format| format.html { redirect_to range_types_url, notice: 'Range type was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @range_specification = RangeSpecification.find(params[:id])\n @range_specification.destroy\n\n respond_to do |format|\n format.html { redirect_to(range_specifications_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rrange.destroy\n respond_to do |format|...
[ "0.6638823", "0.65278983", "0.6519509", "0.64952606", "0.64805067", "0.6477781", "0.6457517", "0.64427745", "0.64364284", "0.6409464", "0.64032245", "0.63863593", "0.63465255", "0.63251895", "0.63134134", "0.63065094", "0.6295574", "0.62885934", "0.6281656", "0.6276903", "0.6...
0.779775
0
Returns all the combinations of the word with one character removed. Example: deletions("word") => ["ord", "wrd", "wod", "wor"]
def deletions new_words = [] @words.each do |word| @word = word || '' new_words += (0..length).map { |i| "#{@word[0...i]}#{@word[i+1..-1]}" } end new_words end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deletions word\n n = word.length\n deletion = (0...n).collect {|i| word[0...i]+word[i+1..-1] }\n end", "def deletion\n (0...length).map { |i|\n string.dup.tap { |str| str[i] = \"\" }\n }.uniq\n end", "def custom_delete(string, dels)\n new = ''\n string.each_char { |c| new << c unless d...
[ "0.7490376", "0.619651", "0.60171515", "0.5990503", "0.5848276", "0.57351094", "0.5698404", "0.56940633", "0.5631374", "0.56178415", "0.56170607", "0.5608425", "0.5603442", "0.56017447", "0.5586035", "0.55252427", "0.5476506", "0.5419113", "0.5369865", "0.5363532", "0.5363399...
0.7776573
0
Returns all combinations of the word with adjacent words transposed. Example: transpositions("word") => ["owrd", "wrod", "wodr"]
def transpositions new_words = [] @words.each do |word| @word = word || '' new_words += (0..length-1).map { |i| "#{@word[0...i]}#{@word[i+1, 1]}#{@word[i,1]}#{@word[i+2..-1]}" } end new_words end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transpositions word\n n = word.length\n (0...n-1).collect {|i| word[0...i]+word[i+1,1]+word[i,1]+word[i+2..-1] }\n end", "def transposition\n (0...length-1).map { |i|\n string[0...i] +\n string[i+1, 1] +\n string[i,1] +\n string[i+2..-1]\n }.uniq\n end", "def word_combos(w...
[ "0.8267741", "0.7397717", "0.6632626", "0.6508019", "0.61694956", "0.61275923", "0.61016613", "0.6075012", "0.6048928", "0.599702", "0.59396076", "0.5878923", "0.5876813", "0.5856411", "0.5843049", "0.5809472", "0.57698923", "0.57686734", "0.57664835", "0.56898916", "0.568352...
0.78448904
1
Returns all variations of the word with each character replaced by all characters from 'a' to 'z'. Example: replacements("word") => ["aord", "bord", "cord", ... "ward", "wbrd" ...]
def replacements new_words = [] @words.each do |word| @word = word || '' length.times do |i| ('a'..'z').each { |c| new_words << "#{@word[0...i]}#{c}#{@word[i+1..-1]}" } end end new_words end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replacements word\n n = word.length\n new_words = []\n n.times {|i| ('a'..'z').each {|l| new_words << word[0...i]+l.chr+word[i+1..-1] } }\n new_words\n end", "def apply_replacements(word)\n @replacements.each do |pattern, target|\n word.gsub!(pattern, target)\n end\n \n word\n ...
[ "0.7423698", "0.6480573", "0.6356044", "0.604883", "0.5664484", "0.5593338", "0.5590618", "0.5556752", "0.5411977", "0.5401827", "0.53972244", "0.53919774", "0.53823835", "0.53780484", "0.53479666", "0.5343286", "0.53395075", "0.53225756", "0.53225756", "0.53219646", "0.52969...
0.7883035
0
Returns all variations of the word with an alphabet inserted between the characters. Example: insertions("word") => ["aword", "bword", "cword" ... "waord", "wbord" ... ]
def insertions new_words = [] @words.each do |word| @word = word || '' (length + 1).times do |i| ('a'..'z').each { |c| new_words << "#{@word[0...i]}#{c}#{@word[i..-1]}" } end end new_words end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertions word\n n = word.length\n new_words = []\n (n+1).times {|i| ('a'..'z').each {|l| new_words << word[0...i]+l.chr+word[i..-1] } }\n new_words\n end", "def insertion\n return [] if string.empty?\n (0..length).flat_map { |i|\n LETTERS.map { |letter|\n string[0...i] + lett...
[ "0.755778", "0.6944533", "0.67156076", "0.62503517", "0.6208298", "0.6174087", "0.60542214", "0.5999374", "0.5925905", "0.58746487", "0.5863773", "0.58560246", "0.5843401", "0.5818282", "0.58039254", "0.57870734", "0.57762617", "0.5768799", "0.5749283", "0.57256037", "0.57146...
0.78312457
0
Indicate a method to call before every wrapped method.
def before_method(method) @@before_methods << method @@wrap_exclusions << method.to_sym # This method will not be wrapped. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before(klass, meth_name, &block)\n intercept(klass, meth_name, :before, &block)\n end", "def before(method_to_hook, method_to_call = nil, options = {}, &block)\n add(:before, method_to_hook, method_to_call, options, &block)\n end", "def _hook_before_method(method, hook, opts = {})\n return...
[ "0.75851417", "0.7422467", "0.73281455", "0.7302582", "0.71154374", "0.70430243", "0.7022979", "0.70028275", "0.6848234", "0.68225724", "0.67861617", "0.66953087", "0.6605023", "0.65922606", "0.65420854", "0.6508723", "0.64814585", "0.647363", "0.6449019", "0.6447024", "0.642...
0.78987837
0
Indicate a method to call after every wrapped method.
def after_method(method) @@after_methods << method @@wrap_exclusions << method.to_sym # This method will not be wrapped. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after(klass, meth_name, &block)\n intercept(klass, meth_name, :after, &block)\n end", "def after(method_to_hook, method_to_call = nil, options = {}, &block)\n add(:after, method_to_hook, method_to_call, options, &block)\n end", "def after_execution(method_name)\n end", "def execute_after(met...
[ "0.76455575", "0.72074723", "0.7029664", "0.70138705", "0.7010981", "0.69445443", "0.6797584", "0.6756058", "0.67309827", "0.6554367", "0.63724095", "0.6347634", "0.6299492", "0.62988937", "0.62954044", "0.62738323", "0.6255562", "0.62202346", "0.62186265", "0.62129927", "0.6...
0.77659214
0
Indicate if its time to call the +after+ callbacks. It is only allowed when its the original method that was called that has finished. When one of the wrapped method called another wrapped method, it will not call after callbacks only after the original method is finished, not when the second method is called from with...
def time_to_call_after_methods? @@inside_methods == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after?\n !after.nil?\n end", "def after(&proc)\n @after = proc if proc\n @after\n end", "def after?\n !!@after\n end", "def after?\n !!@after\n end", "def after(&after)\n @after = after\n end", "def after_method(method)\n @@after_methods << method\n ...
[ "0.68544847", "0.67481107", "0.6674918", "0.6674918", "0.6653447", "0.66073346", "0.6577739", "0.64542794", "0.64451236", "0.64451236", "0.64451236", "0.64451236", "0.6443606", "0.6394913", "0.63627535", "0.63627535", "0.63478035", "0.63234144", "0.61995816", "0.61462855", "0...
0.6768024
1
Indicate if its time to call the +before+ callbacks. It is only allowed when no other wrapped methods has been called and is still running. This is to prevent the before method to be called more than once and ont wrapped method calls another.
def time_to_call_before_methods? @@inside_methods == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before?\n !before.nil?\n end", "def before_hook\n return unless before\n\n Logger.info \"Before Hook Starting...\"\n before.call\n Logger.info \"Before Hook Finished.\"\n rescue Exception => err\n @before_hook_failed = true\n ex = err.is_a?(StandardError) ? Error : Fa...
[ "0.70092964", "0.6988587", "0.6675059", "0.6656847", "0.6577563", "0.6530583", "0.65213275", "0.6479496", "0.6464372", "0.6420498", "0.64171666", "0.6403313", "0.6347615", "0.6328193", "0.6205359", "0.6192835", "0.61861324", "0.615461", "0.61120874", "0.61041975", "0.61011106...
0.73433286
0
Indicate we are leaving the wrapped method.
def leaving_wrap_method @@inside_methods -= 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leave()\n raise NotImplementedError\n end", "def leave; end", "def end_hook name\n # this should be implemented in sub-classes\n end", "def on_leave\n fire_handler :LEAVE, self\n end", "def leave!\n @interact=false\n end", "def leave!\n @interact=false\n end", "def e...
[ "0.6817476", "0.6810174", "0.6699362", "0.62659574", "0.6183705", "0.6183705", "0.6106557", "0.6064191", "0.59343714", "0.5877013", "0.5861653", "0.5854121", "0.58291006", "0.57965887", "0.57942796", "0.5775454", "0.573937", "0.5709731", "0.56679904", "0.56617767", "0.5660555...
0.75844014
0
Returns the list of the methods to call before the wrapped methods.
def before_methods @@before_methods end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_method(method)\n @@before_methods << method\n @@wrap_exclusions << method.to_sym # This method will not be wrapped.\n end", "def __run_before_wrappers(wrappers, method_name, args, high_arity = false)\n wrappers.each do |wrapper|\n next unless wrapper.respond_to?(method_name)\n...
[ "0.7001088", "0.68210953", "0.65511084", "0.6429368", "0.6301703", "0.6252101", "0.61129713", "0.6008861", "0.6000773", "0.5949266", "0.59446865", "0.59220135", "0.5920109", "0.5920109", "0.5905979", "0.5881529", "0.5843323", "0.5807646", "0.5802209", "0.57598525", "0.5752303...
0.720387
0
Returns the list of the methods to call after the wrapped methods.
def after_methods @@after_methods end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_method(method)\n @@after_methods << method\n @@wrap_exclusions << method.to_sym # This method will not be wrapped.\n end", "def after(*method_symbols, &block)\n options = method_symbols[-1].kind_of?(Hash) ? method_symbols.pop : {}\n method_symbols.each do |method_sym|\n __...
[ "0.68049437", "0.6745703", "0.66950786", "0.66797984", "0.6374064", "0.62823516", "0.6251791", "0.6250482", "0.6250482", "0.6218281", "0.6218281", "0.6136477", "0.6129155", "0.60673314", "0.60307235", "0.5977514", "0.59546447", "0.5951336", "0.59466136", "0.5940573", "0.59106...
0.73485774
0
image submit element tag for form within a definition item ex. f.submit_button 'some_image.png'
def image_submit_button(image_file, options={}) @renderer.image_submit_tag(image_file, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_submit(img_path, options = {})\n @template.image_submit_tag(img_path, options)\n end", "def image_submit(img_path, options = {})\n @template.image_submit_tag(img_path, options)\n end", "def image_submit_tag(image_file, options={})\n options[:class] = append_class_name(options[:class]...
[ "0.77163404", "0.75930583", "0.7225556", "0.6955263", "0.68115336", "0.6597908", "0.65966034", "0.6549421", "0.6453396", "0.64414954", "0.6377844", "0.62665504", "0.6255275", "0.6193432", "0.6158716", "0.61385804", "0.6127072", "0.6112672", "0.6071264", "0.60656005", "0.60415...
0.7960764
0
constructs a date selector specifically for birthdays. The day, month, year fields are the attributes for the user mapping to those individual values options => :day (String), :month (String), :year (String), :start_year (Integer), :include_blank (Boolean) ex: f.simple_date_select "Birthday", :month => 'birth_month', :...
def simple_date_select(caption, options) month_value, day_value, year_value = object.send(options[:month]), object.send(options[:day]), object.send(options[:year]) end_year = Time.now.year - 10 html = @template.content_tag("dt", "#{caption}:") html << @template.content_tag("dd") do @tem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_select_old_html (attrs, obj = nil, col = nil)\n date = attrs[:date]\n nullable = attrs[:nullable]\n day_attrs = attrs.merge(\n :name => attrs[:name] + '[day]',\n :id => attrs[:id] + '_day',\n :selected => (date ? date.day.to_s : ''),\n :class ...
[ "0.70325685", "0.6427654", "0.6352592", "0.6235106", "0.61884195", "0.6164175", "0.6146243", "0.61413044", "0.6121693", "0.60182154", "0.59702826", "0.5961932", "0.5947423", "0.5946745", "0.57491976", "0.5738164", "0.5722743", "0.56952405", "0.5666005", "0.5634377", "0.561331...
0.70218813
1
Generate messages This extracts all the information of the battle result and push it in the messages list as phrases
def generate_messages i = 0 # Win phrase if Wep::Things_to_show.include? :win_phrase if Wep::Battle_wins_phrases[$game_temp.battle_troop_id] != nil @messages.push Wep::Battle_wins_phrases[$game_temp.battle_troop_id] else @messages.push Wep::Battle_win_default_phrase end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_msg\n msgs = []\n results.each { |re| msgs.push(re[:msg]) unless re[:passed]}\n msgs\n end", "def message_results\n @message_results\n end", "def m2_message\n [\n \"Super fedt at du gerne vil hjælpe os, med at planlægge Spejdernes Lejr 2017!\",\n \"...
[ "0.65939623", "0.6310258", "0.6228498", "0.60753804", "0.60600543", "0.59961516", "0.5926553", "0.58924925", "0.58826405", "0.58809817", "0.58808106", "0.58790207", "0.5859714", "0.585606", "0.5821039", "0.5820933", "0.58174145", "0.58127695", "0.5762354", "0.57516575", "0.57...
0.7351251
0
Start After Battle Phase moded to extract initial levels and call battle result
def start_phase5 # Obtain extra info for battle result object initial_levels = [] for ac in $game_party.actors initial_levels.push (ac.level) end # Shift to phase 5 @phase = 5 # Play battle end ME $game_system.me_play($game_system.battle_end_me) # Return to BGM before battle st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_phase5\r\n # Shift to phase 5\r\n @phase = 5\r\n # Play battle end ME\r\n $game_system.me_play($game_system.battle_end_me)\r\n # Return to BGM before battle started\r\n $game_system.bgm_play($game_temp.map_bgm)\r\n # Initialize EXP, amount of gold, and treasure\r\n exp = 0\r\n ...
[ "0.6479211", "0.6470125", "0.63796186", "0.6359165", "0.6202059", "0.6166204", "0.6138462", "0.6088859", "0.6065054", "0.6050809", "0.6048328", "0.5982012", "0.59757775", "0.5935659", "0.5852231", "0.5821629", "0.5807853", "0.57752", "0.57726574", "0.5761231", "0.57074636", ...
0.6731829
0
friendly duration to convert duration of song in min and sec
def friendly_duration min = @duration / 60 utes = 60 * min sec = @duration - utes return "#{min} Minutes and #{sec} seconds" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duration\n (Time.mktime(0)+(tracks.map(&:duration).inject(:+) || 0)).strftime(\"%H:%M:%S\")\n end", "def duration\n duration = @file_metadata.duration.to_s\n\n # in format like: 0:02:43 (approx)\n if duration.match /(\\d{1,2}):(\\d{1,2}):(\\d{1,2})/\n hours = $1.strip.to_i\n ...
[ "0.7227589", "0.7099541", "0.70520407", "0.70438933", "0.70329434", "0.7001562", "0.7001562", "0.69681567", "0.6905934", "0.6903248", "0.6896035", "0.68781215", "0.6825291", "0.67613137", "0.6745352", "0.6715814", "0.67030704", "0.66356707", "0.662068", "0.65924704", "0.65835...
0.80674934
0
Draws a starlike shape with number 'points' of points. 'points' must be odd.
def star (points, length) raise "The star must have an odd number of points" if points % 2 == 0 points.times do line length turn (720.0/points).degrees end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_star(radius)\n points = 5\n triangle_base = radius * Math.tan(Math::PI / points)\n triangle = [\n [0, radius],\n [triangle_base / 2, 0],\n [-triangle_base / 2, 0],\n [0, radius]\n ]\n\n result = []\n (0...points).each do |i|\n result[i] = rotate(triangle, i * (2 * Math::PI / p...
[ "0.68941706", "0.6551152", "0.63893414", "0.61078346", "0.60396767", "0.5977498", "0.59042567", "0.58733684", "0.5848147", "0.5779336", "0.5763726", "0.57607996", "0.5754366", "0.5734119", "0.5682888", "0.5666833", "0.5654966", "0.5626548", "0.5623242", "0.5614572", "0.561211...
0.7765214
0
Draws a regular polygon with 'sides' sides, each of length 'length'
def polygon (sides, length) sides.times do line length turn (360.0/sides).degrees end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def polygon_vertices(sides, size)\n vertices = []\n sides.times do |i|\n angle = -2 * Math::PI * i / sides\n vertices << radians_to_vec2(angle) * size\n end\n return vertices\n end", "def polygon_vertices(sides, size)\n vertices = []\n sides.times do |i|\n angle = -2 ...
[ "0.66100395", "0.65690696", "0.6386554", "0.6319001", "0.62370664", "0.6221848", "0.6141547", "0.5912548", "0.58563143", "0.5826391", "0.57798064", "0.56751436", "0.5618167", "0.56066185", "0.55701274", "0.5523796", "0.5469449", "0.5460434", "0.5456068", "0.54495764", "0.5436...
0.86559826
0
GET /call_histories/new GET /call_histories/new.json
def new @call_history = CallHistory.new respond_to do |format| format.html # new.html.erb format.json { render :json => @call_history } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @cocktail_history = CocktailHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cocktail_history }\n end\n end", "def new\n @operation_history = OperationHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n ...
[ "0.73561865", "0.7318957", "0.73150706", "0.72860867", "0.72328544", "0.7204265", "0.712156", "0.7100087", "0.70813495", "0.704776", "0.704776", "0.70431113", "0.6955238", "0.69174516", "0.68752", "0.68663263", "0.68354696", "0.6783719", "0.6766438", "0.67616564", "0.67515236...
0.7945566
0
POST /call_histories POST /call_histories.json
def create @call_history = CallHistory.new(params[:call_history]) respond_to do |format| if @call_history.save format.html { redirect_to(@call_history, :notice => 'Call history was successfully created.') } format.json { render :json => @call_history, :status => :created, :location => @c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n megam_rest.post_billedhistories(to_hash)\n end", "def create\n @call_history = CallHistory.new(call_history_params)\n\n respond_to do |format|\n if @call_history.save\n format.html { redirect_to @call_history, notice: 'Call history was successfully created.' }\n form...
[ "0.6913032", "0.68269676", "0.65884405", "0.6504495", "0.62446177", "0.6155739", "0.6145603", "0.6055951", "0.6036452", "0.6005945", "0.6004015", "0.5976509", "0.59706104", "0.5963356", "0.5925099", "0.59073436", "0.5869398", "0.586792", "0.586792", "0.58383095", "0.58157104"...
0.6866001
1
PUT /call_histories/1 PUT /call_histories/1.json
def update @call_history = CallHistory.find(params[:id]) respond_to do |format| if @call_history.update_attributes(params[:call_history]) format.html { redirect_to(@call_history, :notice => 'Call history was successfully updated.') } format.json { head :ok } else format.htm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @call_history.update(call_history_params)\n format.html { redirect_to @call_history, notice: 'Call history was successfully updated.' }\n format.json { render :show, status: :ok, location: @call_history }\n else\n format.html { render :edit...
[ "0.67747474", "0.6175938", "0.6175938", "0.60669214", "0.603132", "0.60191584", "0.58745474", "0.5856504", "0.5852422", "0.5807749", "0.5779311", "0.57534075", "0.5723495", "0.56670433", "0.566321", "0.5640793", "0.56088865", "0.5605495", "0.55925053", "0.55913585", "0.558809...
0.67264265
1
DELETE /call_histories/1 DELETE /call_histories/1.json
def destroy @call_history = CallHistory.find(params[:id]) @call_history.destroy respond_to do |format| format.html { redirect_to(call_histories_url) } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @call_history.destroy\n respond_to do |format|\n format.html { redirect_to call_histories_url, notice: 'Call history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @calllog.destroy\n respond_to do |format|\n format.html ...
[ "0.75089866", "0.71301395", "0.70385665", "0.70287645", "0.692862", "0.69078153", "0.6886769", "0.6863259", "0.68320537", "0.6798473", "0.6761191", "0.67441875", "0.67441875", "0.67441875", "0.67212963", "0.6694847", "0.6682744", "0.6682744", "0.66731834", "0.6657334", "0.664...
0.76666313
0
Recurisvely scan `database_dir` for blast databases.
def scan_databases_dir database_dir = config[:database_dir] list = %x|blastdbcmd -recursive -list #{database_dir} -list_outfmt "%f %t %p %n %l %d" 2>&1| list.each_line do |line| name = line.split(' ')[0] next if multipart_database_name?(name) self << Database.new(*l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkpoints\n db_pattern = \"#{sql_connection.escape(@db_backup)}\".gsub(\"_\", \"\\\\_\").gsub(\"%\", \"\\\\%\")\n # TODO: this should be quoted properly.\n result = sql_connection.execute(\"SHOW DATABASES LIKE '#{db_pattern}\\\\_%'\")\n prefix_length = @db_backup.length+1\n sql_conne...
[ "0.6015338", "0.58854556", "0.58433646", "0.5831027", "0.5795348", "0.5715606", "0.56379694", "0.56295365", "0.55671465", "0.55611074", "0.5555896", "0.55507284", "0.54095995", "0.5355876", "0.5353444", "0.53380674", "0.5321399", "0.5237198", "0.52360785", "0.5203658", "0.520...
0.8481656
0
Returns an Array of FASTA files that may require formatting, and the type of sequence contained in each FASTA. > unformatted_fastas => [['/foo/bar.fasta', :nulceotide], ...]
def unformatted_fastas list = [] database_dir = config[:database_dir] Find.find database_dir do |file| next if File.directory?(file) next if Database.include? file if probably_fasta? file sequence_type = guess_sequence_type_in_fasta file if [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_unaligned_sequences \n answer = Array.new \n self.genomic_aligns.each do |piece| \n sequence = piece.get_slice.seq\n fas = Bio::FastaFormat.new(Bio::Sequence::NA.new(sequence).to_fasta(piece.genomic_align_id))\n answer.push(fas) \n ...
[ "0.6252254", "0.54724836", "0.5404817", "0.52945566", "0.522857", "0.5174626", "0.5082098", "0.5048087", "0.5043778", "0.503153", "0.4991992", "0.49853578", "0.49750364", "0.49178025", "0.4912758", "0.49042833", "0.49032786", "0.48832196", "0.48717454", "0.4862315", "0.484077...
0.8027302
0
Create BLAST database, given FASTA file and sequence type in FASTA file.
def make_blast_database(file, type) puts "FASTA file: #{file}" puts "FASTA type: #{type}" print "Proceed? [y/n] (Default: y): " response = STDIN.gets.to_s.strip unless response.match(/n/i) default_title = make_db_title(File.basename(file)) print "Enter a dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_blast_databases\n unformatted_fastas.each do |file, sequence_type|\n make_blast_database(file, sequence_type)\n end\n end", "def makedb\n # only scan the first few hundred entries\n n = 100\n # check if the query is a nucl or prot seq\n query_file = Bio::F...
[ "0.7292946", "0.607922", "0.6052386", "0.5623254", "0.5620199", "0.55463135", "0.55391514", "0.5502864", "0.54939616", "0.5453335", "0.54077363", "0.5390296", "0.53558445", "0.5301986", "0.52764434", "0.52751464", "0.5265819", "0.5258607", "0.5247739", "0.518297", "0.5149516"...
0.76780653
0
Returns true if the database name appears to be a multipart database name. e.g. /home/ben/pd.ben/sequenceserver/db/nr.00 => yes /home/ben/pd.ben/sequenceserver/db/nr => no /home/ben/pd.ben/sequenceserver/db/img3.5.finished.faa.01 => yes
def multipart_database_name?(db_name) !(db_name.match(/.+\/\S+\d{2}$/).nil?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multipart?\n has_content_type? ? !!(main_type =~ /^multipart$/i) : false\n end", "def multipart?\n true unless parts.empty?\n end", "def multipart?\n\t true\n\tend", "def multipart?\n http.headers[\"content-type\"] =~ /^multipart/\n end", "def multipart?\n @multipart...
[ "0.6249019", "0.619339", "0.60783166", "0.60710865", "0.606279", "0.606279", "0.6030639", "0.5987106", "0.59457326", "0.5891267", "0.58741236", "0.58088994", "0.5802374", "0.5713013", "0.564603", "0.5637294", "0.56154466", "0.56147933", "0.56117904", "0.56058854", "0.55855244...
0.8682582
0
Returns true if first character of the file is '>'.
def probably_fasta?(file) File.read(file, 1) == '>' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opening?(char)\n DELIMITERS.keys.include?(char)\n end", "def open_tag?(char)\n unless char == nil\n char =~ /\\A<[^>]+>/\n else\n false\n end\n end", "def flagged? file\n self[file][9] == '0C'\n end", "def fullpage?\n File.open(path, &:readline)[0..2...
[ "0.60451853", "0.59814185", "0.5977373", "0.5898968", "0.5780077", "0.57750815", "0.57673585", "0.5713025", "0.56956613", "0.5684289", "0.5602797", "0.55567914", "0.55029756", "0.54284596", "0.53959966", "0.53854984", "0.5360093", "0.5354002", "0.53408694", "0.532963", "0.528...
0.6853935
0
Suggests improved titles when generating database names from files for improved apperance and readability in web interface. For example: Cobs1.4.proteins.fasta > Cobs 1.4 proteins S_invicta.xx.2.5.small.nucl.fa > S invicta xx 2.5 small nucl
def make_db_title(db_name) db_name.gsub!('"', "'") # removes .fasta like extension names db_name.gsub!(File.extname(db_name), '') # replaces _ with ' ', db_name.gsub!(/(_)/, ' ') # replaces '.' with ' ' when no numbers are on either side, db_name.gsub!(/(?<![0-9])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def titleize\n @collection.dictionary.each do |id, data|\n next unless File.basename(data['id']) =~ /^untitled/\n new_name = Ruhoh::StringFormat.clean_slug(data['title'])\n new_file = \"#{new_name}#{File.extname(data['id'])}\"\n old_file = File.basename(data['id'])\n next if...
[ "0.6405323", "0.6262719", "0.61469907", "0.6087213", "0.6052651", "0.5960072", "0.59307176", "0.58981794", "0.5859058", "0.58503395", "0.5834313", "0.5834313", "0.5785105", "0.57809645", "0.5769204", "0.57677805", "0.57484853", "0.5737694", "0.56702614", "0.56634307", "0.5654...
0.7086552
0
Guess whether FASTA file contains protein or nucleotide sequences based on first 32768 characters. NOTE: 2^15 == 32786. Approximately 546 lines, assuming 60 characters on each line.
def guess_sequence_type_in_fasta(file) sample = File.read(file, 32768) sequences = sample.split(/^>.+$/).delete_if { |seq| seq.empty? } sequence_types = sequences.map {|seq| Sequence.guess_type(seq)}.uniq.compact (sequence_types.length == 1) && sequence_types.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_csfasta(fasta)\n # length is the total read lengh + 2\n # cat *.csfasta | perl -ne 'next if /^#/;$i++;if ($i%2==0) {print unless \n # length($_)==52} else {print unless /^>\\d+_\\d+\\_\\d+\\_(F|R)(3|5)(-P2)*\\n$/}'\n # | more\n length = get_bp_length(fasta) + 2\n i = 0\n output = \"\"\n F...
[ "0.65658635", "0.6229822", "0.6187336", "0.618514", "0.5756286", "0.5658233", "0.5630377", "0.5629821", "0.56086355", "0.5585795", "0.55313164", "0.55205417", "0.5448123", "0.54455477", "0.5390017", "0.5388496", "0.5386979", "0.52642334", "0.52577657", "0.52539676", "0.524776...
0.6445481
1
store books in array
def add_books(books) books.each do |book| @books.push(book) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_book(book)\n\t\t@books.push(book)\t\n\tend", "def loadBooks()\n @@bookid_count+=1\n book1 = Book.new(@@bookid_count, \"Harry Potter\", \"JK Rowling\", \"Bloomsbury\", 2010, 5, 5, 5)\n @@bookid_count+=1\n book2 = Book.new(@@bookid_count, \"The Alchemist\", \"Paulho Coelho\", \"...
[ "0.73641175", "0.73614067", "0.72606206", "0.7210309", "0.718929", "0.71613777", "0.68064034", "0.673333", "0.6654052", "0.65733045", "0.6552979", "0.64787984", "0.6469766", "0.6461582", "0.64436615", "0.6432072", "0.6398421", "0.6390026", "0.63399297", "0.63367707", "0.63347...
0.7732529
0
store users in an array
def add_users(users) users.each do |user| @users.push(user) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadUsers()\n @@userid_count+=1\n user1 = User.new(@@userid_count, \"Shweta\", \"Dublin 1\", 1, Array.new)\n @@userid_count+=1\n user2 = User.new(@@userid_count, \"Chirag\", \"Dublin 2\", 5, Array.new)\n @@userid_count+=1\n user3 = User.new(@@userid_count, \"Karishma\"...
[ "0.7351337", "0.7246826", "0.714973", "0.7116326", "0.705994", "0.7046836", "0.701369", "0.6917157", "0.6868712", "0.6843938", "0.6836045", "0.6833186", "0.6826418", "0.68129915", "0.67786384", "0.6778477", "0.6745208", "0.6743128", "0.6716426", "0.6712091", "0.66473705", "...
0.7421838
0
expect_redirect_sessions_new good, as is
def expect_redirect_sessions_new @controller.expects(:redirect_to).with :controller => :sessions, :action => :new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_guest_access_to_userland_gives_login_screen\n get '/in/index'\n assert last_response.redirect?\n follow_redirect!\n\n assert last_request.url.ends_with?(\"/login\")\n assert last_response.ok?\n assert last_response.body.include?('Login to continue') \n end", "def assert_redirected_t...
[ "0.6890419", "0.6555236", "0.6465239", "0.64356506", "0.64108187", "0.6406505", "0.64042497", "0.6369022", "0.6292442", "0.6265219", "0.62486655", "0.6225159", "0.6221296", "0.62212723", "0.6213242", "0.617218", "0.6133675", "0.6128981", "0.61079925", "0.60522634", "0.6052263...
0.8594844
0
if running inside a docker container bind to 0.0.0.0 otherwise bind to localhost
def get_bind_ip File.exist?('/.dockerenv') ? '0.0.0.0' : '127.0.0.1' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def docker_routable_ip\n case @docker_url.scheme\n when 'tcp', 'http', 'https'\n docker_dns = @docker_url.host\n docker_port = @docker_url.port || 2376\n else\n # Cheap trick: for unix, file or other protocols, assume docker ports\n # are proxied to localhost in addition ...
[ "0.668602", "0.6525163", "0.6502812", "0.6414334", "0.6360573", "0.6351432", "0.63504666", "0.62699175", "0.62460876", "0.6192051", "0.6172306", "0.61717176", "0.6100079", "0.6066674", "0.6056095", "0.60243016", "0.600504", "0.59419453", "0.59419453", "0.59057075", "0.5901537...
0.73420584
0
Set up an ActiveRecord model to use a friendly_id. The column argument can be one of your model's columns, or a method you use to generate the slug. Options: :use_slug Defaults to false. Use slugs when you want to use a nonunique text field for friendly ids. :max_length Defaults to 255. The maximum allowed length for a...
def has_friendly_id(column, options = {}) options.assert_valid_keys VALID_FRIENDLY_ID_KEYS options = DEFAULT_FRIENDLY_ID_OPTIONS.merge(options).merge(:column => column) write_inheritable_attribute :friendly_id_options, options class_inheritable_reader :friendly_id_options if options[:use_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friendly_id_config; end", "def slug_column=(_arg0); end", "def slug_column=(_arg0); end", "def friendly_id\n slug(true).to_friendly_id\n end", "def slug_column; end", "def slug_column; end", "def friendly_id; end", "def has_slug(attribute, options = {})\n options.assert_valid_keys(VALID_...
[ "0.5964881", "0.58818585", "0.58818585", "0.5838858", "0.5713394", "0.5713394", "0.55812865", "0.5472621", "0.5393289", "0.53547317", "0.532368", "0.532368", "0.532368", "0.52919173", "0.52900916", "0.5272146", "0.5252986", "0.5160729", "0.5122637", "0.5117106", "0.5116202", ...
0.71595776
0
GET /sleep_alerts GET /sleep_alerts.json
def index @sleep_alerts = SleepAlert.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_sleep_alert\n @sleep_alert = SleepAlert.find(params[:id])\n end", "def alerts(query)\n get_json(\"#{api_url}/alerts/#{url_settings}/q/#{parse_query(query)}.#{@options[:format]}\")\n end", "def get_alerts\r\n\t\turl = URI.parse(\"http://api.wunderground.com/api/#{@token}/alerts...
[ "0.6504531", "0.6451854", "0.64247406", "0.63897264", "0.6293768", "0.62891465", "0.627321", "0.627321", "0.6194733", "0.6186201", "0.61605865", "0.61605865", "0.61605865", "0.6155232", "0.61350036", "0.6131001", "0.6129876", "0.61146545", "0.60561454", "0.60229033", "0.59786...
0.741109
0
POST /sleep_alerts POST /sleep_alerts.json
def create @sleep_alert = SleepAlert.new(sleep_alert_params) @sleep_alert.bed_time = @sleep_alert.wake_time - 9.hours respond_to do |format| if @sleep_alert.save format.html { redirect_to @sleep_alert, notice: 'Sleep alert was successfully created.' } format.json { render :show, stat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sleep_alert_params\n params.require(:sleep_alert).permit(:user_id, :bed_time, :wake_time)\n end", "def set_sleep_alert\n @sleep_alert = SleepAlert.find(params[:id])\n end", "def create\n puts \"==========================\"\n puts \"CREATE\"\n JSON[params[\"updates\"].read].each do ...
[ "0.65614796", "0.6473342", "0.643988", "0.64110214", "0.62484753", "0.6241033", "0.60695326", "0.60415", "0.5956238", "0.59183997", "0.58090925", "0.58029634", "0.5763327", "0.57556194", "0.57490295", "0.57048106", "0.5702444", "0.56199056", "0.5587362", "0.55773985", "0.5566...
0.6839747
0
POST /admin/entries POST /admin/entries.json
def create @entry = Entry.new(params[:entry]) respond_to do |format| if @entry.save format.html { redirect_to [:admin, @entry], notice: 'Entry was successfully created.' } format.json { render json: @entry, status: :created, location: @entry } else format.html { render actio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @current_user.entries << @entry\n format.html { redirect_to user_entries_path, notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\...
[ "0.6933089", "0.6907184", "0.67925256", "0.6760422", "0.6697155", "0.664318", "0.66287273", "0.6531918", "0.6504035", "0.6504035", "0.6504035", "0.64821833", "0.647895", "0.6443803", "0.639075", "0.63884544", "0.63361037", "0.6326299", "0.6313138", "0.6296719", "0.6275068", ...
0.69296485
1
PUT /admin/entries/1 PUT /admin/entries/1.json
def update @entry = Entry.find(params[:id]) respond_to do |format| if @entry.update_attributes(params[:entry]) format.html { redirect_to [:admin, @entry], notice: 'Entry was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n en...
[ "0.7045435", "0.688967", "0.6796855", "0.6615867", "0.6615867", "0.6615867", "0.65924746", "0.65804166", "0.65804166", "0.65653855", "0.65653855", "0.65653855", "0.6519017", "0.651694", "0.64939094", "0.64567953", "0.6456286", "0.6456286", "0.64504015", "0.6447442", "0.644195...
0.69491345
1
DELETE /admin/entries/1 DELETE /admin/entries/1.json
def destroy @entry = Entry.find(params[:id]) @entry.destroy respond_to do |format| format.html { redirect_to admin_entries_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n debugger\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end", "def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n...
[ "0.7603719", "0.7556195", "0.74541986", "0.7444057", "0.7444057", "0.74153924", "0.74153924", "0.74153924", "0.7396678", "0.7388074", "0.73716086", "0.735336", "0.7331764", "0.7331764", "0.73017734", "0.72717315", "0.726465", "0.722468", "0.7143684", "0.7119805", "0.71092707"...
0.78269917
0
Perform operation (:add, :delete) on user and a set of groups
def user_groups_operation(user, groups, operation) params = { :first => user['first'], :last => user['last'], :username => user['username'], :uid => user['uid'] } groups.each do |group| params[:groupname] = group group_op = JSON.parse( @...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_user_to_group(user, group)\n\t\t\tend", "def update\n if params[:commit] == \"Remove users\"\n @usergroup.users.each do |user|\n @usergroup.users.delete(user) if params[:usergroup][\"user\" + user.id.to_s] == \"1\"\n end\n elsif params[:commit] == \"Add users\"\n User.all.each...
[ "0.7075792", "0.69603723", "0.689869", "0.68834436", "0.68563515", "0.6836417", "0.6805925", "0.6661582", "0.6648996", "0.6643728", "0.6615851", "0.65013635", "0.6485491", "0.6480344", "0.6478706", "0.6417249", "0.6396064", "0.6386506", "0.6382898", "0.63495374", "0.6328067",...
0.7703633
0
Delete user from LDAP groups
def delete_user_from_groups(user, groups) user_groups_operation(user, groups, :delete) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.remove_users_from_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Removed member #{params[:id]}\"\n end", "def delete_users_account_groups( user_uid, group_dns )\n ...
[ "0.7752953", "0.7481763", "0.7374588", "0.73439103", "0.7256436", "0.71855825", "0.7158731", "0.70970386", "0.7070976", "0.7061523", "0.70414555", "0.7006968", "0.69795346", "0.6969185", "0.69622815", "0.6955331", "0.6943792", "0.69289994", "0.6922412", "0.6909116", "0.690290...
0.74847066
1
Check if a user is a member of a group
def user_in_group?(user, group) return get_user_groups(user).include?(group) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def member_of(group)\n current_user.is_member?(group)\n end", "def ifMember(group_id,user_id)\n GroupUser.where(:group_id => group_id, :user_id => user_id).exists? #change to current_user_id \n end", "def in_group?(group_or_id)\n group_ids.include?(Ecircle::User.group_id(group_or_id))\n ...
[ "0.84149235", "0.81160873", "0.8039733", "0.8012207", "0.7999305", "0.7943782", "0.7876627", "0.7870723", "0.77554363", "0.7723301", "0.7602143", "0.76017505", "0.75802577", "0.757178", "0.7525805", "0.7505006", "0.7504587", "0.7504587", "0.7494614", "0.74444294", "0.74331564...
0.8395639
1
Get an LAN Manager password hash
def lm_hash(password) NTLM::Util.lm_v1_hash(password).unpack("H*")[0].upcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_password\n\tpwd1 = Password.get(\"New Password: \")\n\tpwd2 = Password.get(\"Retype New Password: \")\n\n\tbegin\n\t\traise if pwd1 != pwd2\n\t\trescue\n\t\t\tprint \"ERROR: Password mismatch!\\n\"\n\t\t\texit\n\tend\n\n\tbegin\n\t\tpwd1.check # check password strength\n\t\trescue\n\t\t\tprint \"ERROR: Pas...
[ "0.694737", "0.6859001", "0.68257797", "0.68132603", "0.67425215", "0.67418337", "0.67062956", "0.66939294", "0.6652135", "0.66297626", "0.6557417", "0.6515173", "0.65126354", "0.6505352", "0.64987665", "0.6497893", "0.6400321", "0.6392234", "0.63695586", "0.6357675", "0.6357...
0.6904985
1
Get an NT Manager password hash
def nt_hash(password) NTLM::Util.nt_v1_hash(password).unpack("H*")[0].upcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ntlm_hash(password, opt = {})\n pwd = password.dup\n unless opt[:unicode]\n pwd = EncodeUtil.encode_utf16le(pwd)\n end\n OpenSSL::Digest::MD4.digest pwd\n end", "def password_hash(pwd)\n hsh = 0\n pwd.reverse.each_char { |c|\n hsh = hsh ^ c.ord\n ...
[ "0.7130953", "0.6926036", "0.68546385", "0.68464637", "0.68241215", "0.6771637", "0.6700953", "0.6696662", "0.66942304", "0.65591687", "0.65051323", "0.6502067", "0.64983076", "0.6483942", "0.6471088", "0.6461837", "0.64516294", "0.643886", "0.6397633", "0.63632166", "0.63435...
0.7605761
0
GET /tasklistings GET /tasklistings.json
def index @tasklistings = Tasklisting.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @taskings = Tasking.all\n end", "def get_tasks(tasklist)\n tasklist_id = tasklist[\"id\"]\n tasklist.tasks = @client.execute(\n api_method: @api.tasks.list,\n parameters: {tasklist: tasklist_id}\n ).data.to_hash[\"items\"]\n end", "def tasks(tasklist_id = '@defau...
[ "0.69428253", "0.66891193", "0.650099", "0.63747966", "0.63591087", "0.63543844", "0.63270223", "0.6314849", "0.6281658", "0.62697965", "0.6243177", "0.6223879", "0.6215714", "0.6200853", "0.6155717", "0.61224645", "0.609302", "0.6081347", "0.60732", "0.6063166", "0.602243", ...
0.77347744
0
Returns true if the moment ends before the other one begins. If given a numeric value it will be treated like instantaneous moment in time. other object that implements begin, or a numeric value.
def before?(other) time = other.is_a?(Numeric) ? other : other.begin self.end <= time end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ends_before_it_begins?\n end_on? && end_on <= start_on\n end", "def after?(other)\n time = other.is_a?(Numeric) ? other : other.end\n self.begin >= time\n end", "def during?(other)\n if other.is_a? Numeric\n other_begin = other_end = other\n else\n other_begin, othe...
[ "0.7183758", "0.7144173", "0.67917067", "0.65259176", "0.6431983", "0.6379019", "0.63504124", "0.62452084", "0.6174968", "0.61451834", "0.61020887", "0.6082297", "0.6017058", "0.5959709", "0.5951678", "0.5940407", "0.59185785", "0.5914104", "0.5893243", "0.58691216", "0.58688...
0.76555544
0
Returns true if the moment begins after the other one ends. If given a numeric value it will be treated like instantaneous moment in time. other object that implements end, or a numeric value.
def after?(other) time = other.is_a?(Numeric) ? other : other.end self.begin >= time end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before?(other)\n time = other.is_a?(Numeric) ? other : other.begin\n self.end <= time\n end", "def ends_before_it_begins?\n end_on? && end_on <= start_on\n end", "def during?(other)\n if other.is_a? Numeric\n other_begin = other_end = other\n else\n other_begin, oth...
[ "0.69329554", "0.6912016", "0.679041", "0.67262584", "0.6632929", "0.6557125", "0.6335588", "0.6330379", "0.62694275", "0.6241053", "0.6166797", "0.6164158", "0.6160886", "0.61426437", "0.6140008", "0.6132952", "0.61105585", "0.6083559", "0.606514", "0.6059327", "0.60477036",...
0.77604973
0
Returns a new moment in the intersection other object that implements both begin and end.
def intersect(other) begin_at = self.begin >= other.begin ? self.begin : other.begin end_at = self.end <= other.end ? self.end : other.end begin_at <= end_at ? self.class.new(begin_at..end_at) : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersection_with(other)\n r1,r2 = matched_range_types(self, other)\n max_begin = [r1.begin,r2.begin].max\n min_end = [r1.end, r2.end ].min\n excl = ( r1.end == min_end && \n r1.respond_to?(:exclude_end?) && r1.exclude_end?\n ) ||\n ( r2.end == min_...
[ "0.68953633", "0.6721276", "0.63657665", "0.6201355", "0.60844624", "0.59996974", "0.5921518", "0.57193214", "0.57067823", "0.56914407", "0.5688982", "0.5675749", "0.5675407", "0.56711304", "0.5626685", "0.5622666", "0.56155986", "0.5612014", "0.5581967", "0.5567293", "0.5561...
0.6799138
1
Create a new DepositReceipt using the Response object returned by the server. ===Parameters response:: the response object returned by the request connection:: a Sword2Ruby::Connection object
def initialize(response, connection) @location = response.header["location"] @status_code = response.code @status_message = response.message if response.body #If a receipt was returned, parse it begin #ensure that there are not parse ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n # if there are any line items, they should all be valid.\n validate_line_items\n\n # make the API call\n # response = Docdata.client.call(:create, xml: create_xml)\n # response_object = Docdata::Response.parse(:create, response)\n if response_object.success?\n ...
[ "0.65508574", "0.63620955", "0.5800771", "0.57577014", "0.5671645", "0.5627099", "0.5625024", "0.5623702", "0.5616438", "0.56050193", "0.5576714", "0.5552487", "0.5539559", "0.5533249", "0.55321395", "0.5527547", "0.54709053", "0.5457693", "0.54208577", "0.54120314", "0.53963...
0.6373854
1
Gives the formatted output of specified bid. Params: bid: business id (String) cat: optional category (String) If specified, then return from existing query Else fire a new query to find business info of bid Example: ys.business_summary("momsgrilledcheesetruckvancouver", "food") or ys.business_summary("momsgrilledchees...
def business_summary(bid, *cat) if cat.empty? search_by_bid(bid) else b_index = @response[cat.first].businesses.find_index{|b| b.id == bid} @response[cat.first].businesses[b_index] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_summary\n summary = \"#{self.title} - \"\n\n if self.avg_bid\n summary += \"#{self.avg_bid}\"\n elsif self.budget\n summary += \"#{self.budget}\"\n elsif self.budget_range\n summary += \"#{self.budget_range.join(\" - \")}\"\n end\n summary\n end", "def fact_display(categ...
[ "0.5467923", "0.5224961", "0.49876085", "0.4917161", "0.48378083", "0.48229358", "0.47968322", "0.478096", "0.47712913", "0.47397572", "0.47370204", "0.470562", "0.46837315", "0.46562493", "0.46222448", "0.4577659", "0.4577659", "0.45538095", "0.45360425", "0.45171073", "0.45...
0.82252073
0
render the opening hours for event date
def show_opening_hours(times, formatted_times, event_date) result = 'Not Open Today' event_day = transformToFourSquareDay(event_date.in_time_zone.wday) times.each_with_index do |time, index| unless time.days.index(event_day).nil? result = formatted_times[index].open[0].renderedTime ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @open_hours = Hash.new\n @place.open_times.each do |schedule|\n @open_hours[schedule.day] = \"#{schedule.open_time.strftime('%l:%M %P')} - #{schedule.close_time.strftime('%l:%M %P')}\"\n end\n end", "def opening_hour\n 11 # 11am\n end", "def opening_hour\n 11\n end", "def op...
[ "0.7583415", "0.68261546", "0.67819184", "0.67529577", "0.6543452", "0.6395733", "0.63855106", "0.6383688", "0.63061786", "0.62769926", "0.62262607", "0.62031305", "0.6105163", "0.6105075", "0.6087681", "0.606036", "0.60447145", "0.60320646", "0.6014234", "0.60035425", "0.599...
0.78061634
0
GET /quizfinals/1 GET /quizfinals/1.xml
def show @quizfinal = Quizfinal.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @quizfinal } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @questions = @quiz.questions.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questions }\n end\n end", "def new\n @quizfinal = Quizfinal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml {...
[ "0.6879233", "0.6555892", "0.624725", "0.60998327", "0.60942304", "0.6057913", "0.6044179", "0.6004726", "0.6002623", "0.6002623", "0.6002623", "0.6002623", "0.6002623", "0.5977035", "0.59098697", "0.5880287", "0.5877415", "0.5857726", "0.5853135", "0.5852244", "0.58369017", ...
0.7151089
0
GET /quizfinals/new GET /quizfinals/new.xml
def new @quizfinal = Quizfinal.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @quizfinal } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @quizfinal = Quizfinal.new(params[:quizfinal])\n\n respond_to do |format|\n if @quizfinal.save\n format.html { redirect_to(@quizfinal, :notice => 'Quizfinal was successfully created.') }\n format.xml { render :xml => @quizfinal, :status => :created, :location => @quizfinal }\...
[ "0.6976906", "0.66912985", "0.66912985", "0.66715384", "0.6649722", "0.66490513", "0.6539322", "0.65380245", "0.6515356", "0.649198", "0.6486526", "0.64579654", "0.64514726", "0.64479655", "0.64467806", "0.64467806", "0.64467806", "0.64467806", "0.64467806", "0.6429536", "0.6...
0.7759686
0
POST /quizfinals POST /quizfinals.xml
def create @quizfinal = Quizfinal.new(params[:quizfinal]) respond_to do |format| if @quizfinal.save format.html { redirect_to(@quizfinal, :notice => 'Quizfinal was successfully created.') } format.xml { render :xml => @quizfinal, :status => :created, :location => @quizfinal } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @quiz = current_user.quizzes.build(quiz_params)\n\n @quiz.questions.each do |q|\n if q.question_type == \"free_answer\"\n q.answers = []\n end\n end\n\n puts @quiz.questions\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to current_user,...
[ "0.62818843", "0.6116551", "0.594172", "0.5826549", "0.5798797", "0.5798797", "0.57557464", "0.57401633", "0.57390344", "0.57379067", "0.573764", "0.5734384", "0.5725366", "0.57071906", "0.5662066", "0.5657221", "0.56321794", "0.56226844", "0.55699563", "0.5538775", "0.553638...
0.7016726
0
PUT /quizfinals/1 PUT /quizfinals/1.xml
def update @quizfinal = Quizfinal.find(params[:id]) respond_to do |format| if @quizfinal.update_attributes(params[:quizfinal]) format.html { redirect_to(@quizfinal, :notice => 'Quizfinal was successfully updated.') } format.xml { head :ok } else format.html { render :action...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @quiz = Quiz.find(params[:id])\n \n respond_to do |format|\n if @quiz.update_attributes(params[:quiz])\n format.html { redirect_to @quiz, notice: 'Quiz was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n ...
[ "0.6406944", "0.6379716", "0.6379716", "0.6319763", "0.6319763", "0.6319763", "0.62618005", "0.6256499", "0.6218256", "0.62137145", "0.6209631", "0.6190479", "0.61281127", "0.6124844", "0.6062926", "0.6047397", "0.60464764", "0.60291994", "0.60224915", "0.5940452", "0.5879466...
0.6989084
0
DELETE /quizfinals/1 DELETE /quizfinals/1.xml
def destroy @quizfinal = Quizfinal.find(params[:id]) @quizfinal.destroy respond_to do |format| format.html { redirect_to(quizfinals_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @quiz.destroy\n\n head :no_content\n end", "def deletepublish\n @question = Publishquiz.find(:all, :conditions=>\"question_id=\"+params[:question]+\" and quiz_id=\"+session[:quizid])\n @question[0].destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }...
[ "0.71384156", "0.70924664", "0.70029634", "0.6929543", "0.688979", "0.688554", "0.68545747", "0.6792162", "0.67401", "0.6714703", "0.67134297", "0.67134297", "0.6704211", "0.6704139", "0.66968465", "0.66964006", "0.66964006", "0.66964006", "0.66964006", "0.66964006", "0.66964...
0.7536592
0
POST /tx_royalties POST /tx_royalties.json
def create @tx_royalty = TxRoyalty.new(tx_royalty_params) respond_to do |format| if @tx_royalty.save format.html { redirect_to @tx_royalty, notice: 'Tx royalty was successfully created.' } format.json { render :show, status: :created, location: @tx_royalty } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_tx_royalty\n @tx_royalty = TxRoyalty.find(params[:id])\n end", "def create\n @nursery_table = NurseryTable.new(nursery_table_params)\n\n respond_to do |format|\n if @nursery_table.save\n format.html { redirect_to @nursery_table, notice: \"Nursery table was successfully created.\...
[ "0.54714036", "0.54399854", "0.5437694", "0.5325699", "0.52982235", "0.5285133", "0.52319324", "0.5192158", "0.51804006", "0.517087", "0.5062961", "0.5050815", "0.50407493", "0.5037304", "0.5034825", "0.5026073", "0.502575", "0.5019938", "0.50164884", "0.5010504", "0.4964461"...
0.6244218
0
PATCH/PUT /tx_royalties/1 PATCH/PUT /tx_royalties/1.json
def update respond_to do |format| if @tx_royalty.update(tx_royalty_params) format.html { redirect_to @tx_royalty, notice: 'Tx royalty was successfully updated.' } format.json { render :show, status: :ok, location: @tx_royalty } else format.html { render :edit } format.jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants...
[ "0.62943965", "0.60849637", "0.6049723", "0.6012433", "0.60094583", "0.599696", "0.59247404", "0.59247404", "0.5910482", "0.58935946", "0.58715343", "0.58249366", "0.5807028", "0.57657635", "0.57637554", "0.57625145", "0.5741435", "0.57221586", "0.57115334", "0.5698711", "0.5...
0.65436316
0
DELETE /tx_royalties/1 DELETE /tx_royalties/1.json
def destroy @tx_royalty.destroy respond_to do |format| format.html { redirect_to tx_royalties_url, notice: 'Tx royalty was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @taxinomy = Taxinomy.find(params[:id])\n @taxinomy.destroy\n\n respond_to do |format|\n format.html { redirect_to taxinomies_url }\n format.json { head :no_content }\n end\n...
[ "0.69922584", "0.67290103", "0.6700421", "0.6593997", "0.6592825", "0.6568502", "0.6514311", "0.65118545", "0.64996123", "0.64974964", "0.6488371", "0.6486171", "0.64776325", "0.6474538", "0.64739525", "0.6469212", "0.6465902", "0.64630824", "0.6461225", "0.6441688", "0.64366...
0.7028019
0
Given a grade_hash and assignment number, return the average score for that assignment. Note that Ruby counts arrays from 0, but we are referring to them as 110.
def assignment_average_score(grade_hash, assignment_num) assignment = grade_hash.map do |key, value| value[assignment_num - 1] end sum = assignment.reduce do |sum, x| sum += x end sum / assignment.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assignment_average_score(grade_hash, assignment_num)\n a = []\n grade_hash.values.each { |dude| a.push(dude[assignment_num - 1]) }\n sum = a.sum\n average = sum/a.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n assignment_score = grade_hash.map do |key, value|\n value [assig...
[ "0.90744793", "0.9064256", "0.9055889", "0.8990212", "0.89789546", "0.8959268", "0.8909102", "0.8855201", "0.8777874", "0.873241", "0.8277006", "0.78221184", "0.76975167", "0.7590457", "0.7590457", "0.7590457", "0.7590457", "0.7590457", "0.7585181", "0.75823367", "0.7519535",...
0.9109685
0
Return a hash of students and their average score. TIP: To convert an array like [[:indiana, 90], [:nevada, 80]] to a hash, use .to_h. Also look at Hashtransform_values.
def averages(grade_hash) averages = grade_hash.map do |key, value| total = 1 sum = grade_hash[key].reduce do |sum, grade| total += 1 sum += grade end avg = sum / total [key, avg] end averages.to_h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def averages(grade_hash)\n student_average_array = grade_hash.map do |key, value|\n average = value.sum / value.length\n [key, average]\n end\n student_average_array.to_h\nend", "def class_average(grade_hash) \n sum = 0\n students = grade_hash.keys.length\n scores = grade_hash.values.length\n total_...
[ "0.75408834", "0.6999593", "0.6975018", "0.6857092", "0.67606515", "0.6746337", "0.67069304", "0.6706569", "0.6653787", "0.66253716", "0.6592403", "0.6546863", "0.6479477", "0.64764684", "0.6473728", "0.6455564", "0.6446884", "0.6432308", "0.63847697", "0.6352908", "0.6348777...
0.7046247
1
Returns a UserManager object specific to OS X
def get_user_manager() return(Users::OSXUserManager.new()) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_manager()\n\t\t\t\treturn(Users::OpenBSDUserManager.new())\n\t\t\tend", "def [](name)\n handle = system.run(:search, \"user\", name, nil, @keyring)\n return nil if handle == -1\n\n system.get(:read, handle)\n end", "def identifier_for(scheme)\n identifiers.by_scheme_name(schem...
[ "0.7198863", "0.60888714", "0.6008444", "0.5792694", "0.5770028", "0.57068527", "0.5622561", "0.56057274", "0.56057274", "0.5598461", "0.555754", "0.5548709", "0.549404", "0.5439386", "0.54292023", "0.5417345", "0.5417284", "0.53819966", "0.5378019", "0.5377998", "0.53777564"...
0.8112664
0
adds a user to the system. If userinfo is a string then it will add the named user with an optional uid. If userinfo is an actual UserInfo object then uid is ignored and everything possible will be used from userinfo (or generated if not supplied)
def add_user(userinfo, password=nil, uid=nil) newuser = UserInfo.new() newuser.username = nil newuser.uid = nil newuser.gid = nil newuser.fullname = nil newuser.shell = nil newuser.homedir = nil if(userinfo.respond_to?(:username)) if(userinfo.username == nil) raise(BadUsernam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_add argv = {}\n\t\tfkv\t\t\t= {}\n\t\tfkv[:name]\t= argv[:name]\n\t\tfkv[:level]\t= argv[:level]\n\t\tfkv[:tag]\t= argv[:tag] if argv[:tag]\n\n\t\t# if the username is existed\n\t\t_throw Sl[:'the user is existed'] if user_has? fkv[:name]\n\n\t\t# password\n\t\trequire \"digest/sha1\"\n\t\tfkv[:salt] \t= ...
[ "0.6709862", "0.66529197", "0.65704066", "0.6562995", "0.6540822", "0.6536096", "0.64775956", "0.646284", "0.6413204", "0.62673825", "0.6208891", "0.62046283", "0.6183421", "0.6132607", "0.612488", "0.6114278", "0.60543376", "0.604756", "0.6017779", "0.6005402", "0.6004883", ...
0.7701631
0
deletes a group from the system
def delete_group(group) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_group(group)\n\t\t\t\tgroupname = nil\n\t\t\t\tif(group.respond_to(:groupname))\n\t\t\t\t\tgroupname = group.groupname\n\t\t\t\telse\n\t\t\t\t\tgroupname = group\n\t\t\t\tend\n\n\t\t\t\t`pw groupdel #{groupname}`\n\t\t\tend", "def remove_group(group)\n self.groups.destroy group \n end", "def del...
[ "0.81135666", "0.8026677", "0.78762484", "0.785122", "0.7840326", "0.782046", "0.7813519", "0.78107667", "0.78070587", "0.7798556", "0.77900004", "0.77900004", "0.7717208", "0.77116877", "0.7702755", "0.7689944", "0.7679747", "0.76643753", "0.7656285", "0.76086736", "0.760293...
0.87497646
1
Returns a PackageList object that contains key value pairs for every installed package where the key is the package name and the value is a PackageInfo object
def installed_packages() installedpackagelist = `#{@finkbin} list -i` installedpackages = PackageList.new() installedpackagelist.each_line() { |line| linearr = line.split() installedpackages[linearr[1]] = PackageInfo.new() installedpackages[linearr[1]].name = linearr[1] installedpackage...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def installed_packages()\n\t\t\t\tpackages = PackageList.new()\n\t\t\t\tpackageregex = /^([^ ]+)-([^- ]+)\\s+(.*)$/\n\n\t\t\t\tinstalledpackageslist = `/usr/sbin/pkg_info`\n\t\t\t\tinstalledpackageslist.each_line() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tmatch = packageregex.match(line)\n\t\t\t\t\tif(match !=...
[ "0.80759007", "0.7899198", "0.78053594", "0.7105834", "0.7072685", "0.65679485", "0.6447896", "0.644356", "0.64097327", "0.63171613", "0.62918484", "0.62847143", "0.62681496", "0.62681496", "0.62100494", "0.6203782", "0.61494905", "0.6145633", "0.61325514", "0.6079028", "0.60...
0.8095609
0
Verify the number of items in a cart
def verify_cart_shopping_cart_size(count) cart_page = MemberManagement::Page::Cart.new $browser @soft_asserts.verify { expect(cart_page.shopping_cart_rows.size).to eq count } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_enough\r\n \tProduct.find(@cart_item.product_id).count - @cart_item.count >= 0\r\n end", "def test_total_number_of_products\n cart = ShoppingCart.new(\"King Soopers\", \"30items\")\n product1 = Product.new(:paper, 'toilet paper', 3.70, '10')\n product2 = Product.new(:meat, 'chicken', 4.50, '2')...
[ "0.7695009", "0.7646764", "0.7120267", "0.7101367", "0.70408505", "0.7012105", "0.69946086", "0.6973096", "0.6850829", "0.68255", "0.6794664", "0.67872214", "0.6746678", "0.67196035", "0.6682283", "0.6675873", "0.6674071", "0.66703767", "0.66640747", "0.66620374", "0.6657565"...
0.8143284
0
Verify the grand total of a cart
def verify_cart_shopping_cart_grand_total(total) cart_page = MemberManagement::Page::Cart.new $browser @soft_asserts.verify { expect(cart_page.grand_total.text).to eq total } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grand_total\n total = 0\n return total if session[:cart].empty? # skip if cart empty...\n session[:cart].each do |item_id, quantity|\n info = {item_id: item_id, quantity: quantity}\n order_item = OrderItem.new(info)\n total += order_item.subtotal\n end\n total\nend", "def checkout(cart, coupons...
[ "0.7530609", "0.7195634", "0.69279855", "0.67688847", "0.67515534", "0.6719154", "0.67072517", "0.66930723", "0.6683159", "0.6647998", "0.6621847", "0.65928036", "0.6582012", "0.6557325", "0.6557325", "0.65564126", "0.65373236", "0.65272146", "0.652469", "0.6506421", "0.64641...
0.85869753
0
=begin Returns nil if no category is disabled, array of disabled ids otherwise. =end
def disabled_options(categories, &block) categories.inject([]) do |disabled, c| if yield(c) disabled else disabled << c.id end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_category_ids\n @allowed_category_ids ||=\n begin\n unrestricted = Category.where(read_restricted: false).pluck(:id)\n unrestricted.concat(secure_category_ids)\n end\n end", "def disabled_categories(card)\n card_benefits = []\n card.benefits.each{|b| card_benefits << ...
[ "0.72495514", "0.6695797", "0.6615539", "0.6526112", "0.6428358", "0.6337903", "0.6337903", "0.6321957", "0.631769", "0.62648225", "0.62408394", "0.6220884", "0.6177829", "0.61465245", "0.61342263", "0.60905063", "0.59337986", "0.56674916", "0.5656138", "0.56436366", "0.56195...
0.72378576
1
Installs required repositories as project's submodules.
def install_submodules if agree( (["OK to add git submodules to your application?", "If you select 'No' here some of the fuctionality can be lost", "\n" ] + SUBMODULES.values).join "\n" ) SUBMODULES.each do |path, submodule...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup\n default_repository.update_submodules(:recursive => true)\n true\n end", "def install!\n each_module do |repo|\n\n print_verbose \"\\n##### processing module #{repo[:name]}...\"\n\n module_dir = File.join(module_path, repo[:name])\n\n unless File.exists?(module...
[ "0.7257783", "0.717883", "0.69483876", "0.6726392", "0.6612064", "0.66022974", "0.6493901", "0.6469494", "0.6429483", "0.64015096", "0.63634706", "0.63346946", "0.63188875", "0.6310473", "0.62054867", "0.6160013", "0.6154139", "0.61529773", "0.60734534", "0.6068954", "0.60659...
0.75199455
0
Create deploy rb file
def create_deploy @@tpl = CapistranoDeployGenerator.source_root empty_directory "config/deploy" say <<-EOF config/deploy.rb generator This menu will help you creating deployment configuration file deploy.rb for Capistrano. It is safe to acceppt defulat values for most or all questions. Just hit Enter if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n deploy\n end", "def gen_deploy(deploy_id, slug_url, config)\n require 'erb'\n require 'shellwords'\n template = ERB.new(File.read(File.join(data_dir, 'deploy.bash.erb')))\n template.result(binding)\n end", "def create\n GITHUB.create_deployment(\n @project.repository_path,...
[ "0.6970038", "0.6962869", "0.6623345", "0.65806484", "0.65737057", "0.65652597", "0.6427499", "0.6423631", "0.6407566", "0.6308319", "0.62779796", "0.6220729", "0.62163943", "0.616739", "0.616618", "0.61655045", "0.61511856", "0.61434823", "0.61416054", "0.614039", "0.6121951...
0.7492605
0
Select version for :rvm_ruby_string Read `rvm list` and set as default rvm version that is current now.
def ruby_version default = %x{ rvm current}.strip items = %x{ rvm ls strings }.split.compact ruby = menu_with_default "RVM Ruby version to use for deployment:", items,default ruby = ask "Enter alternative RVM Ruby string: " if ruby =~ /Other/ ruby end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_rvm_ruby_if_not_given\n if node['rvm_passenger']['rvm_ruby'].nil?\n rvm_ruby = node['rvm']['default_ruby']\n rvm_ruby += \"@passenger\" unless rvm_ruby == \"system\"\n\n node.set['rvm_passenger']['rvm_ruby'] = rvm_ruby\n Chef::Log.debug(%{Setting node['rvm_p...
[ "0.66422695", "0.6213907", "0.5680196", "0.5555658", "0.5547382", "0.54722476", "0.543302", "0.543302", "0.53790027", "0.53758854", "0.5360697", "0.53086525", "0.5272826", "0.52290076", "0.52015257", "0.5130147", "0.5121873", "0.50862586", "0.5070931", "0.505345", "0.5048456"...
0.7684294
0
marble 1 is a special case as only two marbles in circle therefore current_marble now points to new marble and vice versa
def handle_one(new_marble) @current_marble.next_marble = new_marble @current_marble.previous_marble = new_marble new_marble.next_marble = @current_marble new_marble.previous_marble = @current_marble @current_marble = new_marble end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_blinds\n @active_players[0].current_bet = @small_blind_value\n @active_players[1].current_bet = @big_blind_value\n @table_current_bet = @active_players[1].current_bet\n @pot_size += @active_players[0].current_bet + @active_players[1].current_bet\n @committed += @pot_size\n @active_players.rotate!(2)\...
[ "0.5436185", "0.5421149", "0.53781796", "0.53616744", "0.5361203", "0.5359358", "0.5338134", "0.53157", "0.52958596", "0.5275918", "0.5248879", "0.52173704", "0.5212314", "0.5205426", "0.51766604", "0.516871", "0.51524657", "0.5149014", "0.5149014", "0.51384526", "0.5106753",...
0.7370659
0
marble with a number divisble by 23 is also a special case
def handle_divisible_by_23(player) player.score += @number marble_to_remove = @current_marble.previous_marble 6.times { marble_to_remove = marble_to_remove.previous_marble } marble_to_remove.previous_marble.next_marble = marble_to_remove.next_marble marble_to_remove.next_marble.previous_marble...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mod11(number); end", "def boredFriends(n)\n n.to_i % 9\nend", "def featured(integer)\n return \"Error: There is no possible number that fulfills those requirements\" if integer >= 9_876_543_210\n counter = integer + 1\n counter += 1 until counter % 7 == 0 && counter.odd?\n \n loop do\n return co...
[ "0.6814094", "0.6470916", "0.6395678", "0.6326531", "0.6210623", "0.61861664", "0.6173682", "0.6048399", "0.6030718", "0.6029157", "0.60267454", "0.60078794", "0.6000571", "0.5995168", "0.5977118", "0.5974164", "0.59646076", "0.59559613", "0.59425193", "0.5923453", "0.5922196...
0.69315016
0
You are given a map in form of a twodimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells). The island doesn't have "l...
def island_perimeter(grid) perimeter = 0 last_row = grid.length - 1 grid.each_with_index do |row, row_idx| row.each_with_index do |col, col_idx| last_col = row.length - 1 if col == 1 if row_idx == 0 perimeter += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_area_of_island(grid)\n area = 0\n (0...grid.size).each do |i|\n (0...grid[0].size).each do |j|\n area = [area, island_area(grid, i, j)].max if grid[i][j] == 1\n end\n end\n area\nend", "def perimeter\n\n return @side_len * 4\n\n end", "def problem(p=1000)\n m...
[ "0.6814274", "0.6799362", "0.6797749", "0.67271286", "0.66586167", "0.6527267", "0.64951104", "0.6465987", "0.6462515", "0.64554954", "0.6418304", "0.640568", "0.6385987", "0.63442063", "0.61950076", "0.6160231", "0.6160231", "0.6101672", "0.6100375", "0.6069833", "0.6045466"...
0.85463613
0
Provides an Enumerator of each of the "origin" points for each calling state enables you to jump anywhere back up the processor stack
def originchain Enumerator.new do |y| callchain.each do |cs| y.yield cs.origin if cs.origin end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callstack\n @callstack.dup\n end", "def callers\n Rubinius::VM.backtrace(1, true).map &(method(:setup_binding_from_location).\n to_proc)\n end", "def next states\n raise \"Must be implemented by subclass\"\n end", "def return_stack\n ret...
[ "0.5630945", "0.5609247", "0.55288976", "0.55179125", "0.54613316", "0.5414991", "0.54092085", "0.5361391", "0.5361391", "0.5361391", "0.53527975", "0.5329069", "0.52959716", "0.5263768", "0.5251513", "0.5220042", "0.5189601", "0.5176043", "0.5175107", "0.5133826", "0.5124845...
0.67780435
0
Clears calling state information all the way up the processor stack, removing any stored command blocks and allow the current fiber to expire
def reset_states #called by return to clear internal block stack callchain.each do |c| c.instance_exec do # go to the front of the line! @command_block = @previous_command_blocks.first || @command_block @previous_command_blocks = [] @current_state = nil ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clearState()\n\t\t\t@_previous_state = @_state\n\t\t\t@_state = nil\n\t\tend", "def clear\n current_state.clear\n end", "def clear_state\n @state.clear\n self\n end", "def emptyStateStack()\n\t\t\t@_state_stack = []\n\t\tend", "def clear\n @stack.clear\n end", "def clear\n\t\t@stac...
[ "0.66350883", "0.6593083", "0.65637594", "0.6478789", "0.6474248", "0.6441193", "0.63991374", "0.6367419", "0.634529", "0.623296", "0.6094306", "0.60536474", "0.6046544", "0.6021877", "0.60117996", "0.5998626", "0.59270877", "0.5915975", "0.59143186", "0.5894127", "0.5888125"...
0.70401466
0
Sets the executed commands to the current match, and clears the current command
def set_executed_commands (@executed_commands << @current_command.shift) if @current_command @current_command = nil nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_commands\n @commands = {}\n end", "def clear\n @commands.clear\n nil\n end", "def clear\r\n @commands.clear\r\n nil\r\n end", "def clear\n registered_commands.each(&:terminate)\n registered_commands.clear\n\n self\n end", "def clear_commands\n @@...
[ "0.72802174", "0.69715756", "0.6921162", "0.6899576", "0.67995304", "0.66166204", "0.66074824", "0.6394295", "0.6302413", "0.6277184", "0.6210286", "0.6200497", "0.61861986", "0.6070227", "0.5985217", "0.5894447", "0.5892646", "0.58780646", "0.581509", "0.57787395", "0.577298...
0.75172997
0
Resets all states, sets the executed commands to whatever the last execution was and supresses any error encountered while doing so. Basically, this reset's the processor tree in the event of an unrecoverable error
def clean reset_states rescue nil set_executed_commands rescue nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_states\n #called by return to clear internal block stack\n callchain.each do |c|\n c.instance_exec do\n # go to the front of the line!\n @command_block = @previous_command_blocks.first || @command_block\n @previous_command_blocks = []\n @current_state ...
[ "0.80025375", "0.7073982", "0.697908", "0.69403046", "0.68863666", "0.67731696", "0.6762559", "0.6689466", "0.66473293", "0.6631749", "0.65968025", "0.6556052", "0.6556052", "0.6553712", "0.65450704", "0.6507576", "0.6444732", "0.64360845", "0.6431891", "0.6430986", "0.642910...
0.79191566
1
Parse an File article to parse and create a new article Returns a hash containing all values of an article
def parse_article_from_file article_file_name article_values = {} article_values[:content] = '' article_values[:introduction] = '' article_values[:tags] = [] article_values[:authors] = [] article_values[:title] = '' article_values[:date] = nil article_valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_summary(fname)\n hash={}\n # Read file\n File.open(fname,'r') do |f|\n # Loop over line\n f.each_line do |line|\n line.chomp!\n index,content = line.split(/\\s*==\\s*/)\n hash[index] = content # index:id, content:path\n end\n end\n retur...
[ "0.6494359", "0.63364494", "0.62164885", "0.6094187", "0.6040543", "0.60125065", "0.5938195", "0.5930174", "0.5889644", "0.58068806", "0.57830125", "0.5779054", "0.5774223", "0.5760144", "0.5736633", "0.5717503", "0.571302", "0.56807023", "0.5664533", "0.5653263", "0.56181455...
0.7126961
0
The initialization method takes two arguments that were entered on the command line. There must be exactly one energy file and one power file. They can be named anything (note: without spaces) and be entered in any order. === Attributes +filename1+ The first file read from the command line arguments +filename2+ The sec...
def initialize filename1, filename2 @filename = [filename1, filename2] # boolean vasriables to help track which file is read first @parsed_energy = false @parsed_power = false # keeps track of the number of files read in @file_count = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(args = {})\n @file = args[:file] if args[:file]\n @dictionary = args[:dictionary] if args[:dictionary]\n end", "def initialize(args = {})\n @path = args[:path]\n @freq = args[:frequency]\n @fs = args[:fs]\n @seconds = args[:seconds]\n @amplitude = ...
[ "0.66584355", "0.6502084", "0.6448523", "0.64272475", "0.63824004", "0.63743436", "0.6274756", "0.61309105", "0.6094136", "0.6092415", "0.60270983", "0.59857047", "0.59672195", "0.59672195", "0.59642786", "0.5949158", "0.5925788", "0.5911889", "0.59115976", "0.5908731", "0.58...
0.76575315
0
A method to parse the data originally from the energy file and calculate the amount of time that past respresented by the data and total energy outputted (and assign them to variables)
def parse_energy energy_hash = parse_hash # total energy produced temp_array = [] temp_array = energy_hash.to_a # runtime in hours @energy_run_time = (temp_array[temp_array.length - 1][0] - temp_array[0][0])/3600.0 # energy in Wh @energy_amount = (temp_array[temp_array.length - 1][1] - temp_arra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accumulated_power_used\n power_total = 0.0\n\n begin\n (1..3).each do |ipdp|\n (1..4).each do |eg|\n power_reading = @xml.xpath(\"//XMLdata//info8_IPDP#{ipdp}_eg#{eg}\")[0].content.to_f\n #$stderr.puts \"Power Reading Phase #{ipdp} Socket #{eg} Energy #{power_reading}KJ\"\n ...
[ "0.6570041", "0.637124", "0.61529696", "0.6139952", "0.58971155", "0.5867482", "0.5836949", "0.58355427", "0.5834544", "0.5814748", "0.5706275", "0.5694727", "0.5685165", "0.5666351", "0.5652113", "0.5620736", "0.56060725", "0.55664074", "0.55598557", "0.5557295", "0.5511282"...
0.7527124
0
A method to parse the data originally from the power file and find the maximum power reading, minimum power reading, and assign them to class variables
def parse_power power_hash = parse_hash @max_power = power_hash.values.max @min_power = power_hash.values.min @parsed_power = true read_file unless @parsed_energy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_energy\n \tenergy_hash = parse_hash\n \t# total energy produced\n \ttemp_array = []\n \ttemp_array = energy_hash.to_a\n \t# runtime in hours\n \t@energy_run_time = (temp_array[temp_array.length - 1][0] - temp_array[0][0])/3600.0\n \t# energy in Wh\n \t@energy_amount = (temp_array[temp_array.lengt...
[ "0.6090547", "0.58828366", "0.5867111", "0.55441916", "0.548781", "0.54765326", "0.5422501", "0.53642905", "0.5346683", "0.5342109", "0.53296787", "0.532809", "0.5262677", "0.5226917", "0.52190655", "0.5205846", "0.52018166", "0.5182599", "0.5144276", "0.5141053", "0.5136983"...
0.78441226
0
A method to output a human readable report summarizing the data captured in the energy and power files. This method is called after the energy and power files have been parsed and the desired values calculated and comitted to variables.
def output_report # Have user indicate the type of renewable energy system that generated the file # The Aurora is type-agnostic: it only reports power and energy regardless of the type. # puts "Enter the number for the type of renewable production system?\n" puts "1.\tPV Solar\n" puts "2.\tThermal So...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report\n sprintf \"Number of paragraphs %d \\n\" <<\n \"Number of sentences %d \\n\" <<\n \"Number of words %d \\n\" <<\n \"Number of characters %d \\n\\n\" <<\n \"Average words per sentence %.2f \\n\" <<\n \"Av...
[ "0.69058824", "0.6702346", "0.65932405", "0.65494156", "0.6512902", "0.6418618", "0.64071625", "0.6316057", "0.62764263", "0.62680256", "0.625309", "0.62139255", "0.6195331", "0.6194943", "0.6151508", "0.6150987", "0.61461425", "0.61361474", "0.6134629", "0.6128694", "0.61160...
0.6865428
1
Returns all required details for the specified test.
def _test_details(test) suite_name = test.category test_name = test.name test_description = test.description test_name_key = "[#{test_name}] #{test_description}" [suite_name, test_name_key] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_test_info(test, target, project, machine, pool)\n handle_action_exceptions(__method__) do\n cmd_line = [\n \"gettestinfo '#{test}' '#{target}' '#{project}' '#{machine}' \"\\\n \"'#{pool}'\"\n ]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line...
[ "0.65954244", "0.64390916", "0.64280754", "0.6305013", "0.61831254", "0.6040682", "0.5949464", "0.5923676", "0.58873045", "0.5881611", "0.5852258", "0.5836551", "0.58081657", "0.57539564", "0.5749172", "0.57247925", "0.57119405", "0.5700864", "0.56797343", "0.5671683", "0.566...
0.71877456
0
Method for the message 'finaliser_finished'.
def finaliser_finished(source, *args) @manager.allure_stop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finished\n @finished = true\n end", "def finalise\n end", "def finished?; @finished; end", "def finish\n end", "def after_finished\n end", "def finish\n #\n end", "def finished!\n t = Time.now.utc\n update_attribute(:finished_at, t)\n # Save errors counts\n...
[ "0.6740235", "0.6725344", "0.6647908", "0.6572862", "0.6520311", "0.6501888", "0.64478314", "0.64406174", "0.64161104", "0.64066255", "0.6390644", "0.6384824", "0.63740396", "0.63680273", "0.635759", "0.63533556", "0.6322745", "0.630722", "0.62759674", "0.62667763", "0.626478...
0.71496
0
Method for the message 'runner_started'.
def runner_started(source, *args) @manager.allure_start end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_started(current_run_status)\n update_run_status(current_run_status)\n\n disable_reporter_on_error do\n send_to_data_collector(\n Chef::DataCollector::Messages.run_start_message(current_run_status)\n )\n end\n end", "def start\r\n return if runni...
[ "0.67682904", "0.67403924", "0.63755655", "0.6341607", "0.63039285", "0.63039285", "0.62642443", "0.6197169", "0.6130598", "0.6123241", "0.6042088", "0.6020047", "0.5999254", "0.59421015", "0.59312004", "0.58903176", "0.58870727", "0.5860562", "0.5860562", "0.5837585", "0.583...
0.75264776
0
Method for the message 'test_screenshot'.
def test_screenshot(source, file) test = source.test suite_name, test_name = _test_details(test) @manager.allure_add_attachment(suite_name, test_name, file: file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def screenshot _value\n send_cmd(\"screenshot #{_value}\")\n end", "def take_screenshot\n $browser.screenshot.save \"#{$image_folder}#{$testcase}_#{@var2}.png\"\n @var2+=1\n end", "def default_screenshot(message)\n [\"./screenshot.jpg\", message]\n end", "def take_screenshot(_scenari...
[ "0.7236884", "0.71927583", "0.7113932", "0.70880306", "0.70631313", "0.70532686", "0.704742", "0.70206857", "0.6987112", "0.6959128", "0.6921215", "0.6851582", "0.68442297", "0.68353575", "0.67949533", "0.6793308", "0.67815936", "0.6781188", "0.6768569", "0.67298394", "0.6664...
0.72908276
0
Method for the message 'test_step_screenshot'.
def test_step_screenshot(source, step_name, file) test = source.test suite_name, test_name = _test_details(test) @manager.allure_add_attachment(suite_name, test_name, file, step: step_name, title: File.basename(file)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_screenshot(scenario)\r\n scenario_name = \"#{scenario.name}_step\"\r\n sshot_name = \"log/screens/\" + scenario_name +\".png\"\r\n @browser.screenshot.save(sshot_name) rescue nil\r\n embed(sshot_name, 'image/png') rescue nil\r\nend", "def take_screenshot\n $browser.screenshot.save \"#{$image_...
[ "0.741501", "0.722639", "0.71233875", "0.71193415", "0.7058666", "0.7007076", "0.69928247", "0.6956237", "0.6861449", "0.6805622", "0.66489744", "0.66150814", "0.65824884", "0.6572377", "0.6568521", "0.65601975", "0.6518929", "0.64659345", "0.64314467", "0.6412075", "0.638222...
0.7754253
0
Method for the message 'test_step_started'.
def test_step_started(source, step_name, *args) test = source.test suite_name, test_name = _test_details(test) @manager.allure_start_step(suite_name, test_name, step_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_test_step_started(event)\n event.test_step.hook? ? handle_hook_started(event.test_step) : handle_step_started(event.test_step)\n end", "def start_test_step(step_result)\n return logger.error { \"Could not start test step, no test case is running\" } unless @current_test_case\n\n logger.d...
[ "0.78443706", "0.7265559", "0.69461143", "0.6779474", "0.6705636", "0.66253597", "0.65640837", "0.6473037", "0.63924026", "0.63690907", "0.630477", "0.6283276", "0.61707425", "0.61632055", "0.6121647", "0.60662055", "0.6058857", "0.6058857", "0.6035354", "0.6026546", "0.59394...
0.7653638
1
Method for the message 'test_step_finished'.
def test_step_finished(source, step_name, status = :passed, *args) test = source.test suite_name, test_name = _test_details(test) @manager.allure_stop_step(suite_name, test_name, step_name, status) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_test_step_finished(event)\n update_block = proc do |step|\n step.stage = Allure::Stage::FINISHED\n step.status = ALLURE_STATUS.fetch(event.result.to_sym, Allure::Status::BROKEN)\n end\n\n event.test_step.hook? ? handle_hook_finished(event.test_step, update_block) : handle_step_f...
[ "0.72463304", "0.7098731", "0.69635737", "0.6866173", "0.68358535", "0.67265135", "0.6671308", "0.6611195", "0.65640134", "0.6562804", "0.6551564", "0.6551564", "0.65425354", "0.64452374", "0.64396006", "0.6428594", "0.64111453", "0.6403335", "0.63919246", "0.63563377", "0.63...
0.7429429
0
Given a template id, derive (if available) the definition for the template. The definitions are stored in hqmfmodel/data_criteria.json.
def extract_definition_from_template_id found = false @template_ids.each do |template_id| # NOTE! (Adam 6/14): The following logic should absolutely be changed # when Bonnie CQL support goes production. The "try this then try # that" approach is an artifact of the template oids chan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_definition_from_template_id\n found = false\n\n @template_ids.each do |template_id|\n defs = HQMF::DataCriteria.definition_for_template_id(template_id, 'r2')\n if defs\n @definition = defs['definition']\n @status = defs['status'].length > 0 ? defs['status'] : n...
[ "0.7172219", "0.671647", "0.55633885", "0.55622715", "0.5541252", "0.54860145", "0.5413437", "0.53947", "0.538259", "0.52642643", "0.51781964", "0.51762927", "0.51592124", "0.5121665", "0.5083822", "0.5062981", "0.5033205", "0.503175", "0.50142723", "0.49867183", "0.4978556",...
0.7399046
0