query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
make sure the chef environment exists | def check_chef_env(chef_env_name)
if chef_env_name
begin
chef_env = Chef::Environment.load(chef_env_name)
rescue Net::HTTPServerException => e
raise unless e.to_s =~ /^404/
ui.info "Creating chef environment " + chef_env_name
chef_env = Chef::... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_has_environment_files()\n\n end",
"def check_and_set_environment\n check_env\n set_env\n end",
"def ensure_cookbooks!\n raise 'No existing cookbook paths found.' if cookbooks_paths.empty?\n end",
"def check_environment\n # Also, your VMs require public ssh ... | [
"0.7503372",
"0.6762868",
"0.6635703",
"0.6619905",
"0.6564116",
"0.65567404",
"0.65052295",
"0.6453659",
"0.64438653",
"0.6436133",
"0.64247674",
"0.63958704",
"0.63926935",
"0.6339481",
"0.6286482",
"0.62305415",
"0.61941195",
"0.6151301",
"0.6149397",
"0.611287",
"0.610444... | 0.74775726 | 1 |
Merges topology properties into nodes, returning the merged nodes | def merge_topo_properties(nodes, topo_hash)
if nodes && nodes.length > 0
merged_nodes = nodes ? nodes.clone : []
merged_nodes.each do |nodeprops|
normal_defaults = topo_hash['normal'] ? topo_hash['normal'].clone : {}
nodeprops['normal'] ||= {}
nodeprops[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_node_properties(node, tag, parent_properties); end",
"def merge_nodes(graph, x, y)\n new_edges = graph.neighbors(x).inject([]) do |new_edges, neighbor|\n graph.remove(x, neighbor)\n graph.remove(neighbor, x)\n new_edges << Edge.new(neighbor, y)\n end\n\n graph.each_edge{|edge| new_edges << ... | [
"0.61971223",
"0.59006995",
"0.5636834",
"0.55820113",
"0.5561249",
"0.5561249",
"0.55046946",
"0.5447241",
"0.54430044",
"0.5392825",
"0.53735954",
"0.5344103",
"0.5326014",
"0.5316291",
"0.52800393",
"0.5264983",
"0.5256941",
"0.5255519",
"0.518682",
"0.5085256",
"0.5068399... | 0.7689749 | 0 |
Make updates into the original node, returning the list of updated properties. | def update_node_with_values(node, updates)
updated_properties = []
# merge the normal attributes (but not tags)
normal_updates = updates['normal'] || {}
normal_updates.delete('tags')
original_normal = node.normal.clone()
prop_merge!(node.normal, normal_updates)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_node_with_values(node, updates, merge = false)\n updated = []\n\n # merge the normal attributes (but not tags)\n updated << 'normal' if update_attrs(node, updates['normal'], merge)\n\n # update runlist\n updated << 'run_list' if update_runlist(node, updates['run_list'])\n\n ... | [
"0.6268525",
"0.6143362",
"0.6091809",
"0.6061959",
"0.5828979",
"0.5796167",
"0.5781461",
"0.57793576",
"0.57098997",
"0.5680959",
"0.56663465",
"0.5634985",
"0.5627508",
"0.5585935",
"0.5571942",
"0.5498454",
"0.5490109",
"0.54847467",
"0.54840237",
"0.5440855",
"0.5440855"... | 0.6873873 | 0 |
Load a topology from local data bag item file | def load_from_file(bag_name, topo_name)
topo_file = File.join(Dir.pwd, "#{topologies_path}", bag_name, topo_name + '.json')
return unless (loader.file_exists_and_is_readable?(topo_file))
item_data = loader.object_from_file(topo_file)
item_data = if use_encryption
sec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_item_from_local(name)\n local_data_bag_item = Dir[\"#{@context.repo_path}/data_bags/**/#{name}.json\"].first\n return nil if local_data_bag_item.nil?\n\n FFI_Yajl::Parser.parse(File.read(local_data_bag_item))\n rescue FFI_Yajl::ParseError\n nil\n end",
"def load_fro... | [
"0.6295469",
"0.5765982",
"0.5678337",
"0.5657318",
"0.5595321",
"0.5566882",
"0.5562029",
"0.5533524",
"0.5516354",
"0.5516354",
"0.545868",
"0.54554343",
"0.5440475",
"0.5388936",
"0.53236616",
"0.5318755",
"0.5309603",
"0.52981484",
"0.52873343",
"0.5269527",
"0.52534705",... | 0.8051713 | 0 |
Replace existing run list in a node | def set_run_list(node, entries)
node.run_list.run_list_items.clear
entries.each { |e| node.run_list << e }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def override_runlist=(array)\n @override_runlist_set = true\n @override_runlist.reset!(array)\n end",
"def override_runlist(*args)\n return @override_runlist if args.length == 0\n\n @override_runlist_set = true\n @override_runlist.reset!(args)\n end",
"def reapply_nodes\n @nod... | [
"0.60162866",
"0.59702754",
"0.5782852",
"0.5720865",
"0.55999064",
"0.5562124",
"0.5562124",
"0.5454318",
"0.5448144",
"0.53790516",
"0.5313959",
"0.53083354",
"0.530367",
"0.52716935",
"0.52376086",
"0.51912236",
"0.5191097",
"0.517631",
"0.5144575",
"0.51348615",
"0.513486... | 0.7567866 | 0 |
Name of the topology bag | def topo_bag_name(name=nil)
@topo_bag_name = name if (name)
@topo_bag_name ||= "topologies"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_bag_name\n if(node[node_key][:config_bag])\n if(node[node_key][:config_bag].respond_to?(:has_key?))\n name = node[node_key][:config_bag][:name].to_s\n else\n name = node[node_key][:config_bag].to_s\n end\n end\n name.to_s.empty? ? \"config_#{node.name.gsub('.', '_')}\... | [
"0.73384184",
"0.7154113",
"0.6606225",
"0.64356333",
"0.6405254",
"0.62211645",
"0.60892326",
"0.6087981",
"0.59587604",
"0.5798467",
"0.5755647",
"0.5732137",
"0.56977284",
"0.5687102",
"0.56771696",
"0.56559974",
"0.56388855",
"0.56334347",
"0.5627988",
"0.5619316",
"0.561... | 0.82797706 | 0 |
Path for the topologies data bags. For now, use the standard data_bags path for our topologies bags | def topologies_path
@topologies_path ||= "data_bags"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_bags_path\n verify_path DATA_BAGS_PATH\n File.join @tar_contents_path, DATA_BAGS_PATH\n end",
"def data_bags_path\n\t# These can occur on suite-level, provisioner-level, verifier or at the default location\n kitchen_provisioner_config[:data_bags_path] || kitchen_verifier_config[:data... | [
"0.74665135",
"0.7265733",
"0.6977642",
"0.6737",
"0.6203096",
"0.5877547",
"0.53877074",
"0.5383934",
"0.5367111",
"0.5364159",
"0.5337209",
"0.52236074",
"0.50906944",
"0.50848895",
"0.5071172",
"0.49225482",
"0.49213016",
"0.49039546",
"0.48862132",
"0.48655692",
"0.486317... | 0.8800169 | 0 |
initialize args for another knife command | def initialize_cmd_args(args, new_name_args)
args = args.dup
args.shift(2 + @name_args.length)
cmd_args = new_name_args + args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(argv = [])\n super() # having to call super in initialize is the most annoying anti-pattern :(\n @ui = Chef::Knife::UI.new(STDOUT, STDERR, STDIN, config)\n\n command_name_words = self.class.snake_case_name.split(\"_\")\n\n # Mixlib::CLI ignores the embedded name_args\n @name... | [
"0.7386326",
"0.65001816",
"0.6443608",
"0.6408557",
"0.6392182",
"0.6343068",
"0.6318976",
"0.62524295",
"0.6251492",
"0.6223625",
"0.6187747",
"0.617535",
"0.61538434",
"0.6121056",
"0.6110493",
"0.60719126",
"0.6050046",
"0.6043964",
"0.603616",
"0.603616",
"0.603616",
"... | 0.6995782 | 1 |
GET /line_groups GET /line_groups.json | def index
@line_groups = LineGroup.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_line_group\n @line_group = LineGroup.find(params[:id])\n end",
"def create\n @line_group = LineGroup.new(line_group_params)\n\n respond_to do |format|\n if @line_group.save\n format.html { redirect_to @line_group, notice: 'Line group was successfully created.' }\n format.... | [
"0.64911246",
"0.6332811",
"0.6275632",
"0.6249411",
"0.61868626",
"0.61119664",
"0.60800165",
"0.6004477",
"0.59972197",
"0.59911895",
"0.5975915",
"0.59578437",
"0.5926465",
"0.59200263",
"0.5881234",
"0.5846956",
"0.5842931",
"0.5839421",
"0.58342904",
"0.58134186",
"0.575... | 0.761315 | 0 |
POST /line_groups POST /line_groups.json | def create
@line_group = LineGroup.new(line_group_params)
respond_to do |format|
if @line_group.save
format.html { redirect_to @line_group, notice: 'Line group was successfully created.' }
format.json { render :show, status: :created, location: @line_group }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_group_params\n params.require(:line_group).permit(:line_id, :is_tasks_group)\n end",
"def set_line_group\n @line_group = LineGroup.find(params[:id])\n end",
"def CreateGroup params = {}\n \n APICall(path: 'groups.json',method: 'POST',payload: params.to_json)\n \n ... | [
"0.6740488",
"0.65269107",
"0.62295026",
"0.6180152",
"0.6175284",
"0.60641205",
"0.5988591",
"0.59702706",
"0.59702706",
"0.59412885",
"0.59149086",
"0.5868965",
"0.586258",
"0.585679",
"0.57806516",
"0.5762378",
"0.57052636",
"0.57008237",
"0.566065",
"0.56297016",
"0.56117... | 0.75493044 | 0 |
PATCH/PUT /line_groups/1 PATCH/PUT /line_groups/1.json | def update
respond_to do |format|
if @line_group.update(line_group_params)
format.html { redirect_to @line_group, notice: 'Line group was successfully updated.' }
format.json { render :show, status: :ok, location: @line_group }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_line_group\n @line_group = LineGroup.find(params[:id])\n end",
"def UpdateGroup params = {}\n \n APICall(path: 'groups.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n group = Group.find(params[:id])\n if group.update(group_params)\n ren... | [
"0.6539481",
"0.6510062",
"0.63828063",
"0.62542963",
"0.62229514",
"0.6190359",
"0.61816233",
"0.61507195",
"0.6150165",
"0.61000055",
"0.6092995",
"0.6027691",
"0.602368",
"0.6022467",
"0.60160947",
"0.60055935",
"0.60033166",
"0.60026926",
"0.5986054",
"0.59681314",
"0.596... | 0.7523429 | 0 |
DELETE /line_groups/1 DELETE /line_groups/1.json | def destroy
@line_group.destroy
respond_to do |format|
format.html { redirect_to line_groups_url, notice: 'Line group was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteGroup id\n \n APICall(path: \"groups/#{id}.json\",method: 'DELETE')\n \n end",
"def deleteGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"delete\",\"/group\",params)\n end",
"def deleteEntityGroup( entity_id, gen_id)\n para... | [
"0.69815767",
"0.6834231",
"0.67559063",
"0.65634406",
"0.6562379",
"0.6556033",
"0.65188193",
"0.6503596",
"0.6503596",
"0.6483286",
"0.64817244",
"0.6464013",
"0.6436958",
"0.6394396",
"0.63913095",
"0.6389264",
"0.6388247",
"0.63825023",
"0.6380738",
"0.6365951",
"0.636576... | 0.76340604 | 0 |
GET /infraction_types GET /infraction_types.xml | def index
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @infraction_types }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n fo... | [
"0.7023454",
"0.62956685",
"0.61827695",
"0.6039842",
"0.60144496",
"0.59945333",
"0.59584117",
"0.5840479",
"0.5796332",
"0.5767955",
"0.5763737",
"0.5736481",
"0.570795",
"0.56779414",
"0.56687796",
"0.5640763",
"0.56314313",
"0.56244904",
"0.56149054",
"0.5607652",
"0.5606... | 0.73135823 | 0 |
GET /infraction_types/1 GET /infraction_types/1.xml | def show
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @infraction_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @infraction_types }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end",
"def show\n @inc... | [
"0.73743653",
"0.64957",
"0.6058585",
"0.6042864",
"0.5933324",
"0.5916193",
"0.5904228",
"0.5878209",
"0.58565277",
"0.583603",
"0.58255035",
"0.5819739",
"0.58170533",
"0.5768432",
"0.5758865",
"0.57344025",
"0.5720972",
"0.57191056",
"0.5713161",
"0.5710018",
"0.5698713",
... | 0.7253449 | 1 |
GET /infraction_types/new GET /infraction_types/new.xml | def new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @infraction_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @uri_type = UriType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uri_type }\n end\n end",
"def new\n @attr_type = AttrType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @attr_... | [
"0.6966674",
"0.6953083",
"0.69353443",
"0.68361443",
"0.68264836",
"0.6808161",
"0.67201865",
"0.6688675",
"0.66752625",
"0.66443807",
"0.6618492",
"0.6617475",
"0.6613688",
"0.6609365",
"0.6571225",
"0.65575063",
"0.6552991",
"0.65511775",
"0.6530037",
"0.652893",
"0.651547... | 0.79783446 | 0 |
POST /infraction_types POST /infraction_types.xml | def create
@infraction_type = InfractionType.new(infraction_type_params)
respond_to do |format|
if @infraction_type.save
format.html { redirect_to(@infraction_type, :notice => 'Infraction type was successfully created.') }
format.xml { render :xml => @infraction_type, :status => :created,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @infraction_types }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @infraction_type }\n end\n end",
"def pet_types\r\n ... | [
"0.6037526",
"0.5987233",
"0.5895938",
"0.5629819",
"0.5587866",
"0.5392339",
"0.5388811",
"0.53435093",
"0.5343181",
"0.5241693",
"0.5194708",
"0.5179761",
"0.51526403",
"0.5151156",
"0.51308036",
"0.5117127",
"0.51100963",
"0.5102027",
"0.50910556",
"0.50910556",
"0.5087072... | 0.6407237 | 0 |
PUT /infraction_types/1 PUT /infraction_types/1.xml | def update
respond_to do |format|
if @infraction_type.update_attributes(infraction_type_params)
format.html { redirect_to(@infraction_type, :notice => 'Infraction type was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update(type, current_name, metadata={})\n type = type.to_s.camelize\n request :update do |soap|\n soap.body = {\n :metadata => {\n :current_name => current_name,\n :metadata => prepare(metadata),\n :attributes! => { :metada... | [
"0.62920487",
"0.596315",
"0.5855476",
"0.58125997",
"0.5762933",
"0.5706877",
"0.5661378",
"0.5646131",
"0.55932254",
"0.55783314",
"0.5546303",
"0.5522598",
"0.5510746",
"0.5508203",
"0.5499604",
"0.54855275",
"0.54640436",
"0.54614353",
"0.5431562",
"0.54155266",
"0.540501... | 0.6905765 | 0 |
DELETE /infraction_types/1 DELETE /infraction_types/1.xml | def destroy
begin
@infraction_type.destroy
rescue ActiveRecord::DeleteRestrictionError => exception
flash[:error] = exception.message
end
respond_to do |format|
format.html { redirect_to(infraction_types_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @incidenttype = Incidenttype.find(params[:id])\n @incidenttype.destroy\n\n respond_to do |format|\n format.html { redirect_to(incidenttypes_url) }\n format.xml { head :ok }\n end\n ... | [
"0.6570635",
"0.6450584",
"0.6390899",
"0.637767",
"0.6307355",
"0.6276749",
"0.6264602",
"0.6236179",
"0.6208961",
"0.61546004",
"0.61401004",
"0.61079264",
"0.605608",
"0.6033476",
"0.6024758",
"0.6024457",
"0.6020131",
"0.60077643",
"0.59886163",
"0.5985487",
"0.5949294",
... | 0.6924068 | 0 |
we need to verify that the original callback does not receive call if it is nil. this test does so and exercises a branch of the method being tested. should the nil check fail, this test will fail, even though it does not assert or refute anything explicitly | def test_an_original_callback_is_not_invoked_when_absent
multi = Curl::Multi.new
request = OpenStruct.new
error = [OpenStruct.new(name: 'name'), 'last']
prep_on_failure_without_original_callback(request)
def multi.remove_failure_callback(request); end
multi.install_failure_callback(request, nil,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refute_callbacks(recorder)\n assert recorder.empty?, \"Something has been recorded #{recorder.inspect}\"\n end",
"def verify_callback; end",
"def verify_callback; end",
"def wont_be_nil(msg=nil)\n NilAssay.refute!(self, :message=>msg, :backtrace=>caller)\n end",
"def callback\n false... | [
"0.6971335",
"0.66614634",
"0.66614634",
"0.6413172",
"0.6366582",
"0.63591844",
"0.63591844",
"0.6224906",
"0.61727595",
"0.61293244",
"0.61223155",
"0.59868497",
"0.5971441",
"0.59572685",
"0.5953567",
"0.5944178",
"0.5919805",
"0.5919805",
"0.5915836",
"0.5915777",
"0.5863... | 0.7002371 | 0 |
if the guard against installing alreadyinstalled callbacks were to fail, the 'request' mock would receive a second _nr_instrumented call and error out. so while there is no explicit assert/refute being performed, the desired behavior is being verified | def test_callbacks_are_not_installed_again_if_they_have_already_been_installed
multi = Curl::Multi.new
request = MiniTest::Mock.new
segment = MiniTest::Mock.new
segment.expect :add_request_headers, nil, [MiniTest::Mock]
request.expect :_nr_instrumented, true
def multi.wrap_request(req)
wra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_stubbed_calls; end",
"def not_be_called\n @expected_calls = 0\n self\n end",
"def test_verify\n # Start out unavailabl\n assert_raise(Puppet::Network::InvalidClientRequest) do\n @obj.verify(@request)\n end\n class << @obj\n def available?(req)\n true\n... | [
"0.6859417",
"0.64286506",
"0.6415594",
"0.6260056",
"0.6166837",
"0.6098613",
"0.6089942",
"0.6069801",
"0.60316277",
"0.6006718",
"0.5992137",
"0.5897153",
"0.587497",
"0.58528996",
"0.5771644",
"0.5749503",
"0.5691979",
"0.56847996",
"0.56847996",
"0.56723017",
"0.56643474... | 0.7700342 | 0 |
a simple test of install_completion_callback with a nil value for the segment argument to exercise a branch | def test_segment_does_not_receive_a_finish_call_if_absent_on_complete
multi = Curl::Multi.new
request = Curl::Easy.new
multi.install_completion_callback(request, nil, nil)
request.on_complete.call
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_completion_callback( request, t0, segment, wrapped_request, wrapped_response )\n original_callback = request.on_complete\n request._ty_original_on_complete = original_callback\n request.on_complete do |finished_request|\n begin\n TingYun::Agent::CrossAppTracing.... | [
"0.54931575",
"0.5461512",
"0.5415315",
"0.5151035",
"0.512118",
"0.5097024",
"0.5072874",
"0.5069891",
"0.5058178",
"0.5049411",
"0.49962166",
"0.49129966",
"0.4899143",
"0.48890954",
"0.48682755",
"0.48614964",
"0.48614964",
"0.4857178",
"0.48558274",
"0.48420918",
"0.48278... | 0.61941844 | 0 |
Find all UIAStaticTexts|XCUIElementTypeStaticTexts containing value. If value is omitted, all UIAStaticTexts|XCUIElementTypeStaticTexts are returned | def texts(value = false)
return tags static_text_class unless value
if automation_name_is_xcuitest?
visible_elements = tags static_text_class
elements_include visible_elements, value
else
eles_by_json_visible_contains static_text_class, value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def texts(value = false)\n return tags UIAStaticText unless value\n eles_by_json_visible_contains UIAStaticText, value\n end",
"def texts_exact(value)\n if automation_name_is_xcuitest?\n visible_elements = tags static_text_class\n elements_exact visible_elements, value\n else... | [
"0.69426763",
"0.67905736",
"0.663576",
"0.65247405",
"0.6476424",
"0.6411508",
"0.62579745",
"0.62226206",
"0.62157804",
"0.61467415",
"0.599485",
"0.5834997",
"0.58127344",
"0.58116025",
"0.5802856",
"0.5801341",
"0.5772229",
"0.55670816",
"0.5549172",
"0.55453223",
"0.5502... | 0.73452955 | 0 |
Find the last UIAStaticText|XCUIElementTypeStaticText. | def last_text
last_ele static_text_class
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_text\n last_ele UIAStaticText\n end",
"def last_text\n last_ele TEXT_VIEW\n end",
"def first_text\n first_ele UIAStaticText\n end",
"def last_textfield\n result = eles_by_json(_textfield_visible).last\n raise _no_such_element if result.nil?\n\n result\n end"... | [
"0.83741724",
"0.6856159",
"0.68209344",
"0.6482176",
"0.6454336",
"0.63671756",
"0.6002838",
"0.5913543",
"0.5908594",
"0.5707621",
"0.5681411",
"0.56096804",
"0.55588424",
"0.553701",
"0.553701",
"0.5535448",
"0.5525192",
"0.5513722",
"0.5508582",
"0.54479706",
"0.5248081",... | 0.72123754 | 1 |
Find the first UIAStaticText|XCUIElementTypeStaticText that exactly matches value. | def text_exact(value)
if automation_name_is_xcuitest?
raise_error_if_no_element texts_exact(value).first
else
ele_by_json_visible_exact static_text_class, value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text_exact(value)\n ele_by_json_visible_exact UIAStaticText, value\n end",
"def text(value)\n return ele_index UIAStaticText, value if value.is_a? Numeric\n ele_by_json_visible_contains UIAStaticText, value\n end",
"def texts_exact(value)\n eles_by_json_visible_exact UIAStaticText... | [
"0.7902413",
"0.7148272",
"0.71452534",
"0.67664826",
"0.65723",
"0.6559159",
"0.6517812",
"0.6410194",
"0.63915443",
"0.63402355",
"0.6328833",
"0.60525805",
"0.60135543",
"0.59586215",
"0.59178716",
"0.5880487",
"0.58120275",
"0.5791611",
"0.5790895",
"0.5715546",
"0.557296... | 0.73145556 | 1 |
Find all UIAStaticTexts|XCUIElementTypeStaticTexts that exactly match value. | def texts_exact(value)
if automation_name_is_xcuitest?
visible_elements = tags static_text_class
elements_exact visible_elements, value
else
eles_by_json_visible_exact static_text_class, value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text_exact(value)\n ele_by_json_visible_exact UIAStaticText, value\n end",
"def texts_exact(value)\n eles_by_json_visible_exact UIAStaticText, value\n end",
"def text_exact(value)\n if automation_name_is_xcuitest?\n raise_error_if_no_element texts_exact(value).first\n else\... | [
"0.6686254",
"0.6657326",
"0.6442809",
"0.6437196",
"0.6293103",
"0.62743324",
"0.618327",
"0.61023784",
"0.60819244",
"0.5903354",
"0.58788174",
"0.5815479",
"0.5814064",
"0.57862973",
"0.5757887",
"0.5730707",
"0.5728821",
"0.56671804",
"0.5606873",
"0.55693895",
"0.5514961... | 0.6838384 | 0 |
Output: Array of arrays of names Pseudocode create new group add 4 names repeat add any remainder to existing groups, one per group Initial Solution def create_groups(names) groups = [] names.each_slice(4) do |group| if group.count == 4 groups << group else i = 0 group.each do |name| groups[i] << name i += 1 end end en... | def create_groups(names)
groups = []
names.shuffle.each_slice(4) do |group|
if group.count == 4
groups << group
else
i = 0
group.each do |name|
groups[i] << name
i += 1
end
end
end
p groups
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acc_group(names)\n\tnames.shuffle!\n\tgroups = names.each_slice(4).to_a\n\tif names.length % 4 == 1\n\t\tgroups[0] << groups.last[0]\n\t\tgroups.pop\n\telsif names.length % 4 == 2\n\t\tgroups[0] << groups.last[0]\n\t\tgroups[1] << groups.last[1]\n\t\tgroups.pop\n\telsif names.length % 4 == 3\n\t\tgroups[0] << ... | [
"0.8262027",
"0.8192234",
"0.8062415",
"0.7815207",
"0.7800257",
"0.7770334",
"0.7693078",
"0.7692999",
"0.7505829",
"0.7496643",
"0.74245226",
"0.74128634",
"0.7299943",
"0.72470075",
"0.7238206",
"0.7218385",
"0.71938777",
"0.7047914",
"0.70449543",
"0.7038858",
"0.6882551"... | 0.8773733 | 0 |
Check XHubSignature to confirm that this webhook was generated by GitHub, and not a malicious third party. | def verify_webhook_signature
their_signature_header = request.env['HTTP_X_HUB_SIGNATURE'] || 'sha1='
method, their_digest = their_signature_header.split('=')
our_digest = OpenSSL::HMAC.hexdigest(method, ENV['GITHUB_WEBHOOK_SECRET'], @payload_raw)
halt 401 unless their_digest == our_digest
log_actio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_signature!\n request.body.rewind\n payload_raw = request.body.read # We need the raw text of the body to check the webhook signature\n begin\n @payload = JSON.parse payload_raw\n rescue\n @payload = {}\n end\n\n # Check X-Hub-Signature to confirm that this webh... | [
"0.835586",
"0.7989559",
"0.77334476",
"0.7723635",
"0.7548454",
"0.7493759",
"0.74926084",
"0.6830978",
"0.6588358",
"0.6536766",
"0.63303256",
"0.63237345",
"0.63237345",
"0.62877697",
"0.6236676",
"0.62035954",
"0.6199341",
"0.614708",
"0.61350894",
"0.6122087",
"0.6074525... | 0.8250748 | 1 |
skip metric value field because we don't want to accumulate metric values(only costs) | def skip_field_accumulation?(field, value)
return false if cumulative_rate_calculation? == false
return false unless field.ends_with?("_metric") && value
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def additional_metrics\n []\n end",
"def timeclean(metric)\n metric.values = metric.values.find_all { |name, label, value| ['total', 'config_retrieval'].include?(name.to_s) }\n end",
"def optional_metric(plan_node, text, metric, metric_present=nil)\n metric_present ||= metric\n if plan_node.send(... | [
"0.5872762",
"0.58197373",
"0.5648532",
"0.5597578",
"0.5473025",
"0.54557604",
"0.5444505",
"0.5443114",
"0.5423378",
"0.5401526",
"0.5383216",
"0.5350363",
"0.5350363",
"0.53265566",
"0.5317789",
"0.5304011",
"0.5258594",
"0.5257378",
"0.5240957",
"0.5180945",
"0.51660424",... | 0.63964015 | 0 |
include_metrics = nil is default value(true) | def include_metrics?
include_metrics.nil? || include_metrics
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def additional_metrics\n []\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def custom_metrics\n @custom_metrics ||= {}\n end",
"def metrics?\n @metrics\n end",
"def build_metrics\n {}\n end",
"def metrics\n @... | [
"0.7514417",
"0.74311954",
"0.74311954",
"0.74311954",
"0.7104507",
"0.6965149",
"0.66708183",
"0.66127765",
"0.6551364",
"0.6504326",
"0.64192957",
"0.6372412",
"0.6314878",
"0.6275611",
"0.624177",
"0.62392277",
"0.6234514",
"0.6225324",
"0.61684465",
"0.61454195",
"0.61096... | 0.82155937 | 0 |
Push data to Tipboard | def push_data(push_params)
# Push URI
push_uri = URI.parse("#{$tipboard_base_uri}/#{$apikey}/push")
# Post to API to set up tile
push_response = Net::HTTP.post_form(push_uri, push_params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(info)\n\t\tadd(info)\n\tend",
"def push\n end",
"def push\n end",
"def push\n @topic.title = title.strip\n @topic.user = @user\n @topic.top_post.user = @user\n @topic.top_post.content = content.strip\n @topic.top_post.floor = 0\n @topic.anonymous = anonymous || false\n @... | [
"0.612826",
"0.61223173",
"0.61014044",
"0.59745234",
"0.58441603",
"0.5807466",
"0.5758141",
"0.5756693",
"0.56657636",
"0.56573445",
"0.56256586",
"0.5620676",
"0.5620676",
"0.5586556",
"0.5582636",
"0.5557427",
"0.55363744",
"0.55363744",
"0.5482476",
"0.54801625",
"0.5473... | 0.65324795 | 0 |
Push Tileconfig to tipboard | def push_tileconfig(tile_name, tileconfig_params)
# Tileconfig URI
tileconfig_uri = URI.parse("#{$tipboard_base_uri}/#{$apikey}/tileconfig/" + tile_name)
# Post to API to set up tileconfig
tileconfig_response = Net::HTTP.post_form(tileconfig_uri, tileconfig_params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push!\n self.place_config\n self.apply_config!\n end",
"def push_data(push_params)\n # Push URI\n push_uri = URI.parse(\"#{$tipboard_base_uri}/#{$apikey}/push\")\n\n # Post to API to set up tile\n push_response = Net::HTTP.post_form(push_uri, push_params)\nend",
"def teleport... | [
"0.64100724",
"0.60160995",
"0.5751919",
"0.57195204",
"0.56994236",
"0.56688887",
"0.55751276",
"0.5571132",
"0.54967123",
"0.54931843",
"0.5475786",
"0.5436013",
"0.5402462",
"0.53489256",
"0.5306105",
"0.5302489",
"0.5288145",
"0.52842236",
"0.52842236",
"0.52842236",
"0.5... | 0.7815419 | 0 |
builds up the fields that the table will include, returns table head and body with all data Can be used one of three ways: Alone, which will try to detect all content columns on the resource With an array of methods to call on each element in the collection With a block, which assumes you will use +cell+ method to buil... | def data(*args, &block) # :yields: tablebody
options = args.extract_options!
if block_given?
yield self
else
@table_fields += args.empty? ? orm_fields : args.collect {|f| TableField.new(f.to_sym)}
@sortable_fields = options[:sortables] || []
@current_sortable = [:create... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_table_contents(&block)\n TableBodyDSL.new(&block).elements\n end",
"def ar_index_table_data\n returning(\"\") do |result|\n \n for resource in @resources\n columns= [ar_label(resource)]\n\n controller.ardata.fields.for_index.each_with_index do |col... | [
"0.7334861",
"0.6724644",
"0.6611374",
"0.6583057",
"0.6563493",
"0.65542126",
"0.6360845",
"0.6352095",
"0.62802875",
"0.62718606",
"0.620313",
"0.61739904",
"0.61298746",
"0.61194354",
"0.60995513",
"0.60722417",
"0.6068287",
"0.6044335",
"0.601251",
"0.5998534",
"0.5969855... | 0.70106995 | 1 |
The constructor should take one parameter, star_name, and save it in an instance variable. | def initialize(star_name)
@star_name = star_name
@planets = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(star_name)\n\t\t@star_name = star_name\n\t\t@planets = []\n\tend",
"def initialize (star_name)\n @star_name = star_name\n @planets = []\n end",
"def initialize(name, mark)\n @name = name\n @mark = mark\n end",
"def initialize(name,mark)\n\t\t@name = name\n\t\t@nota = mark\n\tend"... | [
"0.7862441",
"0.7622032",
"0.6544523",
"0.641951",
"0.6415567",
"0.6368676",
"0.6368676",
"0.6368676",
"0.6368676",
"0.6368676",
"0.6351759",
"0.6326127",
"0.6296328",
"0.6254459",
"0.6254459",
"0.62249136",
"0.62249136",
"0.6215478",
"0.62013096",
"0.6189667",
"0.61782",
"... | 0.76342934 | 1 |
PATCH/PUT /news/1 PATCH/PUT /news/1.json | def update
respond_to do |format|
@news.title = news_params["title"]
@news.content = news_params["content"]
@news.user_id = @current_user.id
if @news.save
format.html { redirect_to @news, notice: 'News was successfully updated.' }
format.json { head :no_content }
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @news = News.find(params[:id])\n pt = params[:news]\n @news.node_id = pt[:node_id]\n @news.title = pt[:title]\n @news.body = pt[:body]\n\n respond_to do |format|\n if @news.update_attributes(params[:news])\n format.html { redirect_to @news, notice: t(\"news.update_news_su... | [
"0.6976627",
"0.6787201",
"0.67846537",
"0.6646795",
"0.656182",
"0.6522001",
"0.6519163",
"0.65090007",
"0.65047544",
"0.65018195",
"0.65013254",
"0.65013254",
"0.6482918",
"0.6448528",
"0.64413",
"0.64144117",
"0.641361",
"0.63939637",
"0.63702184",
"0.6359215",
"0.6330285"... | 0.68592227 | 1 |
DELETE /news/1 DELETE /news/1.json | def destroy
@news.destroy
respond_to do |format|
format.html { redirect_to news_index_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @news = News.find(params[:id])\n @news.destroy\n\n respond_to do |format|\n format.html { redirect_to news_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @news = News.find(params[:id])\n @news.destroy\n\n respond_to do |format|\n fo... | [
"0.7764078",
"0.775641",
"0.775641",
"0.775641",
"0.775641",
"0.77517444",
"0.7737259",
"0.759947",
"0.7589561",
"0.7574634",
"0.7561988",
"0.7550227",
"0.75414765",
"0.7514595",
"0.7485008",
"0.74733543",
"0.7467099",
"0.7467099",
"0.7467099",
"0.744045",
"0.744045",
"0.74... | 0.777627 | 0 |
This method returns an array, with the representation as it should be encoded in JSON. This is used to create jCard or jCal documents. | def json_serialize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json\n to_a.to_json\n end",
"def tojson\n\t\tend",
"def to_json\n\t\tto_h.to_json\n\tend",
"def to_json\n\t\tto_h.to_json\n\tend",
"def to_json_raw_object()\n #This is a stub, used for indexing\n end",
"def to_json\n JSON(as_json)\n end",
... | [
"0.7051147",
"0.657213",
"0.64737296",
"0.64737296",
"0.6470844",
"0.6461318",
"0.6434858",
"0.6401139",
"0.6396126",
"0.6389234",
"0.6359484",
"0.63527614",
"0.63343626",
"0.6320852",
"0.63141185",
"0.63085717",
"0.629208",
"0.6291343",
"0.6263717",
"0.6242989",
"0.6231246",... | 0.65923816 | 1 |
method to list items on the grocery_list and the number of items in the grocery_list | def list_items(grocery_list)
grocery_list.sort!
grocery_list.each do |item|
puts "* #{item}"
end
puts "#{grocery_list.length} items on the list right now"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grocery_list *items\n for item in items\n if item in list\n item.count += 1\n else\n list << item\n end\n end\nend",
"def print_list(grocery_list)\n grocery_list.each do |item,quantity|\n puts \" #{item} #{quantity}\"\n end\n end",
"def print_list(grocery_list)\n grocery_l... | [
"0.74828005",
"0.738579",
"0.7354263",
"0.72164726",
"0.7213368",
"0.7202302",
"0.7166662",
"0.7166662",
"0.715076",
"0.714676",
"0.71220124",
"0.71050763",
"0.7080997",
"0.7028242",
"0.7017384",
"0.6995576",
"0.6991172",
"0.6973049",
"0.69707125",
"0.69326943",
"0.6906676",
... | 0.7760579 | 0 |
Recursively downloads a remote directory | def download_dir(remote_dir, local_dir)
puts "Downloading remote dir " + remote_dir + " to local dir " + local_dir
@ftp.chdir(remote_dir)
items = @ftp.ls
directories = Array.new
files = Array.new
items.each do |line|
if dir = line.match(@@dir_regex)
if dir[1].eql?(".") || dir[1].eql?("..")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dir_download(*paths); net_scp_transfer!(:download, true, *paths); end",
"def pull_files(remote_path,local_path)\n debug_p(\"pull_files from #{remote_path} to #{local_path}\")\n @sftp_session.dir.foreach(remote_path){ |path|\n #unless path.name == \".\" || path.name == \"..\"\n #not directory\... | [
"0.71641856",
"0.66792285",
"0.6566631",
"0.6400378",
"0.6398305",
"0.6332012",
"0.62677914",
"0.6178676",
"0.6162934",
"0.61275876",
"0.60556805",
"0.6045835",
"0.60370326",
"0.60131246",
"0.60046506",
"0.6000814",
"0.5978228",
"0.5967617",
"0.5964829",
"0.5955443",
"0.59293... | 0.6792597 | 1 |
crawl_hiera_directory crawls a directory to json and yaml files and returns the resulting files in a list. All paths are returned as complete paths (not relative) ==== Attributes +directory+ Directory to start the search in. ==== Examples Illustrate the behaviour of the method using examples. Indent examples: base = Ba... | def crawl_hiera_directory(directory)
files = []
Dir[directory + '/**/*.yaml'].each { |f| files << File.absolute_path(f) }
return files
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_directory(directory)\n return if directory == nil\n \n repo = File.join(path, directory)\n return unless File.directory?(repo) \n \n Dir.chdir(repo)\n Dir.foreach(EXTENSION) do |element|\n next if element == \".\" or element == \"..\"\n yield element\n ... | [
"0.646335",
"0.61802644",
"0.6095087",
"0.59751266",
"0.59404826",
"0.59031105",
"0.58966196",
"0.5887749",
"0.58805585",
"0.58794683",
"0.5784801",
"0.5781191",
"0.57798123",
"0.5764515",
"0.5742166",
"0.572472",
"0.5707037",
"0.57065725",
"0.57035327",
"0.56947243",
"0.5678... | 0.7789031 | 0 |
get_root_keys_from_file returns the root keys of a YAML file ==== Attributes +file+ absolute path to a YAML file ==== Examples Illustrate the behaviour of the method using examples. Indent examples: base = Base.new("./example/common") base.method_name("Example", "more") | def get_root_keys_from_file(file)
@logger.debug("Getting Root Keys fromt %s" % file)
keys = []
y = YAML.load_file(file)
y.each{ |k,v| keys << k }
return keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_root_keys_from_directory(directory)\n @logger.debug(\"Getting Root Keys in %s\" % directory)\n keys = []\n crawl_hiera_directory(directory).each{ |f|\n @logger.debug(\"Found file %s\" % f)\n get_root_keys_from_file(f).each{ |k| keys << k }\n }\n return keys\n end",
"def [](key, ... | [
"0.6287392",
"0.5985158",
"0.59346783",
"0.59106296",
"0.58935887",
"0.5768646",
"0.5765807",
"0.5720261",
"0.56611997",
"0.5653882",
"0.5541604",
"0.55336314",
"0.5513163",
"0.5481823",
"0.5447666",
"0.54394734",
"0.5377224",
"0.53749627",
"0.5363073",
"0.5349754",
"0.534975... | 0.8528707 | 0 |
get_root_keys_from_file returns the root keys of a YAML file ==== Attributes +file+ absolute path to a YAML file ==== Examples Illustrate the behaviour of the method using examples. Indent examples: base = Base.new("./example/common") base.method_name("Example", "more") | def get_root_keys_from_directory(directory)
@logger.debug("Getting Root Keys in %s" % directory)
keys = []
crawl_hiera_directory(directory).each{ |f|
@logger.debug("Found file %s" % f)
get_root_keys_from_file(f).each{ |k| keys << k }
}
return keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_root_keys_from_file(file)\n @logger.debug(\"Getting Root Keys fromt %s\" % file)\n keys = []\n y = YAML.load_file(file)\n y.each{ |k,v| keys << k }\n return keys\n end",
"def [](key, file=_root_file)\n with_file(file, key)\n end",
"def read_keys(opts={})\n if !defined?(@@keys... | [
"0.85272247",
"0.59873664",
"0.59341514",
"0.5912584",
"0.5892814",
"0.5770186",
"0.57665247",
"0.5721196",
"0.56618196",
"0.56544155",
"0.55424094",
"0.553607",
"0.55134684",
"0.54832417",
"0.5450905",
"0.54414666",
"0.53789943",
"0.537516",
"0.5363197",
"0.5351096",
"0.5351... | 0.628639 | 1 |
Process ranged requests by measuring the geographical distance between each user connected, in order to decide whether to send the message to them. | def send_ranged_messages(response)
sender_location = Geokit::LatLng.normalize(@user_data[:location])
sender_visibility_range = @user_data[:visibility_range]
# Truncate through each user, measure distance, and send appropriate message to their mailbox
# TODO: Refactor for efficiency
@connected... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getInRange\n @requests = Request.all # all requests\n @myLongtitude = params[:longtitude]\n @myLatitude = params[:latitude]\n @myTime = params[:time]\n\n @validRequests = Array.new\n\n for request in @requests\n if request.expires < @myTime\n @distance = calcDist(reque... | [
"0.6559568",
"0.5541879",
"0.5408778",
"0.532736",
"0.5199207",
"0.5190987",
"0.5133344",
"0.513183",
"0.50294805",
"0.49952066",
"0.4972891",
"0.4958096",
"0.4926432",
"0.4920918",
"0.49015716",
"0.48933417",
"0.48795596",
"0.4859418",
"0.4840599",
"0.4822533",
"0.4812216",
... | 0.75268847 | 0 |
Process the callback when the timer expires | def timer(milliseconds, &callback)
# Implement in subclass
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timer(timeout,options={},&callback)\n bot.timer.add_timer(:timestamp=>Time.now+timeout.to_i, :requestor=>options[:requestor]||name,&callback)\n end",
"def run(context)\n\t\tcontext.onTimerFinished\n\tend",
"def timer(callback = nil, &blk)\n Timer.new(@loop, callback || blk)\n end",
... | [
"0.64779633",
"0.64264894",
"0.6391979",
"0.63353354",
"0.6237103",
"0.6186185",
"0.616897",
"0.613323",
"0.6122731",
"0.61089855",
"0.6080565",
"0.6080565",
"0.60761404",
"0.60704213",
"0.6058758",
"0.60572356",
"0.6053221",
"0.603928",
"0.603928",
"0.603928",
"0.603928",
... | 0.6870284 | 0 |
GET /position_members/1 GET /position_members/1.xml | def show
@position_member = PositionMember.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @position_member }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n respond_to do |format|\n format.html { render :layout => 'yui_t7_custom' } # index.rhtml\n format.xml { render :xml => @members.to_xml }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @member }\n end\n e... | [
"0.64859504",
"0.63038284",
"0.6302604",
"0.6290618",
"0.62796307",
"0.6244375",
"0.6151373",
"0.61448365",
"0.6108398",
"0.610571",
"0.60390884",
"0.60362685",
"0.6005933",
"0.59992874",
"0.5989505",
"0.5981068",
"0.597821",
"0.5967208",
"0.59448403",
"0.5934121",
"0.5931470... | 0.7202508 | 0 |
GET /position_members/new GET /position_members/new.xml | def new
@position_member = PositionMember.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @position_member }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @position = Position.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @position }\n end\n end",
"def new\n @position = Position.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @p... | [
"0.7227956",
"0.7219613",
"0.68956",
"0.685428",
"0.685428",
"0.685428",
"0.6808057",
"0.6744701",
"0.6744701",
"0.6744701",
"0.6696842",
"0.6599515",
"0.6589089",
"0.6577664",
"0.65210867",
"0.6519946",
"0.64888614",
"0.6472452",
"0.6452893",
"0.64181733",
"0.63958246",
"0... | 0.7971169 | 0 |
POST /position_members POST /position_members.xml | def create
@position_member = PositionMember.new(params[:position_member])
respond_to do |format|
if @position_member.save
@user = User.find(@position_member.user_id)
@user.access_level = 30
@user.save!
format.html { redirect_to(@position_member, :notice => 'Position membe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n \t@position_member = PositionMember.new(position_member_params)\n if position_member_params[:member_id] and !position_member_params[:member_id].empty?\n @member = Member.find(position_member_params[:member_id])\n if params[:avatar]\n @user = @member.user\n if @user and !@us... | [
"0.6068822",
"0.59226036",
"0.5869769",
"0.5652084",
"0.56401694",
"0.5621516",
"0.5576162",
"0.55594385",
"0.5552385",
"0.5494868",
"0.5488418",
"0.548539",
"0.5480334",
"0.5468227",
"0.5448999",
"0.54423296",
"0.5389754",
"0.5388241",
"0.53547716",
"0.5337737",
"0.5312707",... | 0.684351 | 0 |
PUT /position_members/1 PUT /position_members/1.xml | def update
@position_member = PositionMember.find(params[:id])
respond_to do |format|
if @position_member.update_attributes(params[:position_member])
format.html { redirect_to(@position_member, :notice => 'Position member was successfully updated.') }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @position_member = PositionMember.new(params[:position_member])\n\n respond_to do |format|\n if @position_member.save\n @user = User.find(@position_member.user_id)\n @user.access_level = 30\n @user.save!\n format.html { redirect_to(@position_member, :notice => 'P... | [
"0.6317985",
"0.6175349",
"0.5862336",
"0.5788795",
"0.57759947",
"0.57321626",
"0.5627298",
"0.5626695",
"0.5626418",
"0.5603748",
"0.55926514",
"0.5577977",
"0.5566097",
"0.55609894",
"0.554845",
"0.5548224",
"0.5521853",
"0.5486542",
"0.5483256",
"0.54816264",
"0.54736763"... | 0.69098216 | 0 |
DELETE /position_members/1 DELETE /position_members/1.xml | def destroy
@position_member = PositionMember.find(params[:id])
@position_member.destroy
respond_to do |format|
format.html { redirect_to(position_members_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @member = Member.find(params[:id])\n @member.destroy\n \n \n respond_to do |format|\n format.html { redirect_to(members_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @position = Position.find(params[:id])\n @position.destroy\n\n respond_to do |... | [
"0.638631",
"0.6372484",
"0.6352547",
"0.6332755",
"0.6288162",
"0.62825656",
"0.6267353",
"0.6183814",
"0.6165985",
"0.6165985",
"0.6165985",
"0.6165985",
"0.61439246",
"0.61239105",
"0.6120858",
"0.6112019",
"0.61073285",
"0.60923404",
"0.6079514",
"0.6059964",
"0.60402244"... | 0.7169993 | 0 |
Public: Create new BOSHsession (not binded to httpbind service) domain String the jabber server domain port [String|Fixnum] the port of httpbind endpoint of jabber server bind_uri String the httpbind uri Returns Jabber::BoshSession | def initialize(domain, port, bind_uri, options = {})
@domain, @port, @bind_uri = domain, port, bind_uri
@use_sasl = options.fetch(:use_sasl, Jabber::Bosh::DEFAULTS[:use_sasl])
@alive = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session\n response = Stanza::Iq.new :set\n response.to = @to\n response << (sess = XMPPNode.new('session', response.document))\n sess.namespace = SESSION_NS\n\n @stream.send response\n end",
"def create_session(conn, opts={})\n # If there is a parent payload, then use that in p... | [
"0.54062164",
"0.5095261",
"0.50395995",
"0.5006621",
"0.4945401",
"0.49443594",
"0.49304312",
"0.49120608",
"0.48705456",
"0.48646265",
"0.48554593",
"0.48334333",
"0.47609314",
"0.47156614",
"0.46647623",
"0.46580216",
"0.4648453",
"0.46473894",
"0.46471563",
"0.4635743",
"... | 0.64919853 | 0 |
Public: Is BOSHsession uses sasl authentication Returns boolean | def sasl?
@use_sasl
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_sasl(sasl, password)\n sasl.auth(password)\n\n # Restart stream after SASL auth\n restart\n # And wait for features - again\n @features_sem.wait\n\n # Resource binding (RFC3920 - 7)\n if @stream_features.has_key? 'bind'\n @jid = bind(@jid.resource)\n end\n\n ... | [
"0.68923527",
"0.65448654",
"0.6490526",
"0.6466998",
"0.64024776",
"0.6332249",
"0.6323908",
"0.6290836",
"0.62475",
"0.62475",
"0.62475",
"0.6236871",
"0.6214134",
"0.6211382",
"0.62000054",
"0.6173633",
"0.6153777",
"0.61510515",
"0.6144552",
"0.60895693",
"0.60895693",
... | 0.7932517 | 0 |
Internal: Generate request id object for http post request Returns Jabber::Generators::Rid | def request_id
@rid ||= Jabber::Generators.request
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_request_id()\n\t\t\t@random_instance ||= Random.new\n\t\t\tBase64.urlsafe_encode64(@random_instance.bytes(12))\n\t\tend",
"def request_id\n SecureRandom.hex(17)\n end",
"def request_id\n SecureRandom.hex(17)\n end",
"def request_id\n # FIXME make this number configurabl... | [
"0.70408666",
"0.70127195",
"0.70127195",
"0.69514453",
"0.68938303",
"0.67992574",
"0.6788007",
"0.67366576",
"0.6623081",
"0.6520367",
"0.64416873",
"0.64416873",
"0.63210756",
"0.6204667",
"0.6143459",
"0.6138129",
"0.6133079",
"0.6129599",
"0.6126895",
"0.5917454",
"0.590... | 0.7509537 | 0 |
a cargos name is that of its sku | def name
sku.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_with_sku\n [product_name, sku].compact.join(': ')\n end",
"def name_with_sku\n [product_name, sku].compact.join(': ')\n end",
"def sku_properties_name\n #YIHAO PENDING\n end",
"def sku\n reference\n end",
"def name\n BadASS::BAD_DRAGON_SKUS[@sku]\n end",
"def grab_sku... | [
"0.7662771",
"0.76026773",
"0.75331587",
"0.7427996",
"0.72344995",
"0.68952286",
"0.6859144",
"0.6849924",
"0.6797462",
"0.6769362",
"0.6479416",
"0.6376108",
"0.6327747",
"0.6298208",
"0.6259566",
"0.6258604",
"0.6254577",
"0.6232524",
"0.620488",
"0.62004215",
"0.6151422",... | 0.8108757 | 0 |
size returns the enter size of the cargo. If size of an indiviual sku is neede sku.size is suficent | def size
sku.size * amount
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_shirt_size\n return @size\n end",
"def size\n\t\t7500\n\tend",
"def size\n Stal.solve(redis, [\"SCARD\", key])\n end",
"def size\r\n\t\t@size\r\n\t\t#el tamaño\r\n\tend",
"def size\n @size ... | [
"0.71378285",
"0.6889276",
"0.682659",
"0.67661494",
"0.6749681",
"0.6749681",
"0.6711794",
"0.65485793",
"0.6548456",
"0.6548456",
"0.6548456",
"0.6547992",
"0.65383714",
"0.6513257",
"0.6512301",
"0.64878124",
"0.6463835",
"0.6459961",
"0.6459961",
"0.6450328",
"0.6448882",... | 0.81592435 | 0 |
Configuration variables can be stored in '~/.phpowconfig' PHPOW_APACHE_PORT: Configure apache to run on a port other than 8888 PHPOW_PROJECTS_DIRECTORY: Serve your projects out of a directory other than /Users/user/Sites | def load_config
if File.exists?(File.expand_path('~/.phpowconfig'))
self.apache_port = %x{source ~/.phpowconfig; echo $PHPOW_APACHE_PORT}.strip unless %x{source ~/.phpowconfig; echo $PHPOW_APACHE_PORT}.strip.empty?
self.projects_directory = %x{source ~/.phpowconfig; echo $PHPOW_PROJECTS_DIRECTORY}.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_local\n if Process.uid != 0\n warn \"Apache configuration must run as root user\"\n exit 1\n end\n\n TemplateWriter.process(\n \"config-local.yml.erb\",\n \"/srv/Portus/config/config-local.yml\",\n binding\n )\n FileUtils.chown(\"root\", \"www\", \"/srv/Portus/con... | [
"0.6046026",
"0.6004284",
"0.5997313",
"0.5924459",
"0.59089154",
"0.58962566",
"0.58053607",
"0.5717172",
"0.5716209",
"0.56828433",
"0.56828433",
"0.5634939",
"0.56172645",
"0.55639815",
"0.55097634",
"0.55024785",
"0.5476629",
"0.547656",
"0.547656",
"0.547656",
"0.547656"... | 0.77643037 | 0 |
GET /ru_pusks/1 GET /ru_pusks/1.xml | def show
@ru_pusk = RuPusk.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @ru_pusk }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end",
"def index\n @kpis = Kpi.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @kpis }\n end\n end",
"def index\n @uitgelichts = Uitgelicht... | [
"0.63770145",
"0.6204965",
"0.6112057",
"0.6040396",
"0.6017693",
"0.5968138",
"0.59642464",
"0.5963119",
"0.5959656",
"0.5950205",
"0.59024435",
"0.58787876",
"0.58783114",
"0.5851823",
"0.58499354",
"0.58095133",
"0.579244",
"0.5791393",
"0.57840294",
"0.5783076",
"0.576386... | 0.66933244 | 0 |
GET /ru_pusks/new GET /ru_pusks/new.xml | def new
@ru_pusk = RuPusk.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @ru_pusk }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @senh... | [
"0.7248227",
"0.6880522",
"0.6829452",
"0.68034506",
"0.68026114",
"0.6790577",
"0.67786705",
"0.677833",
"0.67634875",
"0.67578644",
"0.67332065",
"0.67113817",
"0.66912824",
"0.66883284",
"0.6682712",
"0.6680641",
"0.66799474",
"0.6679786",
"0.6674154",
"0.66670257",
"0.664... | 0.7259627 | 0 |
POST /ru_pusks POST /ru_pusks.xml | def create
@ru_pusk = RuPusk.new(params[:ru_pusk])
respond_to do |format|
if @ru_pusk.save
format.html { redirect_to(@ru_pusk, :notice => 'Ru pusk was successfully created.') }
format.xml { render :xml => @ru_pusk, :status => :created, :location => @ru_pusk }
else
format.ht... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_xml(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n ... | [
"0.57756704",
"0.573688",
"0.5581266",
"0.5545963",
"0.5528878",
"0.54901654",
"0.5471063",
"0.54707426",
"0.53808856",
"0.5378953",
"0.53781694",
"0.5366146",
"0.5360339",
"0.53343904",
"0.5323112",
"0.527291",
"0.52676755",
"0.5267671",
"0.5260943",
"0.5257027",
"0.5251726"... | 0.6385345 | 0 |
Now define total point per seat (gave weighting option for forward importance), I might use in the future. | def seat_point(row_num,col_num,weight_non_movies=1)
(is_movie? ? point_per_movie_seat_row(row_num) + point_column(col_num) : (weight_non_movies)*point_per_non_movie_seat_row(row_num)) + point_column(col_num)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_of_point\n # Calculating point of each block\n calculate_points\n # Sum\n rubbish_count + not_clear_count + somewhat_count + understand_count\n end",
"def define_total_price\n self.total_price = self.quantity.to_f * (self.price.to_f + self.vat_amount.to_f )\n end",
"def true_poin... | [
"0.62816113",
"0.60355705",
"0.59869045",
"0.5985908",
"0.5973859",
"0.5960539",
"0.5937494",
"0.5899884",
"0.58880895",
"0.5838057",
"0.5815912",
"0.58150506",
"0.58142364",
"0.5801202",
"0.5747331",
"0.5740836",
"0.5707858",
"0.56975687",
"0.56844395",
"0.5670584",
"0.56660... | 0.63283414 | 0 |
now I make chart that holds the values for each seat. returns [row, col, points] | def seat_point_chart
hold=[]
availableSeats.to_a.each do |i|
row=i[1]["row"]
row_num=row_to_num(row)
col=i[1]["column"]
sp=[row,col,seat_point(row_num,col)]
hold.push(sp)
end
return hold
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getchart()\n # The (x, y, z) coordinates of the scattered data\n dataX = [0.5, 1.9, 4.9, 1.0, 8.9, 9.8, 5.9, 2.9, 6.8, 9.0, 0.0, 8.9, 1.9, 4.8,\n 2.4, 3.4, 7.9, 7.5, 4.8, 7.5, 9.5, 0.4, 8.9, 0.9, 5.4, 9.4, 2.9, 8.9, 0.9,\n 8.9, 10.0, 1.0, 6.8, 3.8, 9.0, 5.3, 6.4, 4.9, 4.5, 2... | [
"0.62203676",
"0.62203676",
"0.6118574",
"0.6021007",
"0.60140294",
"0.59974575",
"0.58857304",
"0.5847992",
"0.5687524",
"0.5648484",
"0.5551676",
"0.55460393",
"0.5513917",
"0.5485539",
"0.54795945",
"0.5478822",
"0.5461963",
"0.5446893",
"0.5437061",
"0.5433881",
"0.543222... | 0.8445612 | 0 |
Combinations of available seats by seat number | def seat_combinations(input_num)
#dont allow for combination numbers above number of avail seats
return nil unless input_num < availableSeats.length + 1
seat_point_chart.combination(input_num).to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_best_seat_combinations\n first=seat_point_chart[seat_point_chart.map{|x| x[2]}.each_with_index.max[1]]\n all_best = [[first[0]+first[1].to_s]]\n for i in 2..availableSeats.length\n all_best.push(best_seat_combination(i))\n end \n all_best\n end",
"def best... | [
"0.75966424",
"0.74620247",
"0.6826588",
"0.65714747",
"0.6308752",
"0.62856066",
"0.6259852",
"0.62111104",
"0.6043706",
"0.6036407",
"0.59795254",
"0.5928824",
"0.58867675",
"0.58845377",
"0.58716047",
"0.57876295",
"0.5744436",
"0.5734961",
"0.5722941",
"0.57191336",
"0.56... | 0.8529129 | 0 |
total Value of an input set I am crudely saying is the sum of the of the points per seat multiplied by the number of seated connections divided by the number of total seats | def total_value_of_set(input_set)
pps = input_set.sum{|x| x[2]}
cv= how_many_connections(input_set)
cv*pps
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_total_sale_price_of_seats(seat_numbers)\n @seats_price = 0\n @seats_price = seat_numbers.map{|seat| seat_price(seat)}.reduce(:+)\n end",
"def sum_values\n points.sum\n end",
"def how_many_connections(input_set)\n #counter\n hold = 0\n #n choose 2 in double loo... | [
"0.6909213",
"0.65703464",
"0.65620667",
"0.64086324",
"0.6352009",
"0.62529606",
"0.6196997",
"0.61692756",
"0.6123381",
"0.6111587",
"0.6108227",
"0.61075723",
"0.61075723",
"0.61074424",
"0.6100514",
"0.60796994",
"0.60133445",
"0.597",
"0.59539855",
"0.59465104",
"0.59260... | 0.76488966 | 0 |
Finally here I have all the best seat combinations for each value of the number of tickets (had to force push 1, because I forgoot to) handle earlier and running out time to work on this. | def all_best_seat_combinations
first=seat_point_chart[seat_point_chart.map{|x| x[2]}.each_with_index.max[1]]
all_best = [[first[0]+first[1].to_s]]
for i in 2..availableSeats.length
all_best.push(best_seat_combination(i))
end
all_best
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def best_seat_combination(input_num)\n all_sets = seat_combinations(input_num)\n hold_set = []\n hold_val = 0\n all_sets.each do |i|\n tv = total_value_of_set(i)\n if tv > hold_val\n hold_set = i\n hold_val= tv\n end\n ... | [
"0.72666776",
"0.67531693",
"0.6607428",
"0.6179801",
"0.6132983",
"0.5974757",
"0.5914748",
"0.58647895",
"0.5841812",
"0.578512",
"0.57568896",
"0.5749306",
"0.5748004",
"0.5740518",
"0.5703281",
"0.5696884",
"0.56899905",
"0.5688689",
"0.5673743",
"0.5666827",
"0.56524956"... | 0.77318186 | 0 |
GET /somethings/new GET /somethings/new.json | def new
@something = Something.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @something }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n e... | [
"0.72599906",
"0.7164336",
"0.71495175",
"0.6947333",
"0.6928429",
"0.6888905",
"0.6836025",
"0.67150176",
"0.67118925",
"0.67067087",
"0.66740704",
"0.664265",
"0.664265",
"0.664265",
"0.66371477",
"0.6617355",
"0.66048557",
"0.6599585",
"0.65869063",
"0.65770286",
"0.655387... | 0.7271118 | 0 |
`Manageremployees` returns an `Array` of all the employees that the manager oversees SEE BELOW | def employees
Employee.all.select do |employee|
employee.manager == self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def employees\n Employee.all.select {|employees| employees.manager_name == self.name} \n end",
"def employees\n self.employee_examination_sessions.map(&:employee)\n end",
"def employees\n Employee.select{|employees| employees.manager == self.name}\nend",
"def employees\n employee_ar... | [
"0.74290186",
"0.6992484",
"0.69910294",
"0.69146335",
"0.6823282",
"0.67209685",
"0.6665965",
"0.6643816",
"0.6546385",
"0.6516263",
"0.64503443",
"0.6418576",
"0.6344564",
"0.6339397",
"0.6294284",
"0.62429047",
"0.62318695",
"0.6104275",
"0.6034501",
"0.6028863",
"0.602228... | 0.74248475 | 1 |
TODO: Allow user to upload local files as images (via command line option) prod_version = upload_image row, h2i, current_product_id, row_index | def upload_image(row, h2i, product_id, row_index)
url = get_val row, 'images', h2i
return nil unless url
res = sphere.post_image product_images_url(@sphere_project_key, product_id), url
raise "[row #{row_index}] Problems on image upload: '#{url}' - server returned with code '#{res.code}':\n #{r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_new_version(params={})\n \n file_info = params[:file]\n version_entity = params[:version_entity]\n\n old_version = @media_asset.version\n # If a media asset does not have any version yet, its \n # version is 0, and its fi... | [
"0.6249086",
"0.60121644",
"0.5851947",
"0.5838291",
"0.5828435",
"0.58013254",
"0.5748725",
"0.57482314",
"0.57341844",
"0.57251906",
"0.57139945",
"0.56929016",
"0.56863075",
"0.5665947",
"0.56644547",
"0.56381285",
"0.562542",
"0.5622623",
"0.56073326",
"0.55518764",
"0.55... | 0.7950446 | 0 |
Method: legend_html (Terra::Fieldset) Returns the HTML code for the fields in the fieldset. | def legend_html
"<h3 class='legend'>#{self.to_s}</h3>" unless default?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fieldset legend, &block\n concat content_tag(:fieldset) {\n output = String.new\n output << content_tag(:legend, legend) unless legend.blank?\n output << capture(&block)\n } \n end",
"def field_set_tag(legend = nil, options = nil, &block)\n output = tag(:fieldset, options, true)\... | [
"0.7456154",
"0.72901094",
"0.7125656",
"0.70421684",
"0.69255155",
"0.68758136",
"0.68269813",
"0.6760253",
"0.6756696",
"0.66972184",
"0.6689925",
"0.6513464",
"0.6497205",
"0.6477195",
"0.6296428",
"0.6270693",
"0.6200043",
"0.6186877",
"0.6133853",
"0.6124877",
"0.6056425... | 0.77786833 | 0 |
Default middleware stack that uses default adapter as specified at configuration stage. | def default_middleware
Proc.new do |builder|
builder.use Faraday::Request::Multipart
builder.use Faraday::Request::UrlEncoded
builder.use Yandex::Webmaster::Request::OAuth2, config.oauth_token
builder.use Faraday::Response::Logger if ENV['DEBUG']
builder.use Ya... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_middleware(options = {})\n Middleware.default(options)\n end",
"def middlewares_stack; end",
"def setup_middleware middleware_stack\n where = OpenCensus::Trace.configure.middleware_placement\n case where\n when Class\n middleware_stack.insert_before whe... | [
"0.6988387",
"0.6289056",
"0.62089217",
"0.6185615",
"0.6176461",
"0.60849726",
"0.60449547",
"0.6003715",
"0.59863657",
"0.59770477",
"0.57871985",
"0.57510674",
"0.57313603",
"0.570328",
"0.5701609",
"0.56652755",
"0.566434",
"0.5618749",
"0.56030184",
"0.5586621",
"0.55857... | 0.667111 | 1 |
GET /mazos/1 GET /mazos/1.xml | def show
@mazo = Mazo.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @mazo }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @musica = Musica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @musica }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end... | [
"0.6285327",
"0.6277566",
"0.6250626",
"0.6194739",
"0.6159826",
"0.61384857",
"0.6096382",
"0.6045636",
"0.6024531",
"0.6021772",
"0.6012025",
"0.59980357",
"0.59747225",
"0.5930768",
"0.5929517",
"0.59241426",
"0.59160006",
"0.5899006",
"0.58934975",
"0.58834416",
"0.585383... | 0.6617293 | 0 |
DELETE /mazos/1 DELETE /mazos/1.xml | def destroy
@mazo = Mazo.find(params[:id])
@mazo.destroy
respond_to do |format|
format.html { redirect_to(mazos_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def delete()\n response = send_post_request(@xml_api_del... | [
"0.7113551",
"0.6776104",
"0.67359203",
"0.6626995",
"0.65178597",
"0.6474304",
"0.6454514",
"0.6437913",
"0.6432118",
"0.6423932",
"0.6419455",
"0.639654",
"0.6377922",
"0.6361057",
"0.63506794",
"0.6344343",
"0.6327967",
"0.6306633",
"0.62983996",
"0.62970483",
"0.62967",
... | 0.6780471 | 1 |
player_mutex is used for protecting critical region for accessing player data FIXME: garbage collect unused player mutex ensure player mutex obtained before yielding | def with_player_mutex(id, zone, no_lock, &blk)
if no_lock then
yield
else
cache_key = cache_key(id, zone)
@mutex[cache_key] ||= Mutex.new
this_mutex = @mutex[cache_key]
Boot::Helper.lock_mutex this_mutex, @mutex_try_limit
begin
yield
ensure... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync\n @mutex.synchronize{yield}\n end",
"def sync\n @mutex.synchronize{yield}\n end",
"def sync\n @mutex.synchronize{yield}\n end",
"def sync\n @mutex.synchronize{yield}\n end",
"def player(&block)\n Player.new(self, :player, DEFAULTS[:player], &block)\n end",
"def player\n\t\t@p... | [
"0.56881696",
"0.56881696",
"0.56881696",
"0.56881696",
"0.56308013",
"0.56095123",
"0.5545563",
"0.5545563",
"0.5545563",
"0.5545563",
"0.55434084",
"0.5495199",
"0.5450411",
"0.5450295",
"0.54305255",
"0.5414715",
"0.54104286",
"0.5401583",
"0.53778315",
"0.53618693",
"0.53... | 0.690602 | 0 |
Linebreak a prototype longer than 80 characters on the commas, but only between balanced parentheses so that we don't linebreak args which are function pointers, and then aligning each arg under each other. | def linebreak_proto(proto, indent)
if proto.bytesize <= 80
return proto
end
parts = proto.split(/,\s*/);
if parts.length == 1
return proto;
end
align_pos = proto.index("(") + 1;
align = " " * align_pos
result = parts.shift;
bracket_balance = 0;
parts.each{|part|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printf_func_call_tail\n case @enum.peek.value\n when ','\n @instruction.push(@enum.peek.value)\n comma\n expression\n @instruction.push(@enum.peek.value)\n match(Token.new(:symbol, ')'))\n semicolon\n when ')'\n @instruction.push(@enum.peek.value)\n match(Token.... | [
"0.58445644",
"0.5795318",
"0.570876",
"0.56993425",
"0.56184685",
"0.5575941",
"0.5553428",
"0.5487642",
"0.5464975",
"0.54645157",
"0.54115033",
"0.5381851",
"0.53619885",
"0.5354047",
"0.53469265",
"0.53469265",
"0.53469265",
"0.53469265",
"0.53469265",
"0.53469265",
"0.53... | 0.68493474 | 0 |
Returns the name of the first section heading in the comment block for which is_section_doc(src, i) is true | def get_section_heading(src, i)
if src[i] =~ /^\/\*\*? \#+ *(.*)/
heading = $1
elsif src[i+1] =~ /^ ?\* \#+ *(.*)/
heading = $1
end
return heading.gsub(' -- ', ' – ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def section_doc(src, i)\n name = get_section_heading(src, i)\n comment = \"<span id=\\\"#{section_name_to_id(name)}\\\"></span>\\n\\n\"\n while true\n # append line, except if it's a horizontal divider\n comment = comment + src[i] if src[i] !~ /^[\\/ ]?\\*{1,2} ?-{50,}/\n break if sr... | [
"0.72215325",
"0.6825655",
"0.6660688",
"0.64103216",
"0.62859315",
"0.6277076",
"0.626307",
"0.6219221",
"0.6200666",
"0.6199289",
"0.61853284",
"0.61799157",
"0.6166308",
"0.6022279",
"0.59903765",
"0.5904292",
"0.588322",
"0.5849874",
"0.5836845",
"0.5778617",
"0.5769518",... | 0.7587031 | 0 |
Returns true if the line is the start of a generic documentation section. Such section must start with the symbol, i.e. a markdown heading, on the first or the second line. | def is_section_doc(src, i)
return src[i] =~ /^\/\*\*? \#/ ||
(src[i] =~ /^\/\*/ && src[i+1] =~ /^ ?\* \#/)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def starts_licence_section?(line)\n /^#+\\s*li[sc]en[sc]e/i =~ line\n end",
"def section?\n type == \"Section\"\n end",
"def mid_block_keyword?(line)\n line.length > 2 && line[0] == SILENT_SCRIPT && MID_BLOCK_KEYWORDS.include?(line[1..-1].split[0])\n end",
"def should_parse?(line)\n stri... | [
"0.677957",
"0.6389917",
"0.6126233",
"0.6095023",
"0.6085428",
"0.6084241",
"0.60468507",
"0.5989597",
"0.59368813",
"0.58641243",
"0.58217865",
"0.58095807",
"0.57982457",
"0.57779896",
"0.57625127",
"0.570737",
"0.56967777",
"0.5691165",
"0.5670408",
"0.5663369",
"0.566053... | 0.6498543 | 1 |
Configures the Fever groups, ensuring that hot water is first since its producers may be used as aliases in other groups. | def setup
@groups =
Etsource::Fever.groups.map do |conf|
Group.new(conf.name, self)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n @key = :__first_group__\n start(nil)\n end",
"def add_hosts_group\n puppet_ip = any_hosts_as?(:loadbalancer) ? loadbalancer.ip : master.ip\n hosts_group = {\n \"name\" => \"Clamps Managed Hosts\",\n \"rule\" => [\"or\", [\"=\", %w[fact id], \"root\"]],\n \"parent... | [
"0.58779293",
"0.57479364",
"0.56443727",
"0.56225705",
"0.55959374",
"0.5490516",
"0.5486426",
"0.54264",
"0.5368841",
"0.5360333",
"0.53336227",
"0.5312575",
"0.52634406",
"0.52617145",
"0.5241758",
"0.52126557",
"0.51829326",
"0.5180696",
"0.51712734",
"0.5163632",
"0.5157... | 0.6749537 | 0 |
Overrides ActionController::Paginatepaginate() to give ability to automatically pass the correct :per_page URL option value. | def paginate(collection_id, options = {})
if !options[:per_page].nil?
params[:num_per_page] = options[:per_page].to_s
else
params[:num_per_page] = '10' if params[:num_per_page].nil?
end
super(collection_id, options.merge(:per_page => params[:num_per_page].to_i))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def will_paginate_extended(collection, options = {})\n all_options = { style: 'display: inline-block;' }\n all_options = options.merge(all_options)\n\n (will_paginate(collection, all_options) || ''.html_safe) +\n ' Per page: '.html_safe +\n select_tag(:per_page, options_for_se... | [
"0.74300504",
"0.73912716",
"0.73410815",
"0.730152",
"0.72923446",
"0.72844845",
"0.7282492",
"0.726784",
"0.7256399",
"0.72477937",
"0.7213959",
"0.72101635",
"0.7202227",
"0.7194945",
"0.71611094",
"0.7129434",
"0.7114916",
"0.7108257",
"0.7104673",
"0.70688003",
"0.706261... | 0.7671532 | 0 |
Hashes adventure_land(adventure_hash) returns the value associated with the :land key | def adventure_land(adventure_hash)
adventure_hash[:land]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home_or_away(team_name)\n game_hash[team_name][:status]\nend",
"def get_area_code(somehash, key)\n\tputs \"The area code for #{key} is #{somehash[key]}\"\nend",
"def get_area_code(hashbook, city)\n hashbook[city]\nend",
"def find_value hash\n @values_mapping[hash]\n end",
"def house\n ... | [
"0.5714972",
"0.5484992",
"0.54744667",
"0.5448004",
"0.54300565",
"0.5417968",
"0.54170394",
"0.5402173",
"0.53864676",
"0.53823245",
"0.5381556",
"0.53565353",
"0.53536534",
"0.53191555",
"0.5297878",
"0.52896243",
"0.5280601",
"0.524357",
"0.52372575",
"0.5232112",
"0.5227... | 0.8507715 | 0 |
Hashes add_knight(name, quest, favorite_color, hash) adds a knight to the hash | def add_knight(name, quest, favorite_color, hash)
hash = {
:name => name,
:quest => quest,
:favorite_color => favorite_color
}
# knights are an array...so push a hash into an array??
adventure_hash[:knights] << hash
adventure_hash # doesn't work without returning this
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_knights\r\n $board[1][0] = Knight.new('white')\r\n\t\t$board[6][0] = Knight.new('white')\r\n\t\t$board[1][7] = Knight.new('black')\r\n\t\t$board[6][7] = Knight.new('black')\r\n end",
"def addDrinkToHashes(nameHash, ingredientHash, drink)\n\n\t\t# this one is easy, as we just install the\n\t\t# valu... | [
"0.5516489",
"0.53785163",
"0.53657883",
"0.51565826",
"0.5087118",
"0.5071115",
"0.5071115",
"0.5056542",
"0.50393546",
"0.4999182",
"0.49810973",
"0.4980367",
"0.49670577",
"0.4942989",
"0.49254584",
"0.4896055",
"0.4894375",
"0.48875177",
"0.4873322",
"0.48706007",
"0.4868... | 0.6755989 | 0 |
Change the threadlocal level for the duration of the given block. | def log_at(level)
old_local_level, self.local_level = local_level, level
yield
ensure
self.local_level = old_local_level
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_level( new_level, &block )\n\t\treturn self.clone_with( level: new_level, &block )\n\tend",
"def with_level( new_level, &block )\n\t\treturn self.clone_with( level: new_level, &block )\n\tend",
"def block_depth=(value)\n #Thread.current[:block_depth] = value\n @@depth = value\n end",
"d... | [
"0.5742308",
"0.5742308",
"0.55748165",
"0.5526219",
"0.5515768",
"0.54881674",
"0.5470964",
"0.5397911",
"0.53954566",
"0.53552663",
"0.5263201",
"0.52135617",
"0.5211286",
"0.5164468",
"0.5087935",
"0.5081016",
"0.5076258",
"0.50549704",
"0.503663",
"0.5036321",
"0.502585",... | 0.60240513 | 0 |
Add a partner review to this partner from the given data. | def add_partner_review(data)
add_child('partner_review', data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @practice = Practice.new(practice_params)\n if params[:recruiter_partner].present?\n @partner = Partner.find(params[:recruiter_partner])\n @practice.partners << @partner\n end\n\n @practice.site_id = @current_partner.site.id\n\n respond_to do |format|\n if @practice.save\... | [
"0.6574705",
"0.65364563",
"0.64137965",
"0.63257194",
"0.6321152",
"0.6129331",
"0.6108013",
"0.5933671",
"0.58964354",
"0.58960205",
"0.5883538",
"0.5873644",
"0.58648276",
"0.58568084",
"0.58242184",
"0.5800034",
"0.57342064",
"0.5711739",
"0.57087123",
"0.5674163",
"0.564... | 0.8540337 | 0 |
Add a partner press item to this partner from the given data. | def add_partner_press(data)
add_child('partner_press', data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_partner_review(data)\n add_child('partner_review', data)\n end",
"def add_new_itemized_partner(partner)\n # basic partner info\n fill_company_info(partner)\n # admin & company type info\n fill_partner_admin_info(partner)\n fill_partner_specific_info(partner)\n # item... | [
"0.65335065",
"0.6482845",
"0.5777127",
"0.54998636",
"0.5420581",
"0.53728515",
"0.5361917",
"0.5317523",
"0.5317415",
"0.5306154",
"0.5301608",
"0.53001285",
"0.5222998",
"0.5195638",
"0.5183712",
"0.51705587",
"0.51612836",
"0.51600343",
"0.51586604",
"0.51330024",
"0.5127... | 0.8036303 | 0 |
Add an activity to this partner from the given data. If the activity does not already have an id, it will automatically be sent to the API when this function is called | def add_activity(data)
add_child('activity', data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_activity(activity)\n self.activities << activity\n end",
"def add_activity(activity)\n act = activity.as_json\n write_feed.add_activity(act)\n end",
"def add_activity(activity)\n @activities.push activity\n end",
"def append_to_activity_stream\n # the `return if activity_verb.... | [
"0.6924637",
"0.67397255",
"0.66826916",
"0.6665379",
"0.657293",
"0.6528917",
"0.65104717",
"0.641577",
"0.639406",
"0.6364231",
"0.6254055",
"0.62285656",
"0.6186459",
"0.61621994",
"0.6126549",
"0.6122571",
"0.60768676",
"0.60430837",
"0.6013382",
"0.59904444",
"0.5988348"... | 0.7594863 | 0 |
Detect documents in the XML based on xpath information and calls the parser on each document. This returns an Array of Hash objects. | def document_to_array( xpath = DIF_XPATH, namespace = NAMESPACE)
a = []
document.xpath( xpath, namespace ).each do | node |
dif = Gcmd::Dif.new
dif.load_xml node.to_s
a << dif.document_to_hash
end
a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document_to_object( xpath = XPATH, namespace = NAMESPACE)\n obj = []\n \n document.xpath( xpath, namespace ).each do | node |\n hash_data = hash_from_xml( node.children )\n obj << hash_data\n end\n \n obj\n end",
"def xpathall(path,xml)\n r=[]\n XPath.each... | [
"0.640814",
"0.6335273",
"0.63005906",
"0.61937416",
"0.6074695",
"0.59954005",
"0.5980848",
"0.5974425",
"0.5867601",
"0.579195",
"0.5719314",
"0.57063735",
"0.56957346",
"0.5676538",
"0.5676538",
"0.56614405",
"0.5656102",
"0.5630972",
"0.5597983",
"0.5521389",
"0.549757",
... | 0.6743825 | 0 |
Loads DIF XML from source (path/filename, XML string, URI) Loadings sets a Nokogiri XML Document, converts it to an Hash, and injects properties from this Hash into self. | def load_xml(source)
#begin
if source.is_a? Nokogiri::XML::Document
@document = source
else
#source =~ /\<DIF\>/
if source.size < 255 and File.exists? source
source = File.read source
end
@document = Nokogiri::XML::Document.parse( sourc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(xml)\n @source = isxml?(xml) ? xml : File.read(xml)\n @doc_stream = AltoDocStream.new\n parser = Nokogiri::XML::SAX::Parser.new(doc_stream)\n parser.parse(@source)\n end",
"def load!(xml)\n root = Nokogiri::XML(xml).root\n try(root.xpath(\"//network\"... | [
"0.6085291",
"0.58324975",
"0.57899135",
"0.56423944",
"0.55685616",
"0.5545121",
"0.5541919",
"0.54807407",
"0.54555875",
"0.5455071",
"0.545135",
"0.5357284",
"0.5335198",
"0.53076416",
"0.5288899",
"0.52787375",
"0.5263705",
"0.52374345",
"0.5220054",
"0.5198445",
"0.51936... | 0.78885245 | 0 |
Load a DIF document, either Hash or XML | def load(document)
if document.respond_to?(:keys)
load_hash(document)
else
load_xml(document)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_xml(source)\n #begin\n if source.is_a? Nokogiri::XML::Document\n @document = source\n else\n #source =~ /\\<DIF\\>/\n if source.size < 255 and File.exists? source\n source = File.read source\n end\n @document = Nokogiri::XML::Docum... | [
"0.6894974",
"0.5792483",
"0.5726595",
"0.5417079",
"0.53046924",
"0.52939737",
"0.52338046",
"0.51664495",
"0.5156313",
"0.5128603",
"0.51190466",
"0.50674236",
"0.50545526",
"0.50393957",
"0.5029075",
"0.5025716",
"0.5023871",
"0.5022077",
"0.49946958",
"0.49790597",
"0.497... | 0.6499986 | 1 |
Input type name for the service method. This is resolved in the same way as FieldDescriptorProto.type_name, but must refer to a message type. | def input_type_name
method_descriptor_proto.input_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_name_from_type(type); end",
"def service_name\n raise TypeError, 'no type on this reply' unless\n instance_variable_defined? :@type\n\n @type.split('.').first.sub '_', ''\n end",
"def type_name\n @type_name ||= name.underscore\n end",
"def input_name_from_type(type)\n ... | [
"0.6861329",
"0.66951376",
"0.6222917",
"0.61976254",
"0.6064725",
"0.60273916",
"0.5964968",
"0.5958523",
"0.58687395",
"0.58602697",
"0.5857914",
"0.5852962",
"0.5846468",
"0.58203936",
"0.57794",
"0.5727384",
"0.56929505",
"0.5632847",
"0.55807966",
"0.5580254",
"0.5566680... | 0.76679164 | 0 |
Output type name for the service method. This is resolved in the same way as FieldDescriptorProto.type_name, but must refer to a message type. | def output_type_name
method_descriptor_proto.output_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_name\n raise TypeError, 'no type on this reply' unless\n instance_variable_defined? :@type\n\n @type.split('.').first.sub '_', ''\n end",
"def name\n method_descriptor_proto.name\n end",
"def type_name\n @type_name ||= determine_type_name(descriptor)\n end",
"def i... | [
"0.69764006",
"0.6525618",
"0.6419434",
"0.640408",
"0.63041955",
"0.6260102",
"0.62597865",
"0.62219566",
"0.6077732",
"0.60740465",
"0.6071511",
"0.5962905",
"0.5958776",
"0.5938064",
"0.59304917",
"0.59192336",
"0.5851188",
"0.5850747",
"0.58201426",
"0.5818119",
"0.577416... | 0.7103313 | 0 |
constructor Parses the input string and returns a Person instance whose attributes are determined by processing the input. | def parse string
attributes, matches = {}, @pattern.match(string)
return nil if matches.nil?
%w(last_name first_name gender middle_initial favorite_color).
map(&:intern).each { |key|
if matches.names.include? key.to_s
attributes[key] = matches[key] || ""
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def person_from_person_string( person_string )\n\n # where the values are in the person string\n person_index_ix = 0\n person_cid_index = 1\n person_fn_index = 2\n person_ln_index = 3\n person_dept_index = 4\n person_pub_index = 5\n\n tokens = person_string.split( \"\\n\" )\... | [
"0.68046296",
"0.6232364",
"0.6140085",
"0.60835505",
"0.59154904",
"0.5845758",
"0.5769948",
"0.57641554",
"0.57287",
"0.57025045",
"0.56946766",
"0.5684438",
"0.56753695",
"0.56753695",
"0.56753695",
"0.56753695",
"0.56160533",
"0.56077516",
"0.5576944",
"0.55578506",
"0.55... | 0.7738513 | 0 |
GET /heat_sources/1 GET /heat_sources/1.json | def show
@heat_source = HeatSource.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @heat_source }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @heat_source = HeatSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heat_source }\n end\n end",
"def get_a_heat_image_given_its_floorplan_id_and_filter_parameters(args = {}) \n get(\"/resource.json/heat/#{args[:floorplanId]}/#{args[:fi... | [
"0.6264783",
"0.6228303",
"0.6180218",
"0.60978365",
"0.6054179",
"0.5903474",
"0.5884329",
"0.5879765",
"0.5856195",
"0.58437234",
"0.58243513",
"0.5800715",
"0.57848287",
"0.5779455",
"0.5775308",
"0.5764593",
"0.57309747",
"0.5704136",
"0.5695883",
"0.5688393",
"0.56876415... | 0.73382026 | 0 |
GET /heat_sources/new GET /heat_sources/new.json | def new
@heat_source = HeatSource.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @heat_source }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @heat_source = HeatSource.new(params[:heat_source])\n\n respond_to do |format|\n if @heat_source.save\n format.html { redirect_to @heat_source, notice: 'Heat source was successfully created.' }\n format.json { render json: @heat_source, status: :created, location: @heat_source... | [
"0.71189433",
"0.70566714",
"0.6899965",
"0.6778504",
"0.6773824",
"0.6734713",
"0.6649316",
"0.66288155",
"0.65022117",
"0.6428302",
"0.6366953",
"0.6319033",
"0.62934273",
"0.6283753",
"0.62682813",
"0.6267279",
"0.6261763",
"0.6257891",
"0.61900324",
"0.6140175",
"0.614017... | 0.7699365 | 0 |
POST /heat_sources POST /heat_sources.json | def create
@heat_source = HeatSource.new(params[:heat_source])
respond_to do |format|
if @heat_source.save
format.html { redirect_to @heat_source, notice: 'Heat source was successfully created.' }
format.json { render json: @heat_source, status: :created, location: @heat_source }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @heat_source = HeatSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heat_source }\n end\n end",
"def create\n @historical_source = HistoricalSource.new(historical_source_params)\n\n respond_to do |format|\n if @historical_so... | [
"0.6108023",
"0.56938154",
"0.56831974",
"0.5587617",
"0.55222785",
"0.5390286",
"0.5346565",
"0.5335608",
"0.5335242",
"0.5319127",
"0.5243418",
"0.5229522",
"0.5195668",
"0.5190379",
"0.51774275",
"0.5135812",
"0.5123476",
"0.5091276",
"0.5082466",
"0.5076967",
"0.5056811",... | 0.69817793 | 0 |
PUT /heat_sources/1 PUT /heat_sources/1.json | def update
@heat_source = HeatSource.find(params[:id])
respond_to do |format|
if @heat_source.update_attributes(params[:heat_source])
format.html { redirect_to @heat_source, notice: 'Heat source was successfully updated.' }
format.json { head :no_content }
else
format.html {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n ... | [
"0.63816804",
"0.61172456",
"0.6063553",
"0.59124094",
"0.5909089",
"0.5850886",
"0.58379245",
"0.58379245",
"0.5825963",
"0.5825963",
"0.5811911",
"0.57979333",
"0.5789918",
"0.5751604",
"0.5729927",
"0.5719113",
"0.56904995",
"0.5684948",
"0.5667277",
"0.566266",
"0.566266"... | 0.69312805 | 0 |
DELETE /heat_sources/1 DELETE /heat_sources/1.json | def destroy
@heat_source = HeatSource.find(params[:id])
@heat_source.destroy
respond_to do |format|
format.html { redirect_to heat_sources_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @historical_source.destroy\n respond_to do |format|\n format.html { redirect_to historical_sources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chef_att_source.destroy\n respond_to do |format|\n format.html { redirect_to chef_att_sources_url,... | [
"0.68342996",
"0.68163633",
"0.677239",
"0.67723215",
"0.67723215",
"0.66988975",
"0.6696748",
"0.6696748",
"0.6657821",
"0.6599829",
"0.6595566",
"0.65842533",
"0.65732634",
"0.65632725",
"0.6443319",
"0.6424076",
"0.6412898",
"0.64068997",
"0.6363593",
"0.6343312",
"0.63398... | 0.78493416 | 0 |
POST /meal_schedules POST /meal_schedules.json | def create
@meal_schedule = current_owner.meal_schedules.new(meal_schedule_params)
respond_to do |format|
if @meal_schedule.save
format.html { redirect_to meal_schedules_path, notice: 'MealSchedule was added successfully' }
format.json { render json: @meal_schedule, status: :created }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"schedule\"\n end",
"def create\n @schedule = Schedule.new(params[:schedule])\n\n if @schedule.save\n render json: @schedule, status: :created, location: @schedule\n else\n render js... | [
"0.69450206",
"0.6866776",
"0.664146",
"0.65890294",
"0.6571364",
"0.656865",
"0.65677774",
"0.65545183",
"0.6549708",
"0.65452886",
"0.65328455",
"0.6532398",
"0.6509192",
"0.650304",
"0.6486827",
"0.64632404",
"0.6462183",
"0.6425592",
"0.6400811",
"0.6397001",
"0.63933134"... | 0.77954805 | 0 |
PATCH/PUT /meal_schedules/1 PATCH/PUT /meal_schedules/1.json | def update
respond_to do |format|
if @meal_schedule.update(meal_schedule_params)
format.html { redirect_to meal_schedules_path, notice: 'MealSchedule was updated successfully' }
format.json { render :show, status: :ok, location: meal_schedules_path }
else
format.html { render :ed... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @my_schedule.update(my_schedule_params)\n format.html { redirect_to @my_schedule, notice: 'My schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_schedule }\n else\n format.html { render :edit }\n ... | [
"0.69177336",
"0.687447",
"0.6839567",
"0.6829499",
"0.6825469",
"0.6824275",
"0.68170214",
"0.6815778",
"0.6815778",
"0.6815778",
"0.6815778",
"0.6815778",
"0.6815778",
"0.6815778",
"0.6809976",
"0.6806783",
"0.67967486",
"0.67859954",
"0.67671007",
"0.6755765",
"0.6747175",... | 0.7767884 | 0 |
Validate the latitude and longitude values. Latitudes must be between 90.0 and 90.0 while longitudes must be between 180.0 and 180.0. | def validate(lat1, lon1, lat2, lon2)
[lat1, lat2].each do |lat|
if lat > 90 || lat < -90
msg = "Latitude '#{lat}' is invalid - must be between -90 and 90"
raise Error, msg
end
end
[lon1, lon2].each do |lon|
if lon > 180 || lon < -180
msg = "Longit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n lat && lng && lat >= -90 && lat <= 90 && lng >= -180 && lng <= 180\n end",
"def valid?\n !@lat.nil? && !@lon.nil? && @lat.to_f.abs < 90 && @lon.to_f.abs < 90\n end",
"def valid_lat_long?\n float?(latitude) && float?(longitude) &&\n latitude.to_f.between?(VALID_LATITUDE[... | [
"0.7836681",
"0.77913517",
"0.7779805",
"0.7659158",
"0.7418511",
"0.7418511",
"0.70583785",
"0.67490005",
"0.6729914",
"0.6682856",
"0.6656692",
"0.66223955",
"0.65450794",
"0.6513213",
"0.64801496",
"0.64663255",
"0.63195574",
"0.6316175",
"0.6299953",
"0.6284552",
"0.62776... | 0.8016566 | 0 |
GET /purchase_feedbacks/1 GET /purchase_feedbacks/1.json | def show
@purchase_feedback = PurchaseFeedback.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @purchase_feedback }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @feedbacks = Feedback.find(params[:id])\n render json: @feedbacks\n end",
"def show\n render json: @feedback\n end",
"def new\n @purchase_feedback = PurchaseFeedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_feedback... | [
"0.73906106",
"0.7134217",
"0.7084431",
"0.6875648",
"0.6824644",
"0.6824644",
"0.6824644",
"0.6824644",
"0.6824644",
"0.6824644",
"0.6790681",
"0.6756132",
"0.67561173",
"0.6723569",
"0.6723569",
"0.66845983",
"0.66283906",
"0.6601836",
"0.6601836",
"0.6601836",
"0.6601836",... | 0.7480007 | 0 |
GET /purchase_feedbacks/new GET /purchase_feedbacks/new.json | def new
@purchase_feedback = PurchaseFeedback.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @purchase_feedback }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback ... | [
"0.7854754",
"0.7854754",
"0.7854754",
"0.7699265",
"0.7651508",
"0.7575607",
"0.7574881",
"0.73898816",
"0.7352123",
"0.7352123",
"0.73106843",
"0.73062855",
"0.73062855",
"0.72505677",
"0.7228671",
"0.72256505",
"0.7196343",
"0.7172973",
"0.7164622",
"0.7164057",
"0.7155567... | 0.8092145 | 0 |
POST /purchase_feedbacks POST /purchase_feedbacks.json | def create
@purchase_feedback = PurchaseFeedback.new(params[:purchase_feedback])
respond_to do |format|
if @purchase_feedback.save
format.html { redirect_to @purchase_feedback, notice: 'Purchase feedback was successfully created.' }
format.json { render json: @purchase_feedback, status: :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @feedback = Feedback.new(feedback_params)\n\n if @feedback.save\n render json: @feedback, status: :created\n else\n render json: @feedback.errors, status: :unprocessable_entity\n end\n end",
"def create\n @feedback = Feedback.new(feedback_params)\n\n if @feedback.save\n ... | [
"0.7127724",
"0.6839312",
"0.6837399",
"0.66580445",
"0.6586885",
"0.65853995",
"0.65800565",
"0.65800565",
"0.65785384",
"0.6549118",
"0.65287274",
"0.6524988",
"0.65041983",
"0.6503492",
"0.64425296",
"0.64053833",
"0.63714933",
"0.6362882",
"0.6356207",
"0.6330894",
"0.630... | 0.73903936 | 0 |
PUT /purchase_feedbacks/1 PUT /purchase_feedbacks/1.json | def update
@purchase_feedback = PurchaseFeedback.find(params[:id])
respond_to do |format|
if @purchase_feedback.update_attributes(params[:purchase_feedback])
format.html { redirect_to @purchase_feedback, notice: 'Purchase feedback was successfully updated.' }
format.json { head :no_conten... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @feedback = Feedback.find(params[:id])\n @feedback.update_attributes(params[:feedback])\n respond_with(@feedback)\n end",
"def create\n @purchase_feedback = PurchaseFeedback.new(params[:purchase_feedback])\n\n respond_to do |format|\n if @purchase_feedback.save\n format.h... | [
"0.67894477",
"0.66300595",
"0.6588158",
"0.65447235",
"0.654333",
"0.65311164",
"0.6517943",
"0.6517943",
"0.6517943",
"0.6516363",
"0.64661694",
"0.64661694",
"0.64661694",
"0.64661694",
"0.64070797",
"0.6382257",
"0.6382257",
"0.6382257",
"0.6382257",
"0.6353618",
"0.63375... | 0.72820956 | 0 |
DELETE /purchase_feedbacks/1 DELETE /purchase_feedbacks/1.json | def destroy
@purchase_feedback = PurchaseFeedback.find(params[:id])
@purchase_feedback.destroy
respond_to do |format|
format.html { redirect_to purchase_feedbacks_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @feedback = Feedback.find(params[:id])\n @feedback.destroy\n\n respond_to do |for... | [
"0.7391894",
"0.735804",
"0.735804",
"0.735804",
"0.73448527",
"0.73153156",
"0.73153156",
"0.73153156",
"0.73153156",
"0.73153156",
"0.7307209",
"0.7307209",
"0.71658003",
"0.71658003",
"0.71553016",
"0.7147505",
"0.71373063",
"0.71090585",
"0.7105338",
"0.7105338",
"0.71053... | 0.7993584 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.