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
Override the accessor: The Jekyll::Rendereer calls document.content, so this seems like the best way to set our "page" content with what we want.
def content zones = {} keys = %w[content preferences] if page['block_instances'].length # create zone buckets page['block_instances'].each do |i| # go through all content if site.config.event? keys.each do |key| i[key].each do |k, v| if placeholder?(v) # maintain the {{ t.foo }} variables v.gsub!(/(\{\{\s*t\.[a-z_.]+\s*\}\})/, '{% raw %}\1{% endraw %}') i[key][k] = render_with_substitutions(v, 'event' => site.data['event'], 'mappable' => site.data['mappable']) end end end unless site.data['mappable'].nil? || site.data['mappable'].empty? perform_substitution!(i, 'mappable' => site.data['mappable']) end end zones[i['zone']] = [] if zones[i['zone']].nil? zones[i['zone']] << i end # sort each bucket by widget weight zones.each do |k, zone| zone.sort! { |x, y| x['weight'] <=> y['weight'] } end end zones.to_json end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content\n return @content if @content\n content, id = self.get_page_content\n content = master.render(content)\n Ruhoh::Converter.convert(content, id)\n end", "def set_resource_content\n @page = Page.available.homepage.first!\n end", "def documentation_content_for(page)\n ...
[ "0.68852824", "0.67624646", "0.67619675", "0.6447814", "0.6438497", "0.6417692", "0.6417692", "0.6417692", "0.6417692", "0.6417692", "0.6417692", "0.63165885", "0.61453617", "0.61395913", "0.6132145", "0.6120535", "0.6111205", "0.608347", "0.6077901", "0.60763055", "0.6067383...
0.0
-1
marking objects for destruction brute force version. Only works if you save parent. Going through each element and destroy it is not very efficient
def mark_children_for_removal work_graphics.each do |work_graphic| work_graphic.destroy end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n #primitives in structs are without parent\n parent and parent.children.delete self\n end", "def destroy\n self.littles.each do | little|\n little.big_id = nil;\n end\n self.positions.each do | pos |\n pos.dke_info_id = nil;\n end\n return super\n end", "def ...
[ "0.6851682", "0.6746977", "0.6646924", "0.65748346", "0.64702755", "0.64254194", "0.63182765", "0.62679046", "0.61741376", "0.61004126", "0.6043362", "0.60281384", "0.6025435", "0.60194993", "0.60027665", "0.59834915", "0.5973925", "0.59564304", "0.59363323", "0.59327054", "0...
0.639375
6
=============================================================================== helper de cadastro
def texto_longo_ecm_new_cadastro_item(form_item, params) view = "" unless params view.concat(text_area :cadastro, "item_#{form_item.id}", options={:cols=>form_item.opcoes[:largura], :rows=>form_item.opcoes[:altura]}) else view.concat(text_area :cadastro, "item_#{form_item.id}", options={:value=>params["item_#{form_item.id}"], :cols=>form_item.opcoes[:largura], :rows=>form_item.opcoes[:altura]}) end return view end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mi_carrera\n\n\tend", "def set_cadastro\n @cadastro = Cadastro.find(params[:id])\n end", "def agregar_compra(producto, unidades = 1)\n DB.execute(\"insert into compras values ( ?, ?)\", producto, unidades)\nend", "def suivre; end", "def diario\n fechas()\n @ejercicios = Ejercicio.find(:a...
[ "0.6171839", "0.59500235", "0.5908083", "0.58400655", "0.58154124", "0.5770937", "0.5720225", "0.56514174", "0.5649546", "0.56271476", "0.56078136", "0.5564297", "0.556201", "0.5546432", "0.55187553", "0.5514774", "0.5500641", "0.5500641", "0.5500641", "0.5492789", "0.5489904...
0.0
-1
Reset counters in seller when change the seller of store
def reset_seller_counters(store) # Reset counter cache to new seller Seller.reset_counters(store.seller_id, :stores) # Recount all stores_count for all sellers tree SellerAppCountWorker.perform_at(1.minutes.from_now, store.seller.id) if store.seller_id_was && Seller.exists?(store.seller_id_was) # Reset counter cache to old seller Seller.reset_counters(store.seller_id_was, :stores) # Recount all stores_count for all sellers tree SellerAppCountWorker.perform_at(1.minutes.from_now, store.seller_id_was) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_counter_cache\n User.reset_counters(@listing.seller_id, :active_listings)\n end", "def hire_seller\r\n\t\t@sellers += 1\r\n\t\tputs \"*\"*50\r\n\t\tputs \"You just hired a new seller, you now have #{@sellers} sellers working for you.\"\r\n\t\tputs \"*\"*50\r\n\tend", "def recount_actives_stores(...
[ "0.68718934", "0.6710743", "0.62266004", "0.59057367", "0.5828847", "0.5812863", "0.58118725", "0.5791982", "0.5791982", "0.5791982", "0.5791982", "0.5791982", "0.5791982", "0.5769071", "0.5741195", "0.56977665", "0.5670078", "0.56671", "0.5660644", "0.5642519", "0.56270856",...
0.8447676
0
Public: Creates a snapshot for a VM. The VM must be running in order to create a snapshot. Snapshot names must be unique. name The desired name of the snapshot. The name must be unique. Examples
def create_snapshot(name) unless exists? return Response.new :code => 1, :message => 'VM does not exist' end running_response = running? return running_response unless running_response.successful? unless running_response.data message = 'The VM must be running in order to take a snapshot.' return Response.new :code => 1, :message => message end conf_file_response = conf_file return conf_file_response unless conf_file_response.successful? snapshots_response = snapshots return snapshots_response unless snapshots_response.successful? if snapshots_response.data.include? name message = "There is already a snapshot named '#{name}'." return Response.new :code => 1, :message => message end command = "#{vmrun_cmd} snapshot " command << "#{conf_file_response.data} \"#{name}\" 2>&1" Response.from_command(`#{command}`) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_snapshot(snapshot_name)\n execute(:create_snapshot, VmId: vm_id, SnapName: snapshot_name)\n end", "def create_snapshot(name)\n Fission::Action::Snapshot::Creator.new(self).create_snapshot(name)\n end", "def create_snapshot(snap_id, snap_name)\n memory_dumps = true\n ...
[ "0.87295747", "0.8101503", "0.7989879", "0.7883372", "0.77501374", "0.73471594", "0.7126852", "0.6777018", "0.6686673", "0.66147506", "0.65359205", "0.6513703", "0.64694715", "0.644606", "0.63948697", "0.6331971", "0.6325482", "0.62572885", "0.6255418", "0.6215297", "0.619974...
0.847478
1
Public: Reverts the VM to the specified snapshot. The snapshot to revert to must exist and the Fusion GUI must not be running. name The snapshot name to revert to. Examples
def revert_to_snapshot(name) unless exists? return Response.new :code => 1, :message => 'VM does not exist' end if Fusion.running? message = 'It looks like the Fusion GUI is currently running. ' message << 'A VM cannot be reverted to a snapshot when the Fusion GUI is running. ' message << 'Exit the Fusion GUI and try again.' return Response.new :code => 1, :message => message end conf_file_response = conf_file return conf_file_response unless conf_file_response.successful? snapshots_response = snapshots return snapshots_response unless snapshots_response.successful? unless snapshots_response.data.include? name message = "Unable to find a snapshot named '#{name}'." return Response.new :code => 1, :message => message end command = "#{vmrun_cmd} revertToSnapshot " command << "#{conf_file_response.data} \"#{name}\" 2>&1" Response.from_command(`#{command}`) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revert_to_snapshot(name)\n raise Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n command = \"#{vmrun_cmd} revertToSnapshot #{vmx_path.shellescape} \\\"#{name}\\\" 2>&1\"\n output = `#{command}`\n\n response = Fission::Response.new :code => $?.exitstatus\n response...
[ "0.8358712", "0.83442545", "0.7905424", "0.7835717", "0.73976845", "0.6691044", "0.6623359", "0.6483487", "0.63131666", "0.6285355", "0.61799955", "0.61680114", "0.6142899", "0.61428314", "0.6123987", "0.6114518", "0.6073976", "0.59369624", "0.5795219", "0.5753843", "0.563419...
0.84456444
0
Public: List the snapshots for a VM. Examples
def snapshots unless exists? return Response.new :code => 1, :message => 'VM does not exist' end conf_file_response = conf_file return conf_file_response unless conf_file_response.successful? command = "#{vmrun_cmd} listSnapshots " command << "#{conf_file_response.data} 2>&1" output = `#{command}` response = Response.new :code => $?.exitstatus if response.successful? snaps = output.split("\n").select { |s| !s.include? 'Total snapshots:' } response.data = snaps.map { |s| s.strip } else response.message = output end response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snapshots\n raise Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n command = \"#{vmrun_cmd} listSnapshots #{vmx_path.shellescape} 2>&1\"\n output = `#{command}`\n\n raise \"There was an error listing the snapshots of #{@name} :\\n #{output}\" unless $?.exitstatus==0\n\...
[ "0.8300678", "0.8081066", "0.80803514", "0.7840411", "0.7684221", "0.74065936", "0.7338083", "0.7323141", "0.7128714", "0.71278566", "0.7087461", "0.7066364", "0.7021482", "0.7017439", "0.7007793", "0.6985959", "0.67653114", "0.6729876", "0.67017585", "0.6624287", "0.6563861"...
0.7795029
4
Public: Starts a VM. The VM must not be running in order to start it. options Hash of options: :headless Boolean which specifies to start the VM without a GUI console. The Fusion GUI must not be running in order to start the VM headless. (default: false) Examples
def start(options={}) unless exists? return Response.new :code => 1, :message => 'VM does not exist' end running_response = running? return running_response unless running_response.successful? if running_response.data return Response.new :code => 1, :message => 'VM is already running' end conf_file_response = conf_file return conf_file_response unless conf_file_response.successful? unless options[:headless].blank? if Fusion.running? message = 'It looks like the Fusion GUI is currently running. ' message << 'A VM cannot be started in headless mode when the Fusion GUI is running. ' message << 'Exit the Fusion GUI and try again.' return Response.new :code => 1, :message => message end end command = "#{vmrun_cmd} start " command << "#{conf_file_response.data} " command << (options[:headless].blank? ? 'gui ' : 'nogui ') command << '2>&1' Response.from_command(`#{command}`) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(options={})\n unless @vm.exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n running_response = @vm.running?\n return running_response unless running_response.successful?\n\n if running_response.data\n retu...
[ "0.8063125", "0.7371226", "0.72947097", "0.6703487", "0.66851383", "0.6637769", "0.63795877", "0.6048234", "0.6026887", "0.60018075", "0.59982306", "0.5958771", "0.59550554", "0.5914051", "0.58915216", "0.5859023", "0.58584094", "0.5856711", "0.5852507", "0.5768819", "0.57680...
0.80328715
1
Public: Stops a VM. The VM must be running in order to stop it. options Hash of options: :hard Boolean which specifies to power off the VM (instead of attempting to initiate a graceful shutdown). This is the equivalent of passing 'hard' to the vmrun stop command. (default: false) Examples
def stop(options={}) unless exists? return Response.new :code => 1, :message => 'VM does not exist' end running_response = running? return running_response unless running_response.successful? unless running_response.data return Response.new :code => 1, :message => 'VM is not running' end conf_file_response = conf_file return conf_file_response unless conf_file_response.successful? command = "#{vmrun_cmd} stop " command << "#{conf_file_response.data} " command << 'hard ' unless options[:hard].blank? command << '2>&1' Response.from_command(`#{command}`) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(options={})\n Fission::Action::VM::Stopper.new(self).stop(options)\n end", "def halt_fusion_vm(options)\n stop_fusion_vm(options)\nend", "def force_stop(options={})\n @state.value = State::STOPPED\n @cartridge_model.create_stop_lock\n @container_plugin.stop(options)\n ...
[ "0.7952278", "0.71565455", "0.6723032", "0.6444872", "0.6229081", "0.62088543", "0.6152392", "0.61098343", "0.60134584", "0.5987258", "0.595926", "0.5947789", "0.58820486", "0.5866406", "0.586381", "0.58149314", "0.5808411", "0.5782733", "0.5781018", "0.577224", "0.57667756",...
0.81308055
0
Public: Suspends a VM. The VM must be running in order to suspend it. Examples
def suspend unless exists? return Response.new :code => 1, :message => 'VM does not exist' end running_response = running? return running_response unless running_response.successful? unless running_response.data return Response.new :code => 1, :message => 'VM is not running' end conf_file_response = conf_file return conf_file_response unless conf_file_response.successful? command = "#{vmrun_cmd} suspend " command << "#{conf_file_response.data} 2>&1" Response.from_command(`#{command}`) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suspend\n execute(\"controlvm\", @uuid, \"savestate\")\n end", "def suspend\n Fission::Action::VM::Suspender.new(self).suspend\n end", "def suspend\n execute_prlctl('suspend', @uuid)\n end", "def suspend\n requires :id\n begin\n response = ...
[ "0.72526103", "0.674012", "0.655616", "0.63345", "0.6240721", "0.62070835", "0.6192826", "0.6139993", "0.6128174", "0.6116592", "0.597085", "0.57992333", "0.57641864", "0.57539874", "0.57539874", "0.5694305", "0.5680789", "0.56572825", "0.5650772", "0.55372185", "0.5509754", ...
0.6477853
3
Public: Provides the MAC addresses for a VM. Examples:
def mac_addresses network_response = network_info return network_response unless network_response.successful? response = Response.new :code => 0 response.data = network_response.data.values.collect { |n| n['mac_address'] } response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_mac_addresses\n read_vm_option('mac').strip.gsub(':', '').split(' ')\n end", "def read_mac_address\n execute(:get_network_mac, VmId: vm_id)\n end", "def mac_address\n mac = nil\n\n ovf.xpath(\"//*[local-name()='Machine']/*[local-name()='Hardware']/*[local-name...
[ "0.7692694", "0.74545956", "0.7099549", "0.70928115", "0.70827186", "0.7019374", "0.6979955", "0.68134606", "0.68021387", "0.67451507", "0.67300785", "0.6715417", "0.6691889", "0.65320915", "0.65040594", "0.65022993", "0.63408506", "0.63189", "0.6315108", "0.63004774", "0.627...
0.72958803
3
Public: Provides the state of the VM. Examples
def state running_response = running? return running_response unless running_response.successful? response = Response.new :code => 0, :data => 'not running' if running_response.data response.data = 'running' else suspended_response = suspended? return suspended_response unless suspended_response.successful? response.data = 'suspended' if suspended_response.data end response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state(vm_name)\n `VBoxManage showvminfo #{vm_name}` =~ /^State:\\s+(.*)$/ ? $1 : 'unknown'\n end", "def read_state\n read_vm_option('status').strip.to_sym\n end", "def get_current_state\n execute(:get_vm_status, VmId: vm_id)\n end", "def read_state\n output ...
[ "0.66668713", "0.66076", "0.6602058", "0.6538977", "0.6533354", "0.64973766", "0.64890385", "0.64790255", "0.64336526", "0.6419743", "0.63984644", "0.63975495", "0.6395126", "0.6390423", "0.6379748", "0.6374456", "0.6364532", "0.6360513", "0.6352875", "0.63508016", "0.6344633...
0.0
-1
Public: Determines if the VM exists or not. This method looks for the VM's conf file ('.vmx') to determine if the VM exists or not. Examples
def exists? conf_file.successful? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists?\n File.exists? vmx_path\n end", "def check_fusion_vm_exists(options)\n set_vmrun_bin(options)\n if options['host-os-name'].to_s.match(/Linux/)\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']\n else\n fusion_vm_dir = options['fusiondir']+\"/\"+options['name']+\".vmwarevm\...
[ "0.7622194", "0.754773", "0.7458194", "0.7458194", "0.72291404", "0.71238846", "0.7053148", "0.69420063", "0.6885644", "0.6843978", "0.68160194", "0.68004954", "0.6784", "0.67590314", "0.6726877", "0.6713914", "0.6643735", "0.66268003", "0.65253115", "0.6507069", "0.64989924"...
0.58102995
43
Public: Determines if a VM is suspended. Examples
def suspended? running_response = running? return running_response unless running_response.successful? response = Response.new :code => 0, :data => false response.data = suspend_file_exists? unless running_response.data response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suspended?\n status.suspended?\n end", "def suspended?\n (status == SUSPENDED)\n end", "def suspended?\n !active?\n end", "def suspended?()\n #This is a stub, used for indexing\n end", "def suspended?\n (status == SUSPEND)\n end", "def is_suspended?\n current_...
[ "0.7707653", "0.7624279", "0.7370699", "0.7369654", "0.73558897", "0.68175644", "0.6817079", "0.6506195", "0.64723384", "0.64467597", "0.63937956", "0.6337369", "0.63169354", "0.63122475", "0.62116605", "0.6162644", "0.615737", "0.6099624", "0.6099624", "0.60401946", "0.60336...
0.630387
14
Public: Determines if a VM has a suspend file ('.vmem') in it's directory. This only looks for a suspend file which matches the name of the VM. Examples
def suspend_file_exists? File.file? File.join(path, "#{@name}.vmem") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suspend\n unless exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n running_response = running?\n return running_response unless running_response.successful?\n\n unless running_response.data\n return Response.new :code => 1, :message => 'V...
[ "0.5882661", "0.5777305", "0.576586", "0.57584304", "0.5748528", "0.5652615", "0.54903674", "0.54500395", "0.54241735", "0.54192775", "0.5355263", "0.5355263", "0.5311403", "0.5243774", "0.5243667", "0.5243667", "0.52360857", "0.52010655", "0.5191226", "0.5185978", "0.5177669...
0.7517683
1
Public: Determines if a VM is running. Examples
def running? all_running_response = self.class.all_running return all_running_response unless all_running_response.successful? response = Response.new :code => 0, :data => false if all_running_response.data.collect { |v| v.name }.include? @name response.data = true end response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running\n\t @vm_running = Virtualmachine.isrunning\n end", "def vm_running?\n `docker-machine ls | grep #{project_config['docker-machine']['name']}` =~ /running/i ? true : false\nend", "def vm_ok?\n unless @vm\n warn 'No VM initialized'\n return false\n end\n inf = vm_info\n...
[ "0.8204294", "0.77401966", "0.7664043", "0.7388182", "0.73449606", "0.7291203", "0.7264888", "0.713769", "0.7125689", "0.712245", "0.70647603", "0.70549226", "0.7054564", "0.69614667", "0.6945672", "0.6945672", "0.6945672", "0.69407046", "0.6922534", "0.6914648", "0.6912643",...
0.0
-1
Public: Determines the path to the VM's config file ('.vmx'). Examples
def conf_file vmx_path = File.join path, "*.vmx" conf_files = Dir.glob vmx_path response = Response.new case conf_files.count when 0 response.code = 1 response.message = "Unable to find a config file for VM '#{@name}' (in '#{vmx_path}')" when 1 response.code = 0 response.data = conf_files.first else if conf_files.include?(File.join(File.dirname(vmx_path), "#{@name}.vmx")) response.code = 0 response.data = File.join(File.dirname(vmx_path), "#{@name}.vmx") else response.code = 1 output = "Multiple config files found for VM '#{@name}' (" output << conf_files.sort.map { |f| "'#{File.basename(f)}'" }.join(', ') output << " in '#{File.dirname(vmx_path)}')" response.message = output end end response.data.gsub! ' ', '\ ' if response.successful? response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vmx_path\n return File.join(path, \"#{@name}.vmx\")\n end", "def path\n File.join Fission.config.attributes['vm_dir'], \"#{@name}.vmwarevm\"\n end", "def path\n File.join Fission.config['vm_dir'], \"#{@name}.vmwarevm\"\n end", "def path\n File.join Fission.config['vm_dir'], \...
[ "0.7842283", "0.775856", "0.7737295", "0.7737295", "0.7139698", "0.70410436", "0.69512856", "0.66847956", "0.666324", "0.65464497", "0.65182424", "0.64154017", "0.63584983", "0.6341152", "0.63227695", "0.6321877", "0.6313751", "0.63087255", "0.62857175", "0.6284578", "0.62738...
0.7224048
4
Public: Provides the expected path to a VM's directory. This does not imply that the VM or path exists. name The name of the VM to provide the path for. Examples
def path File.join Fission.config['vm_dir'], "#{@name}.vmwarevm" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n File.join Fission.config.attributes['vm_dir'], \"#{@name}.vmwarevm\"\n end", "def path(name=nil)\n if name\n return @dir + '/' + name\n else\n return @dir\n end\n end", "def vagrant_box(name)\n result = boxes_path.join(name)\n FileUtils.mkdir_p(result)\n re...
[ "0.6807978", "0.65036577", "0.6354682", "0.6059271", "0.60238516", "0.5988303", "0.5812387", "0.57191455", "0.5660093", "0.5637171", "0.55512977", "0.5549756", "0.55132025", "0.5470299", "0.5448806", "0.5448806", "0.5438736", "0.5437756", "0.5437428", "0.5419269", "0.53777117...
0.68357503
1
Public: Deletes a VM. The VM must not be running in order to delete it. As there are a number issues with the Fusion command line tool for deleting VMs, this is a best effort. The VM must not be running when this method is called. This essentially deletes the VM directory and attempts to remove the relevant entries from the Fusion plist file. It's highly recommended to delete VMs without the Fusion GUI running. If the Fusion GUI is running this method should succeed, but it's been observed that Fusion will recreate the plist data which is deleted. This leads to 'missing' VMs in the Fusion GUI. Examples
def delete unless exists? return Response.new :code => 1, :message => 'VM does not exist' end running_response = running? return running_response unless running_response.successful? if running_response.data message = 'The VM must not be running in order to delete it.' return Response.new :code => 1, :message => message end FileUtils.rm_rf path Metadata.delete_vm_info path Response.new :code => 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n unless @vm.exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n running_response = @vm.running?\n return running_response unless running_response.successful?\n\n if running_response.data\n message = 'The ...
[ "0.783307", "0.7668545", "0.7576776", "0.7350829", "0.71360725", "0.70495564", "0.6981492", "0.6955153", "0.6829678", "0.6660791", "0.6660105", "0.66413295", "0.66387916", "0.65960497", "0.65945834", "0.6533798", "0.64958787", "0.64371127", "0.63971364", "0.6387111", "0.63643...
0.7764674
1
Internal: Helper for getting the configured vmrun_cmd value. Examples
def vmrun_cmd Fission.config['vmrun_cmd'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vmrun_cmd\n Fission.config['vmrun_cmd']\n end", "def vmrun_cmd\n Fission.config['vmrun_cmd']\n end", "def vmrun_cmd\n Fission.config['vmrun_cmd']\n end", "def vmrun_cmd\n Fission.config['vmrun_cmd']\n end", "def vmm_command_line\n retur...
[ "0.8105079", "0.8105079", "0.8105079", "0.8105079", "0.6743608", "0.59995025", "0.58677274", "0.5789821", "0.5727923", "0.5633322", "0.5628246", "0.56238335", "0.5592715", "0.5584428", "0.55658007", "0.5538986", "0.55275685", "0.5470546", "0.5460587", "0.54174024", "0.5414408...
0.8133074
1
GET /issue_areas GET /issue_areas.json
def index @issue_areas = IssueArea.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def areas\n aux = WorkOrderArea.by_name\n render json: serialized_work_order_areas(aux)\n end", "def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n ...
[ "0.70127183", "0.6727345", "0.66888404", "0.6558727", "0.65512115", "0.6534904", "0.64769685", "0.6413627", "0.63966495", "0.63444394", "0.6341734", "0.6323693", "0.630118", "0.62706697", "0.6158841", "0.61516535", "0.6138727", "0.6120565", "0.6110637", "0.609412", "0.6085813...
0.79893744
0
GET /issue_areas/1 GET /issue_areas/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @issue_areas = IssueArea.all\n end", "def set_issue_area\n @issue_area = IssueArea.find(params[:id])\n end", "def area\n popolo.areas.find_by(id: area_id)\n end", "def create\n @issue_area = IssueArea.new(issue_area_params)\n\n respond_to do |format|\n if @issue_are...
[ "0.7761095", "0.6578399", "0.6543199", "0.6533289", "0.6496538", "0.646605", "0.6439099", "0.6422843", "0.64179593", "0.640564", "0.6398376", "0.6366962", "0.6359093", "0.6271248", "0.6251754", "0.6250936", "0.6235553", "0.619187", "0.6141472", "0.6131239", "0.60808593", "0...
0.0
-1
POST /issue_areas POST /issue_areas.json
def create @issue_area = IssueArea.new(issue_area_params) respond_to do |format| if @issue_area.save format.html { redirect_to @issue_area, notice: 'Issue area was successfully created.' } format.json { render :show, status: :created, location: @issue_area } else format.html { render :new } format.json { render json: @issue_area.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end", "def index\n @issue_areas = IssueArea.all\n end", "def issue_area_params\n params.req...
[ "0.6930734", "0.6652359", "0.6537024", "0.6382811", "0.62683016", "0.62683016", "0.6191356", "0.6113902", "0.60869265", "0.6041581", "0.59948945", "0.5951343", "0.58914816", "0.58670884", "0.58535504", "0.5826219", "0.58185035", "0.5800887", "0.5790258", "0.5739498", "0.57390...
0.74074733
0
PATCH/PUT /issue_areas/1 PATCH/PUT /issue_areas/1.json
def update respond_to do |format| if @issue_area.update(issue_area_params) format.html { redirect_to @issue_area, notice: 'Issue area was successfully updated.' } format.json { render :show, status: :ok, location: @issue_area } else format.html { render :edit } format.json { render json: @issue_area.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @area = Area.find(params[:id])\n\n respond_to do |format|\n if @area.update_attributes(params[:area])\n format.html { redirect_to @area, notice: 'Area was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n...
[ "0.6479621", "0.6479621", "0.6479621", "0.63736206", "0.6260628", "0.6223009", "0.61924714", "0.61846274", "0.6142388", "0.6111292", "0.61105484", "0.6103904", "0.5962165", "0.5955237", "0.59473336", "0.59217215", "0.5919821", "0.58968246", "0.5896768", "0.5896302", "0.588780...
0.72290885
0
DELETE /issue_areas/1 DELETE /issue_areas/1.json
def destroy @issue_area.destroy respond_to do |format| format.html { redirect_to issue_areas_url, notice: 'Issue area was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.html { redirect_to areas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @area = Area.find(params[:id])\n @area.destroy\n\n respond_to do |format|\n format.h...
[ "0.7194692", "0.7194692", "0.7194692", "0.7048286", "0.69548094", "0.69177425", "0.6882465", "0.6877776", "0.6877776", "0.6862402", "0.6862246", "0.68579644", "0.685396", "0.684552", "0.6825438", "0.68250924", "0.682498", "0.6789736", "0.6783404", "0.677249", "0.6748169", "...
0.7535661
0
Use callbacks to share common setup or constraints between actions.
def set_issue_area @issue_area = IssueArea.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 issue_area_params params.require(:issue_area).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.6978086", "0.6780264", "0.6742658", "0.6738813", "0.67338693", "0.65908474", "0.6501793", "0.6495506", "0.64796513", "0.64755446", "0.6454826", "0.6437561", "0.6377127", "0.63722163", "0.6364058", "0.63178706", "0.62979764", "0.62968165", "0.62913024", "0.6289789", "0.6289...
0.0
-1
The following line would run the calculate function calculate(1,1)
def prompt_numbers puts "Give me a number" a = gets.chomp.to_f puts "Give me another number" b = gets.chomp.to_f return a, b end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculation\n end", "def calculate\n (2 + 2) * 2\nend", "def calculate!\n calculate_amount\n calculate_fee\n calculate_insurance\n calculate_deposit\n end", "def calculate(a,b,c)\n s = a * b* c \n end", "def add(x,y)\n total = x + y\n puts total\n calculate(total)\nend", "def cal...
[ "0.74688274", "0.74355286", "0.7231579", "0.70753103", "0.69653946", "0.6760296", "0.6726776", "0.6715163", "0.6704213", "0.6692412", "0.667871", "0.66573507", "0.662741", "0.6613849", "0.66029924", "0.65868723", "0.6584611", "0.6552796", "0.6539509", "0.6469822", "0.6452766"...
0.0
-1
This function runs two other functions that prompt the user for input
def prompt function = prompt_function a, b = prompt_numbers return a, b, function end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_input(prompt); end", "def another_function()\n prompt = '@#$!%'\n print \"How old are you? \"\n print prompt\n age = $stdin.gets.chomp\n print \"How tall are you? \"\n print prompt\n height = $stdin.gets.chomp\n print \"How much do you weight?\"\n puts prompt\n weight = ...
[ "0.7458676", "0.7297848", "0.7268164", "0.7191035", "0.71856666", "0.7178354", "0.71561", "0.7130122", "0.7125505", "0.7123631", "0.71206594", "0.7100177", "0.7100177", "0.7100177", "0.7100177", "0.70945466", "0.7042461", "0.7015035", "0.70139223", "0.69977903", "0.69977903",...
0.682595
54
Add param to filters
def add_filter_param(param, value) @mg_params[filter_param_name.to_sym][param] = value unless @mg_params[filter_param_name.to_sym].key?(param) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_filters(filters); end", "def add_filter\n @filter = true \n end", "def add_filter(filter)\n @filters << filter\n end", "def add_filter(filter_symbol)\n filters << filter_symbol\n end", "def add_filter(filter_argument = T.unsafe(nil), &filter_proc); end", "def to_param\n \"fil...
[ "0.7667878", "0.73295593", "0.7155153", "0.7059293", "0.70547163", "0.7017768", "0.701622", "0.69522434", "0.6847494", "0.68402976", "0.67480344", "0.67480344", "0.67368716", "0.6736221", "0.6734661", "0.6734661", "0.6715528", "0.6713427", "0.66717345", "0.6602613", "0.656823...
0.83977306
0
Get filter name by field
def get_filter_name(field, model = nil) field_name = model.present? ? "#{model.table_name}.#{field}" : field "#{name}[#{filter_param_name}][#{field_name}]" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_name\n if filters.one?\n filters.keys.first.to_s\n else\n filters.keys.join('_and_')\n end\n end", "def field_name(field=nil)\n result = field_name_fragment\n result << \"[#{field}]\" if field\n result\n end", "def field_na...
[ "0.7092277", "0.70194924", "0.6902115", "0.67540735", "0.66454047", "0.662417", "0.65781116", "0.65339345", "0.648112", "0.6452713", "0.63599074", "0.6355486", "0.6303464", "0.6282133", "0.6263003", "0.61842185", "0.61584145", "0.6101875", "0.61001", "0.6095226", "0.59746104"...
0.85356957
0
Thinking Sphinx apply filters
def ts_apply_filters # TODO: Make filters for Thinking Sphinx end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filters; end", "def filters; end", "def index \n\n ...\r\n \r\n #add/remove any selected filters\n selected_filter_conditions(Widget)\n\n @widgets = Widget.find(:all,{}, {:conditions => @conditions, :include => @included}) \n \n # This can be combined with any named scopes eg \n # @wid...
[ "0.6395649", "0.6395649", "0.6394962", "0.6393056", "0.6343207", "0.6331165", "0.6331165", "0.62281", "0.61923224", "0.6096554", "0.60748357", "0.60746837", "0.604416", "0.60266453", "0.60153943", "0.6001512", "0.5982304", "0.597698", "0.5964869", "0.5903267", "0.5897382", ...
0.8029215
0
Following solution is optimized for time, but not space O(n) time complexity O(n) space complexity
def kth_to_last(head, k) count = 0 current_node = head node_hash = {} while current_node node_hash[count] = current_node count += 1 current_node = current_node.next end node_hash[node_hash.keys.size - k].value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n...
[ "0.72011554", "0.68064815", "0.6800744", "0.6755844", "0.6687568", "0.66418976", "0.6629113", "0.6614764", "0.66100013", "0.6604537", "0.65870476", "0.6581771", "0.65489805", "0.65482247", "0.6546301", "0.6541277", "0.65363646", "0.65175325", "0.6500247", "0.6492299", "0.6488...
0.0
-1
The following is optimized for time and space O(n) time complexity 0(1) space complexity
def kth_to_last_space_optimized(head, k) count = 1 current_node = head while current_node count += 1 current_node = current_node.next end current_node = head target = count - k count = 1 while current_node return current_node.value if count == target count += 1 current_node = current_node.next end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))...
[ "0.70928335", "0.6901146", "0.66407204", "0.6599523", "0.657768", "0.6498791", "0.6490742", "0.6478487", "0.64626044", "0.6419806", "0.64079374", "0.6394649", "0.6379443", "0.636823", "0.636227", "0.6349882", "0.63466394", "0.63365704", "0.6320437", "0.63151544", "0.63094366"...
0.0
-1
Convert CFPropertyList to binary format; since we have to count our objects we simply unique CFDictionary and CFArray
def to_str(opts={}) @unique_table = {} @count_objects = 0 @string_size = 0 @int_size = 0 @misc_size = 0 @object_refs = 0 @written_object_count = 0 @object_table = [] @object_ref_size = 0 @offsets = [] binary_str = "bplist00" unique_and_count_values(opts[:root]) @count_objects += @unique_table.size @object_ref_size = Binary.bytes_needed(@count_objects) file_size = @string_size + @int_size + @misc_size + @object_refs * @object_ref_size + 40 offset_size = Binary.bytes_needed(file_size) table_offset = file_size - 32 @object_table = [] @written_object_count = 0 @unique_table = {} # we needed it to calculate several values, but now we need an empty table opts[:root].to_binary(self) object_offset = 8 offsets = [] 0.upto(@object_table.size-1) do |i| binary_str += @object_table[i] offsets[i] = object_offset object_offset += @object_table[i].bytesize end offsets.each do |offset| binary_str += Binary.pack_it_with_size(offset_size,offset) end binary_str += [offset_size, @object_ref_size].pack("x6CC") binary_str += [@count_objects].pack("x4N") binary_str += [0].pack("x4N") binary_str += [table_offset].pack("x4N") return binary_str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_plist\n @attributes.to_plist\n end", "def to_plist\n attributes.to_plist\n end", "def dict_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"d\",val.value.size) # d=1101, type indicator for dictionary\n...
[ "0.6139177", "0.60764384", "0.60576075", "0.5864793", "0.57980335", "0.57768667", "0.5773309", "0.56523263", "0.5488065", "0.5468661", "0.5372827", "0.534327", "0.5326962", "0.5317539", "0.528196", "0.5281396", "0.5261453", "0.52338505", "0.51893896", "0.51809084", "0.5177891...
0.5590915
8
read a binary int value
def read_binary_int(fname,fd,length) raise CFFormatError.new("Integer greater than 8 bytes: #{length}") if length > 3 nbytes = 1 << length val = nil buff = fd.read(nbytes) case length when 0 then val = buff.unpack("C") val = val[0] when 1 then val = buff.unpack("n") val = val[0] when 2 then val = buff.unpack("N") val = val[0] when 3 hiword,loword = buff.unpack("NN") val = hiword << 32 | loword end return CFInteger.new(val); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_int\n return @as_int unless @as_int.nil?\n _pos = @_io.pos\n @_io.seek(0)\n @as_int = @_io.read_u2be\n @_io.seek(_pos)\n @as_int\n end", "def read_int(offset, stream = @index)\n stream.seek(offset)\n stream.read(4).unpack('L')[0]\n end", "def r...
[ "0.7664172", "0.75506127", "0.74316055", "0.7430628", "0.732355", "0.72860515", "0.72324526", "0.715396", "0.70769686", "0.7073567", "0.7015265", "0.70132434", "0.7009441", "0.69623375", "0.6928583", "0.6905657", "0.6901286", "0.68502516", "0.6789339", "0.6773747", "0.6761497...
0.7823983
0
read a binary real value
def read_binary_real(fname,fd,length) raise CFFormatError.new("Real greater than 8 bytes: #{length}") if length > 3 nbytes = 1 << length val = nil buff = fd.read(nbytes) case length when 0 then # 1 byte float? must be an error raise CFFormatError.new("got #{length+1} byte float, must be an error!") when 1 then # 2 byte float? must be an error raise CFFormatError.new("got #{length+1} byte float, must be an error!") when 2 then val = buff.reverse.unpack("f") val = val[0] when 3 then val = buff.reverse.unpack("d") val = val[0] end return CFReal.new(val) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def real_to_binary(val)\n bdata = Binary.type_bytes(\"2\",3) # 2 is 0010, type indicator for reals\n buff = [val].pack(\"d\")\n return bdata + buff.reverse\n end", "def read_bignum; end", "def binary_value\n\t\treturn self.value.unpack( 'm' ).first\n\tend", "def read_int64; end", "def rea...
[ "0.71810484", "0.70387715", "0.68851215", "0.67749465", "0.6718428", "0.65083176", "0.63742584", "0.6350838", "0.6321549", "0.63113016", "0.63111025", "0.62680936", "0.626058", "0.6202346", "0.6136513", "0.6136513", "0.6105215", "0.60897", "0.6017096", "0.6011622", "0.5988135...
0.783559
0
read a binary date value
def read_binary_date(fname,fd,length) raise CFFormatError.new("Date greater than 8 bytes: #{length}") if length > 3 nbytes = 1 << length val = nil buff = fd.read(nbytes) case length when 0 then # 1 byte CFDate is an error raise CFFormatError.new("#{length+1} byte CFDate, error") when 1 then # 2 byte CFDate is an error raise CFFormatError.new("#{length+1} byte CFDate, error") when 2 then val = buff.reverse.unpack("f") val = val[0] when 3 then val = buff.reverse.unpack("d") val = val[0] end return CFDate.new(val,CFDate::TIMESTAMP_APPLE) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_date; end", "def date_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n val = val.getutc.to_f - CFDate::DATE_DIFF_APPLE_UNIX # CFDate is a real, number of seconds since 01/01/2001 00:00:00 GMT\n\n bdata = Binary.type_bytes(\"3\", 3) # 3 is 0...
[ "0.65893734", "0.656487", "0.65204334", "0.64839846", "0.63936645", "0.6314313", "0.5901791", "0.57451266", "0.5666163", "0.562766", "0.56220925", "0.5616594", "0.5577351", "0.55132914", "0.5490037", "0.54841167", "0.54658884", "0.5410722", "0.5404405", "0.53968966", "0.53851...
0.7879995
0
Read a binary data value
def read_binary_data(fname,fd,length) buff = ""; buff = fd.read(length) if length > 0 return CFData.new(buff,CFData::DATA_RAW) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_binary\n raise NotImplementedError\n end", "def read_byte; end", "def data\n read_attribute(binary ? :binary_data : :data)\n end", "def read\n read_object(read_byte)\n end", "def read_byte(data, offset)\n out = data[offset,1].unpack('C').first rescue 0\n return out\n end...
[ "0.7632058", "0.73937154", "0.73124635", "0.72500354", "0.7006242", "0.69913465", "0.69329166", "0.6918088", "0.68678564", "0.6830702", "0.6812567", "0.6698399", "0.6693482", "0.6627418", "0.66016376", "0.6594737", "0.6592734", "0.65844", "0.65458167", "0.6540291", "0.6513359...
0.7130284
4
Read a binary string value
def read_binary_string(fname,fd,length) buff = "" buff = fd.read(length) if length > 0 @unique_table[buff] = true unless @unique_table.has_key?(buff) return CFString.new(buff) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_string(length)\n BinData::Stringz.read(read_and_advance(length))\n end", "def read_binary\n raise NotImplementedError\n end", "def read(str)\n str = str.sysread(size) if not str.kind_of?(::String)\n @value = str.unpack(format).first\n size\n end", "def binary_string; end...
[ "0.72143054", "0.70673025", "0.6999473", "0.6976893", "0.69134617", "0.69010377", "0.684761", "0.6814804", "0.679744", "0.6681768", "0.65348625", "0.65180916", "0.65180916", "0.65172774", "0.6513126", "0.65090585", "0.6474409", "0.6444584", "0.64056027", "0.6397608", "0.63882...
0.7048001
2
Read a unicode string value, coded as UTF16BE
def read_binary_unicode_string(fname,fd,length) # The problem is: we get the length of the string IN CHARACTERS; # since a char in UTF-16 can be 16 or 32 bit long, we don't really know # how long the string is in bytes buff = fd.read(2*length) @unique_table[buff] = true unless @unique_table.has_key?(buff) return CFString.new(Binary.charset_convert(buff,"UTF-16BE","UTF-8")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_string(data, offset, length, encoding)\n if \"UTF-16\".casecmp(encoding) == 0\n out = data[offset, length].unpack('v*').pack('U*')\n else\n out = data[offset, length].unpack('C*').pack('U*')\n end\n return out\n end", "def get_utf16_of(character)\n character.encode('UTF-16BE').un...
[ "0.79713976", "0.7114958", "0.70792717", "0.6842437", "0.6825415", "0.6810971", "0.66008973", "0.6565299", "0.64788467", "0.6384433", "0.62750787", "0.6213166", "0.61774117", "0.6167788", "0.613427", "0.6095045", "0.60800445", "0.6056757", "0.60370576", "0.6020688", "0.600382...
0.71791196
1
Read an binary array value, including contained objects
def read_binary_array(fname,fd,length) ary = [] # first: read object refs if(length != 0) then buff = fd.read(length * @object_ref_size) objects = buff.unpack(@object_ref_size == 1 ? "C*" : "n*") # now: read objects 0.upto(length-1) do |i| object = read_binary_object_at(fname,fd,objects[i]) ary.push object end end return CFArray.new(ary) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_binary_object(fname,fd)\n # first: read the marker byte\n buff = fd.read(1)\n\n object_length = buff.unpack(\"C*\")\n object_length = object_length[0] & 0xF\n\n buff = buff.unpack(\"H*\")\n object_type = buff[0][0].chr\n\n if(object_type != \"0\" && object_length == 15)...
[ "0.70284456", "0.69862336", "0.68214107", "0.6640798", "0.6626206", "0.65283865", "0.6451477", "0.64165217", "0.63352776", "0.6239434", "0.6229584", "0.62125087", "0.6182966", "0.61515546", "0.6077128", "0.6076064", "0.6062472", "0.6019979", "0.59944135", "0.59940684", "0.598...
0.71458286
0
Read a dictionary value, including contained objects
def read_binary_dict(fname,fd,length) dict = {} # first: read keys if(length != 0) then buff = fd.read(length * @object_ref_size) keys = buff.unpack(@object_ref_size == 1 ? "C*" : "n*") # second: read object refs buff = fd.read(length * @object_ref_size) objects = buff.unpack(@object_ref_size == 1 ? "C*" : "n*") # read real keys and objects 0.upto(length-1) do |i| key = read_binary_object_at(fname,fd,keys[i]) object = read_binary_object_at(fname,fd,objects[i]) dict[key.value] = object end end return CFDictionary.new(dict) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read\n value = super\n value = value.to_hash if value.respond_to?(:to_hash)\n value\n end", "def extract_data(object)\n if object.is_a?(Hash) && object.size == 1\n return object.values.first\n else\n return object\n end\n end", "def read_entry(key, **op...
[ "0.6401827", "0.62023777", "0.60165054", "0.60061866", "0.59796745", "0.59665734", "0.5922959", "0.5887369", "0.5864625", "0.5849955", "0.5823342", "0.5818345", "0.58171487", "0.5755363", "0.5720155", "0.5680275", "0.5632676", "0.5576335", "0.5573226", "0.55635834", "0.554881...
0.59418935
6
Read an object type byte, decode it and delegate to the correct reader function
def read_binary_object(fname,fd) # first: read the marker byte buff = fd.read(1) object_length = buff.unpack("C*") object_length = object_length[0] & 0xF buff = buff.unpack("H*") object_type = buff[0][0].chr if(object_type != "0" && object_length == 15) then object_length = read_binary_object(fname,fd) object_length = object_length.value end retval = nil case object_type when '0' then # null, false, true, fillbyte retval = read_binary_null_type(object_length) when '1' then # integer retval = read_binary_int(fname,fd,object_length) when '2' then # real retval = read_binary_real(fname,fd,object_length) when '3' then # date retval = read_binary_date(fname,fd,object_length) when '4' then # data retval = read_binary_data(fname,fd,object_length) when '5' then # byte string, usually utf8 encoded retval = read_binary_string(fname,fd,object_length) when '6' then # unicode string (utf16be) retval = read_binary_unicode_string(fname,fd,object_length) when 'a' then # array retval = read_binary_array(fname,fd,object_length) when 'd' then # dictionary retval = read_binary_dict(fname,fd,object_length) end return retval end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read\n read_object(read_byte)\n end", "def recover_object\n # Up to the tab is the amount of bytes to read\n demarshal_bytes = @io.gets(\"\\t\").to_i\n \n # When at end of IO return nil\n raise NothingToRecover if demarshal_bytes.zero?\n \n blob = @io.read(demarshal_bytes)\n d...
[ "0.7598876", "0.6863633", "0.6685689", "0.66833586", "0.65031505", "0.64321953", "0.64161086", "0.63541293", "0.6300766", "0.6239332", "0.62110823", "0.6168578", "0.61405313", "0.6116484", "0.60989505", "0.6098249", "0.6062003", "0.5992228", "0.5992228", "0.59890467", "0.5972...
0.7098113
1
Read an object type byte at position $pos, decode it and delegate to the correct reader function
def read_binary_object_at(fname,fd,pos) position = @offsets[pos] fd.seek(position,IO::SEEK_SET) return read_binary_object(fname,fd) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read\n read_object(read_byte)\n end", "def read_binary_object(fname,fd)\n # first: read the marker byte\n buff = fd.read(1)\n\n object_length = buff.unpack(\"C*\")\n object_length = object_length[0] & 0xF\n\n buff = buff.unpack(\"H*\")\n object_type = buff[0][0].chr\n\n...
[ "0.7311331", "0.6798551", "0.6503346", "0.6390284", "0.6339939", "0.6306967", "0.62698436", "0.61795175", "0.61770576", "0.6116316", "0.60945594", "0.60597056", "0.600354", "0.6000059", "0.5911306", "0.59051025", "0.58754176", "0.58548117", "0.5845684", "0.5837417", "0.582976...
0.6630583
2
Uniques and transforms a string value to binary format and adds it to the object table
def string_to_binary(val) saved_object_count = -1 unless(@unique_table.has_key?(val)) then saved_object_count = @written_object_count @written_object_count += 1 @unique_table[val] = saved_object_count utf16 = false val.each_byte do |b| if(b > 127) then utf16 = true break end end if(utf16) then bdata = Binary.type_bytes("6",Binary.charset_strlen(val,"UTF-8")) # 6 is 0110, unicode string (utf16be) val = Binary.charset_convert(val,"UTF-8","UTF-16BE") val.force_encoding("ASCII-8BIT") if val.respond_to?("encode") @object_table[saved_object_count] = bdata + val else bdata = Binary.type_bytes("5",val.bytesize) # 5 is 0101 which is an ASCII string (seems to be ASCII encoded) @object_table[saved_object_count] = bdata + val end else saved_object_count = @unique_table[val] end return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] = bdata + val\n\n return saved_object_count\n end", "def cast(v...
[ "0.6002326", "0.5797143", "0.5793277", "0.56514406", "0.561846", "0.5611824", "0.5598785", "0.55561554", "0.55302864", "0.55093014", "0.5441502", "0.54117167", "0.5360556", "0.5351907", "0.53468585", "0.5341088", "0.5316499", "0.53156316", "0.5307022", "0.5254363", "0.5234028...
0.7459094
0
Codes an integer to binary format
def int_to_binary(value) nbytes = 0 nbytes = 1 if value > 0xFF # 1 byte integer nbytes += 1 if value > 0xFFFF # 4 byte integer nbytes += 1 if value > 0xFFFFFFFF # 8 byte integer nbytes = 3 if value < 0 # 8 byte integer, since signed bdata = Binary.type_bytes("1", nbytes) # 1 is 0001, type indicator for integer buff = "" if(nbytes < 3) then fmt = "N" if(nbytes == 0) then fmt = "C" elsif(nbytes == 1) fmt = "n" end buff = [value].pack(fmt) else # 64 bit signed integer; we need the higher and the lower 32 bit of the value high_word = value >> 32 low_word = value & 0xFFFFFFFF buff = [high_word,low_word].pack("NN") end return bdata + buff end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int_to_binary_string(number)\n number.to_s(2)\nend", "def to_bin(number)\n number = Integer(number);\n if(number == 0)\n return 0;\n end\n ret_bin = \"\";\n ## Untill val is zero, convert it into binary format\n while(number != 0)\n ret_bin = String(number % 2) + ret_bi...
[ "0.8118605", "0.7725005", "0.7348912", "0.7309225", "0.7218738", "0.7218738", "0.7111606", "0.7067939", "0.6997278", "0.6994265", "0.69752103", "0.6933819", "0.6928739", "0.69271845", "0.692328", "0.6913677", "0.6881685", "0.68341064", "0.68309563", "0.68174404", "0.6761772",...
0.7988794
1
Codes a real value to binary format
def real_to_binary(val) bdata = Binary.type_bytes("2",3) # 2 is 0010, type indicator for reals buff = [val].pack("d") return bdata + buff.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_to_binary_string(value)\n #value.pack(\"V\")\n raise NotImplementedError\n end", "def input_to_bitstring( value )\r\n value\r\n end", "def to_binary()\n return self.unpack('B*').join\n end", "def show_binstring()\n @values.values.map do |v|\n v...
[ "0.76387566", "0.73857784", "0.70741576", "0.69966084", "0.69353193", "0.6870486", "0.686756", "0.6860697", "0.68493295", "0.6845571", "0.68288904", "0.6777516", "0.6741485", "0.67203945", "0.6716213", "0.6709726", "0.6709726", "0.6681656", "0.66692364", "0.6667497", "0.66251...
0.8134485
0
Converts a numeric value to binary and adds it to the object table
def num_to_binary(value) saved_object_count = @written_object_count @written_object_count += 1 val = "" if(value.is_a?(CFInteger)) then val = int_to_binary(value.value) else val = real_to_binary(value.value) end @object_table[saved_object_count] = val return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] = bdata + val\n\n return saved_object_count\n end", "def dict_t...
[ "0.7372401", "0.6532221", "0.6515368", "0.6515368", "0.64618844", "0.6447378", "0.63010615", "0.6284817", "0.6267158", "0.6241623", "0.6154173", "0.60950464", "0.60596514", "0.60448486", "0.603212", "0.60292953", "0.60069513", "0.5987567", "0.589815", "0.58818686", "0.5877616...
0.7999949
0
Convert date value (apple format) to binary and adds it to the object table
def date_to_binary(val) saved_object_count = @written_object_count @written_object_count += 1 val = val.getutc.to_f - CFDate::DATE_DIFF_APPLE_UNIX # CFDate is a real, number of seconds since 01/01/2001 00:00:00 GMT bdata = Binary.type_bytes("3", 3) # 3 is 0011, type indicator for date @object_table[saved_object_count] = bdata + [val].pack("d").reverse return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_date()\n #This is a stub, used for indexing\n end", "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] =...
[ "0.62352306", "0.6061859", "0.5925008", "0.59146583", "0.5899505", "0.58940595", "0.5834136", "0.5696109", "0.56730443", "0.5643133", "0.56275725", "0.5623474", "0.56228405", "0.56044054", "0.5595214", "0.55874425", "0.55853236", "0.55780107", "0.55737776", "0.5545583", "0.55...
0.80985737
0
Convert a bool value to binary and add it to the object table
def bool_to_binary(val) saved_object_count = @written_object_count @written_object_count += 1 @object_table[saved_object_count] = val ? "\x9" : "\x8" # 0x9 is 1001, type indicator for true; 0x8 is 1000, type indicator for false return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_boo string\n\t\tActiveRecord::Type::Boolean.new.cast(string)\n\tend", "def old_boolean_to_binary(arr)\n binary = \"\"\n\n arr.each do |boolean|\n if boolean\n binary += \"1\"\n else\n binary += \"0\"\n end\n end\n\n binary\nend", "def boolean_to_binary(array)\nend", "def write_b...
[ "0.72672784", "0.7210135", "0.7078653", "0.6999839", "0.699487", "0.66359603", "0.6601401", "0.6562944", "0.6548674", "0.65412736", "0.65098464", "0.640848", "0.6400983", "0.6390524", "0.63897985", "0.63661003", "0.63559127", "0.6315174", "0.6306795", "0.629747", "0.62785494"...
0.8388247
0
Convert data value to binary format and add it to the object table
def data_to_binary(val) saved_object_count = @written_object_count @written_object_count += 1 bdata = Binary.type_bytes("4", val.bytesize) # a is 1000, type indicator for data @object_table[saved_object_count] = bdata + val return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_binary\n Formatters::Binary.new.serialize self\n end", "def dict_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"d\",val.value.size) # d=1101, type indicator for dictionary\n\n val.value.each_key do |k...
[ "0.6759858", "0.67387134", "0.6717039", "0.66537166", "0.66537064", "0.66328", "0.66024834", "0.6579127", "0.62942713", "0.61972284", "0.61822", "0.6161647", "0.6134418", "0.6081542", "0.60703397", "0.6036884", "0.59574085", "0.5957148", "0.5904086", "0.5901617", "0.5884673",...
0.80280674
0
Convert array to binary format and add it to the object table
def array_to_binary(val) saved_object_count = @written_object_count @written_object_count += 1 bdata = Binary.type_bytes("a", val.value.size) # a is 1010, type indicator for arrays val.value.each do |v| bdata += Binary.pack_it_with_size(@object_ref_size, v.to_binary(self)); end @object_table[saved_object_count] = bdata return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for data\n @object_table[saved_object_count] = bdata + val\n\n return saved_object_count\n end", "def to_bin...
[ "0.6767909", "0.64879626", "0.6384719", "0.6267628", "0.62673205", "0.6246435", "0.61951655", "0.6126787", "0.60429925", "0.6011801", "0.5992629", "0.5983729", "0.59797907", "0.59782565", "0.59502876", "0.58508396", "0.5833801", "0.5829443", "0.5804415", "0.5770621", "0.57706...
0.7604434
0
Convert dictionary to binary format and add it to the object table
def dict_to_binary(val) saved_object_count = @written_object_count @written_object_count += 1 bdata = Binary.type_bytes("d",val.value.size) # d=1101, type indicator for dictionary val.value.each_key do |k| str = CFString.new(k) key = str.to_binary(self) bdata += Binary.pack_it_with_size(@object_ref_size,key) end val.value.each_value do |v| bdata += Binary.pack_it_with_size(@object_ref_size,v.to_binary(self)) end @object_table[saved_object_count] = bdata return saved_object_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def marshal_dump\n @table\n end", "def to_binary\n Formatters::Binary.new.serialize self\n end", "def data_to_binary(val)\n saved_object_count = @written_object_count\n @written_object_count += 1\n\n bdata = Binary.type_bytes(\"4\", val.bytesize) # a is 1000, type indicator for d...
[ "0.6019073", "0.6013988", "0.59561574", "0.58213556", "0.5737301", "0.5699765", "0.56747013", "0.5618138", "0.5615141", "0.55964977", "0.55716604", "0.5534259", "0.55316526", "0.5496958", "0.54798055", "0.54774326", "0.5458964", "0.54547024", "0.5425382", "0.54219854", "0.533...
0.7461467
0
Create a static hop BFD peer Creates a BFD peer for static route. The required parameters includes peer IP address.
def create_static_hop_bfd_peer(logical_router_id, static_hop_bfd_peer, opts = {}) data, _status_code, _headers = create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer ...'\n end\n # verify the requir...
[ "0.6617239", "0.6229633", "0.60930145", "0.5871882", "0.57874286", "0.5786859", "0.5782089", "0.5502796", "0.5379553", "0.5352684", "0.534905", "0.5237958", "0.5224783", "0.5205536", "0.51922005", "0.51922005", "0.509461", "0.5091298", "0.50749326", "0.5036021", "0.4987679", ...
0.79299843
0
Create a static hop BFD peer Creates a BFD peer for static route. The required parameters includes peer IP address.
def create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer ...' end # verify the required parameter 'logical_router_id' is set if @api_client.config.client_side_validation && logical_router_id.nil? fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer" end # verify the required parameter 'static_hop_bfd_peer' is set if @api_client.config.client_side_validation && static_hop_bfd_peer.nil? fail ArgumentError, "Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer" end # resource path local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(static_hop_bfd_peer) auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'StaticHopBfdPeer') if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#create_static_hop_bfd_peer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_static_hop_bfd_peer(logical_router_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts)\n data\n end", "def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_pee...
[ "0.7930343", "0.62298757", "0.6094754", "0.587161", "0.5788293", "0.5787778", "0.57824856", "0.5504895", "0.5381322", "0.53558946", "0.5350371", "0.5236187", "0.52263016", "0.5206584", "0.51940227", "0.51940227", "0.5095933", "0.50930303", "0.5076193", "0.5038284", "0.4989422...
0.6618446
1
Delete a specified static route BFD peer cofigured on a specified logical router Deletes the specified BFD peer present on specified logical router.
def delete_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {}) delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer ...'\n end\n # verify the required param...
[ "0.67823887", "0.6534451", "0.6495973", "0.64280313", "0.6255645", "0.5999183", "0.59921753", "0.5791187", "0.5701881", "0.56482565", "0.5554026", "0.5551079", "0.5528091", "0.5514554", "0.5485993", "0.54585177", "0.5414058", "0.5398831", "0.5361642", "0.5350564", "0.53363323...
0.82927024
0
Delete a specified static route BFD peer cofigured on a specified logical router Deletes the specified BFD peer present on specified logical router.
def delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer ...' end # verify the required parameter 'logical_router_id' is set if @api_client.config.client_side_validation && logical_router_id.nil? fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer" end # verify the required parameter 'bfd_peer_id' is set if @api_client.config.client_side_validation && bfd_peer_id.nil? fail ArgumentError, "Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer" end # resource path local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s) # query parameters query_params = {} query_params[:'force'] = opts[:'force'] if !opts[:'force'].nil? # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#delete_static_hop_bfd_peer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n nil\n end", "def delete_static_route(logical_router_id, id, opts = {})\n delete_static_route_with_http_info(logical_router_id, id, opts)\...
[ "0.82927585", "0.6535487", "0.649687", "0.64274323", "0.62566966", "0.6000363", "0.59927255", "0.57916", "0.5702532", "0.5646954", "0.55535996", "0.5549381", "0.5527597", "0.5515386", "0.54870594", "0.54595447", "0.5413791", "0.5399849", "0.53616154", "0.5349558", "0.533597",...
0.6781829
1
List static routes BFD Peers Returns information about all BFD peers created on specified logical router for static routes.
def list_static_hop_bfd_peers(logical_router_id, opts = {}) data, _status_code, _headers = list_static_hop_bfd_peers_with_http_info(logical_router_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_static_routes(logical_router_id, opts = {})\n data, _status_code, _headers = list_static_routes_with_http_info(logical_router_id, opts)\n data\n end", "def list_static_hop_bfd_peers_with_http_info(logical_router_id, opts = {})\n if @api_client.config.debugging\n @api_client.conf...
[ "0.6381591", "0.5682232", "0.56553996", "0.5518457", "0.5518457", "0.5495218", "0.547126", "0.5423009", "0.54211867", "0.5328362", "0.532435", "0.52953637", "0.52602637", "0.5161609", "0.5137966", "0.5121958", "0.512092", "0.5114098", "0.51108235", "0.50975984", "0.5093997", ...
0.72717303
0
List static routes BFD Peers Returns information about all BFD peers created on specified logical router for static routes.
def list_static_hop_bfd_peers_with_http_info(logical_router_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers ...' end # verify the required parameter 'logical_router_id' is set if @api_client.config.client_side_validation && logical_router_id.nil? fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers" end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be smaller than or equal to 1000.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be greater than or equal to 0.' end # resource path local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s) # query parameters query_params = {} query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil? query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil? query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil? # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'StaticHopBfdPeerListResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#list_static_hop_bfd_peers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_static_hop_bfd_peers(logical_router_id, opts = {})\n data, _status_code, _headers = list_static_hop_bfd_peers_with_http_info(logical_router_id, opts)\n data\n end", "def list_static_routes(logical_router_id, opts = {})\n data, _status_code, _headers = list_static_routes_with_http_info(...
[ "0.72717154", "0.63821566", "0.5654464", "0.55182755", "0.55182755", "0.5495078", "0.5472782", "0.5420841", "0.54201937", "0.5327967", "0.5324518", "0.5295144", "0.5260151", "0.5161899", "0.5136402", "0.5120511", "0.51203746", "0.5113525", "0.5110664", "0.5096531", "0.5094369...
0.56827587
2
Read a static route BFD peer Read the BFD peer having specified ID.
def read_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {}) data, _status_code, _headers = read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_static_route(logical_router_id, id, opts = {})\n data, _status_code, _headers = read_static_route_with_http_info(logical_router_id, id, opts)\n data\n end", "def read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})\n if @api_client.config.debugging\n ...
[ "0.6606323", "0.6104351", "0.5968783", "0.5813354", "0.5699982", "0.5678284", "0.56629646", "0.56325006", "0.5626648", "0.54887843", "0.5481124", "0.53925824", "0.5363777", "0.5340827", "0.52619636", "0.5257866", "0.5216754", "0.521414", "0.5208699", "0.5193338", "0.5193304",...
0.69173354
0
Read a static route BFD peer Read the BFD peer having specified ID.
def read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer ...' end # verify the required parameter 'logical_router_id' is set if @api_client.config.client_side_validation && logical_router_id.nil? fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer" end # verify the required parameter 'bfd_peer_id' is set if @api_client.config.client_side_validation && bfd_peer_id.nil? fail ArgumentError, "Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer" end # resource path local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = nil auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'StaticHopBfdPeer') if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#read_static_hop_bfd_peer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})\n data, _status_code, _headers = read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)\n data\n end", "def read_static_route(logical_router_id, id, opts = {})\n data, _status_code, _headers = read_st...
[ "0.6917232", "0.6608929", "0.59693867", "0.5812565", "0.5699138", "0.56788343", "0.56645817", "0.56325674", "0.56258357", "0.5488818", "0.54817367", "0.5394265", "0.5364146", "0.5341863", "0.52623606", "0.52566415", "0.52169806", "0.52130526", "0.52111435", "0.5193842", "0.51...
0.6103767
2
Update a static route BFD peer Modifies the static route BFD peer. Modifiable parameters includes peer IP, enable flag and configuration of the BFD peer.
def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {}) data, _status_code, _headers = update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer ...'\n end\n # veri...
[ "0.6365141", "0.55864155", "0.55398107", "0.54104346", "0.5408062", "0.52611494", "0.52549493", "0.52203995", "0.521008", "0.52073044", "0.5157824", "0.5157343", "0.51220965", "0.5112575", "0.5112575", "0.5034793", "0.5000252", "0.4960514", "0.4959216", "0.4952912", "0.493463...
0.70052713
0
Update a static route BFD peer Modifies the static route BFD peer. Modifiable parameters includes peer IP, enable flag and configuration of the BFD peer.
def update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer ...' end # verify the required parameter 'logical_router_id' is set if @api_client.config.client_side_validation && logical_router_id.nil? fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer" end # verify the required parameter 'bfd_peer_id' is set if @api_client.config.client_side_validation && bfd_peer_id.nil? fail ArgumentError, "Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer" end # verify the required parameter 'static_hop_bfd_peer' is set if @api_client.config.client_side_validation && static_hop_bfd_peer.nil? fail ArgumentError, "Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer" end # resource path local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s) # query parameters query_params = {} # header parameters 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 = {} # http body (model) post_body = @api_client.object_to_http_body(static_hop_bfd_peer) auth_names = ['BasicAuth'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'StaticHopBfdPeer') if @api_client.config.debugging @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#update_static_hop_bfd_peer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})\n data, _status_code, _headers = update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts)\n data\n end", "def update_static_route(logical_router_id, id, static_r...
[ "0.70053154", "0.55831844", "0.55385983", "0.54096377", "0.5407031", "0.5260514", "0.5256426", "0.5219717", "0.5211384", "0.52049154", "0.51588905", "0.5158409", "0.5121474", "0.5113762", "0.5113762", "0.50361305", "0.4999628", "0.49626377", "0.49598977", "0.4952247", "0.4935...
0.63649476
1
show all the bookings on booking_history
def booking_history @bookings = Booking.where(:user_id => current_user.id).paginate(:page => params[:page], :per_page => 10) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_booking_history\n @booking_history = BookingHistory.find(params[:id])\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.order(updated_at: :desc).page(params[:page]).per(NUM_PER_PAGE)\n end", "def index\n @bookings = Booking.all\n end", "de...
[ "0.75333446", "0.7191425", "0.71350545", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7134303", "0.7123582", "0.6983818", "0.69792986", "0.6926872", "0.6871498", ...
0.82227737
0
allocate taxi within range for booking
def booking_texi(vehicle_type_id, pickup_date, pickup_time, dropoff_date, dropoff_time, pickup_addr) @texi_info = TexiInfo.near(pickup_addr,4).where(vehicle_type_id: vehicle_type_id).map(&:id).uniq rescue 0 @bookings = Booking.where(:user_id => current_user.id).where('pickup_time <= ? AND dropoff_time >= ?', pickup_time, dropoff_time).where(:pickup_datetime => pickup_date.to_date).where(:return_pickup_datetime => dropoff_date.to_date).order('pickup_datetime ASC') rescue 0 @ids = @bookings.map(&:taxi_info_id).uniq unless @bookings.blank? rescue 0 if !@ids.blank? @texi_info = @texi_info-@ids end if @texi_info.blank? return [] else return @texi_info.sample end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tax_charge!\n #puts \"Adjustments #{adjustments} TAX #{tax_total}\"\n #puts \"CREATE TAX for #{ship_address} \"\n all_rates = Spree::TaxRate.all\n matching_rates = all_rates.select { |rate| rate.zone.include?(ship_address) }\n if matching_rates.empty?\n matching_rates = all_rates.se...
[ "0.5994364", "0.5947343", "0.59292084", "0.5676179", "0.5608662", "0.55748254", "0.55671656", "0.5541891", "0.5539141", "0.5490904", "0.5461911", "0.54490584", "0.54376036", "0.54068834", "0.53668654", "0.5360255", "0.5356661", "0.53511155", "0.5331436", "0.5314998", "0.53029...
0.5163432
45
show pick_up and drop_off address on new booking map
def show_new_booking_map @pickup_address = Geocoder.search(params[:pick_up_addr]).first @dropoff_address = Geocoder.search(params[:drop_off_addr]).first @hash = Gmaps4rails.build_markers(@pickup_address) do |user, marker| marker.lat user.latitude marker.lng user.longitude marker.infowindow "PickUp Addr: "+params[:pick_up_addr] marker.picture({ "url" => "/assets/img/ico/map/ico_location_mark_a.png", "width" => 36, "height" => 36 }) end @hash1 = Gmaps4rails.build_markers(@dropoff_address) do |user, marker| marker.lat user.latitude marker.lng user.longitude marker.infowindow "DropOff Addr: "+params[:drop_off_addr] marker.picture({ "url" => "/assets/img/ico/map/ico_location_mark_b.png", "width" => 36, "height" => 36 }) end @loc_distance = Geocoder::Calculations.distance_between(params[:pick_up_addr], params[:drop_off_addr], :units=> :km).round(1) respond_to do |format| format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showpickup_address(booking_id)\n pa = PickupAddress.where(:booking_id => booking_id).last\n pa.address rescue \"\"\n end", "def showdropoff_address(booking_id)\n pa = DropoffAddress.where(:booking_id => booking_id).last\n pa.address rescue \"\"\n end", "def get_address\n booking = Booking....
[ "0.67744863", "0.65876126", "0.65671104", "0.63637066", "0.6055136", "0.6049782", "0.60411626", "0.59734213", "0.594067", "0.5938259", "0.59177", "0.59027946", "0.5878054", "0.5865389", "0.5864325", "0.58348703", "0.57920045", "0.57724124", "0.57297826", "0.57114345", "0.5703...
0.63521314
4
recurrent pick_up and drop_off address
def get_address booking = Booking.where(user_id: current_user.id).last pick_up_addr = PickupAddress.where(:booking_id => booking.id).last drop_off_addr = DropoffAddress.where(:booking_id => booking.id).last hash = {:pick_up_addr => pick_up_addr.address, :drop_off_addr => drop_off_addr.address} respond_to do |format| format.json { render :json => hash.to_json, :status => 200 } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_drop_off\n @bus1.pick_up(@person)\n assert_equal(1, @bus1.number_passengers())\n @bus1.drop_off(@person)\n assert_equal(0, @bus1.number_passengers())\n end", "def preselect_existing_address\n return unless can_preselect_address?\n\n selected_address = temp_addresses.detect { |addr...
[ "0.59913915", "0.54354763", "0.5411594", "0.5289057", "0.52543163", "0.5247747", "0.5221226", "0.51953673", "0.5114895", "0.51058376", "0.5054755", "0.5032971", "0.5032971", "0.5018826", "0.49849388", "0.4968024", "0.4968024", "0.49610198", "0.49473", "0.49436817", "0.4920519...
0.0
-1
handling booking parameters of booking tab
def booking_params params[:booking][:user_id] = current_user.id vehicle_type_id = params[:booking][:vehicle_preferences_attributes].first[1][:vehicle_type_id] pickup_date = params[:booking][:pickup_datetime] pickup_time = params[:booking][:pickup_time] dropoff_date = params[:booking][:return_pickup_datetime] dropoff_time = params[:booking][:dropoff_time] pickup_addr = params[:booking][:pickup_addresses_attributes].first[1][:address] params[:booking][:taxi_info_id] = booking_texi(vehicle_type_id, pickup_date, pickup_time, dropoff_date, dropoff_time, pickup_addr) params.require(:booking).permit(:dropoff_address, :via_address, :number_of_bags, :number_of_passengers, :booked_hours, :flight_info, :recurrent_type,:passenger_name, :passenger_phone_no, :passenger_email, :pickup_datetime, :return_pickup_datetime, :pickup_time, :dropoff_time, :user_id, :taxi_info_id, :vehicle_preferences_attributes => [:number_of_vehicle, :booking_id, :vehicle_type_id], :pickup_addresses_attributes => [:address, :booking_id], :dropoff_addresses_attributes => [:address, :booking_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def booking_params\n params[:booking]\n end", "def booking_params\n if ['index', 'destroy'].include?(params[:action])\n params.permit(:booking)\n else\n params.require(:booking).permit(:date_in, :date_out, :hotel_id,:user_id,:status)\n end\n\n end", "def show...
[ "0.7540592", "0.72203285", "0.7195991", "0.7069011", "0.7047531", "0.7029437", "0.70106757", "0.69961333", "0.6982345", "0.6970114", "0.6962022", "0.69605994", "0.6954737", "0.6951022", "0.6935218", "0.69285244", "0.69266385", "0.69034845", "0.6886282", "0.68806916", "0.68758...
0.68247545
26
GET /plants/1 GET /plants/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n \n @plants = Plant.all\n @personal_plants = PersonalPlant.where(:user_id => session[:user][:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plants }\n end\n end", "def index\n @plants = Plant.all\n\n respond_to do |format|\n...
[ "0.7626426", "0.7559377", "0.7494183", "0.69456923", "0.67404145", "0.6738881", "0.6736135", "0.6680127", "0.6663009", "0.6593484", "0.65574867", "0.64715606", "0.64597154", "0.6404637", "0.63969845", "0.6395302", "0.6357955", "0.632299", "0.6296218", "0.6293668", "0.6291755"...
0.0
-1
POST /plants POST /plants.json
def create @plant = @garden.plants.new(plant_params) respond_to do |format| if @plant.save format.html { redirect_to garden_plant_path(@garden, @plant), notice: 'Plant was successfully created.' } format.json { render action: 'show', status: :created, location: @plant } else format.html { render action: 'new' } format.json { render json: @plant.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n plant = Plant.create(plant_params)\n render json: plant, status: :created\n end", "def create\n @plant = current_user.plants.create(plant_params)\n if @plant.valid?\n redirect_to plant_path(@plant)\n else\n render :new, status: :unprocessable_entity\n end\n end", "def...
[ "0.6902806", "0.6719342", "0.64493144", "0.61954564", "0.6145679", "0.6139447", "0.61214685", "0.60941553", "0.6040986", "0.6024834", "0.60134804", "0.595717", "0.5945627", "0.59392214", "0.5935888", "0.5934618", "0.58955294", "0.58821785", "0.5847297", "0.58405566", "0.58387...
0.68420595
1
PATCH/PUT /plants/1 PATCH/PUT /plants/1.json
def update respond_to do |format| if @plant.update(plant_params) format.html { redirect_to garden_plant_path(@garden, @plant), notice: 'Plant was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @plant.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "def update\n if not check_logged_in then\n return\n end\n\n @plant = Plant.find(params[:id])\n\n respond_to do |format|\n if @plant.update_attributes(params[:plant])\n format.html { redirect_to @plant, notice: 'Plant was successfully updated....
[ "0.6417405", "0.63763666", "0.6347557", "0.6264377", "0.62427336", "0.6241535", "0.62391424", "0.623645", "0.6227365", "0.6192443", "0.6180778", "0.6176146", "0.6170411", "0.61692363", "0.61692363", "0.61692363", "0.61605185", "0.615469", "0.6097303", "0.6097303", "0.6093931"...
0.6388268
1
DELETE /plants/1 DELETE /plants/1.json
def destroy @plant = @garden.plants.find(params[:id]) @plant.destroy respond_to do |format| format.html { redirect_to @garden, notice: 'Plant deleted.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n if not check_logged_in then\n return\n end\n @plant = Plant.find(params[:id])\n @plant.destroy\n\n respond_to do |format|\n format.html { redirect_to plants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if not check_logged_in then\n ...
[ "0.7304276", "0.72435623", "0.7090649", "0.70646024", "0.7037072", "0.7020316", "0.69914526", "0.6966658", "0.6936882", "0.68521255", "0.6838", "0.68047786", "0.67268914", "0.6722232", "0.6717373", "0.6710692", "0.6681807", "0.6676933", "0.6676933", "0.66657996", "0.66657", ...
0.75170726
0
Use callbacks to share common setup or constraints between actions.
def set_garden @garden = Garden.find(params[:garden_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 plant_params params.require(:plant).permit(:garden_id, :plant_image, :family, :variety, :seed_source, :quantity, :notes, :plant_date) 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.6978086", "0.6780264", "0.6742658", "0.6738813", "0.67338693", "0.65908474", "0.6501793", "0.6495506", "0.64796513", "0.64755446", "0.6454826", "0.6437561", "0.6377127", "0.63722163", "0.6364058", "0.63178706", "0.62979764", "0.62968165", "0.62913024", "0.6289789", "0.6289...
0.0
-1
This method will allow me to check the password attempt A new password object will be created(but not saved) comparing the current password_digest to the pasword attempt's digest
def is_password?(password_attempt) BCrypt::Password.new(password_digest).is_password?(password_attempt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_pass(password)\n BCrypt::Password.create(password) == self.hash_pass\n end", "def validate_password(challenge)\n actual = BCrypt::Password.new(password_digest)\n actual == challenge\n end", "def is_password?(password_attempt)\n BCrypt::Password.new(password_digest).is_password?(password_...
[ "0.73229575", "0.7279151", "0.7199799", "0.7168252", "0.71405554", "0.71181184", "0.706325", "0.706325", "0.7051116", "0.6977497", "0.69660085", "0.6958755", "0.69585586", "0.6944173", "0.69436115", "0.6935888", "0.693142", "0.6917615", "0.6857313", "0.6857313", "0.6825218", ...
0.7249801
2
The equal sign next to password will allow us to set a password value directly instead of having to pass it as a parameter Self within the method refers to every instance of a user
def password=(password) @password = password self.password_digest = BCrypt::Password.create(password) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password=(password)\n @password = password\n end", "def password=(new_password); end", "def set_password_field(password)\n end", "def password=(should); end", "def set_password(pass)\n self.user_password = User.crypt(pass)\n end", "def password=(value)\n @password = value\n...
[ "0.7945201", "0.7936429", "0.7911718", "0.7854132", "0.78001887", "0.77896094", "0.7750377", "0.77147377", "0.76700145", "0.7643079", "0.7639849", "0.7629075", "0.76205117", "0.76205117", "0.76205117", "0.76205117", "0.762029", "0.7552042", "0.75517905", "0.7536476", "0.75313...
0.0
-1
The list of all updatable properties
def updatable_properties @updatable ||= Set.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_fields\n fieldlist = self.class.required_on_update + @newvalues.to_a - self.class.never_on_update\n @properties.select{|key, value| fieldlist.include?(key)}\n end", "def modified_properties\n return @modified_properties\n end", "def updatable_property name, *ar...
[ "0.67452586", "0.6656477", "0.64379704", "0.6398018", "0.62315035", "0.6193906", "0.61785704", "0.61513007", "0.61110914", "0.6100965", "0.6099039", "0.60753393", "0.6023469", "0.6021993", "0.5992287", "0.59601694", "0.59458965", "0.5933607", "0.5912656", "0.58987504", "0.588...
0.8273149
0
Add a new updatable property
def updatable_property name, *args property name, *args @updatable ||= Set.new @updatable << name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updatable_properties\n @updatable ||= Set.new\n end", "def add_property(key, value = nil, column_properties = {})\n key = key.to_sym\n unless property? key\n @_values[key] = value\n\n # Include in database columns definition\n @_columns[key] = {} unless column...
[ "0.6705231", "0.6028638", "0.60149807", "0.60097134", "0.59517425", "0.5933048", "0.59043676", "0.58887565", "0.5829095", "0.5828522", "0.58160406", "0.57781696", "0.57781696", "0.57398236", "0.57256514", "0.5691363", "0.56197745", "0.55551666", "0.55349386", "0.55204296", "0...
0.7993935
0
GET /comments GET /comments.json
def index @comments = Comment.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments\n client.get(\"/#{id}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n render json: @post.comments\n end", "def list\n comments = Comment.where(post: @p...
[ "0.85731363", "0.7836477", "0.7836477", "0.75563234", "0.7529806", "0.7521614", "0.74968386", "0.7397085", "0.7301993", "0.72955334", "0.72854245", "0.72738886", "0.7270647", "0.7248709", "0.7243295", "0.7208719", "0.7205121", "0.7185704", "0.7178388", "0.71587324", "0.715722...
0.0
-1
:nodoc: We need to wrap the run method so we can do things like run a cleanup method if it exists
def run(result, &progress_block) # :nodoc: super_run(result) do |state, name| if state == Test::Unit::TestCase::STARTED cleanup if self.respond_to?(:cleanup) log_start(name) else cleanup if self.respond_to?(:cleanup) log_end(name) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(_); end", "def run(_); end", "def run() end", "def run\n raise \"Not implemented yet.\"\n end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run\n nil\n end", "def...
[ "0.72897696", "0.72897696", "0.7218302", "0.71431446", "0.6946793", "0.6946793", "0.6946793", "0.6946793", "0.6946793", "0.6946793", "0.6946793", "0.6946793", "0.6946793", "0.6912175", "0.6889371", "0.6796001", "0.679071", "0.6785756", "0.67625695", "0.67325085", "0.67216825"...
0.6180866
81
OAuth2 Endpoints Passport exchange Passport Strategy first exchange Insider : Client information from Apps should always be trusted
def create @client = current_client @session = @client.session debug { "SessionsController#create - #{@session.inspect}"} raise "ResourceOwner from token != session.owner" if doorkeeper_token.resource_owner_id != @session.owner.id @client.update_attributes!(client_params) render json: @client, status: :created, serializer: Sso::ClientSerializer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exchange_oauth_tokens\n end", "def oauth_authentication; end", "def authenticate!\n @client = Octokit::Client.new\n url = @client.authorize_url(CLIENT_ID)\n redirect url\nend", "def use_oauth\n\t\t\t\n\t\tend", "def on_simple_outbound\r\n {\"userCredentials\" => {\"accessToken\" => ACCESS_...
[ "0.6560234", "0.64327234", "0.61521095", "0.6107974", "0.6073148", "0.6073148", "0.60122347", "0.6003596", "0.598927", "0.5957799", "0.59501743", "0.5916614", "0.58853847", "0.58667505", "0.58667505", "0.58643615", "0.5848473", "0.58226377", "0.5813317", "0.57771486", "0.5760...
0.0
-1
JSONP endpoint based on Devise session
def id render json: { passport_id: sso_session_id } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n respond_to do |format|\n format.html {\n render\n }\n format.json { \n render :json => {:auth_key => current_user.authentication_token }, \n :callback => params[:callback] \n }\n end\n end", "def show\n @session = Session.find(params[:id])\n sess...
[ "0.66655207", "0.62987924", "0.61211914", "0.6096706", "0.60541505", "0.6046555", "0.60135597", "0.5978105", "0.59197277", "0.5888756", "0.58740205", "0.5854477", "0.5854377", "0.58528525", "0.5837395", "0.583535", "0.58328754", "0.58169", "0.57637763", "0.57604194", "0.57442...
0.54014283
68
Passport verification Session exists (browser/insider) return passport state Sessionless (iphone/outsider) Returns passport
def show @session = Sso::Session.find(sso_session_id) render json: @session, serializer: Sso::SessionSerializer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_session\n data = { :account => Encryptor.encrypt({:id => id, :phone => phone, :password => password}.to_json, :key => $secret_key) }\n\n response = RestClient.post \"#{$service_url}/api/account/check_session\", data, { :content_type => :json, :accept => :json }\n\n JSON.parse(response)\n rescue...
[ "0.6734302", "0.64541", "0.6420031", "0.6388748", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0.6325727", "0....
0.0
-1
Retrieve a stored value from a given `key`
def [](key) @raw[utf8(key)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(key)\n self[key]\n end", "def get(key)\n @hash.get(key)\n end", "def get(key)\n @hash[key]\n end", "def get(key)\n position = find(key)\n if position != nil\n @values[position]\n else\n nil\n end\n end", "def getValue(key)\r\n \r\n ...
[ "0.828755", "0.8140361", "0.8138523", "0.8110371", "0.8025281", "0.8020805", "0.7993248", "0.7978211", "0.79378587", "0.79378587", "0.79378587", "0.79378587", "0.7860705", "0.7829985", "0.78287375", "0.78061444", "0.78035533", "0.7777323", "0.77565044", "0.7743377", "0.773992...
0.0
-1
Removes all keyvalue pairs from `self`.
def clear @raw.clear self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup!\n self.reject! { |k, v| v.empty? }\n end", "def remove_empty_fields\n self.each_pair do |k, v|\n if self[k].class == Hash\n self[k] = self[k].remove_empty_fields\n else\n self.delete(k) if v.to_s == \"\"\n end\n end...
[ "0.72865564", "0.6979874", "0.682195", "0.6734593", "0.6729228", "0.6694518", "0.6661533", "0.66526616", "0.66008806", "0.6592267", "0.6575835", "0.6532649", "0.65251887", "0.65058804", "0.6482117", "0.64808905", "0.6468398", "0.64671004", "0.64671004", "0.64598936", "0.63897...
0.0
-1
Calls the given block once for each key in the hash, passing the keyvalue pair as parameters. If no block is given, an `Enumerator` is returned instead.
def each return enum_for(__method__) unless block_given? @raw.each_pair do |key, value| yield key, value end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n hash.each(&block)\n end", "def each(&block)\n @hash.each {|k,v| block.call k,v }\n end", "def each(&block)\n @hash.each(&block)\n end", "def each(*args, &block)\n @hash.each(*args, &block)\n end", "def each_pair(&block)\n @hash.each_pair(&block)\n ...
[ "0.8046937", "0.8010828", "0.7942713", "0.756059", "0.75390995", "0.7518694", "0.75044554", "0.7473204", "0.73918426", "0.73157436", "0.7315615", "0.73091584", "0.72909814", "0.72860295", "0.72446823", "0.71660346", "0.71633285", "0.7125818", "0.7098365", "0.7098365", "0.7092...
0.6900659
24
Calls the given block once for each key in the hash, passing the key as a parameter. If no block is given, an `Enumerator` is returned instead.
def each_key return enum_for(__method__) unless block_given? @raw.each_key do |key| yield key end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n hash.each(&block)\n end", "def each(&block)\n @hash.each(&block)\n end", "def each(&block)\n @hash.each {|k,v| block.call k,v }\n end", "def each_key(&block)\n keys.each(&block)\n end", "def each\n @hash.each_key { |o| yield(o) }\n self\n end", ...
[ "0.7865592", "0.775081", "0.7693306", "0.748823", "0.7442418", "0.7399876", "0.7295237", "0.7238419", "0.7228679", "0.72066975", "0.71726716", "0.7139497", "0.7070028", "0.7029381", "0.6981385", "0.6981385", "0.69748366", "0.6904482", "0.68985206", "0.6894795", "0.6828259", ...
0.7110123
12
Calls the given block once for each key in the hash, passing the value at the respective key as a parameter. If no block is given, an `Enumerator` is returned instead.
def each_value return enum_for(__method__) unless block_given? @raw.each_value do |value| yield value end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n hash.each(&block)\n end", "def each(&block)\n @hash.each {|k,v| block.call k,v }\n end", "def each(&block)\n @hash.each(&block)\n end", "def each( &block ) # :yield: member, value\n\t\t\t@hash.each( &block )\n\t\tend", "def each(*args, &block)\n @hash.each(*a...
[ "0.81592214", "0.804703", "0.8029286", "0.7558101", "0.753966", "0.7535335", "0.75024974", "0.7471396", "0.7417457", "0.7382011", "0.7363745", "0.73050296", "0.72958535", "0.7283866", "0.7219739", "0.7207881", "0.71745884", "0.7150925", "0.714957", "0.714957", "0.7143827", ...
0.0
-1
GET /users GET /users.xml
def index @title = 'User Directory' @users = User.where('email not ?', nil).order('first_name DESC').paginate(:page => params[:page], :per_page => User.per_page) respond_to do |format| format.html # index.html.erb format.json { render :json => @users } format.xml { render :xml => @users } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_users\n self.class.get('/users')\n end", "def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end", "def me\n users(request(\"users/authenticate.xml\", :auth => true))\n en...
[ "0.7657926", "0.76263535", "0.7490723", "0.7470033", "0.74069935", "0.7387062", "0.7248585", "0.72448206", "0.721343", "0.7211573", "0.7210826", "0.71998477", "0.71764135", "0.71337295", "0.71337295", "0.71337295", "0.7132803", "0.7132208", "0.7130947", "0.7115423", "0.709057...
0.0
-1
GET /users/1 GET /users/1.xml
def show @user ||= User.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end", "def me\n users(request(\"users/authenticate.xml\", :auth => true))\n end", "def index\n @users = User.all\n render :xml ...
[ "0.7207235", "0.7114702", "0.7054687", "0.7047563", "0.6916399", "0.6915569", "0.69152325", "0.6889017", "0.6863717", "0.6862916", "0.68537647", "0.6850865", "0.6850865", "0.6850865", "0.6827962", "0.68276834", "0.68265396", "0.68056685", "0.68004096", "0.6785998", "0.6765893...
0.0
-1
PUT /Users/1 PUT /Users/1.xml
def update @user = User.find(params[:id]) bSave = true if(bSave) bSave = @user.update_attribute(:bio,params[:user][:bio]) end if(bSave) bSave = @user.update_attribute(:location,params[:user][:location]) end if(bSave) bSave = @user.update_attribute(:first_name,params[:user][:first_name]) end if(bSave) bSave = @user.update_attribute(:last_name,params[:user][:last_name]) end if(bSave) bSave = @user.update_attribute(:name,params[:user][:name]) end if(bSave) bSave = @user.update_attribute(:email,params[:user][:email]) #@user.email = params[:user][:email] #bSave = @user.save end #debugger respond_to do |format| if bSave format.html { redirect_to(@user) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def upd...
[ "0.6658993", "0.63987726", "0.6370967", "0.63224995", "0.6104578", "0.60290873", "0.58474857", "0.58285254", "0.5807006", "0.5779408", "0.5639215", "0.5591483", "0.5571705", "0.5544946", "0.5532271", "0.55310327", "0.55142385", "0.54945296", "0.54808897", "0.545664", "0.54402...
0.0
-1
Get a wiki page.
def wikipage(page, subreddit = nil) name = extract_attribute(subreddit, :display_name) path = "/wiki/#{page}.json" path.prepend("/r/#{name}") if subreddit object_from_response :get, path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_page(id)\n @client.raw('get', \"/content/pages/#{id}\")\n end", "def get_page\n @html_doc = Nokogiri::HTML(open(\"https://en.wikipedia.org/wiki/2020_NBA_playoffs\"))\n return @html_doc\n end", "def url\n\t\t\"#{base}/wiki/#{page}\"\n\tend", "def wiki_page(name, path = nil, versio...
[ "0.720681", "0.70575005", "0.69782513", "0.69630504", "0.69353354", "0.6795602", "0.6795405", "0.67675763", "0.67675763", "0.6732266", "0.67222935", "0.66828233", "0.65933794", "0.65304285", "0.6526571", "0.64633095", "0.64633095", "0.64633095", "0.64633095", "0.64473546", "0...
0.70832086
1
Yields translations to block
def each each_locale { |locale| yield Translation.new(self, locale) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translations; end", "def __with_locale__(locale, &block)\n yield\n end", "def each_locale_and_translated_attribute\r\n used_locales.each do |locale|\r\n translated_attribute_names.each do |name|\r\n yield locale, name\r\n end\r\n end\r\n end", "def carry(*attri...
[ "0.65218854", "0.6201924", "0.61959136", "0.61952144", "0.6055725", "0.5886856", "0.58282363", "0.58015263", "0.57411504", "0.573049", "0.5680819", "0.5674635", "0.56733376", "0.566249", "0.5600197", "0.55918765", "0.5568261", "0.5537879", "0.5523076", "0.55131483", "0.550638...
0.7183599
0
List locales available for this backend.
def locales map(&:locale) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locales\n get(\"locales\")[\"locales\"]\n end", "def available_locales\n self.locales.map { |locale| locale.to_sym }\n end", "def available_locales\n evaluate_localization_option!(:available_locales)\n end", "def available_locales\n resource.translations.all(:fields => [:loca...
[ "0.775015", "0.7720163", "0.7659254", "0.76236016", "0.751332", "0.738009", "0.73524016", "0.73524016", "0.73498744", "0.7231358", "0.72260714", "0.7193378", "0.7131783", "0.7131057", "0.71171355", "0.71171314", "0.7073235", "0.70539683", "0.7050902", "0.7045013", "0.7024242"...
0.7620866
4
Assign block to be called on model class.
def setup &block if @setup_block setup_block = @setup_block exec_setup_block = method(:exec_setup_block) @setup_block = lambda do |attributes, options, backend_class| [setup_block, block].each do |blk| exec_setup_block.call(self, attributes, options, backend_class, &blk) end end else @setup_block = block end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(&block)\n @block = block\n end", "def initialize(&block)\n @block = block\n end", "def initialize(&block)\n @block = block\n end", "def parsed_model(&block)\n parsed_model_class.class_eval(&block)\n end", "def execute(block)\n model = @wrapper...
[ "0.70473266", "0.6913146", "0.6913146", "0.68325454", "0.67524666", "0.6699584", "0.66709614", "0.6657844", "0.65972716", "0.65951025", "0.65910745", "0.65881836", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", "0.65776056", ...
0.6149898
63
Build a subclass of this backend class for a given set of options
def build_subclass(model_class, options) ConfiguredBackend.build(self, model_class, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(options={})\n klass = options.delete(:type)\n \n if klass\n module_eval \"#{klass.to_s.capitalize}.new(#{options})\"\n else\n assign_options(options)\n end\n end", "def initialize_options(original_options)\n super\n\n case options[:backend]\n when Str...
[ "0.6497293", "0.644078", "0.6379249", "0.63658696", "0.6317947", "0.62407863", "0.61906207", "0.6120596", "0.60955805", "0.607285", "0.6040165", "0.6028494", "0.6020593", "0.6006312", "0.59902906", "0.59701794", "0.59594756", "0.59489304", "0.58794874", "0.5850741", "0.584996...
0.7384247
0
Create instance and class methods to access value on options hash
def option_reader(name) module_eval <<-EOM, __FILE__, __LINE__ + 1 def self.#{name} options[:#{name}] end def #{name} self.class.options[:#{name}] end EOM end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options ; @options ||= get(:options) end", "def get_options; end", "def method_missing(sym, *args)\n return @options[sym]\n end", "def options\n self[:options] || {}\n end", "def options\n @options ||= self.class.options\n end", "def options\n self.cl...
[ "0.7246439", "0.7124633", "0.7010595", "0.70088863", "0.6865761", "0.6853084", "0.68266654", "0.68260986", "0.6800341", "0.67721343", "0.6762285", "0.6753329", "0.674094", "0.66978514", "0.66870797", "0.66870797", "0.6676867", "0.6676867", "0.66763216", "0.66605836", "0.66605...
0.0
-1
Call setup block on a class with attributes and options.
def setup_model(model_class, attribute_names) return unless setup_block = @setup_block exec_setup_block(model_class, attribute_names, options, self, &setup_block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(&block)\n define_method(:setup, &block)\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def initialize(*args, &blk)\n setup(*arg...
[ "0.7373911", "0.73719925", "0.7358792", "0.7341957", "0.7304759", "0.7248919", "0.71910113", "0.7184338", "0.7184338", "0.70105827", "0.6975673", "0.69716394", "0.692515", "0.6921935", "0.69026744", "0.688502", "0.6875963", "0.68683666", "0.68347543", "0.6834604", "0.68089736...
0.66891235
26
Show subclassed backend class name, if it has one.
def inspect (name = superclass.name) ? "#<#{name}>" : super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_name\n klass = single_class\n while klass.name == ''\n klass = klass.superclass\n end\n if list_context?\n \"[#{klass}]\"\n else\n klass.name\n end\n end", "def backend_klass; end", "def display_name\n class_name\n end", "def sg_base_class_n...
[ "0.6831985", "0.6440317", "0.64034855", "0.6316508", "0.6314508", "0.62795836", "0.626747", "0.626747", "0.62649447", "0.62633145", "0.62614065", "0.62553453", "0.6237324", "0.6225607", "0.619343", "0.619343", "0.61895573", "0.61798745", "0.6176625", "0.61765593", "0.6152883"...
0.0
-1