query
stringlengths
7
9.5k
document
stringlengths
10
1.07M
negatives
listlengths
19
19
metadata
dict
DELETE /markets/1 DELETE /markets/1.json
def destroy @market.destroy respond_to do |format| format.html { redirect_to markets_url } format.json { head :no_content } end end
[ "def destroy\n @market = Market.find(params[:id])\n @market.destroy\n\n respond_to do |format|\n format.html { redirect_to markets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @market.destroy\n respond_to do |format|\n format.html { redirect_to markets_ur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the chosen colour mode.
def colour_mode instance.options[:colour_mode] end
[ "def color_mode\n return @color_mode\n end", "def color_mode=(value)\n @color_mode = value\n end", "def color_modes\n return @color_modes\n end", "def colour_mode\n parser.on('-C', '--colour-mode [COLOURS]', Integer,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return the configured foreground colour for the client application.
def foreground instance.options[:foreground] end
[ "def foreground\n get_or_inherit_color(:foreground, Cura::Color.white)\n end", "def context_get_fgcolor()\n return $gimp_iface.gimp_context_get_foreground()[0]\nend", "def foreground\n @foreground ||= if colour && present?(colour.foreground)\n colour.foreground\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a boolean indicating whether the log has been configured.
def log? log != nil end
[ "def logging?\n config.logger_enabled\n end", "def logging_enabled?\n !!logging_enabled\n end", "def logging?\n @_logging\n end", "def configured?\n true\n end", "def log?\n @log ||= false\n end", "def log?\n\t\t\t@glogging\n\t\tend", "def is_configured\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns whether mouse support was enabled or disabled.
def mouse? instance.options[:mouse] end
[ "def enable_mouse(enable = true)\n\t\trequest = Packet.create_request('stdapi_ui_enable_mouse')\n\n\t\trequest.add_tlv(TLV_TYPE_BOOL, enable)\n\n\t\tresponse = client.send_request(request)\n\n\t\treturn true\n\tend", "def mouse_moving?\n MouseMonitor[5]\n end", "def disable_mouse\n\t\treturn enable_mouse(fa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the renderers which should receive output.
def renderers instance.options[:renderers] end
[ "def renderers\n self\n end", "def renderer_classes\n self.class.classes_from(namespace).select { |cand| renderer? cand }\n end", "def renderer\n DirRenderer.renderers.partition {|r| !r.built_in?}.flatten.find do |r|\n r.can_render?(self) && !plugin_disabled?(r)\n end\n e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the redefined setting for STDERR.
def stderr instance.options[:stderr] end
[ "def stderr_redirection(tool_config, logging)\n # if there's no logging enabled, return :stderr_redirect unmodified\n return tool_config[:stderr_redirect] if (not logging)\n\n # if there is logging enabled but the redirect is a custom value (not enum), return the custom string\n return tool_config[:stde...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the terminal mode for the application. Default is `:raw`.
def terminal_mode instance.options[:terminal_mode] end
[ "def mode\n @_mode ||= Configuration.terminal_mode\n end", "def raw_mode!\n Vedeu.log(\"Terminal switching to 'raw' mode\")\n\n @_mode = :raw\n end", "def mode\n return 'quiet' if quiet?\n (@mode || 'normal').downcase\n end", "def raw!\n Vedeu.log(\"Configuration...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempt to determine the terminal colour mode via $TERM environment variable, or be optimistic and settle for 256 colours.
def detect_colour_mode case ENV['TERM'] when /-truecolor$/ then 16_777_216 when /-256color$/, 'xterm' then 256 when /-color$/, 'rxvt' then 16 else 256 end end
[ "def detect_colour_mode\n case ENV['TERM']\n when /-truecolor$/ then 16777216\n when /-256color$/, 'xterm' then 256\n when /-color$/, 'rxvt' then 16\n else 256\n end\n end", "def detect_colour_mode\n case ENV['TERM']\n when 'xterm-256color', 'screen-256color'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Represents the Attachment as a String
def to_s "#{@name}, #{@mime_type}" end
[ "def to_s\n @file_text\n end", "def attachments_s\n str = ''\n self.attachments.each do |att|\n str.concat(att.to_s)\n end\n str = @strmaker.red(\" N/A#{$/}\") if str == '' # no attachments\n str.concat($/)\n str end", "def to_s\n self.filename + \"\\n\" + self.metadata.to_s\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /tarifas/1 GET /tarifas/1.xml
def show @tarifas = Tarifas.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @tarifas } end end
[ "def index\n @tipo_lancamentos = TipoLancamento.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tipo_lancamentos }\n end\n end", "def index\n retrieve_vtodos\n\n respond_to do |format|\n format.html # index.html.erb\n format.rdf { ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /tarifas/new GET /tarifas/new.xml
def new @tarifas = Tarifas.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @tarifas } end end
[ "def new\n @revista = Revista.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @revista }\n end\n end", "def new\n @servico = Servico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @servico }\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /tarifas POST /tarifas.xml
def create @tarifas = Tarifas.new(params[:tarifas]) respond_to do |format| if @tarifas.save flash[:notice] = 'Tarifas was successfully created.' format.html { redirect_to(@tarifas) } format.xml { render :xml => @tarifas, :status => :created, :location => @tarifas } else ...
[ "def new\n @tarifas = Tarifas.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tarifas }\n end\n end", "def create\n @tarifas_servicio = TarifasServicio.new(tarifas_servicio_params)\n\n respond_to do |format|\n if @tarifas_servicio.save\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /tarifas/1 PUT /tarifas/1.xml
def update @tarifas = Tarifas.find(params[:id]) respond_to do |format| if @tarifas.update_attributes(params[:tarifas]) flash[:notice] = 'Tarifas was successfully updated.' format.html { redirect_to(@tarifas) } format.xml { head :ok } else format.html { render :actio...
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def test_put_existing...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /tarifas/1 DELETE /tarifas/1.xml
def destroy @tarifas = Tarifas.find(params[:id]) @tarifas.destroy respond_to do |format| format.html { redirect_to(tarifas_url) } format.xml { head :ok } end end
[ "def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @archivo = Archivo.find(params[:id])\n @archivo.destroy...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /group_events POST /group_events.json
def create @group_event = GroupEvent.new(group_event_params) respond_to do |format| if @group_event.save format.html { redirect_to @group_event, notice: 'Group event was successfully created.' } format.json { render :show, status: :created, location: @group_event } else form...
[ "def create\n @group_event = GroupEvent.new(params[:group_event])\n\n respond_to do |format|\n if @group_event.save\n format.html { redirect_to @group_event, notice: 'Groups event was successfully created.' }\n format.json { render json: @group_event, status: :created, location: @group_even...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /group_events/1/publish GET /group_events/1/publish.json
def publish @group_event.published = true begin @group_event.save! rescue Exception => ex respond_to do |format| format.json { render :json => {:errors => @group_event.errors.full_messages}, :status => 422 } format.html { redirect_to group_events_url, notice: ex.message } ...
[ "def publish\n @event = Event.find_by_id(params[:event_id].to_i)\n if @event != nil && !@event.archived\n if !@event.published\n @event.published = true\n @event.published_date = Time.now\n if @event.save\n # send push notifications\n # send_push_notification_to_mem...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creates a new renderer instance of given id or the default one if id is not recognized
def renderer_named(id) id == 'cool' ? CoolRenderer.new : DefaultRenderer.new end
[ "def renderer(name, *args)\n if r = renderers.find{|triple| triple[0] == name}\n r[2].new(*args)\n else\n raise \"No renderer registered for #{name}\"\n end\n end", "def create_default_renderer\n r = ListRenderer.new self\n renderer(r)\n end", "def get_re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Restituisce true se l'array contiene altri array (es. [[1],2,3] => true)
def boolean_nested_array(array) array.each do |slot| return true if slot.kind_of?(Array) end return false end
[ "def include_array?(array)\n array.any? { |member| array?(member) }\n end", "def include_any?(*array)\n array = array[0] if array.size == 1 && array[0].is_a?(Array)\n !array.nil? && (array.empty? || !(self & array).empty?)\n end", "def array?\n return false if error?\n result.is_a?(Ar...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
la funzione + riceve come argomento un oggetto Point2D e restituisce un nuovo oggetto Point2D che ha come coordinate la somma delle coordinate dei due oggetti. (x1 + x2, y1 + y2) la funzione non deve alterare lo stato interno dell'oggetto, ma restituire un nuovo oggetto
def + (point) return Point2D.new(@x + point.x, @y + point.y) end
[ "def + (point) \r\n return Point2D.new(@x+point.x,@y+point.y) \r\n end", "def +(other)\n Point2D.new(@x + other.x, @y + other.y)\n end", "def trans2d(point2d)\n check_pre((self.shape2d? and point2d== Point2d))\n if (self== Range2d) then\n Range2d[(self.x_range).trans1d(point2d.x),(self.y_ra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
VM information Returns an Array of snapshot names
def snapshots raise Fission::Error,"VM #{@name} does not exist" unless self.exists? command = "#{vmrun_cmd} listSnapshots #{vmx_path.shellescape} 2>&1" output = `#{command}` raise "There was an error listing the snapshots of #{@name} :\n #{output}" unless $?.exitstatus==0 snaps_unfilte...
[ "def list_all_vbox_vm_snapshots()\n vm_list = get_available_vbox_vms()\n vm_list.each do |line|\n options['name'] = line.split(/\"/)[1]\n list_vbox_vm_snapshots(options)\n end\n return\nend", "def list_vbox_vm_snapshots(options)\n if options['name'] == \"none\"\n list_all_vbox_vm_snapshots()\n else...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve the ip address for a vm. This will only look for dynamically assigned ip address via vmware dhcp
def ip_address raise ::Fission::Error,"VM #{@name} does not exist" unless self.exists? unless mac_address.nil? lease=LeasesFile.new("/var/db/vmware/vmnet-dhcpd-vmnet8.leases").find_lease_by_mac(mac_address) if lease.nil? return nil else return lease.ip en...
[ "def vm_ip\n $logger.info { 'Get VM IP addresses' }\n addresses = []\n dc = VMwareWrapper.datacenter(opts)\n vm = dc.find_vm(\"#{opts[:vm_folder_path]}/#{vm_name}\") || abort('VM not found')\n vm.guest.net.each do |nic|\n addresses << nic.ipAddress\n end\n addresses\n end", "def ip_addr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns true if the text chunk is international, false otherwise
def international? @international end
[ "def english?\n text.ascii_only?\n end", "def unicode?\n self.local =~ /[^\\p{InBasicLatin}]/ ? true : false\n end", "def unicode?(text)\n !is_gsm(text)\n end", "def latinish?\n latin_count = cyrillic_count = 0\n split_words.each do |word|\n if word.latin?\n latin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prints formatted keyword and text
def report if @language == "" && @translated_keyword == "" puts @keyword + ": " + text else puts @language puts @keyword + ", " + @translated_keyword + ": " + text end end
[ "def printable\n\t\tstr_out = ''\n\t\tcount = 0\n\t\tself.keywords.each do |key| \t\t\t#use keywords to ensure it's sorted\n\t\t\tcount += 1\n\t\t\tstr_out += \"[#{key}] \\\"#{@entries[key]}\\\"\"\n\t\t\t# append \\n if not the last entry\n\t\t\tstr_out += \"\\n\" if count != self.keywords.length\n\t\tend\n\t\tstr_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
paginate a call to find_tagged_with klass is the tagged class tag is the tag to find count is the total number of items with that tag, if nil count_tags is called per_page is numbe rof items per page page is the page we are on order is the order to return the items in
def tag_paginator(klass, tag, count=nil, per_page=10, page=1, offset = 0, order='created_at DESC') count ||= klass.count_tags(tag) pager = ::Paginator.new(count, per_page) do |offset, per_page| klass.find_tagged_with(tag, :order => order, :limit => per_page, :offset => offset) end page ||= 1 ...
[ "def paginate( options = {} )\n pp = options.delete(:per_page) || per_page\n all = options.delete(:all)\n\n options.delete(:category_id) if options[:category_id].nil?\n\n count = count_for( all, options[:category_id] )\n\n Paginator.new( count, per_page ) do |offset, per_page|\n all...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
format time to long style
def timelong( time ) time.strftime('%Y-%m-%d %H:%M:%S') if time end
[ "def long_form_time(timestamp)\n timestamp.strftime('%H:%M')\n end", "def long\n @time_format = \"%d %b, %Y at %I:%M%P\"\n self\n end", "def humanize_time(time)\n\tmm, ss = time.divmod(60)\n\thh, mm = mm.divmod(60)\n\tdd, hh = hh.divmod(24)\n\tdays = \"%d days, \" % [dd] if dd > 0\n\thours = \"%d hou...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Explicitly set the name of a queue for the given method route Ex. queue_for :created, "derp.derp" queue_for :updated, "foo.bar"
def queue_for(method, queue_name) @_queue_names ||= {} @_queue_names[method] = queue_name end
[ "def queue_name_for_method(method_name)\n return queue_names[method_name] if queue_names[method_name]\n\n queue_name = generate_queue_name(method_name)\n queue_for(method_name, queue_name)\n return queue_name\n end", "def method_name(queue)\n queue.split(\"__\").last\n end", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Explicitly set the whole routing key to use for a given method route.
def routing_key_for(method, routing_key_name) @_routing_key_names ||= {} @_routing_key_names[method] = routing_key_name end
[ "def route_key=(_arg0); end", "def singular_route_key=(_arg0); end", "def routing_key_name_for_method(method_name)\n return routing_key_names[method_name] if routing_key_names[method_name]\n\n routing_key_name = generate_routing_key_name(method_name)\n routing_key_for(method_name, routing_key_nam...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=begin input: float, output: string. rules: use two digit numbers with leading zeros when formatting minutes and seconds. Use constant to represent degree symbol. if num greater than 360... DS: string algo: define a method called dms, takes one float number parameter num init lv angle, set to empty string turn float nu...
def dms(num) angle_str = %() num_ary = num.to_s.partition('.') #degree angle_str << (num_ary[0] + DEGREE) minutes_seconds_ary = ((num_ary[-1].to_f * 60.0) / 10**(num_ary[-1].size).to_f).to_s.partition('.') #minutes if minutes_seconds_ary[0].size <= 1 angle_str << ('0' + minutes_seconds_...
[ "def dms(num)\n if num > 360\n num = num % 360\n elsif num < 0\n num = 360 - (num.abs % 360)\n end\n degree = num.to_i\n minutes = 0\n seconds = 0\n if degree != 0\n minutes = num % num.to_i * 60\n if minutes != 0\n seconds = minutes % minutes.to_i * 60\n end\n end\n \n %(#{degree}\\xC...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
OCSP response stapling information.
def ocsp_response @ocsp_response ||= if (ocsp_response = @node.at('ocspStapling/ocspResponse')) OCSPResponse.new(ocsp_response) end end
[ "def response_line\n \"ICAP/#{@icap_version} #{@icap_status_code} #{ICAP_STATUS_CODES[@icap_status_code]}\\r\\n\"\n end", "def success_response(api_response, response)\n @response_details = response[:shipment_reply]\n end", "def ret_ocsp\n # Build ocsp request\n digest = OpenSSL::D...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Moves an existing attachment to its target directory
def move_to_target_directory! return if new_record? || !readable? src = diskfile self.disk_directory = target_directory dest = diskfile return if src == dest if !RedmicaS3::Connection.move_object(src, dest) Rails.logger.error "Could not move attachment from #...
[ "def move(old_path, new_path)\n blog.client.file_move(old_path, new_path)\n end", "def move(destination)\n FileUtils.mv(self, destination)\n destination.to_pathname\n end", "def move_into(directory, &block)\n self.move_as(directory / self.basename, &block)\n end", "def move_to(new_path, permiss...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates attachment digest to SHA256
def update_digest_to_sha256! return unless readable? object = self.s3_object sha = Digest::SHA256.new sha.update(object.get.body.read) new_digest = sha.hexdigest unless new_digest == object.metadata['digest'] object.copy_from(object, content_dispos...
[ "def update_with_file_contents(digest, filename)\n File.open(filename) do |io|\n while (chunk = io.read(1024 * 8))\n digest.update(chunk)\n end\n end\n end", "def update_digest\n\n path = self.bundle_dir\n sha = Digest::SHA2.new\n bundle_sha = Digest::SHA2.new\n\n d...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Extract the connection string for the rabbitmq service from the service information provided by Cloud Foundry in an environment variable.
def amqp_url if not ENV['VCAP_SERVICES'] return { :host => "localhost", :port => 5672, :username => "guest", :password => "guest", :vhost => "/", } end services = JSON.parse(ENV['VCAP_SERVICES'], :symbolize_names => true) url = services.values.map do |srvs| srvs.map do...
[ "def amqp_url\n if not ENV['VCAP_SERVICES']\n return {\n :host => \"localhost\",\n :port => 5672,\n :username => \"guest\",\n :password => \"guest\",\n :vhost => \"/\",\n }\n end\n\n services = JSON.parse(ENV['VCAP_SERVICES'], :symbolize_names => true)\n url = services.values.map ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Opens a client connection to the RabbitMQ service, if one isn't already open. This is a class method because a new instance of the controller class will be created upon each request. But AMQP connections can be longlived, so we would like to reuse the connection across many requests.
def client unless $client u = amqp_url conn = Bunny.new(u) conn.start $client = conn.create_channel # We only want to accept one un-acked message $client.prefetch(1) end $client end
[ "def client\n unless $client\n c = Bunny.new(amqp_url)\n c.start\n $client = c\n\n # We only want to accept one un-acked message\n $client.qos :prefetch_count => 1\n end\n $client\n end", "def ensure_connection\n client = @connection.client(self)\n\n if client.nil?\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return a queue named "messages". This will create the queue on the server, if it did not already exist. Again, we use a class method to share this across requests.
def messages_queue $messages_queue ||= client.queue("messages", :durable => true, :auto_delete => false) end
[ "def messages_queue\n $messages_queue ||= client.queue(\"messages\")\n end", "def messages_queue\n $messages_queue ||= client.queue(\"messages\")\nend", "def queue( name )\n Qup::Adapter::Kestrel::Queue.new( @client, name )\n end", "def get_message_counting_queue\n\t\t@queue ||= begin\n\t\t\tself...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If all gates are hidden, the sation must be hidden, if one is visible, station must be visible.
def check_station_visibility station.update(hidden: station.access_control_gates.where.not(id: id).pluck(:hidden).push(hidden).uniq.all?) if hidden_changed? end
[ "def hidden?\n !visible?\n end", "def hidden?\n not visible?\n end", "def hidden?\n !visible?\n end", "def visible=(vis)\n if vis\n show\n else\n hide\n end\n end", "def hidden?()\n not visible?()\n end", "def is_visible?\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a status record if one does not exist
def check_create_status if self.v_status.nil? status = VStatus.new status.v_project = self status.v_user_data = self.v_user_data self.v_status = status end end
[ "def create_status(Status status)\n Status.create(group_id: @group_id, status: status)\n end", "def ensure_status\n return unless @status.nil?\n\n refresh_status!\n return unless @status.nil?\n\n logger.debug(\"#{STATUS_TAG} created during perform\")\n create([\n 'p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /maintenance_schedules/1 GET /maintenance_schedules/1.xml
def show @maintenance_schedule = MaintenanceSchedule.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @maintenance_schedule } end end
[ "def index\n @schedules = Schedule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @schedules }\n end\n end", "def show\n @simple_schedule = SimpleSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /maintenance_schedules/new GET /maintenance_schedules/new.xml
def new @maintenance_schedule = MaintenanceSchedule.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @maintenance_schedule } end end
[ "def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end", "def new\n @simple_schedule = SimpleSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simple_schedule }\n end\n end", "def new\n @sched...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /maintenance_schedules POST /maintenance_schedules.xml
def create @maintenance_schedule = MaintenanceSchedule.new(params[:maintenance_schedule]) respond_to do |format| if @maintenance_schedule.save format.html { redirect_to(@maintenance_schedule, :notice => 'Maintenance schedule was successfully created.') } format.xml { render :xml => @main...
[ "def maintenance_schedule(statuspage_id, maintenance_name, maintenance_details, infrastructure_affected,\n date_planned_start, time_planned_start, date_planned_end, time_planned_end,\n automation = \"0\", all_infrastructure_affected = \"0\",\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /maintenance_schedules/1 PUT /maintenance_schedules/1.xml
def update @maintenance_schedule = MaintenanceSchedule.find(params[:id]) respond_to do |format| if @maintenance_schedule.update_attributes(params[:maintenance_schedule]) format.html { redirect_to(@maintenance_schedule, :notice => 'Maintenance schedule was successfully updated.') } format....
[ "def update\n @simple_schedule = SimpleSchedule.find(params[:id])\n\n respond_to do |format|\n if @simple_schedule.update_attributes(params[:simple_schedule])\n format.html { redirect_to(@simple_schedule, :notice => 'Simple schedule was successfully updated.') }\n format.xml { head :ok }\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /maintenance_schedules/1 DELETE /maintenance_schedules/1.xml
def destroy @maintenance_schedule = MaintenanceSchedule.find(params[:id]) @maintenance_schedule.destroy respond_to do |format| format.html { redirect_to(maintenance_schedules_url) } format.xml { head :ok } end end
[ "def destroy\n @simple_schedule = SimpleSchedule.find(params[:id])\n @simple_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(simple_schedules_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @maintenance = Maintenance.find(params[:id])\n @maintena...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check that all arguments are probabilites i.e. the are numbers between 0.0 and 1.0
def assert_probability *args assert_floatable(*args) args.each do |var| assert do var >= 0.0 && var <= 1.0 end end end
[ "def check_probability_bounds(bounds)\r\n bounds1, bounds2 = bounds\r\n bounds_diff = bounds2 - bounds1 \r\n if (\r\n (bounds_diff < 0) || (bounds_diff > 100) ||\r\n (bounds1 < 0) || (bounds2 > 100)\r\n )\r\n raise ArgumentError, \"wasn't given 0 <= bounds1 <= bounds2 <= 100\"\r\n end\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks that all arguments are float or can be converted to a float.
def assert_floatable *args args.each do |var| assert do var.not_nil? && var.is_a?(Numeric) end end end
[ "def test_arg_is_float\r\n args = [1.1, 2.1, 3.5]\r\n assert_nil argsCheck(args)\r\n end", "def valid_float?\nbegin\nFloat(self)\ntrue\nrescue ArgumentError\nfalse\nend\nend", "def validate_float(v); end", "def are_floats?(x,y)\n return x.is_a?(Float) && y.is_a?(Float)\n end", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks that all arguments are symbols.
def assert_symbol *args args.each{|a| assert{a.is_a?(Symbol)}} end
[ "def raise_error_args?\n arg_types = arguments.map(&:sexp_type)\n [[], [:str], [:const], [:const, :str]].include?(arg_types)\n end", "def raise_error_args?\n arg_types = arguments.map(&:sexp_type)\n [[], [:str], [:const], %i[const str], [:colon2]].include?(arg_types)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks that all arguments are a Proc object or +nil+.
def assert_proc_or_nil *args args.each{|a| assert{a.nil? || a.is_a?(Proc)}} end
[ "def safe_proc_call proc, args\n if proc.respond_to?(:call)\n proc.call(*args)\n else\n if args.length == 0\n proc # Popular bug: call no-arg method not like a property\n else\n raise NoMethodError, \"Invalid callable\"\n end\n end\n # proc.is_a?(Arr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /employees_roles POST /employees_roles.json
def create @employees_role = EmployeesRole.create(employees_role_params) redirect_to employees_roles_path end
[ "def create_employee_role(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me/roles'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
clean up the filters so only valid ones exist
def clean_filters cleaned_filters = {} self.filters.each do |name, value| if (self.filter_options[name.to_sym][:fields].detect{|f| f[:value] == value } rescue false) cleaned_filters[name.to_sym] = value end end self.filters = cleaned_filters end
[ "def prepare_filters\n params = instance_values.symbolize_keys\n filters = clean_params(params)\n validate_filters(filters)\n end", "def sanitize_filter_fields\n if self.filter_fields\n self.filter_fields.reject! { |id| id.blank? }\n end\n end", "def validate_filte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
test return via tail call
def test_will_return_via_tail_call src =<<-EOC defn g() {9} defn f(x) { zero?(:x) && return %g %g + 9 } EOC vi = mkvi src+"\nf(0)\n";ti = mkti src+"\nf(0)\n" assert (vi.run == 9) && (ti.run == 9), "Expected both optimized and non_optiized to return9, but one of them did not" end
[ "def success?() end", "def exit(res=0) end", "def tail_call(intp)\n apply(intp)\n end", "def crappy_api_call\n $count += 1\n\n # First two calls fail\n raise \"OH SNAP\" if $count < 3\n\n # Next few calls say pending\n return :pending if $count < 5\n\n # Then finally done\n return :happy\nend", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Should not have any tail calls for toplevel conditionals, either.
def test_top_level_conditionals_should_not_have_tail_calls tcompile 'zero?(0) && %g' tail_found = false lambdacall_found = false visit_tree @tc.ast, lambdacall: ->(x) { lambdacall_found = true }, tailcall: ->(x) { tail_found = true } assert !tail_found, "Expected to not find any :tailcalls, but di...
[ "def test_non_tail_position_blocks_cannot_have_tailcalls\n tails_found = 0\n tcompile 'defn foo() {{9; %g}; 99}'\n visit_tree @tc.ast, tailcall:->(x) {tails_found += 1 }\n assert tails_found.zero?, \"Expected to not find any tail calls, but found #{tails_found} instead\" \n end", "def print_ending_co...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Cannot have tail calls in blocks that are not the tail position inside lambdas. Must refrain from promoting anything in block or conditional into tailcall.
def test_non_tail_position_blocks_cannot_have_tailcalls tails_found = 0 tcompile 'defn foo() {{9; %g}; 99}' visit_tree @tc.ast, tailcall:->(x) {tails_found += 1 } assert tails_found.zero?, "Expected to not find any tail calls, but found #{tails_found} instead" end
[ "def test_top_level_conditionals_should_not_have_tail_calls\n tcompile 'zero?(0) && %g'\n tail_found = false\n lambdacall_found = false\n visit_tree @tc.ast, lambdacall: ->(x) { lambdacall_found = true }, tailcall: ->(x) { tail_found = true }\n assert !tail_found, \"Expected to not find any :tailca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /tutorials/1 PATCH/PUT /tutorials/1.json
def update respond_to do |format| if @tutorial.update(tutorial_params) format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @tutorial.erro...
[ "def update\n\t\tif @tutorial.update(tut_params)\n\t\t\thead :no_content\n\t\telse\n\t\t\trender json: @tutorial.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update\n if @tutorial.update(tutorial_params)\n render :show, status: :ok\n else\n render json: @tutorial.errors, status: :u...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /tutorials/1 DELETE /tutorials/1.json
def destroy @tutorial.destroy respond_to do |format| format.html { redirect_to tutorials_url } format.json { head :no_content } end end
[ "def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tutorials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n render...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Right now we have /v2/exercises and /v2/exercises/:track_id. Let's tweak the /v2/exercises to take an optional parameter ?tracks=a,b,c and if that parameter is passed, only return the data for those tracks.
def test_that_you_may_filter_to_single_track getting '/v2/exercises?tracks=fruit' returns_tracks %w( fruit ) end
[ "def tracks(opts={})\n perform_get_request('tracks.json', opts)\n end", "def search_track(opts = {}, &block)\n if opts.is_a? String\n query = opts\n else\n query = opts[:query]\n artist = opts[:artist]\n track = opts[:track]\n end\n if not query.nil?\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Debit the label's account, and each parent up the tree.
def debit_sign_up user, transaction_event, label return if label.nil? # It's ok if the balance goes negative, we want the sign up either way. This is an atomic update Label.update_all("available_balance = available_balance - package_signup_rate", {id: label.id}) label.reload ce = CreditEvent.cre...
[ "def debit_entry\n transaction.debit_entry\n end", "def subtract_account(account_tracker, account, number_coins)\r\n exists = account_tracker.account_exists?(account)\r\n account_tracker.remove_balance(account, number_coins) if exists\r\n account_tracker.add_account(account) unless exists\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Each month, debit the label for each active subscription. Care has been taken so that this job, which usually runs from a cron > rake task, can safely be rerun in case an error occurs.
def debit_monthly_subscriptions ccp = CreditCardProcessor.new(@label) # subscriptions dont start for atleast a month after being created. # filter out any recently billed subscriptions. This allows a job to rerun safely if an error occurs. @label.subscriptions.where('created_at < ? and label_last_bi...
[ "def company_payment_reminders\n check_company_usage_cycle\n company_monthly_payment_reminders\n end", "def generate_and_send_labels\n date = DateTime.parse(@result['created_at'])\n creation_date = date.strftime('%d/%m/%Y')\n case @result['state']\n when 'created', 'purchased'\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /armas/new GET /armas/new.json
def new @arma = Arma.new respond_to do |format| format.html # new.html.erb format.json { render json: @arma } end end
[ "def new\n @rota = Rota.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rota }\n end\n end", "def new\n @aroma = Aroma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aroma }\n end\n end", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /armas POST /armas.json
def create @arma = Arma.new(params[:arma]) respond_to do |format| if @arma.save format.html { redirect_to @arma, notice: 'Arma was successfully created.' } format.json { render json: @arma, status: :created, location: @arma } else format.html { render action: "new" } ...
[ "def create\n @armamento = Armamento.new(armamento_params)\n\n respond_to do |format|\n if @armamento.save\n format.html { redirect_to @armamento, notice: 'O Armamento foi criado com sucesso!' }\n format.json { render :show, status: :created, location: @armamento }\n else\n form...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Save auto scale group
def group_save(group) raise NotImplementedError end
[ "def save\n if group.id\n update\n true\n else\n raise \"New #{self.class} are created when a new Fog::Rackspace::AutoScale::Group is created\"\n end\n end", "def save_group\r\n\t\tsave = 'INSERT INTO groups (name, faction, number) VALUES (?,?,?)'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reload the group data from the API
def group_reload(group) if(group.persisted?) result = request( :method => :get, :path => "/groups/#{group.id}", :expects => 200 ) grp = result.get(:body, :group) group.load_data( :name => grp.get('groupConf...
[ "def group_reload(group)\n if group.id || group.name\n load_group_data(group)\n end\n group\n end", "def reload\n if group_id.nil?\n super\n service.delete_security_group(name)\n else\n requires :group_id\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Throws InvalidListOptions if options were passed that shouldn't have been.
def sanitize_options(options) options.keys.each do |key| unless Facade.options[:valid_find_options].include?(key) || Facade.options[:valid_list_options].include?(key) raise InvalidListOptions, "Bad key passed: #{key}" end end end
[ "def validate_options\n # do nothing\n end", "def options_with_errors\n options.reject(&:valid?)\n end", "def validate_options(options)\n return super unless backend\n super(options.slice(*(options.keys - backend.valid_keys)))\n\n # Validate that the default backend from...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merge options for a specified name and type into the defaults and return the result.
def merge_default_options(name, type, options = {}) list_options[name][type].merge(options) end
[ "def fetch_options(opts, type, defaults)\n options = opts.fetch(type, defaults)\n defaults.merge(options || {})\n end", "def merge_defaults!(config)\n MERGE_DEFAULT.each do |option|\n if config[option].kind_of?(Array)\n config[option] = (DEFAULTS[option] | config[option])\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Does this questionnaire contain true/false questions?
def true_false_questions? for question in questions if question.true_false return true end end return false end
[ "def true_false_questions?\n questions.each { |question| return true if question.type == 'Checkbox' }\n false\n end", "def true_false_questions?\n questions.each {|question| return true if question.type == \"Checkbox\" }\n false\n end", "def accurate?(bools)\n self.answers.map(&:correct) == boo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Produces a speech from V For Vendetta.
def speech fetch('v_for_vendetta.speeches') end
[ "def speech; end", "def to_speech\n Aurora::Api.get_tts(@text)\n end", "def speak\n object_instance = object_instances.last\n Liquid::Template.parse(text_to_voice).render(object_instance.try(:attributes))\n end", "def speak\n require 'win32/sapi5'\n Win32::SpVoice.new.Spea...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Produces a quote from V For Vendetta.
def quote fetch('v_for_vendetta.quotes') end
[ "def marvin_quote; end", "def quote\n fetch('venture_bros.quote')\n end", "def quote\n fetch('seinfeld.quote')\n end", "def king_richard_iii_quote; end", "def quote\n fetch('greek_philosophers.quotes')\n end", "def quote\n fetch('departed.quotes')\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Download a recording of a webinar downloading the webinar records via the download url is only possible if: you enable redirection you use the JWT access token will not work with the Oauth token. This is a known bug in the API.
def meeting_recordings_download_file(download_url) raise "You must use JWT client" unless self.class == Zoom::Clients::JWT file=Tempfile.create file.binmode response = HTTParty.get("#{download_url}?access_token=#{access_token}", stream_body: true, follow_redirects: tr...
[ "def download\n @export_file = Export.active.find_by_access_token params[:id]\n\n if @export_file\n path = @export_file.document.path\n mime_type = Mime::Type.lookup_by_extension(path.split('.').last).to_s\n\n data = open(@export_file.document.expiring_url(DOWNLOAD_AVAILABLE_FOR_IN_SECONDS))\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to perform a mouse up on this view in the remote application
def mouse_up() mouse_up_at :center, :center end
[ "def onLButtonUp(flags, x, y, view)\n end", "def onLButtonUp(flags, x, y, view)\n Sketchup::set_status_text $uStrings.GetString(\"Left button up at\") + \" (#{x}, #{y})\"\nend", "def right_mouse_up()\n right_mouse_up_at :center, :center\n end", "def scrollUp\n \th = getProperty('height'...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to perform a mouse down with right button on this view in the remote application
def right_mouse_down() right_mouse_down_at :center, :center end
[ "def right_click()\n right_mouse_down\n right_mouse_up\n stall :right_click\n end", "def right_click\n Bewildr::Mouse.right_click(clickable_point)\n end", "def key_click_right_pressed\n\t\t@picrossFrame.click(@posY, @posX, CellButton::BUTTON_RIGHT_CLICK)\n\t\treturn sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to perform a mouse up with right button on this view in the remote application
def right_mouse_up() right_mouse_up_at :center, :center end
[ "def right_click()\n right_mouse_down\n right_mouse_up\n stall :right_click\n end", "def right_click\n Bewildr::Mouse.right_click(clickable_point)\n end", "def onLButtonUp(flags, x, y, view)\n Sketchup::set_status_text $uStrings.GetString(\"Left button up at\") + \" ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to perform a single right click on this view in the remote application
def right_click() right_mouse_down right_mouse_up stall :right_click end
[ "def right_click\n Bewildr::Mouse.right_click(clickable_point)\n end", "def right_click(*args)\n if args.empty?\n root.right_click\n else\n widget(*args).right_click\n end\n end", "def right_click(name, *args)\n widget(name, *args).right_click\n en...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to perform a mouse wheel action on the xaxis
def mouse_wheel_delta_x(delta) @driver.sc_mouse_wheel_delta_x action_target, delta, *action_locator_args stall :mouse_wheel end
[ "def wheel(delta_x: 0, delta_y: 0)\n @client.send_message('Input.dispatchMouseEvent',\n type: 'mouseWheel',\n x: @x,\n y: @y,\n deltaX: delta_x,\n deltaY: delta_y,\n modifiers: @keyboard.modifiers,\n pointerType: 'mouse',\n )\n end", "def scroll_mouse(x_amount, y_amount)\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to perform a mouse wheel action on the yaxis
def mouse_wheel_delta_y(delta) @driver.sc_mouse_wheel_delta_y action_target, delta, *action_locator_args stall :mouse_wheel end
[ "def wheel(delta_x: 0, delta_y: 0)\n @client.send_message('Input.dispatchMouseEvent',\n type: 'mouseWheel',\n x: @x,\n y: @y,\n deltaX: delta_x,\n deltaY: delta_y,\n modifiers: @keyboard.modifiers,\n pointerType: 'mouse',\n )\n end", "def wheelEvent(event)\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to perform a key down on this view in the remote application You can either type a printable character or a function key. If you want to type a printable character then the 'key' parameter just has to be a string, such as 'a'. If you want to type a function key such as F1, then the 'key' parameter must be the corr...
def key_down(key) focus @driver.sc_key_down action_target, key, *action_locator_args stall :key_down end
[ "def handle_key_down(_key) end", "def alt_key_down\r\n command 'altKeyDown'\r\n end", "def keys_down\n rev_map(@key_handler.keys_down)\n end", "def down\n @key_up.down || @key_held.down || s\n end", "def control_key_down()\n do_command(\"controlKeyDown\", [])\n end", "def...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Used to type a key on this view in the remote application. This will cause a key down followed by a key up You can either type a printable character or a function key. If you want to type a printable character then the 'key' parameter just has to be a string, such as 'a'. If you want to type a function key such as F1, ...
def type_key(key) focus @driver.sc_type_key action_target, key, *action_locator_args stall :type_key end
[ "def type(key); end", "def key_up! key\n send_input! 3, key\n end", "def type_keys(locator,value)\n do_command(\"typeKeys\", [locator,value,])\n end", "def key_type\n @key_type\n end", "def press(key); end", "def control_key_up\r\n command 'controlKeyUp'\r\n end", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Override this to supply the arguments to generate the locator
def action_locator_args() end
[ "def __find_args__\n self\n end", "def locator\n @locator = ''\n\n @lat_tmp = @lat + 90.0\n @lon_tmp = @lon + 180.0\n @precision_tmp = @precision\n\n calculate_field\n calculate_values\n\n @locator\n end", "def area(* args)\r\n raise \"not implemented for Selenium\"\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merges accepted corrections for specially formatted files into content AT. This is done in two steps: 1. Apply all corrections that can be done automatically (based on exact text matches) 2. Apply manual corrections where no or multiple extact matches are found. We have to do it in two steps so that when we open the fi...
def merge_accepted_corrections_into_content_at(options) # First validate the spot sheets and cancel process if errors are found. validate_spot_sheet(options.merge('validate_or_merge' => 'merge')) accepted_corrections_base_dir = config.compute_base_dir( options['base-dir'] || ...
[ "def merge_accepted_corrections_into_content_at(options)\n input_file_spec_accepted_corrections = 'accepted_corrections_dir/txt_files'\n input_file_pattern_accepted_corrections = config.compute_glob_pattern(input_file_spec_accepted_corrections)\n base_dir_accepted_corrections = config.base_dir(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merges gap_mark_tagging_import into content AT. Uses content AT as authority for text.
def merge_gap_mark_tagging_import_into_content_at(options) gap_mark_tagging_import_base_dir = config.compute_base_dir( options['base-dir'] || options['base-dir-1'] || :gap_mark_tagging_import_dir ) gap_mark_tagging_import_glob_pattern = config.compute_glob_pattern( gap_mark_t...
[ "def merge_gap_mark_tagging_import_into_content_at(options)\n input_file_spec_gap_mark_tagging_import = options['input_1'] || 'gap_mark_tagging_import_dir/txt_files'\n input_file_pattern_gap_mark_tagging_import = config.compute_glob_pattern(input_file_spec_gap_mark_tagging_import)\n base_dir_ga...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merges record_marks from FOLIO XML import into IDML import Uses IDML as authority for text and all tokens except record_marks. If no IDML file is present, uses FOLIO XML as authority for everything.
def merge_record_marks_from_folio_xml_at_into_idml_at(options) input_folio_base_dir = config.compute_base_dir( options['base-dir'] || options['base-dir-1'] || :folio_import_dir ) input_idml_base_dir = config.compute_base_dir(options['base-dir-2'] || :idml_import_dir) input_file...
[ "def merge_record_marks_from_folio_xml_at_into_idml_at(options)\n input_file_spec_folio_xml = options['input_1'] || 'import_folio_xml_dir/at_files'\n input_file_pattern_folio_xml = config.compute_glob_pattern(input_file_spec_folio_xml)\n import_folio_xml_base_dir = config.base_dir(:import_folio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merges subtitle_marks from subtitle_import into content AT. Uses content AT as authority for text and all tokens except subtitle_marks.
def merge_subtitle_marks_from_subtitle_import_into_content_at(options) subtitle_import_base_dir = config.compute_base_dir( options['base-dir'] || options['base-dir-1'] || :subtitle_import_dir ) subtitle_import_glob_pattern = config.compute_glob_pattern( subtitle_import_base_d...
[ "def merge_subtitle_marks_from_subtitle_tagging_import_into_content_at(options)\n subtitle_tagging_import_base_dir = config.compute_base_dir(\n options['base-dir'] || options['base-dir-1'] || :subtitle_tagging_import_dir\n )\n subtitle_tagging_import_glob_pattern = config.compute_glob_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merges subtitle_marks from subtitle_tagging_import into content AT. Uses content AT as authority for text and all tokens except subtitle_marks.
def merge_subtitle_marks_from_subtitle_tagging_import_into_content_at(options) subtitle_tagging_import_base_dir = config.compute_base_dir( options['base-dir'] || options['base-dir-1'] || :subtitle_tagging_import_dir ) subtitle_tagging_import_glob_pattern = config.compute_glob_pattern( ...
[ "def merge_subtitle_marks_from_subtitle_tagging_import_into_content_at(options)\n input_file_spec_subtitle_tagging_import = options['input_1'] || 'subtitle_tagging_import_dir/txt_files'\n input_file_pattern_subtitle_tagging_import = config.compute_glob_pattern(input_file_spec_subtitle_tagging_import)\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merges titles from folio roundtrip compare txt files into content AT to get correct spelling.
def merge_titles_from_folio_roundtrip_compare_into_folio_import(options) folio_roundtrip_compare_base_dir = File.join( config.compute_base_dir( options['base-dir'] || options['base-dir-1'] || :compare_dir ), 'folio_source/with_folio_import' ) folio_impor...
[ "def merge_titles_from_folio_roundtrip_compare_into_folio_import(options)\n base_dir_folio_roundtrip_compare = File.join(\n config.base_dir(:compare_dir), 'folio_source/with_folio_import'\n )\n file_pattern_folio_roundtrip_compare = config.file_pattern(:txt_files)\n base_dir_fol...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /exam_managements GET /exam_managements.json
def index @exam_managements = ExamManagement.all end
[ "def index\n @managements = Management.all\n end", "def index\n @medical_exams = MedicalExam.all\n end", "def index\n @matriculation_exams = MatriculationExam.all\n end", "def index\n @admission_exams = AdmissionExam.all\n end", "def index\n @product_managements = ProductManagement.all\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /exam_managements POST /exam_managements.json
def create @exam_management = ExamManagement.new(exam_management_params) respond_to do |format| if @exam_management.save format.html { redirect_to @exam_management, notice: 'Exam management was successfully created.' } format.json { render :show, status: :created, location: @exam_manageme...
[ "def index\n @exam_managements = ExamManagement.all\n end", "def create\n @medical_exam = MedicalExam.new(medical_exam_params)\n\n respond_to do |format|\n if @medical_exam.save\n format.html { redirect_to @medical_exam, notice: 'Medical exam was successfully created.' }\n format.json...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /exam_managements/1 PATCH/PUT /exam_managements/1.json
def update respond_to do |format| if @exam_management.update(exam_management_params) format.html { redirect_to @exam_management, notice: 'Exam management was successfully updated.' } format.json { render :show, status: :ok, location: @exam_management } else format.html { render :...
[ "def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to exams_path, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /legalstatuses GET /legalstatuses.json
def index @legalstatuses = Legalstatus.all end
[ "def statuses\n out = [ \"any\" ]\n ListingStatus.statuses.each do |t|\n out << t\n end\n render json: out\n end", "def index\n @married_statuses = MarriedStatus.all\n end", "def index\n @marital_statuses = MaritalStatus.all\n end", "def statuses\n render json: Course...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /legalstatuses/1 DELETE /legalstatuses/1.json
def destroy @legalstatus.destroy respond_to do |format| format.html { redirect_to legalstatuses_url, notice: 'Legalstatus was successfully destroyed.' } format.json { head :no_content } end end
[ "def destroy\n @reqstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqstatuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to(sta...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /buddyfights GET /buddyfights.json
def index @buddyfights = Buddyfight.all end
[ "def show\n @buddy_datum = BuddyDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @buddy_datum }\n end\n end", "def index\n @undead_banes = UndeadBane.all\n\n render json: @undead_banes\n end", "def index\n @battles = Batt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
POST /buddyfights POST /buddyfights.json
def create @buddyfight = Buddyfight.new(buddyfight_params) respond_to do |format| if @buddyfight.save format.html { redirect_to @buddyfight, notice: 'Buddyfight was successfully created.' } format.json { render :show, status: :created, location: @buddyfight } else format.htm...
[ "def index\n @buddyfights = Buddyfight.all\n end", "def create\n @buddy_datum = BuddyDatum.new(params[:buddy_datum])\n\n respond_to do |format|\n if @buddy_datum.save\n format.html { redirect_to @buddy_datum, notice: 'Buddy datum was successfully created.' }\n format.json { render jso...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /buddyfights/1 DELETE /buddyfights/1.json
def destroy @buddyfight.destroy respond_to do |format| format.html { redirect_to buddyfights_url, notice: 'Buddyfight was successfully destroyed.' } format.json { head :no_content } end end
[ "def destroy\n @buddy_datum = BuddyDatum.find(params[:id])\n @buddy_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to buddy_data_url }\n format.json { head :no_content }\n end\n end", "def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
////////////////////////////////////////////////////////////////////////// Properties ////////////////////////////////////////////////////////////////////////// Get a specific selected actor or current actor i : index of the selected actor GET
def selected_actor(i=nil) actor = nil if i == nil actor = @data[self.index] else actor = (index < 0 || self.index(i) < 0 ? nil : @data[self.index(i)]) end return actor end
[ "def selected_reserve_actor(i=nil)\n actor = nil\n if i == nil\n actor = @data[self.index]\n else\n actor = (index < 0 || self.index(i) < 0 ? nil : @data[self.index(i)])\n end\n return actor\n end", "def actor\n return @actor\n end", "def smooth_target_actor(a...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
////////////////////////////////////////////////////////////////////////// Private Methods ////////////////////////////////////////////////////////////////////////// Create an item for CharFacesList index : item index
def create_item(index) actor = @data[index] rect = item_rect(index, true) ucChar = UCFormationCharFace.new(self, actor, rect) return ucChar end
[ "def create_item(index)\n actor = @data[index]\n rect = item_rect(index)\n \n ucChar = UCCharacterFace.new(self, rect, actor, 1)\n \n return ucChar\n end", "def create_item(index)\n actor = @data[index]\n rect = item_rect(index)\n \n ucItem = UCCharacte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
puts "nyan" break end counter + 1 while counter < 11 puts counter counter = counter + 1 end def hungry_sb kitkat = 0 while < 30 puts "Give me another kitkat!" kitkat +=
def hungry_person mango= 0 until mango == 10 puts "Give me my mango! i only want #{mango}" mango += 1 end puts "thank you" end
[ "def using_while\n\tlevitation_force = 6\n\twhile levitation_force < 10\n puts \"Wingardium Leviosa\"\n levitation_force += 1\n end\nend", "def count(numpick) #\r\n counter = 0 #\r\n until counter == (numpick + 0) #\r\n if counter == 3 #\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PATCH/PUT /calllists/1 PATCH/PUT /calllists/1.json
def update respond_to do |format| if @calllist.update(calllist_params) format.html { redirect_to @calllist, notice: 'Calllist was successfully updated.' } format.json { render :show, status: :ok, location: @calllist } else format.html { render :edit } format.json { render...
[ "def update_list(list_id:, name:)\n api_request(method: :patch, path: \"lists/#{list_id}\", params: list_params(name))\n end", "def update\n @call_list_owner = CallListOwner.find(params[:id])\n\n respond_to do |format|\n if @call_list_owner.update_attributes(params[:call_list_owner])\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /calllists/1 DELETE /calllists/1.json
def destroy @calllist.destroy respond_to do |format| format.html { redirect_to calllists_url, notice: 'Calllist was successfully destroyed.' } format.json { head :no_content } end end
[ "def destroy\n @call_list = CallList.find(params[:id])\n @call_list.destroy\n\n respond_to do |format|\n format.html { redirect_to call_lists_url }\n format.json { head :no_content }\n end\n end", "def delete_list(list)\n api_delete(:list, {:list => list})\n end", "def delete_list...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
remove a stock from database
def remove_stock(db,stock_ticker) db.execute(<<-SQL DELETE FROM stocks2 Where stock_ticker="#{stock_ticker}"; SQL ) puts "===================================================" puts "#{stock_ticker} has been removed from the database." puts "=================================================...
[ "def remove_item_from_stock(item_id, quantity)\n item = Item.find(item_id)\n s= item.stocks\n k = s.where(store_configuration_id:current_user.store_configuration.id).last\n if k ==nil\n e= Stock.new\n e.item = item\n e.quantity =0 \n e.rank = 0 \n e.store_configuratio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
before_filter :check, :only=>[:create] crudify :'refinery/ships/ship', :xhr_paging => true before_filter :all_collections, :only=>[:new, :edit]
def index if client_signed_in? @ships = Refinery::Ships::Ship.includes(:translations, :page_status).where(:client_id=>current_client.id).order('updated_at DESC') @all = @ships @moderate = @ships.select{|ship| ship.page_status.id == 1} @publishe...
[ "def view_fee_collection\n @batch = Batch.shod(params[:id])\n @collections ||= @batch.finance_fee_collections\n authorize! :read, @collections.first\n end", "def edit_fee_collection\n @batch = Batch.shod(params[:id])\n @collections ||= @batch.finance_fee_collections\n @collection = @batch.finan...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Here we verify if a preference is true.
def test_should_verify_if_is_true a_preference = preferences(:store_use_inventory_control) assert a_preference.is_true? a_preference = preferences(:store_require_login) assert !a_preference.is_true? end
[ "def has_pref?(preference)\n !prefs[preference].to_s.empty?\nend", "def pref?\n type? 'PREF'\n end", "def pref?\n type? \"PREF\"\n end", "def has_dietary_preferences?\n return self.dietary_preference.present?\n end", "def meets_contract_preferences?(user)\n\t\t#-----------------...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
GET /draft_lists/new GET /draft_lists/new.xml
def new @draft_list = DraftList.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @draft_list } end end
[ "def new\n @draft = Draft.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft }\n end\n end", "def new\n @title = \"New Listing\"\n @list = List.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
PUT /draft_lists/1 PUT /draft_lists/1.xml
def update @draft_list = DraftList.find(params[:id]) respond_to do |format| if @draft_list.update_attributes(params[:draft_list]) flash[:notice] = 'Draft list was successfully updated.' format.html { redirect_to(draft_lists_path) } format.xml { head :ok } else forma...
[ "def update\n @draft = Draft.find(params[:id])\n\n respond_to do |format|\n if @draft.update_attributes(params[:draft])\n flash[:notice] = 'Draft was successfully updated.'\n format.html { redirect_to(@draft) }\n format.xml { head :ok }\n else\n format.html { render :act...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DELETE /draft_lists/1 DELETE /draft_lists/1.xml
def destroy @draft_list = DraftList.find(params[:id]) errorMessage = "" if !@draft_list.league_memberships.empty? errorMessage += 'Cannot delete the list named ' + @draft_list.name + ' because it is being used by the following memberships: ' + @dr...
[ "def destroy\n @draft = Draft.find(params[:id])\n @draft.destroy\n\n respond_to do |format|\n format.html { redirect_to(drafts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }