query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Use callbacks to share common setup or constraints between actions.
def set_sales_forecast @sales_forecast = SalesForecast.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def sales_forecast_params params.require(:sales_forecast).permit(:service_center_id, :segment_id, :status_id, :area_id, :company, :division, :customer_name, :instrument, :price, :budget_id, :certainty_id, :reporting_date, :fixed_date, :order_date, :agent, :condition_text, :person_in_charge, :visible) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
For example if the input is 4, then your program should return 10 because 1+2+3+4 = 10.
def SimpleAdding(num) sum = 0 (1..num).each do |number| sum += number end sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SimpleAdding(num\n total = 1.upto(num).reduce(&:+)\n total \nend", "def sum(input)\n arr = input.to_s.chars.map { |x| x.to_i }\n arr.reduce { |sum, num| sum + num }\n # number.to_s.chars.map(&:to_i).reduce(:+) # read up on symbols and procs\nend", "def addition(number)\n (1..number).reduce(:+)...
[ "0.7081776", "0.7055382", "0.70188284", "0.6957403", "0.6889566", "0.6862021", "0.68231344", "0.6817671", "0.6789057", "0.678087", "0.67713755", "0.6766516", "0.67608327", "0.6744585", "0.67346686", "0.6716996", "0.67154837", "0.67126733", "0.6705608", "0.66938645", "0.669386...
0.0
-1
GET /product_showrooms def index
def destroy if current_user.id == @product_showroom.showroom.owner_id @product_showroom.destroy else render json: {errors: ['Unauthorized']}, status: :unauthorized end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @rooms = Room.all\n respond_to do | format |\n format.html\n format.json\n end\n \n end", "def index\n @rooms = Room.all\n \n respond_to do |f|\n f.html\n end\n end", "def index\n @restrooms = Restroom.all\n end", "def index\n @rooms = Room.all\n\n ...
[ "0.7250432", "0.721175", "0.7173299", "0.71025777", "0.707864", "0.707864", "0.707864", "0.707864", "0.707864", "0.707864", "0.707864", "0.707864", "0.707864", "0.707864", "0.707864", "0.7077684", "0.69886446", "0.6947703", "0.6929497", "0.69233197", "0.6887779", "0.6874277...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_product_showroom @product_showroom = ProductShowroom.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def product_showroom_params params.require(:product_showroom).permit(:product_id, :showroom_id, :status) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
The opposite of Arrayinclude i.e. return true if self appears in the array splatted into +first+ and +rest+.
def in? first, *rest (first.is_a?(Array) ? first : [first].concat(rest)).include? self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_include?(array, target)\n return false if array.empty?\n return true if array.first == target\n my_include?(array.drop(1), target)\nend", "def includes?(array, target)\n if array.empty?\n false\n elsif array.first == target\n true\n else\n includes?(array.drop(1),target)\n end\nend", "de...
[ "0.7352883", "0.7275701", "0.725362", "0.7145677", "0.712652", "0.7106624", "0.7047529", "0.69749135", "0.69622946", "0.6862535", "0.68409693", "0.68224657", "0.68108904", "0.6761371", "0.6692932", "0.6681192", "0.6680476", "0.6668103", "0.6651931", "0.6624857", "0.6623291", ...
0.8168852
0
Return this object's metaclass; i.e. the value of self within a 'class << self' block.
def metaclass class << self; self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metaclass\n class << self;\n self\n end\n end", "def metaclass\n class << self;\n self\n end\n end", "def metaclass\n class << self; self; end;\n end", "def metaclass\n if !self.metaclass?\n raise NoMetaClass, self\n else\n class << self; self; ...
[ "0.8166059", "0.8166059", "0.8026234", "0.7975332", "0.7844113", "0.7844113", "0.7740912", "0.71944124", "0.6931881", "0.6778121", "0.67406315", "0.67406315", "0.6682594", "0.66146445", "0.66146445", "0.64811945", "0.63630056", "0.6283211", "0.6247136", "0.62076557", "0.61530...
0.78683776
4
Return true if this object is +nil?+, or +empty?+ if it accepts that method.
def blank? nil? || (respond_to?(:empty?) && empty?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nil_or_empty?(obj)\n obj.nil? || (obj.respond_to?(:empty?) && obj.empty?)\n end", "def empty?\n @value.nil? || (@value.respond_to?(:empty?) && @value.empty?)\n end", "def blank?\n respond_to?(:empty?) ? !!empty? : !self\n end", "def nil?\n\t\t\tempty?\n\t\tend", "def blank?\...
[ "0.7699884", "0.71426743", "0.7137497", "0.7127501", "0.7082801", "0.7003134", "0.6990346", "0.69731843", "0.697255", "0.6909335", "0.68669826", "0.6866432", "0.68478334", "0.6824168", "0.68132603", "0.6797004", "0.6787903", "0.6774785", "0.67682517", "0.66865164", "0.6679941...
0.6962996
11
Return self unmodified after logging the output of inspect, along with the point at which +tapp+ was called.
def tapp tap { puts "#{File.basename caller[4]}: #{self.inspect}" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tapp\n Babushka::LogHelpers.deprecated! '2017-09-01'\n tap { STDOUT.puts \"#{File.basename caller[2]}: #{self.inspect}\" }\n end", "def inspect!\n $stderr.puts(self.inspect)\n end", "def inspect!\n $stderr.puts(self.inspect)\n end", "def get\n super\n .tap { |result...
[ "0.6483636", "0.5369693", "0.5369693", "0.52905303", "0.52770275", "0.5134703", "0.50808525", "0.50808525", "0.502376", "0.49886099", "0.49886099", "0.49886099", "0.4965967", "0.49399868", "0.49362803", "0.48896167", "0.4859325", "0.48477146", "0.4812033", "0.4812033", "0.479...
0.6342416
1
Log and return unmodified in the same manner as tapp, but escape the output to be HTML safe and easily readable. For example, becomes &lt;Object:0x00000100bda208>
def taph tap { puts "<pre>" + "#{File.basename caller[2]}: #{self.inspect}".gsub('&', '&amp;').gsub('<', '&lt;') + "</pre>" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(object)\n puts \"<pre>\"\n puts object.pretty_inspect.gsub('<', '&lt;').gsub('>', '&gt;')\n puts \"</pre>\"\nend", "def ru_debug(object)\n begin\n \"<pre class='debug_dump'>#{object.to_yaml}</pre> <p><em>Raw dump</em></p>\".html_safe\n rescue Exception => e # errors from Marshal or YAML\n...
[ "0.6483437", "0.62061334", "0.6087314", "0.594068", "0.58671564", "0.5843327", "0.5815329", "0.57354784", "0.5728294", "0.5641781", "0.563286", "0.563286", "0.56151956", "0.56121206", "0.5595415", "0.55726415", "0.55717295", "0.5569038", "0.5550239", "0.5534598", "0.5534598",...
0.62805504
1
Executes the given block within the context of the receiver. In order to set the context, the variable self is set to this object while the block is executing, giving the code access to this object's instance variables. Arguments are passed as block parameters. This is a fallback implementation for older rubies that don't have a builtin instance_exec.
def instance_exec(*args, &block) begin old_critical, Thread.critical = Thread.critical, true n = 0 n += 1 while respond_to?(mname="__instance_exec#{n}") InstanceExecHelper.module_eval{ define_method(mname, &block) } ensure Thread.critical = old_critical end begin ret = send(mname, *args) ensure InstanceExecHelper.module_eval{ remove_method(mname) } rescue nil end ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _exec block, *args\n instance_exec(*args, &block)\n end", "def run(context = nil, *args)\n if context\n context.instance_exec(*args, &@block)\n else\n @block.call(*args)\n end\n end", "def evaluate(&block)\n if block.arity > 0\n yield self\n else\n in...
[ "0.8038417", "0.7608923", "0.7133825", "0.7016939", "0.701285", "0.699832", "0.6978153", "0.69703704", "0.6927305", "0.6897472", "0.6874533", "0.68489146", "0.6776979", "0.67618835", "0.6744641", "0.6741976", "0.6741976", "0.6741976", "0.6737922", "0.6699209", "0.6692339", ...
0.63130426
39
This method save data for better view and test (useful for having an overview of regexp matches)
def save( directory ) File.open( "parsed_data/#{directory}.yaml", 'w' ) do |f| f.write( @pages.to_yaml ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_additional_data\n end", "def save_match(match_data)\n begin\n save_match_summary(match_data)\n save_player_stats(match_data)\n rescue\n end\n end", "def record_data_for_later_saving(data, definition)\n word = data[:word]\n word_index = data[:index]\n\n ...
[ "0.5834503", "0.581124", "0.5772738", "0.57070047", "0.56758887", "0.5592121", "0.54858935", "0.54773647", "0.54695505", "0.53946084", "0.5381834", "0.5381834", "0.52908367", "0.52908367", "0.52908367", "0.5289626", "0.5289544", "0.5273991", "0.52601457", "0.5211825", "0.5192...
0.0
-1
This method prepare the data for future VueJs requests
def prepare( directory ) path = '../vue_js/data/' + directory FileUtils.mkpath( path ) @pages.each do |key, data| File.open( "#{path}/#{key}.json", 'w' ) do |f| f.puts( JSON.pretty_generate( data ) ) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_data\n\t\t\tsuper\n\t\t\t@data[:tuneable_data] = @tuneable_data\n\t\t\t@data[:@lowest_old] = @lowest_old\n\t\tend", "def prepare_data\n # This method is just a stub.\n end", "def prepare_data\n initial_data_eval \n initial_sorting if self.data_grid.sorting?\n filter\n global...
[ "0.6801018", "0.66666555", "0.6521163", "0.63313836", "0.6284821", "0.6186728", "0.6174908", "0.617153", "0.6056353", "0.6034315", "0.59595585", "0.5956695", "0.5948949", "0.5921524", "0.5904306", "0.5882984", "0.585618", "0.5830013", "0.58214325", "0.5817504", "0.5799957", ...
0.0
-1
The absolute path to the artifact's release directory.
def release_path ::File.join(install_path, artifact_name, artifact_version) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release_path\n @release_path ||= Pathname.new(source_dir).join(data['release_path'] || './release').to_s\n end", "def filepath\n groupId = @groupId.gsub('.', '/')\n artifactId = @artifactId.gsub('.', '/')\n return \"#{groupId}/#{artifactId}/#{@version}/#{artifactId}-#{@version}\"\n...
[ "0.7805322", "0.6771892", "0.6750139", "0.67314434", "0.66772777", "0.6619616", "0.6613908", "0.6569632", "0.65583193", "0.6538671", "0.6538304", "0.653421", "0.64757997", "0.6438014", "0.64031345", "0.63880557", "0.63862365", "0.63862365", "0.63840806", "0.63767666", "0.6376...
0.86605835
0
The absolute path to the current symlink for this artifact.
def current_path ::File.join(install_path, artifact_name, 'current') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linked_path\n File.readlink current_directory\n end", "def path\n @link.TargetPath\n end", "def symlink_current_dir\n @shell.symlink self.checkout_path, self.current_path\n end", "def last_resurrect\n File.readlink(the_symlink)\n end", "def working_directory\n @link.Wor...
[ "0.821351", "0.73287606", "0.7153724", "0.7048193", "0.6653185", "0.6583951", "0.6503875", "0.64727736", "0.647031", "0.6444303", "0.64361703", "0.6422452", "0.6421492", "0.63861394", "0.6382418", "0.63717014", "0.6364741", "0.6350254", "0.63377297", "0.6308187", "0.6257666",...
0.72428364
2
GET /image_paths/new GET /image_paths/new.xml
def new @image_path = ImagePath.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @image_path } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @uploaded_image = UpdatedImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uploaded_image }\n end\n end", "def new\n @img = Img.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => ...
[ "0.6165053", "0.6133824", "0.5990479", "0.5975609", "0.5970181", "0.59514606", "0.593504", "0.5910915", "0.5905742", "0.5843028", "0.5842058", "0.58256274", "0.5822929", "0.57385665", "0.5719524", "0.5719442", "0.56936336", "0.5641516", "0.56367075", "0.5625314", "0.5615091",...
0.69418824
0
POST /image_paths POST /image_paths.xml
def create @image_path = ImagePath.new(params[:image_path]) respond_to do |format| if @image_path.save flash[:notice] = 'ImagePath was successfully created.' format.html { redirect_to(@image_path) } format.xml { render :xml => @image_path, :status => :created, :location => @image_path } else format.html { render :action => "new" } format.xml { render :xml => @image_path.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def element\n image_name_list = get_image_name_list ORIGINALS_PATH\n image_name_list.each { |image_name| post(image_name) }\n end", "def make_request(img_paths)\n # Load contents of the imagefiles and instantiate Google::Apis::VisionV1::Image objects\n img_data = img_paths.map { |p| File.open(p).rea...
[ "0.6240876", "0.5513908", "0.5493714", "0.5417255", "0.5392265", "0.5390093", "0.53345364", "0.5307892", "0.5270956", "0.5249065", "0.5232015", "0.523189", "0.523189", "0.5208456", "0.5186416", "0.5184379", "0.5132494", "0.5111202", "0.51083183", "0.510389", "0.50965774", "...
0.5596245
1
PUT /image_paths/1 PUT /image_paths/1.xml
def update @image_path = ImagePath.find(params[:id]) respond_to do |format| if @image_path.update_attributes(params[:image_path]) flash[:notice] = 'ImagePath was successfully updated.' format.html { redirect_to(@image_path) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @image_path.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def update\n\n params = image_params\n params[\"tags\"] = params[\"tags\"].delete_suffix(',')\n\n respond_to do |format|\n if @image.update(params)\n format.html { redirect_to @image, notice: \"Image was suc...
[ "0.6095052", "0.5699765", "0.56992865", "0.5659542", "0.56241524", "0.56241524", "0.56108135", "0.5590362", "0.5552536", "0.55395144", "0.5532609", "0.5496175", "0.5492888", "0.5485352", "0.5474991", "0.54723066", "0.54717857", "0.5469874", "0.5453326", "0.5435665", "0.543083...
0.6370364
0
DELETE /image_paths/1 DELETE /image_paths/1.xml
def destroy @image_path = ImagePath.find(params[:id]) @image_path.destroy respond_to do |format| format.html { redirect_to(image_paths_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @img = Img.find(params[:id])\n @img.destroy\n\n respond_to do |format|\n format.html { redirect_to(imgs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n \n imagen = @image.filename\n \n #function in manage_images...
[ "0.6799447", "0.67660975", "0.6710873", "0.66433656", "0.66433656", "0.66433656", "0.66241515", "0.6623799", "0.6623578", "0.65880513", "0.6587223", "0.6548239", "0.65446794", "0.6543704", "0.65315104", "0.65198755", "0.6518764", "0.65038085", "0.65017927", "0.64876753", "0.6...
0.7535475
0
=begin def xyz(abc) azz=[] abc.each do |i| azz= i if i.to_s.include?("wa") break if azz.size>0 end print azz end =end =begin
def count_elements(abc) z=0 i=1 xyz=Array.new() xyz[0]=abc[0] xyz[0][:count]=1 while i<abc.size do if xyz[z][:name]==abc[i][:name] xyz[z][:count]+=1 i+=1 else z+=1 xyz[z]=abc[i] xyz[z][:count]=1 i+=1 end end #puts xyz.size print xyz end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sch(emaillist,finalPrint,cmlInput,argm,search)\n\temaillist.each {|e| finalPrint.push(e) if yield(e)} if\n\tcmlInput[argm+1].eql? search\n\tfinalPrint\nend", "def xyz2\n\n end", "def bs; end", "def start=(_arg0); end", "def test;\"def test;;end;array = [attempt];puts array\";end", "def get_letters(i...
[ "0.57231677", "0.5534685", "0.5487405", "0.54800254", "0.54774016", "0.53817517", "0.5361834", "0.5361834", "0.53134114", "0.5307534", "0.5299324", "0.52880657", "0.5272075", "0.5254862", "0.5244559", "0.5244559", "0.5244559", "0.5241725", "0.5236698", "0.52181625", "0.521773...
0.0
-1
find_cool(ttt) puts ttt[0] puts ttt[1] find_cool(ttt) =begin
def find_cool(abc) xyz=[] abc.each do |i| if i[:temperature]=="cool" print i xyz=i end end #print xyz end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_it(seq)\r\n\r\nend", "def beer_search_first(arg)\n beer_search(arg).find {|beer|beer}\nend", "def find; end", "def find(t)\n text = t\n text.downcase! unless @case_sensitive\n text.gsub!(/\\s+/,' ') # Get rid of multiple spaces.\n @state = 0\n index = 0\n text.each_char do |char...
[ "0.6378533", "0.60212594", "0.5975574", "0.58719736", "0.5759661", "0.5624258", "0.5575567", "0.55651367", "0.5559199", "0.5477042", "0.5470051", "0.5444748", "0.5424308", "0.5420687", "0.54182726", "0.54171497", "0.5416891", "0.5416079", "0.54078174", "0.5387714", "0.5374093...
0.53779054
20
Delegate all method calls we don't know about to target object
def method_missing(sym, *args, &block) proxy_target.__send__(sym, *args, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delegating_method; end", "def delegate_all\n # noop\n end", "def method_missing(method_name, *args, &block)\n if target.respond_to?(method_name)\n target.public_send(method_name, *args, &block)\n else\n super\n end\n end", "def method_missing(method, *args, &block)\n _targe...
[ "0.6739356", "0.6451455", "0.64021194", "0.6251275", "0.61972314", "0.6168438", "0.61553776", "0.61553776", "0.612947", "0.6107595", "0.6094749", "0.604592", "0.6037904", "0.5988997", "0.5972005", "0.5959359", "0.5889798", "0.58865637", "0.58574474", "0.58574474", "0.58418", ...
0.5902514
16
table data insert process
def insert_cako sql = "insert into CacheTako values (?, ?, ?)" return sql end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_into(table, data)\n\t\tkeys = \"(#{data.keys.join(', ')})\"\n\t\tvalues = \"(#{data.values.map{ |value| \"'#{value}'\" }.join(', ')})\"\n\t\texecute_with_retry \"INSERT INTO #{table} #{keys} VALUES #{values}; \"\n\tend", "def insert_by_data data, table\n sql = \"insert into #{table} \"\n cas...
[ "0.74943197", "0.72217417", "0.69258296", "0.6924332", "0.69196045", "0.68222225", "0.67787504", "0.6745788", "0.67008656", "0.67008656", "0.66724616", "0.66724616", "0.65907043", "0.65866613", "0.65754974", "0.65745676", "0.6538777", "0.6538777", "0.65291214", "0.64823574", ...
0.0
-1
table data update process
def update_cako sql = "update from CacheTako" return sql end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(table,cond,op)\n connection.update(path(table),cond,op)\n end", "def update data, table, condition = {}\n sql = \"update #{table} set\"\n data.each do |k,v|\n v = v.to_json if v.is_a?(Hash)\n if !!v == v\n sql = \"#{sql} #{k}=#{v},\"\n else\n ...
[ "0.6961447", "0.69002265", "0.6833356", "0.6782169", "0.66434956", "0.6561265", "0.6556899", "0.6556851", "0.6473217", "0.645009", "0.63937616", "0.6382954", "0.63729477", "0.63588774", "0.63588774", "0.63588774", "0.63588774", "0.63588774", "0.63588774", "0.63588774", "0.635...
0.0
-1
Return: id of the created object
def post_xml(url, ls_data) uri = URI.parse(url) request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML) request.body = ls_data request.basic_auth(@nsx_user, @nsx_password) response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https| https.request(request) end return response.body if check_response(response, 201) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_id() end", "def id\n object.id.to_i\n end", "def id\n object.id.to_s\n end", "def id\n object.id\n end", "def id\n object.id\n end", "def id\n object.object_id\n end", "def id\n object_id\n end", "def return_id(obj)\r\n if (obj.new_record?)\r\n ...
[ "0.79416245", "0.7843138", "0.77955467", "0.7787047", "0.7787047", "0.77575487", "0.77150655", "0.76802975", "0.7676885", "0.7676885", "0.7663011", "0.7623117", "0.760327", "0.7476846", "0.73703384", "0.7355571", "0.7333011", "0.7297001", "0.7292987", "0.7258343", "0.7224329"...
0.0
-1
Return: id of the created object
def post_json(url, ls_data) uri = URI.parse(url) request = Net::HTTP::Post.new(uri.request_uri, HEADER_JSON) request.body = ls_data request.basic_auth(@nsx_user, @nsx_password) response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https| https.request(request) end return JSON.parse(response.body)['id'] \ if check_response(response, 201) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_id() end", "def id\n object.id.to_i\n end", "def id\n object.id.to_s\n end", "def id\n object.id\n end", "def id\n object.id\n end", "def id\n object.object_id\n end", "def id\n object_id\n end", "def return_id(obj)\r\n if (obj.new_record?)\r\n ...
[ "0.79416245", "0.7843138", "0.77955467", "0.7787047", "0.7787047", "0.77575487", "0.77150655", "0.76802975", "0.7676885", "0.7676885", "0.7663011", "0.7623117", "0.760327", "0.7476846", "0.73703384", "0.7355571", "0.7333011", "0.7297001", "0.7292987", "0.7258343", "0.7224329"...
0.0
-1
GET /therapists GET /therapists.json
def index @therapists = Therapist.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end", "def artists\n if RESPONSE.code == 200\n # Return data to page\n JSON.parse(RESPONSE.to_s)['topartists']['artist']\...
[ "0.6562694", "0.6169816", "0.60333884", "0.5904657", "0.58211124", "0.5700912", "0.5698166", "0.56811047", "0.5671451", "0.5653851", "0.5626245", "0.56250376", "0.55675656", "0.553357", "0.553357", "0.553357", "0.5489247", "0.54392534", "0.54169357", "0.54157764", "0.5379153"...
0.67537636
2
GET /therapists/1 GET /therapists/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end", "def index\n @therapists = Therapist.all\n end", "def index\n @therapists = Therapist.all\n end", "def index\n @t...
[ "0.7174276", "0.6771803", "0.6771803", "0.6771803", "0.6771803", "0.621438", "0.613181", "0.61102575", "0.5975644", "0.5957762", "0.5954145", "0.5898816", "0.58721733", "0.58721733", "0.58721733", "0.58653253", "0.58572644", "0.58281696", "0.579335", "0.57567984", "0.57113117...
0.0
-1
POST /therapists POST /therapists.json
def create @therapist = Therapist.new(therapist_params) respond_to do |format| if @therapist.save format.html { redirect_to @therapist, notice: 'Therapist was successfully created.' } format.json { render :show, status: :created, location: @therapist } else format.html { render :new } format.json { render json: @therapist.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @therapist = Therapist.new(params[:therapist])\n\n respond_to do |format|\n if @therapist.save\n format.html { redirect_to @therapist, notice: 'Therapist was successfully created.' }\n format.json { render json: @therapist, status: :created, location: @therapist }\n else\...
[ "0.6404418", "0.61935127", "0.61634153", "0.5756791", "0.5664453", "0.5594197", "0.55832016", "0.5535142", "0.55215055", "0.55215055", "0.55215055", "0.55215055", "0.5423509", "0.5402538", "0.5380349", "0.5351084", "0.5314024", "0.5314024", "0.53133786", "0.52829635", "0.5273...
0.63292545
2
PATCH/PUT /therapists/1 PATCH/PUT /therapists/1.json
def update respond_to do |format| if @therapist.update(therapist_params) format.html { redirect_to @therapist, notice: 'Therapist was successfully updated.' } format.json { render :show, status: :ok, location: @therapist } else format.html { render :edit } format.json { render json: @therapist.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n if @therapist.update_attributes(params[:therapist])\n format.html { redirect_to @therapist, notice: 'Therapist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html...
[ "0.6600802", "0.64254564", "0.62123835", "0.6177276", "0.59769326", "0.5938455", "0.5935275", "0.58813494", "0.58594966", "0.58484775", "0.58376294", "0.5820418", "0.5815003", "0.57989615", "0.57927454", "0.5791307", "0.5763348", "0.5754602", "0.5751635", "0.57411397", "0.573...
0.67339206
1
DELETE /therapists/1 DELETE /therapists/1.json
def destroy @therapist.destroy respond_to do |format| format.html { redirect_to therapists_url, notice: 'Therapist was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @therapist = Therapist.find(params[:id])\n @therapist.destroy\n\n respond_to do |format|\n format.html { redirect_to therapists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronist = Uchronist.find(params[:id])\n @uchronist.destroy\n\n res...
[ "0.7385645", "0.6731119", "0.66847366", "0.6673562", "0.6646744", "0.65873194", "0.658058", "0.65756166", "0.6543277", "0.6516445", "0.65016747", "0.6499451", "0.64946085", "0.6491436", "0.6486369", "0.6471839", "0.64355314", "0.6434971", "0.6432992", "0.6419995", "0.6416921"...
0.7257804
3
Returns a pair where p[0] is an array containing the top three categories, and p[1] is an array containing therapist ids in descending order of relevance
def getCategoriesAndTherapists(query) query = query.gsub("'", "") f = open("|python ../nlp/FindTherapistsByQuery.py #{query}") output = f.read().strip().gsub("\n", ", ").split(", ") categories = Array.new() output[0..2].each do |x| x.sub!('[', '') x.sub!(']', '') categories << x end therapists = Array.new() output[3..-1].each do |x| x.sub!('[', '') x.sub!(']', '') therapists << x.to_i end return [categories,therapists] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_three_recipes \n a = recipes.sort_by do |i| \n i.rating \n end \n a[-3..-1]\n end", "def top_three_recipes\n recipes_sorted_by_rating.reverse[0..2]\n end", "def top_three_recipes\n my_recipes = self.recipe_cards\n my_recipes.sort{|a, b| b.rati...
[ "0.63290876", "0.63278717", "0.6326671", "0.6317078", "0.6298532", "0.6271997", "0.6177567", "0.61019856", "0.60731256", "0.6015085", "0.6009022", "0.58957064", "0.585386", "0.58149844", "0.5773825", "0.57319534", "0.5720246", "0.56945884", "0.5692115", "0.56269914", "0.56250...
0.6130565
7
Use callbacks to share common setup or constraints between actions.
def set_therapist @therapist = Therapist.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def therapist_params params.require(:therapist).permit(:pt_id, :name, :summary, :phone) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Helper method to ensure wait time with additional buffer
def wait_until_with_buffer(args, &block) original_timeout = args[:timeout] || ENV['WAIT_TIMEOUT'].to_i args_buffered = args.dup args_buffered[:timeout] = 60 start_time = Time.now Frank::Cucumber::WaitHelper.wait_until(args_buffered) { block.call() } end_time = Time.now delta = end_time - start_time puts("wait_until exceeded timeout #{original_timeout}. Took #{delta}. #{caller[0]}") if delta > original_timeout end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_readable_or_timeout; end", "def wait_until_not_full; end", "def wait_writable_or_timeout; end", "def wait; end", "def wait; end", "def wait; end", "def wait_for_rx\n sleep DATA_REFRESH_RATE + @latency\n end", "def wait\n sleep WAIT_TIME unless @skip_wait\n end", "def wait\n ...
[ "0.697314", "0.6893673", "0.65395635", "0.65077627", "0.65077627", "0.65077627", "0.64972615", "0.6451797", "0.63891727", "0.6375768", "0.63728917", "0.6355762", "0.6327225", "0.62768304", "0.62280184", "0.62280184", "0.616895", "0.6149683", "0.6135843", "0.61253667", "0.6086...
0.6911476
1
Wait for the UI to finish processing an action
def wait_for_ui_to_update sleep(UI_UPDATE_DELAY) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_complete() self.finished = true; end", "def wait_done\n sleep 0.01 until done?\n end", "def wait; end", "def wait; end", "def wait; end", "def wait\n\tend", "def waiting; end", "def waiting; end", "def wait\n true\n end", "def wait_for_elements\n super\n @wait...
[ "0.7182441", "0.6788431", "0.66238284", "0.66238284", "0.66238284", "0.66030705", "0.64908904", "0.64908904", "0.6476253", "0.6194249", "0.6187958", "0.6163954", "0.6137924", "0.61210084", "0.61168545", "0.6092502", "0.60601664", "0.6040198", "0.60121256", "0.5994139", "0.598...
0.6586998
6
Similar to wait_until but won't fail if the condition is never true. wait_until is prefered, but this can be useful if the condition might not occur.
def wait_until_without_failing(timeout=UI_UPDATE_DELAY) start = Time.now while ((Time.now - start) <= timeout) break if yield sleep(WaitHelpers::LOOP_DELAY) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_until times: 5, delay: 1, &condition\n times.times do\n return if condition.call\n sleep delay\n end\n raise \"Condition not met. Waited #{times} times with #{delay} sec delay\"\n end", "def wait_until_true(*args, &block)\n Selenium::WebDriver::Wait.new(*args).until(&block)\n...
[ "0.7180849", "0.6953944", "0.6926367", "0.690409", "0.69028425", "0.681789", "0.6814156", "0.6801709", "0.67515063", "0.67208886", "0.6720026", "0.67182094", "0.67060846", "0.67034185", "0.66877306", "0.6651108", "0.66334397", "0.6567752", "0.6567567", "0.6545148", "0.6474974...
0.665238
15
Expected options: :output_dir: A folder to dump filtered sql files into. This folder will be emptied before running the dump. :mysql_options: Command line options to pass mysql (e.g. u root some_db_name). :db_connection: An active record connection to the database to dump. :column_filters: A hash of column types to filter mapped to an array of values to filter on. :table_filters: An array of tables names that should have all data filtered out.
def initialize(options = {}) self.output_dir = options[:output_dir] self.mysql_options = options[:mysql_options] self.db_connection = options[:db_connection] self.column_filters = (options[:column_filters] || {}).stringify_keys! self.table_filters = (options[:table_filters] || []).map(&:to_s) self.post_dump_command = options[:post_dump_command] self.file_extension = options[:file_extension] || ".sql" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dump_tables(opts)\n if opts[:schema]\n _literal_table_sort(tables(opts.merge(:qualify=>true)))\n else\n tables(opts).sort\n end\n end", "def dump(db = config[\"database\"], data_selection: {})\n file_namer = Postgres::FileNameGenerator.new(working_dir)\n exclude_tab...
[ "0.60283154", "0.589884", "0.5849439", "0.57685965", "0.5689041", "0.56366765", "0.5518343", "0.5504224", "0.5498455", "0.54618114", "0.54434943", "0.5412365", "0.53963107", "0.53621936", "0.5312326", "0.52636266", "0.52486044", "0.52257913", "0.5223067", "0.5200668", "0.5179...
0.7232968
0
Run the dump. Call this method for a good time.
def run tables.each do |table| dump_table(table) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_dump\n end", "def start_dump\n end", "def start_dumping\n %Q{Start dumping ...}\n end", "def perform!\n super\n\n dump = \"echo '.dump' | #{sqlitedump_utility} #{path}\"\n\n pipeline = Pipeline.new\n dump_ext = \"sql\".dup\n\n pipeline << dum...
[ "0.75981015", "0.75981015", "0.6972107", "0.66652936", "0.66576517", "0.6498528", "0.6441552", "0.6416067", "0.63914543", "0.63914543", "0.63421273", "0.6309646", "0.6275292", "0.61923075", "0.61918044", "0.61461705", "0.6140818", "0.6140184", "0.6100221", "0.602161", "0.5991...
0.6629076
5
Execute the mysqldump command for the given table. Any column or table filters will be applied.
def dump_table(table) conditions = conditions_for(table) cmd = "mysqldump #{ mysql_options } --tables #{ table }" cmd += " \"--where=#{ conditions }\"" if conditions.present? if post_dump_command cmd += "| #{post_dump_command}" end cmd += " > #{ output_dir }/#{ table }#{file_extension}" system(cmd) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump\n check_dependencies('mysqldump', 'bzip2', '/bin/sh')\n options = {}\n while arg = args.shift\n case arg\n when '-f', '--force'\n options[:force] = true\n when /^[^-]/\n raise CommandFailed, \"too many arguments passed\" if options[:filename]\n ...
[ "0.58444566", "0.57970226", "0.5688865", "0.56162184", "0.5516886", "0.5512034", "0.5509626", "0.5462216", "0.5455626", "0.54280394", "0.5311821", "0.52377546", "0.5107581", "0.50713354", "0.50572675", "0.5049411", "0.5007488", "0.49645013", "0.4902564", "0.48862857", "0.4852...
0.78548235
0
Return a string suitable for use in the mysqldump command line where option.
def conditions_for(table) conditions = [] column_filters.keys.each do |type| conditions << column_filter_conditions_for(table, type) end # exclude all rows from table filtered tables conditions << '1 = 0' if table_filters.include?(table) conditions.compact.join(' or ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pg_dump_args\n ['-x', '-O', if schema_only\n '-s'\n end, conf['database']].compact.join(' ')\n end", "def dump_path\n dump = {:postgresql => 'pg_dump',:mysql => 'mysqldump'}\n # Note: the 'mysqldump_path' config option is DEPRECATED but keeping this in for ...
[ "0.56896085", "0.5640027", "0.56199324", "0.5397596", "0.53662616", "0.52767104", "0.52732885", "0.52212965", "0.5166593", "0.5133538", "0.51143086", "0.5015769", "0.5003394", "0.49865937", "0.4960623", "0.4915719", "0.49095353", "0.48870468", "0.48632118", "0.48536316", "0.4...
0.0
-1
Any conditions that should be used to filter table based on type
def column_filter_conditions_for(table, type) values = column_filters[type].join(', ') foreign_key = type.singularize.foreign_key if table == type "\\`id\\` in (#{ values })" elsif columns_for(table).include?(foreign_key) "\\`#{ foreign_key }\\` in (#{ values })" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_conditions(type)\n sql = ' WHERE ' + (T_DELETABLE.include?(type) ? 'deleted_at IS NULL AND ' : '')\n\n if T_LISTS.include? type\n check_api_token\n\n unless @current_user\n return 'ERROR'\n end\n\n id = @current_user.theatre_id\n\n if type == 'theatres' && id != 0\n ...
[ "0.70685226", "0.7011513", "0.6773623", "0.67075807", "0.65949965", "0.6562494", "0.65536016", "0.65347576", "0.64803755", "0.6434349", "0.64013046", "0.6395308", "0.6290136", "0.6280743", "0.6252328", "0.6252328", "0.62393916", "0.6214773", "0.6202415", "0.6193779", "0.61319...
0.7718533
0
A list of all tables in the db
def tables db_connection.select_values("show tables") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tables\n execute(\"SHOW TABLES FROM #{@opts[:database]}\")\n .map{ |i| i.values }\n .reduce(:+)\n .map{ |i| i.to_sym }\n end", "def tables()\n tables = []\n @client.query(\"SHOW TABLES;\").each do |table|\n tables.push(table.values[0...
[ "0.8499479", "0.83081716", "0.81848574", "0.81427336", "0.80861485", "0.80534613", "0.7979202", "0.7953699", "0.79384804", "0.79357654", "0.7846949", "0.7829539", "0.7824308", "0.7812821", "0.78055245", "0.77726704", "0.7763799", "0.7755373", "0.7754824", "0.77542955", "0.769...
0.84634954
1
A list of all columns for table
def columns_for(table) db_connection.select_values("show columns from `#{ table }`") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_columns\n columns\n end", "def table_columns\n klass.column_names\n end", "def all\n __getobj__.column_names\n end", "def get_table_column_names(table)\r\n @db[table].columns\r\n end", "def columns(table_name)\n @db.table_info(table_name).map { |info| info[\"name...
[ "0.8558935", "0.80598795", "0.7951822", "0.7878924", "0.7862773", "0.78619456", "0.78464586", "0.7842156", "0.78395635", "0.78395635", "0.7834244", "0.7816846", "0.7771062", "0.7770335", "0.7751243", "0.77316546", "0.7706285", "0.7704942", "0.7699515", "0.76968247", "0.769595...
0.8322581
1
GET /married_statuses GET /married_statuses.json
def index @married_statuses = MarriedStatus.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end", "def set_married_status\n @married_status = MarriedStatus.find(params[:id])\n end", "def show_status(status_id)\n get \"statuses/show/#{status_id}\"\n end", "def update\n respond_to do |forma...
[ "0.64134794", "0.63754165", "0.59984237", "0.595277", "0.59112424", "0.5827594", "0.5805667", "0.5798412", "0.57732296", "0.56787175", "0.5674036", "0.56538707", "0.56222755", "0.56222755", "0.56143117", "0.55412096", "0.55409783", "0.55313104", "0.5514922", "0.5490368", "0.5...
0.7358902
0
GET /married_statuses/1 GET /married_statuses/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @married_statuses = MarriedStatus.all\n end", "def show_status(status_id)\n get \"statuses/show/#{status_id}\"\n end", "def statuses\n Sifter.\n get(\"/api/statuses\").\n parsed_response[\"statuses\"]\n end", "def set_married_status\n @married_status = MarriedStatus.fin...
[ "0.7028147", "0.6499806", "0.642677", "0.6307701", "0.61127007", "0.59730375", "0.59716785", "0.59531933", "0.59261584", "0.5906872", "0.58738357", "0.585114", "0.58212036", "0.58149934", "0.5803932", "0.5800421", "0.5783163", "0.5762086", "0.5734228", "0.5734228", "0.5723452...
0.0
-1
POST /married_statuses POST /married_statuses.json
def create @married_status = MarriedStatus.new(married_status_params) respond_to do |format| if @married_status.save format.html { redirect_to @married_status, notice: 'Married status was successfully created.' } format.json { render :show, status: :created, location: @married_status } else format.html { render :new } format.json { render json: @married_status.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def married_status_params\n params.require(:married_status).permit(:name)\n end", "def create_statuses\n end", "def create_statuses\n end", "def index\n @married_statuses = MarriedStatus.all\n end", "def set_married_status\n @married_status = MarriedStatus.find(params[:id])\n end", ...
[ "0.647825", "0.6294594", "0.6294594", "0.6277677", "0.6146193", "0.59509134", "0.58110416", "0.5783689", "0.57458234", "0.56536686", "0.56203765", "0.55974174", "0.5560564", "0.55356175", "0.551086", "0.55105096", "0.5473909", "0.54488045", "0.54235417", "0.53783315", "0.5369...
0.6917205
0
PATCH/PUT /married_statuses/1 PATCH/PUT /married_statuses/1.json
def update respond_to do |format| if @married_status.update(married_status_params) format.html { redirect_to @married_status, notice: 'Married status was successfully updated.' } format.json { render :show, status: :ok, location: @married_status } else format.html { render :edit } format.json { render json: @married_status.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @current_statuses.update(current_statuses_params)\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_statuses }\n else\n format...
[ "0.6699571", "0.6523629", "0.65057445", "0.6272926", "0.62283516", "0.6162448", "0.6126403", "0.6071017", "0.6068237", "0.60560423", "0.604338", "0.60276586", "0.60276586", "0.6022956", "0.6012158", "0.5965091", "0.59637815", "0.593372", "0.5921117", "0.5921117", "0.59066504"...
0.7180156
0
DELETE /married_statuses/1 DELETE /married_statuses/1.json
def destroy @married_status.destroy respond_to do |format| format.html { redirect_to married_statuses_url, notice: 'Married status was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_status(status_id)\n delete \"statuses/destroy/#{status_id}\"\n end", "def delete_status(id)\n delete(\"/statuses/#{id}\")\n end", "def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url }\n format.json { head :no_content }\n ...
[ "0.7316664", "0.7198055", "0.7114044", "0.7109347", "0.7086772", "0.707513", "0.7041838", "0.7009426", "0.6996029", "0.6927694", "0.6922116", "0.6827844", "0.68117946", "0.6797788", "0.6797788", "0.67199755", "0.6717694", "0.6704238", "0.6693786", "0.6670758", "0.6669584", ...
0.7700158
0
Use callbacks to share common setup or constraints between actions.
def set_married_status @married_status = MarriedStatus.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def married_status_params params.require(:married_status).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981537", "0.67835593", "0.6748275", "0.67436063", "0.6736311", "0.65937173", "0.6503359", "0.6498499", "0.6482832", "0.6478776", "0.645703", "0.6439998", "0.63802195", "0.6377008", "0.6366287", "0.632018", "0.63016284", "0.63011277", "0.62932974", "0.62919617", "0.6290564...
0.0
-1
Build Apartments using their description and features. Get HTML, then parse it and collect parameters.
def build(apartment_url) @apartment = Nokogiri::HTML(Net::HTTP.get(URI(apartment_url))) description = apartment_description features = apartment_features description['apartment_features'] = features Apartments.new(description) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\n if params[:sample]\n analyse = Ca::Analyse.new(HTMLReader.instance.page(params[:sample][:address]));\n end\n if params[:text]\n analyse = Ca::Analyse.new(params[:text][:content]);\n end\n descript = analyse.description\n @problems = descript.problems\n @text = de...
[ "0.5359373", "0.53573185", "0.52481955", "0.52323633", "0.5228217", "0.5209506", "0.5098252", "0.50677514", "0.505511", "0.505511", "0.505511", "0.5024265", "0.49952686", "0.49942705", "0.49534038", "0.49341407", "0.49321362", "0.49249387", "0.4918939", "0.49103743", "0.48976...
0.7131718
0
Makes common apartments description. Hash, based on constant APARTMENT_DESCRIPTION, first merge it, then find unique description
def apartment_description apartment_description = {} apartment_description.merge!(APARTMENT_DESCRIPTION) apartment_description.keys.each { |key| apartment_description[key] = send(apartment_description[key]) } apartment_description end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_info_description(info, val)\n\t\tmerge_info_string(info, 'Description', val)\n\tend", "def merge_description_notes\n src_notes = @src.all_notes\n dest_notes = @dest.all_notes\n src_notes.each_key do |f|\n if dest_notes[f].blank?\n dest_notes[f] = src_notes[f]\n el...
[ "0.58629906", "0.5643776", "0.5629066", "0.55231047", "0.5436626", "0.5427282", "0.53373724", "0.5335062", "0.5315231", "0.53100395", "0.5269072", "0.5264237", "0.52463824", "0.5243661", "0.523188", "0.5208591", "0.52035874", "0.51994884", "0.5180714", "0.5176603", "0.5171239...
0.6304396
0
Makes common apartments features. Hash, based on constant APARTMENT_FEATURES, first merge it, then find unique features
def apartment_features apartment_features = {} apartment_features.merge!(APARTMENT_FEATURES) features_unavailable.each { |feature| apartment_features[feature] = false } apartment_features end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end", "def get_required_features(features)\n features.merge(@features) unless @features.nil?\n end", "def selected_features(activating_contexts, active_contexts)\n concerned = concerned_features(activat...
[ "0.5694013", "0.5694013", "0.54719406", "0.5449497", "0.5445721", "0.54392433", "0.5367435", "0.5349743", "0.53452206", "0.5340121", "0.531569", "0.5293815", "0.52930105", "0.5287015", "0.52672917", "0.52443814", "0.52270395", "0.52179515", "0.5188723", "0.5186548", "0.516943...
0.6113703
0
method that takes 2 args and prints the sum
def sum_these_numbers(a,b) puts a + b end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_sum(num1, num2)\n p num1 + num2\nend", "def calc_sum_two(first, second)\n\n puts \"the sum of #{first} and #{second} is #{first + second}\"\n\nend", "def sum_two(num1, num2)\n p \"#{num1} + #{num2} = #{num1 + num2}\"\nend", "def sum(a, b)\n puts \"Sum total: #{a} + #{b} = #{10 + 20}\"\n\nend", ...
[ "0.8242617", "0.8135315", "0.81145835", "0.7973638", "0.79689616", "0.79239273", "0.7917015", "0.7899012", "0.78814495", "0.78180134", "0.7816875", "0.7777289", "0.7758747", "0.7752694", "0.77397704", "0.77377224", "0.77055234", "0.7689922", "0.7674478", "0.7660498", "0.76384...
0.75571847
25
Writes a method for division and one for addition. Calls upon the return value in the second method.
def divide(a,b) a/b end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_divide; end", "def division (first_number, second_number)\nfirst_number / second_number\nend", "def divide(number_one, number_two)\nnumber_one / number_two\nend", "def divide\n match '/'\n factor\n emit_ln 'MOVE (SP)+,D1'\n emit_ln 'DIVS D1,D0'\nend", "def numerator() end", "def divide(num1,...
[ "0.6588389", "0.64899135", "0.63537985", "0.6314706", "0.63010716", "0.6295089", "0.6290365", "0.62898433", "0.6272394", "0.6244718", "0.6205226", "0.6169197", "0.61394906", "0.6136974", "0.6125868", "0.61156917", "0.6095771", "0.6093122", "0.607734", "0.6053234", "0.6053234"...
0.629748
5
Return VDOE Cluster contact. The contact will respond to name, email, and phone, returning Strings.
def contact @contact ||= OpenStruct.new(get_attr(:contact)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contact\n response[\"contact\"]\n end", "def contact\n ::HubEdos::Common::Reference::Descriptor.new(@data['contact']) if @data['contact']\n end", "def contact\n Zapi::Models::Contact.new\n end", "def contact\n @contact ||= get_contact(@data_object.user...
[ "0.66833985", "0.66090137", "0.65540034", "0.64098597", "0.62773436", "0.6145131", "0.609668", "0.60651255", "0.60434", "0.60434", "0.59495527", "0.59093964", "0.5896344", "0.5817725", "0.5817725", "0.5817725", "0.5817725", "0.5817725", "0.57928205", "0.5744455", "0.56779766"...
0.654526
3
Courses related to the Cluster
def courses @courses ||= CourseList.new(:cluster => slug.gsub('-', ' ')). sort_by { |c| c.title + c.edition }. uniq { |c| c.code + c.edition } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def courses\n [self]\n end", "def courses\n course_list = []\n \n semesters.collect do |semester|\n course_list << semester.cis_courses\n end\n \n course_list << course_bin.cis_courses\n \n return course_list\n end", "def courses\n Content::Courses.new(token: @token)\n ...
[ "0.6577266", "0.64513713", "0.64507455", "0.6379219", "0.63550264", "0.6263102", "0.62602764", "0.6251284", "0.6235173", "0.6113608", "0.60380566", "0.5993471", "0.5989406", "0.5977029", "0.5928846", "0.5905281", "0.5895975", "0.58901745", "0.5882325", "0.5856688", "0.5842029...
0.6826941
0
Store a global content data object as a part of content data keeping service. If type is full flush then content data is saved as it. Otherwise incremental diff of comparison with the latest saved file is calculated and saved. In the later case content data objects containing data regarding added files and removed files is stored in a separate files. If there is no added or/and removed files, then appropreate diff files are not created. NOTE global content data object should be locked for writing while adding it to this service.
def add(is_full_flush) content_data = $local_content_data return if content_data.empty? # for the latest content data added to the DB latest_snapshot = nil # for instances that were added regarding latest_snapshot added_cd = nil # for insrances that were removed regarding latest_snapshot removed_cd = nil latest_index_time = nil content_data.each_instance do |_,_,_,_,_,_,index_time| if latest_index_time.nil? || latest_index_time < index_time.to_i latest_index_time = index_time.to_i end end # Checking time consistency content_data_timestamp = DateTime.from_epoch(latest_index_time) if !@latest_timestamp.nil? && (content_data_timestamp <= @latest_timestamp) # It is possible when instances added at @latest_timestamp # were removed and any new instances addded, # then latest indexed time in the new content data # is earlier then @latest_timestamp # Example: # ContentData for Date1 (noted as latest_snapshot): # Content1 # location1 # location2 # Between Date1 and Date2 location2 was removed # and no other file operations were done. # ContentData for Date2 (noted as content_data): # Content1 # location1 # Then: # content_data.remove_instances(latest_snapshot) is empty. latest_snapshot = get(@latest_timestamp) added_cd = content_data.remove_instances(latest_snapshot) msg = "latest index time of the content data: #{content_data_timestamp}" + "must be later then latest timestamp: #{latest_timestamp}" if added_cd.empty? # In this case we do not know exactly when the indexation was # then the timestamp is fake # TODO better solution? latest_timestamp_epoch = @latest_timestamp.strftime('%s') content_data_timestamp = DateTime.from_epoch(latest_timestamp_epoch.to_i + 1) Log.warning msg else fail msg end end if is_full_flush save(content_data, DiffFile::SNAPSHOT_TYPE, nil, # 'from' param is not relevant for full flush content_data_timestamp) end # If it is not the first content data that we store, # i.e there are already stored content data, # then a diff files are relevant. # NOTE we save diff (added/removed) files even in the case of full flush # cause of data consistency. It is crucial for the diff operation. # Example (simple, without removed): # When: # date1-date2.added # date2-date3.added (added along with a snapshot) # date3.snapshot # date3-date4.added # Then: # ContentDataDb.diff(date2, date4) = date2-date3.added + date3-date4.added if @latest_timestamp.nil? earliest_index_time = nil content_data.each_instance do |_,_,_,_,_,_,index_time| if earliest_index_time.nil? || earliest_index_time > index_time earliest_index_time = index_time end end content_data_from = DateTime.from_epoch(earliest_index_time) save(content_data, DiffFile::ADDED_TYPE, content_data_from, content_data_timestamp) else latest_snapshot ||= get(@latest_timestamp) added_cd ||= content_data.remove_instances(latest_snapshot) unless added_cd.empty? save(added_cd, DiffFile::ADDED_TYPE, @latest_timestamp, content_data_timestamp) end removed_cd = latest_snapshot.remove_instances(content_data) unless removed_cd.empty? save(removed_cd, DiffFile::REMOVED_TYPE, @latest_timestamp, content_data_timestamp) end end @latest_timestamp = content_data_timestamp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_data\n @global_data ||= DataStore.new(File.expand_path(\"global_data.json\", home_path))\n end", "def save(content_data, type, from, till)\n filename = DiffFile.compose_filename(type, from, till)\n path = case type\n when DiffFile::SNAPSHOT_TYPE\n File.join(...
[ "0.5787639", "0.57433087", "0.5566787", "0.55094874", "0.54253364", "0.5327555", "0.53268236", "0.5261412", "0.5210791", "0.51719934", "0.51689905", "0.51689905", "0.51615727", "0.5160665", "0.5109377", "0.5072805", "0.505124", "0.50323355", "0.5016275", "0.49901885", "0.4990...
0.5880467
0
Save content data file in the DB. ContentData DB directories created in the lazy manner, so if they are still absent, they will be created during add content data operation.
def save(content_data, type, from, till) filename = DiffFile.compose_filename(type, from, till) path = case type when DiffFile::SNAPSHOT_TYPE File.join(@snapshots_path, till.year.to_s, filename) when DiffFile::ADDED_TYPE, DiffFile::REMOVED_TYPE File.join(@diffs_path, till.year.to_s, filename) else fail ArgumentError, "Unrecognized type: #{type}" end dirname = File.dirname(path) unless Dir.exist?(dirname) FileUtils.mkdir_p dirname end content_data.to_file(path) filename end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save()\n File.write(@database_file, @data.to_json)\n end", "def save_to_storage\n if save_attachment?\n (db_file || build_db_file).data = temp_data\n db_file.save!\n self.class.update_all ['db_file_id = ?', self.db_file_id = db_file.id], ['id = ?', ...
[ "0.6420183", "0.6406604", "0.6371505", "0.6282888", "0.6026979", "0.59837586", "0.5962015", "0.5962015", "0.5951333", "0.5940295", "0.58668655", "0.58661467", "0.58489925", "0.58402663", "0.5838136", "0.582204", "0.58186257", "0.5813595", "0.580001", "0.5793781", "0.5789255",...
0.57324785
21
Returns a snapshot of instances indexed before (including) provided timestamp.
def get(till = DateTime.now) # looking for the latest base file that is earlier than till argument base = snapshot_files.inject(nil) do |cur_base, f| if (cur_base.nil? || f.same_time_as?(till) || (f.earlier_than?(till) && f.later_than?(cur_base.till))) cur_base = f end cur_base end base_cd = ContentData::ContentData.new base_cd.from_file(base.filename) # applying diff files between base timestamp and till argument diff_from_base = diff(base.till, till) added_content_data = diff_from_base[DiffFile::ADDED_TYPE] removed_content_data = diff_from_base[DiffFile::REMOVED_TYPE] result = base_cd.merge(added_content_data) result.remove_instances!(removed_content_data) result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preceding(obj, timestamp_arg = false)\n if timestamp_arg != true && primary_key_is_int?\n return where(arel_table[primary_key].lt(obj.id)).order(arel_table[primary_key].desc)\n end\n\n obj = obj.send(PaperTrail.timestamp_field) if obj.is_a?(self)\n where(arel_table[PaperTra...
[ "0.60803396", "0.5694255", "0.55965793", "0.55965793", "0.5550635", "0.55179596", "0.54913265", "0.5463175", "0.5459604", "0.5356755", "0.5335492", "0.53346974", "0.533032", "0.5284458", "0.5280035", "0.5266561", "0.52608395", "0.5223791", "0.5218488", "0.52169335", "0.521208...
0.0
-1
Diff between two timestamps.
def diff(from, till = DateTime.now) if from.nil? err_msg = 'from parameter should be defined. Did you mean a get method?' fail ArgumentError, err_msg end diff_files_in_range = diff_files.select do |df| df.later_than?(from) && (df.earlier_than?(till) || df.same_time_as?(till)) end added_content_data = ContentData::ContentData.new removed_content_data = ContentData::ContentData.new # diff files sorted by date to enable correct processing of files # that were changed few times between the timestamps, # thus resulted revision is indeed latest revision. diff_files_in_range.sort!.each do |df| cd = ContentData::ContentData.new cd.from_file(df.filename) if df.type == DiffFile::ADDED_TYPE added_content_data.merge!(cd) elsif df.type == DiffFile::REMOVED_TYPE removed_content_data.merge!(cd) end end { DiffFile::REMOVED_TYPE => removed_content_data, DiffFile::ADDED_TYPE => added_content_data } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_diff\n diff = (@start_at and @end_at) ? @end_at.to_time - @start_at.to_time : 0\n diff.round.to_i\n end", "def time_diff\n return ((time_2 - time_1) / 3600).round\n end", "def timeDifference\n receive_timestamp-@startTime\n end", "def timestamp_delta\n @ti...
[ "0.73357546", "0.72436374", "0.711391", "0.7014129", "0.6795968", "0.65606296", "0.655958", "0.64303714", "0.64100695", "0.6349768", "0.6255267", "0.62479687", "0.6245177", "0.62373", "0.6197899", "0.61782825", "0.61694765", "0.61478966", "0.61191404", "0.60989463", "0.608031...
0.0
-1
Use this to call any builtin object methods that are masked by ImmutableProxy's builtin object methods.
def send_to_target(name, *args, &block) raise "Mutable methods not allowed" unless allowed?(name) @target.__send__(name, *args, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unboring_instance_methods\n if [::BasicObject,::Object,::Kernel].include? self\n self.instance_methods\n # elsif [Class,Module].include? self\n # self.instance_methods - Object.instance_methods\n else\n self.instance_methods - (::Object.instance_methods - self.local_instance_methods)\n ...
[ "0.61126834", "0.5994068", "0.5979825", "0.59736365", "0.59670377", "0.5911224", "0.5899633", "0.58934534", "0.58731234", "0.58501977", "0.58149904", "0.57679796", "0.57244265", "0.57203865", "0.5716093", "0.57036877", "0.5686787", "0.5656572", "0.5639709", "0.56335324", "0.5...
0.0
-1
and returns true if the string includes all the letters in the alphabet and false otherwise "the quick brown fox jumps over the lazy dog"
def string_has_all_letters(str) result = {} str.each_char do |c| return true if result.length == 26 if c == " " next elsif !result.include?(c) result[c] = c end end result.length == 26 ? true : false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_letters? str\r\n str[/[a-zA-z]+/] == str\r\nend", "def letters?(word)\n\t\t# Split word and check if each letter is within the range a-z\n\t\tword.split('').each do |letter| # Use each loop as it is slightly better in performance, 'letter' iterator is encapsulated in a way that it cannot be accessed bey...
[ "0.8151747", "0.76416415", "0.7584866", "0.7579621", "0.75392896", "0.7463846", "0.7459924", "0.74596894", "0.73800147", "0.7341007", "0.7337289", "0.7306161", "0.73020756", "0.7297379", "0.7256316", "0.7241348", "0.7197539", "0.7149373", "0.7136688", "0.7136688", "0.7136688"...
0.7732584
1
Retourne le premier mot
def first_word (a) return a.split[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def motto; end", "def Pot\n exp1, msg = self.Primario\n if exp1 then\n if @token.get_tipo == \"^\" then\n op, msg = le(\"^\")\n if op\n exp2, msg = self.Fator\n if exp2 then\n return Hash[\"tag\" =...
[ "0.63641864", "0.6079449", "0.58775055", "0.5490274", "0.54848814", "0.5482", "0.54228705", "0.5412627", "0.54090995", "0.5408171", "0.5401835", "0.53941286", "0.538468", "0.5331964", "0.53057104", "0.53020376", "0.527282", "0.52647406", "0.52609843", "0.5253508", "0.5251829"...
0.0
-1
Mettre une majuscule // Bug //
def titleize(a) word = a.split phrase = "" if word[1].empty? return a.split[0] else word.each do |element| phrase = phrase + element.capitalize + "" return phrase end else end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def marquer!\n fail \"Doit etre defini dans la sous-classe\"\n end", "def mambo_no_5; end", "def mi_carrera\n\n\tend", "def schumann; end", "def suivre; end", "def minor; end", "def minor; end", "def minor; end", "def celebrity; end", "def celebrity; end", "def celebration; end", "def mal...
[ "0.6316823", "0.61429083", "0.60477185", "0.5976003", "0.5945212", "0.59011716", "0.59011716", "0.59011716", "0.5892193", "0.5892193", "0.58853245", "0.5699722", "0.5673872", "0.5654073", "0.56159574", "0.5498585", "0.5498479", "0.54802686", "0.54697686", "0.54601276", "0.543...
0.0
-1
Copied over code and then added w/ extra current user only condition.
def collection if params[:deleted] == 'on' base_variant_scope ||= super.with_deleted else base_variant_scope ||= super end search = Spree::Config.variant_search_class.new(params[:variant_search_term], scope: base_variant_scope) @collection = search.results.includes(variant_includes).page(params[:page]).per(Spree::Config[:admin_variants_per_page]) @collection = @collection.where(user_id: spree_current_user.try(:id) ) if spree_current_user && !spree_current_user.admin? @collection end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applies_to?(user); false end", "def current_user\n # super: don't change anything, i just want the exact same behavior \n # as in the method that we are overriding\n\n # what this line means is that if the user is logged in, super is true,\n # then call super treat everything n...
[ "0.6458769", "0.63881606", "0.6372016", "0.6280778", "0.62759703", "0.6185129", "0.6178637", "0.612089", "0.61104846", "0.6082802", "0.60506845", "0.6046031", "0.60411066", "0.6038733", "0.6010903", "0.6007372", "0.6007372", "0.5996541", "0.5981947", "0.5977512", "0.59721637"...
0.0
-1
Check a relation tuple To learn how relation tuples and the check works, head over to [the documentation](../concepts/relationtuples.mdx).
def get_check(namespace, object, relation, opts = {}) data, _status_code, _headers = get_check_with_http_info(namespace, object, relation, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_relation_literal!(heading, tuples, raise_on_error = true)\n if Array === tuples\n invalid = tuples.find{|t| !valid_tuple_literal?(heading, t)}\n if invalid\n raise_on_error ? raise(::Veritas::RelationMismatchError, \"Invalid tuple #{invalid.inspect} for heading #{headi...
[ "0.7015953", "0.6605728", "0.6361857", "0.6198903", "0.60191625", "0.579029", "0.5698508", "0.5596643", "0.5500909", "0.53615284", "0.5320704", "0.52337974", "0.51784104", "0.51652044", "0.5137385", "0.5097203", "0.5097203", "0.5095431", "0.50804377", "0.5077863", "0.5056793"...
0.0
-1
Check a relation tuple To learn how relation tuples and the check works, head over to [the documentation](../concepts/relationtuples.mdx).
def get_check_with_http_info(namespace, object, relation, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ReadApi.get_check ...' end # verify the required parameter 'namespace' is set if @api_client.config.client_side_validation && namespace.nil? fail ArgumentError, "Missing the required parameter 'namespace' when calling ReadApi.get_check" end # verify the required parameter 'object' is set if @api_client.config.client_side_validation && object.nil? fail ArgumentError, "Missing the required parameter 'object' when calling ReadApi.get_check" end # verify the required parameter 'relation' is set if @api_client.config.client_side_validation && relation.nil? fail ArgumentError, "Missing the required parameter 'relation' when calling ReadApi.get_check" end # resource path local_var_path = '/check' # query parameters query_params = opts[:query_params] || {} query_params[:'namespace'] = namespace query_params[:'object'] = object query_params[:'relation'] = relation query_params[:'subject_id'] = opts[:'subject_id'] if !opts[:'subject_id'].nil? query_params[:'subject_set.namespace'] = opts[:'subject_set_namespace'] if !opts[:'subject_set_namespace'].nil? query_params[:'subject_set.object'] = opts[:'subject_set_object'] if !opts[:'subject_set_object'].nil? query_params[:'subject_set.relation'] = opts[:'subject_set_relation'] if !opts[:'subject_set_relation'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetCheckResponse' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"ReadApi.get_check", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ReadApi#get_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_relation_literal!(heading, tuples, raise_on_error = true)\n if Array === tuples\n invalid = tuples.find{|t| !valid_tuple_literal?(heading, t)}\n if invalid\n raise_on_error ? raise(::Veritas::RelationMismatchError, \"Invalid tuple #{invalid.inspect} for heading #{headi...
[ "0.70170575", "0.6604974", "0.6361968", "0.6199828", "0.601983", "0.5791429", "0.56987613", "0.5596251", "0.5501244", "0.5362164", "0.53187114", "0.52338684", "0.5177114", "0.5165867", "0.5137209", "0.5097905", "0.5097905", "0.5094715", "0.5081012", "0.5077448", "0.50573194",...
0.0
-1
Expand a Relation Tuple Use this endpoint to expand a relation tuple.
def get_expand(namespace, object, relation, max_depth, opts = {}) data, _status_code, _headers = get_expand_with_http_info(namespace, object, relation, max_depth, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_relation_tuples(opts = {})\n patch_relation_tuples_with_http_info(opts)\n nil\n end", "def create_relation_tuple_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WriteApi.create_relation_tuple ...'\n end\n # r...
[ "0.61490965", "0.59804386", "0.58907497", "0.5821089", "0.5736419", "0.56363285", "0.5592303", "0.54958576", "0.5446701", "0.539018", "0.5334504", "0.5320094", "0.5302275", "0.5155383", "0.51421624", "0.51375866", "0.50912446", "0.50813067", "0.5055887", "0.5038976", "0.50217...
0.45721352
56
Expand a Relation Tuple Use this endpoint to expand a relation tuple.
def get_expand_with_http_info(namespace, object, relation, max_depth, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ReadApi.get_expand ...' end # verify the required parameter 'namespace' is set if @api_client.config.client_side_validation && namespace.nil? fail ArgumentError, "Missing the required parameter 'namespace' when calling ReadApi.get_expand" end # verify the required parameter 'object' is set if @api_client.config.client_side_validation && object.nil? fail ArgumentError, "Missing the required parameter 'object' when calling ReadApi.get_expand" end # verify the required parameter 'relation' is set if @api_client.config.client_side_validation && relation.nil? fail ArgumentError, "Missing the required parameter 'relation' when calling ReadApi.get_expand" end # verify the required parameter 'max_depth' is set if @api_client.config.client_side_validation && max_depth.nil? fail ArgumentError, "Missing the required parameter 'max_depth' when calling ReadApi.get_expand" end # resource path local_var_path = '/expand' # query parameters query_params = opts[:query_params] || {} query_params[:'namespace'] = namespace query_params[:'object'] = object query_params[:'relation'] = relation query_params[:'max-depth'] = max_depth # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ExpandTree' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"ReadApi.get_expand", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ReadApi#get_expand\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_relation_tuples(opts = {})\n patch_relation_tuples_with_http_info(opts)\n nil\n end", "def create_relation_tuple_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: WriteApi.create_relation_tuple ...'\n end\n # r...
[ "0.6148216", "0.597972", "0.58912784", "0.58220965", "0.5735235", "0.5635795", "0.5595332", "0.54948616", "0.54483986", "0.53932273", "0.5336877", "0.5321562", "0.5305559", "0.5154556", "0.51443547", "0.514021", "0.50917137", "0.50810313", "0.5056913", "0.50432634", "0.502316...
0.4332848
98
Query relation tuples Get all relation tuples that match the query. Only the namespace field is required.
def get_relation_tuples(namespace, opts = {}) data, _status_code, _headers = get_relation_tuples_with_http_info(namespace, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_relation_tuples_with_http_info(namespace, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReadApi.get_relation_tuples ...'\n end\n # verify the required parameter 'namespace' is set\n if @api_client.config.client_side_validation && nam...
[ "0.64533687", "0.5897142", "0.58628005", "0.5677368", "0.55983114", "0.555004", "0.555004", "0.5404969", "0.5391372", "0.53506917", "0.5291705", "0.52539784", "0.52229613", "0.51843756", "0.51743656", "0.51691085", "0.5137401", "0.51104915", "0.50819343", "0.50815237", "0.504...
0.70719904
0
Query relation tuples Get all relation tuples that match the query. Only the namespace field is required.
def get_relation_tuples_with_http_info(namespace, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ReadApi.get_relation_tuples ...' end # verify the required parameter 'namespace' is set if @api_client.config.client_side_validation && namespace.nil? fail ArgumentError, "Missing the required parameter 'namespace' when calling ReadApi.get_relation_tuples" end # resource path local_var_path = '/relation-tuples' # query parameters query_params = opts[:query_params] || {} query_params[:'namespace'] = namespace query_params[:'page_token'] = opts[:'page_token'] if !opts[:'page_token'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'object'] = opts[:'object'] if !opts[:'object'].nil? query_params[:'relation'] = opts[:'relation'] if !opts[:'relation'].nil? query_params[:'subject_id'] = opts[:'subject_id'] if !opts[:'subject_id'].nil? query_params[:'subject_set.namespace'] = opts[:'subject_set_namespace'] if !opts[:'subject_set_namespace'].nil? query_params[:'subject_set.object'] = opts[:'subject_set_object'] if !opts[:'subject_set_object'].nil? query_params[:'subject_set.relation'] = opts[:'subject_set_relation'] if !opts[:'subject_set_relation'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetRelationTuplesResponse' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"ReadApi.get_relation_tuples", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ReadApi#get_relation_tuples\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_relation_tuples(namespace, opts = {})\n data, _status_code, _headers = get_relation_tuples_with_http_info(namespace, opts)\n data\n end", "def tuples\n results = run_tuples(@last_query_context.to_sparql_select)\n results[\"results\"][\"bindings\"].map do |h|\n h.keys.each do...
[ "0.70719904", "0.5897142", "0.58628005", "0.5677368", "0.55983114", "0.555004", "0.555004", "0.5404969", "0.5391372", "0.53506917", "0.5291705", "0.52539784", "0.52229613", "0.51843756", "0.51743656", "0.51691085", "0.5137401", "0.51104915", "0.50819343", "0.50815237", "0.504...
0.64533687
1
Check a relation tuple To learn how relation tuples and the check works, head over to [the documentation](../concepts/relationtuples.mdx).
def post_check(opts = {}) data, _status_code, _headers = post_check_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_relation_literal!(heading, tuples, raise_on_error = true)\n if Array === tuples\n invalid = tuples.find{|t| !valid_tuple_literal?(heading, t)}\n if invalid\n raise_on_error ? raise(::Veritas::RelationMismatchError, \"Invalid tuple #{invalid.inspect} for heading #{headi...
[ "0.7015953", "0.6605728", "0.6361857", "0.6198903", "0.60191625", "0.579029", "0.5698508", "0.5596643", "0.5500909", "0.53615284", "0.5320704", "0.52337974", "0.51784104", "0.51652044", "0.5137385", "0.5097203", "0.5097203", "0.5095431", "0.50804377", "0.5077863", "0.5056793"...
0.0
-1
Check a relation tuple To learn how relation tuples and the check works, head over to [the documentation](../concepts/relationtuples.mdx).
def post_check_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ReadApi.post_check ...' end # resource path local_var_path = '/check' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'payload']) # return_type return_type = opts[:debug_return_type] || 'GetCheckResponse' # auth_names auth_names = opts[:debug_auth_names] || [] new_options = opts.merge( :operation => :"ReadApi.post_check", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ReadApi#post_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_relation_literal!(heading, tuples, raise_on_error = true)\n if Array === tuples\n invalid = tuples.find{|t| !valid_tuple_literal?(heading, t)}\n if invalid\n raise_on_error ? raise(::Veritas::RelationMismatchError, \"Invalid tuple #{invalid.inspect} for heading #{headi...
[ "0.70167816", "0.66043293", "0.6362414", "0.6198588", "0.6017634", "0.57891464", "0.56978273", "0.5597392", "0.55021274", "0.5360187", "0.53194505", "0.5232657", "0.51772624", "0.5164011", "0.51385814", "0.50963265", "0.50963265", "0.5095716", "0.50808156", "0.5077837", "0.50...
0.0
-1
Attempts to return the schema from table_name and table_name_prefix
def schema_name return self.table_name.split('.')[0] if self.table_name && self.table_name =~ /\./ return self.table_name_prefix.to_s.gsub(/\./,'') if self.table_name_prefix && self.table_name_prefix =~ /\./ return self.connection.config[:database] if self.connection.mysql? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema_and_table_name\n if qualified_table_name.include? '.'\n schema_name, table_name = qualified_table_name.split('.', 2)\n else\n table_name = qualified_table_name\n schema_name = self.class.default_schema_name\n end\n [schema_name, table_name]\n end", "def extr...
[ "0.7890468", "0.766686", "0.7419078", "0.73171866", "0.71402097", "0.70742774", "0.6926123", "0.6907323", "0.68817", "0.68221694", "0.67872965", "0.6696679", "0.6693215", "0.6641224", "0.662283", "0.6589934", "0.6589023", "0.65569425", "0.652769", "0.6499903", "0.6474521", ...
0.76656115
2
Set the unformatted schema name for the given model / connection class EX: class User 'users_db' User.table_name_prefix => 'users_db.' User.table_name => 'users_db.users'
def schema_name=schema_name self.table_name_prefix = "#{schema_name}." if schema_name && !schema_name.blank? self.table_name = "#{self.table_name_prefix}#{self.table_name}" unless self.abstract_class? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_schema(schema)\n define_class_method(:schema) {schema.to_s.to_sym}\n end", "def schema_name\n return self.table_name.split('.')[0] if self.table_name && self.table_name =~ /\\./\n return self.table_name_prefix.to_s.gsub(/\\./,'') if self.table_name_prefix && self.table_name_prefix =...
[ "0.7063645", "0.665204", "0.6544634", "0.65237355", "0.63980806", "0.63883513", "0.6381655", "0.6375005", "0.6353489", "0.6264394", "0.62488264", "0.62342995", "0.6219615", "0.61584246", "0.60872304", "0.60706234", "0.60491985", "0.60254496", "0.6018481", "0.60173607", "0.600...
0.72890466
0
A place to store managed connections
def managed_connections @@managed_connections end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connections\n @connections ||= {}\n end", "def connections\n @_connections ||= {}\n end", "def connections\n @connections ||= {}\n end", "def connections\n @connections ||= []\n end", "def grab_connections\n connections = []\n connections << @host\n...
[ "0.78580385", "0.7808314", "0.7747195", "0.7455886", "0.6746446", "0.67325324", "0.6642948", "0.66416085", "0.642973", "0.6412615", "0.63878965", "0.633877", "0.63363284", "0.6313833", "0.62448925", "0.6227242", "0.62070274", "0.61570615", "0.6132078", "0.6107775", "0.6078849...
0.77632385
2
Makes a request to the regional api for the URL to a specific server's auction database.
def refreshRealmAPI begin uri = "https://" + @regionURL + "/wow/auction/data/" + @realm + "?locale=#{@locale}" + "&apikey=#{@apikey}" puts uri jsontemp = Yajl::Parser.parse(open(uri)) # Parse JSON to ruby object. @dataURL = jsontemp["files"][0]["url"] @lastModified = Time.at(jsontemp["files"][0]["lastModified"]/1000) puts "Successfully retrived data URL for #{uri}\nURL: #{@dataURL}\nLatest data is from #{@lastModified}" @log.info "Successfully retrived data URL for #{uri}\nURL: #{@dataURL}\nLatest data is from #{@lastModified}" return true rescue => e puts "Failed to get the Auction data URL." @log.error "Failed to get the Auction data URL." puts "Error message from the server:\n\n #{jsontemp}\n\n" @log.error "Error message from the server:\n\n #{jsontemp}\n\n" puts e @log.error e return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_db_master(method, database, master, uuid)\n \n #5.times { puts }\n #puts \"#{method} requested [database] /#{database}/#{master};#{uuid}\"\n \n if database == XDCR_BUCKET \n return [200]\n else\n return [404]\n end\nend", "def edubase_client\n @uri = API_PATH + \"RunQuery/?\"\n...
[ "0.5609157", "0.5608949", "0.54337823", "0.5408552", "0.5359365", "0.5301148", "0.52393365", "0.52278036", "0.5223498", "0.5199291", "0.517414", "0.51336545", "0.5120033", "0.51006985", "0.5059749", "0.5048924", "0.5047501", "0.5018101", "0.49888328", "0.4981478", "0.4977666"...
0.0
-1
Downloads the actual auction database file from a specific server. The fileformat is JSON.
def getAuctionJSON begin json = open(@dataURL).read if !json.include? "ownerRealm" raise "Recieved something unexpected: \n #{json} \n of class: #{json.class}" end return json rescue => e puts "Failed to download the Auction JSON data.\n #{e}" @log.error "Failed to download the Auction JSON data.\n #{e}" return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_file url\n check_session\n result = api_client.execute(:uri => url)\n if result.status == 200\n return result.body\n else\n puts \"An error occurred: #{result.data['error']['message']}\"\n return nil\n ...
[ "0.57935965", "0.5785309", "0.5725889", "0.57110524", "0.5689905", "0.55466974", "0.5521662", "0.55145407", "0.5514303", "0.55055064", "0.5498958", "0.54974514", "0.5487188", "0.54548717", "0.5402494", "0.5394242", "0.5391018", "0.53770953", "0.53466976", "0.5340965", "0.5339...
0.5675986
5
Collects all contained fields.
def all_fields found_fields = Array.new self.fields.each do |field| found_fields << field found_fields = found_fields + field.all_fields if field.type == 'ObjectField' end found_fields end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_fields\n fields.values\n end", "def all_fields\n @fields.values\n end", "def fields\n @fields ||= self.class.fields.collect { |f| f.clone_for(self) }\n end", "def fetch_fields\n @fields\n end", "def fields\n @_fields ||= {}\n end", "def all_fields\n superc...
[ "0.7575919", "0.75224596", "0.7179399", "0.707724", "0.70342255", "0.6961201", "0.69537", "0.69453555", "0.6915724", "0.69142556", "0.69055235", "0.68843734", "0.68843734", "0.68843734", "0.68843734", "0.68843734", "0.68798184", "0.6860387", "0.68035775", "0.6751277", "0.6727...
0.7798035
0
Use callbacks to share common setup or constraints between actions.
def set_pet @pet = Pet.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def pet_params params.require(:pet).permit(:name, :age) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.71230334", "0.70530915", "0.69479465", "0.6902122", "0.67367256", "0.67172784", "0.6689043", "0.66784793", "0.6660117", "0.6555213", "0.6528485", "0.6458438", "0.6452378", "0.6451654", "0.64478326", "0.6433326", "0.6413599", "0.6413599", "0.63907677", "0.63787645", "0.6378...
0.0
-1
GET /documents GET /documents.json
def index @attachments = Attachment.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def documents(params={})\n server.get(\"#{name}/_all_docs\", params)\n end", "def index\n @documents = Document.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end", "def documents\n return bad_request unless params[...
[ "0.7656662", "0.7626486", "0.75327045", "0.7379236", "0.73293954", "0.73293954", "0.73293954", "0.73293954", "0.73293954", "0.73293954", "0.73293954", "0.7327912", "0.73046535", "0.7289063", "0.72620124", "0.7253349", "0.7240533", "0.7154175", "0.7143549", "0.7138256", "0.711...
0.0
-1
GET /documents/1 GET /documents/1.json
def show send_data(@attachment.file_contents, type: @attachment.content_type, filename: @attachment.filename) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n \n @document = Document.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n \n end", "def index\n @documents = Document.all\n\n respond_to do |format|\n format.html # index.html.erb\n form...
[ "0.7391596", "0.73689586", "0.73263764", "0.73263764", "0.73263764", "0.73263764", "0.73263764", "0.73263764", "0.73263764", "0.73170596", "0.7306216", "0.7303724", "0.7286854", "0.72555476", "0.71793205", "0.71743375", "0.71661717", "0.714282", "0.71288323", "0.7051852", "0....
0.0
-1
POST /documents POST /documents.json
def create @attachment = Attachment.new(attachment_params) if file_data.respond_to?(:read) @@world = file_data.read xml_contents = file_data.read elsif file_data.respond_to?(:path) xml_contents = File.read(file_data.path) else logger.error "Bad file_data: #{file_data.class.name}: #{file_data.inspect}" end respond_to do |format| if @attachment.save format.html { redirect_to attachments_path, notice: 'Document was successfully created.' } format.json { render action: 'show', status: :created, location: @attachment } else format.html { render action: 'new' } format.json { render json: @dattachment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, :notice => 'Document was successfully created.' }\n format.json { render :json => @document, :status => :created, :location => @document }\n e...
[ "0.72675", "0.72270125", "0.7202067", "0.7202067", "0.71927583", "0.71516854", "0.7137915", "0.71379024", "0.712435", "0.7049302", "0.68928266", "0.6876889", "0.6837602", "0.6818319", "0.68161947", "0.6751123", "0.67454964", "0.6734003", "0.6723543", "0.66879636", "0.6685973"...
0.0
-1
PATCH/PUT /documents/1 PATCH/PUT /documents/1.json
def update respond_to do |format| if @attachment.update(attachment_params) format.html { redirect_to @attachment, notice: 'Document was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @attachment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n document = Document.find(params[:id])\n document.update!(update_params)\n render json: {}\n end", "def update\n document = Document.find(params[:id])\n if document.update(params_document)\n render json: document, status: 200\n else\n render json: docum...
[ "0.70435137", "0.6930837", "0.6855188", "0.6815346", "0.68135005", "0.67967653", "0.6793707", "0.67770743", "0.67770743", "0.67770743", "0.6773916", "0.67491776", "0.6741166", "0.6725393", "0.67247325", "0.6706539", "0.67052364", "0.66906583", "0.66906583", "0.66906583", "0.6...
0.0
-1
DELETE /documents/1 DELETE /documents/1.json
def destroy @attachment.destroy respond_to do |format| format.html { redirect_to attachments_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n @client.delete_document(@path)\n end", "def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end", "def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond...
[ "0.78232354", "0.761401", "0.7518423", "0.75177574", "0.7488822", "0.7488822", "0.7488822", "0.7488822", "0.7488822", "0.7483412", "0.7483412", "0.7474384", "0.7474384", "0.7474384", "0.7474384", "0.7474384", "0.7474384", "0.7474384", "0.7474384", "0.7474384", "0.74585146", ...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_attachment @attachment = Attachment.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def attachment_params params.require(:attachment).permit(:file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
after dividing the larger number by the smaller number. Division by zero should return NaN. Arguments will both be integers. escribe 'Remainder Function' do it 'Should handle arguments and math as defined in specificaitons' do Test.assert_equals(remainder(17,5), 2, 'Returned value should be the value left over after dividing as much as possible.') Test.assert_equals(remainder(13, 72), remainder(72, 13), 'The order the arguments are passed should not matter.') Test.expect(remainder(1, 0).nil?, 'Divide by zero should return nil') Test.expect(remainder(0, 0).nil?, 'Divide by zero should return nil') end end
def my_remainder(a, b) return nil if a == 0 || b == 0 return a.abs % b.abs if a.abs >= b.abs return b.abs % a.abs if b.abs > a.abs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remainder(arg0)\n end", "def remainder(val); end", "def divmod(arg0)\n end", "def divmod(arg0)\n end", "def get_remainder(num1,num2)\n num1%num2\nend", "def remainder(p0) end", "def dec_remainder_of_two_integers(i_dividend, i_divisor)\n # your code goes here\n dec_remainder_of_two_floats(i_di...
[ "0.76481676", "0.7472466", "0.74267524", "0.74267524", "0.7393483", "0.71505165", "0.71389467", "0.7118643", "0.7096791", "0.698439", "0.69758356", "0.696419", "0.69162863", "0.69068396", "0.6879262", "0.6879262", "0.6877722", "0.6762794", "0.6698192", "0.668713", "0.6686745"...
0.73172474
5
Use callbacks to share common setup or constraints between actions.
def set_pagamento @pagamento = Pagamento.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def pagamento_params params.require(:pagamento).permit(:id, :valor, :state, :data_vencimento, :data_pagamento, :evento_financeiro_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Default method, subclasses must override this
def run super # first, ensure we're fingerprinted require_enrichment opt_max_rate = _get_option("max_rate") results = _masscan_netblock(@entity,[4786],[],opt_max_rate) _log_error "Invalid params" unless results results.each do |r| _log "Result: #{r}" # check to see if it's a smart install enabled device ip_entity = _create_entity "IpAddress", {"name" => r["ip_address"]} _create_network_service_entity(ip_entity,r["port"],r["protocol"],{}) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overrides; end", "def custom; end", "def custom; end", "def default; end", "def default; end", "def private; end", "def special\n override\n end", "def defaults\n super\n end", "def implementation; end", "def implementation; end", "def default\n end", "def defaults; end", ...
[ "0.7415348", "0.73554313", "0.73554313", "0.6991004", "0.6991004", "0.69613177", "0.69572926", "0.6824949", "0.6801543", "0.6801543", "0.67361915", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0.66934764", "0...
0.0
-1
recursively build the tree display
def to_a list = @list lines = [] return lines if list.length < 2 if list[0].is_a? Array left = to_a(list[0]).flatten right = to_a(list[1]).flatten indent = (left + right).collect { |i| i.length }.max all = left[0..(left.length / 2)] left[(left.length / 2 + 1)..-1].each do |i| all << ((i + (" "*indent))[0..(indent-1)] + "|") end all << (" "*indent) + "|---" right[0..(right.length / 2 - 1)].each do |i| all << ((i + (" "*indent))[0..(indent-1)] + "|") end all << right[(right.length / 2)..-1] else return [list[0].to_s, "---", " |---", "---", list[1].to_s] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_tree\n htmltree = \"\"\n self.each { |node| \n htmltree += \"<li><a href='#{normalize(node.name)}'>\"\n htmltree += '&nbsp; ' * node.node_depth * 3\n htmltree += \"#{node.name}</a></li>\\n\"\n }\n htmltree\n end", "def show_tree\n\tend", "def display_tree() ...
[ "0.7314121", "0.71735543", "0.7171269", "0.6967468", "0.6928821", "0.69102544", "0.6896934", "0.68819135", "0.6851404", "0.6805692", "0.67988634", "0.6783851", "0.675101", "0.67384154", "0.6703568", "0.6641606", "0.66398305", "0.66274816", "0.66012764", "0.6561899", "0.656165...
0.0
-1
i = 1 j = 0 while i = 0 list.insert(current1, list[current]) list.delete_at(current+1) current = 1 end end j+=1 end i+=1 end list end
def insertion_sort(arr, &prc) dir = (prc.call(1,2) == -1) ? :ASC : :DESC while true i = 0 j = 1 inserted = false while j < arr.length if dir == :ASC if arr[i] > arr[j] num = arr.delete_at(i) arr.insert(j, num) inserted = true end else if arr[i] < arr[j] num = arr.delete_at(i) arr.insert(j, num) inserted = true end end i += 1 j += 1 end break if !inserted end arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertion_sort(list)\n for i in 1..list.size - 1\n j = i - 1\n while j >=0 and list[j+1] < list[j] # if current < previous\n list[j], list[j+1] = list[j+1], list[j] # swap previous and current values. faster.\n\n# list[j+1] = list[j] --- typical book way. slower.\n j -= 1\n end\n#...
[ "0.71921366", "0.69812787", "0.681147", "0.6775793", "0.66426057", "0.6620658", "0.64684635", "0.6422278", "0.6330906", "0.63046795", "0.6223973", "0.6183446", "0.6178061", "0.615965", "0.6151347", "0.613927", "0.61380535", "0.6102281", "0.6057625", "0.60569406", "0.60525376"...
0.0
-1
We need to define it because of openurl method received
def open object.open end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open?(uri); end", "def URI(url); end", "def consume_url; end", "def openurl(url)\n runcmd 'openurl', url\n end", "def open(url)\n Net::HTTP.get(URI.parse(url))\nend", "def open(url)\n Net::HTTP.get(URI.parse(url))\nend", "def open_url(url)\t\n\t\tputs \"Open url #{url} by creating an op...
[ "0.70443976", "0.6838619", "0.6798097", "0.6742751", "0.6653469", "0.6653469", "0.66116345", "0.65972686", "0.6596559", "0.65895385", "0.65895385", "0.65895385", "0.65895385", "0.65895385", "0.65895385", "0.65895385", "0.65362185", "0.65362185", "0.65362185", "0.65362185", "0...
0.0
-1
before_action :check_review_options, only: [:show] GET /show_search
def show_search @tour = Tour.new @tour.tour_locations.build end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @search_mode = false #true if we came here from a tire search\n @default_tab = 1\n # DG 7/16/15 - commented this out since it no longer applies\n #if (!session[:diameter].blank?)\n # @default_tab = 2\n #else\n # @default_tab = 1\n #end\n\n # we don't currently have an i...
[ "0.6621513", "0.638247", "0.63462746", "0.63395184", "0.6327548", "0.63262004", "0.630805", "0.61938184", "0.617426", "0.6169452", "0.6143272", "0.6129062", "0.6127854", "0.6090672", "0.6058821", "0.60522443", "0.6029703", "0.6023195", "0.60205024", "0.60189414", "0.60008156"...
0.0
-1
GET /tours GET /tours.json
def index if params[:search] @page_title = "List of Tours from filter" # function located above... search_results = search() @tours = search_results[0] @filter = search_results[1] else personalize = params[:my_tours] bookmarked_tours = params[:bookmarked_tours] waitlisted_tours = params[:waitlisted_tours] if personalize if %w[admin agent].include?(current_user.role) @tours = current_user.tours @page_title = "My Tours" elsif current_user.role.eql? 'customer' booked_user_tours = current_user.user_tours.select {|x| x.booked? || x.wait_listed?} @tours = booked_user_tours.map {|ut| Tour.find(ut[:tour_id])} @page_title = "My Tours" end elsif bookmarked_tours bookmarked_user_tours = current_user.user_tours.select {|x| x.bookmarked?} @tours = bookmarked_user_tours.map {|ut| Tour.find(ut[:tour_id])} @page_title = "My Bookmarked Tours" elsif waitlisted_tours waitlisted_user_tours = current_user.user_tours.select {|x| x.wait_listed?} @tours = waitlisted_user_tours.map {|ut| Tour.find(ut[:tour_id])} @page_title = "My Waitlisted Tours" else @tours = Tour.all @page_title = "All Tours" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tours = Tour.all\n end", "def index\n @tours = Tour.all\n end", "def index\n #@tours = Tour.all\n end", "def show\n @tours = Tour.find(params[:id])\n end", "def index\n @tours = Tour.all\n if params[:search]\n @search = TourSearch.new(params[:search])\n @tours =...
[ "0.7661255", "0.7661255", "0.7493558", "0.7369424", "0.7208394", "0.71341306", "0.7035222", "0.69646", "0.6800399", "0.67208934", "0.66991645", "0.6634698", "0.6579901", "0.6518906", "0.65050703", "0.6435392", "0.640606", "0.6384809", "0.63697237", "0.63596994", "0.63517576",...
0.59414524
50