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 |
|---|---|---|---|---|---|---|
GET /volunteer_jobs GET /volunteer_jobs.json | def index
@volunteer_jobs = VolunteerJob.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @volunteer_jobs }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @volunteer_job = VolunteerJob.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volunteer_job }\n end\n end",
"def index\n @jobs = current_user.jobs\n\n respond_to do |format|\n format.html # index.html.erb\n fo... | [
"0.7364898",
"0.712347",
"0.7085784",
"0.6929859",
"0.6753155",
"0.6736709",
"0.66865975",
"0.64835364",
"0.6483072",
"0.64656293",
"0.6452728",
"0.6450726",
"0.64321464",
"0.6416266",
"0.6416266",
"0.64099526",
"0.6407239",
"0.6379839",
"0.6371384",
"0.6371384",
"0.63697743"... | 0.790424 | 0 |
GET /volunteer_jobs/1 GET /volunteer_jobs/1.json | def show
@volunteer_job = VolunteerJob.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @volunteer_job }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @volunteer_jobs = VolunteerJob.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @volunteer_jobs }\n end\n end",
"def new\n @volunteer_job = VolunteerJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.j... | [
"0.76611525",
"0.69956744",
"0.6941505",
"0.68474334",
"0.68314624",
"0.66359216",
"0.66268396",
"0.6617462",
"0.6593418",
"0.65677124",
"0.65677124",
"0.65474856",
"0.6513014",
"0.6513014",
"0.6513014",
"0.6513014",
"0.6513014",
"0.6486095",
"0.6486095",
"0.64708775",
"0.644... | 0.7560687 | 1 |
GET /volunteer_jobs/new GET /volunteer_jobs/new.json | def new
@volunteer_job = VolunteerJob.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @volunteer_job }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end",
"def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n en... | [
"0.7913525",
"0.7913525",
"0.7703204",
"0.7570831",
"0.7570831",
"0.7570831",
"0.7570831",
"0.7556856",
"0.72684777",
"0.7255133",
"0.7225403",
"0.71859294",
"0.7168041",
"0.71634156",
"0.7136533",
"0.7133316",
"0.7110318",
"0.70895237",
"0.7084016",
"0.7082202",
"0.70697623"... | 0.815024 | 0 |
POST /volunteer_jobs POST /volunteer_jobs.json | def create
@volunteer_job = VolunteerJob.new(params[:volunteer_job])
respond_to do |format|
if @volunteer_job.save
format.html { redirect_to @volunteer_job, notice: 'Volunteer job was successfully created.' }
format.json { render json: @volunteer_job, status: :created, location: @voluntee... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @job = Job.new(job_params)\n @job.user = current_user\n if @job.save\n render json: { redirect_url: job_url(@job), notice: \"Thanks for posting! Your job is now pending review.\" }\n else\n render json: @job.errors\n end\n end",
"def create\n @job = current_user.posted_j... | [
"0.6663876",
"0.66525453",
"0.66429484",
"0.64768344",
"0.62916523",
"0.6247854",
"0.6214603",
"0.6212004",
"0.619421",
"0.6176091",
"0.61703014",
"0.61641085",
"0.6156818",
"0.61516213",
"0.61468",
"0.61285746",
"0.61042786",
"0.6103418",
"0.60971755",
"0.6088171",
"0.607151... | 0.7408671 | 0 |
PUT /volunteer_jobs/1 PUT /volunteer_jobs/1.json | def update
@volunteer_job = VolunteerJob.find(params[:id])
respond_to do |format|
if @volunteer_job.update_attributes(params[:volunteer_job])
format.html { redirect_to @volunteer_job, notice: 'Volunteer job was successfully updated.' }
format.json { head :ok }
else
format.ht... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n @job = current_member.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(job_params)\n format.html { redirect_to @job, notice: 'The stuff you want done was successfully updated.' }\n format.json { head :no_content }\n else\n format.html... | [
"0.6560337",
"0.64914775",
"0.6477605",
"0.6461418",
"0.64592385",
"0.6419217",
"0.64160067",
"0.63072014",
"0.6305497",
"0.6254279",
"0.6240452",
"0.6240452",
"0.6240452",
"0.6229798",
"0.62066555",
"0.6196746",
"0.6191166",
"0.61800814",
"0.61780137",
"0.61745924",
"0.61714... | 0.73060834 | 0 |
DELETE /volunteer_jobs/1 DELETE /volunteer_jobs/1.json | def destroy
@volunteer_job = VolunteerJob.find(params[:id])
@volunteer_job.destroy
respond_to do |format|
format.html { redirect_to volunteer_jobs_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @job = current_member.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @launched_job.destroy\n respond_to do |format|\n format.html { redirect_to ... | [
"0.73790056",
"0.731788",
"0.72712225",
"0.7236911",
"0.723433",
"0.7217059",
"0.7217059",
"0.7217059",
"0.7217059",
"0.7216241",
"0.7206061",
"0.72037226",
"0.71646094",
"0.7151036",
"0.7148282",
"0.71481603",
"0.71276057",
"0.71104103",
"0.7098183",
"0.7084551",
"0.7064156"... | 0.7925121 | 0 |
Operation sperformed in FleetServiceRequest_FromDashboard script 1. User Login to application with valid credentials 2. User searches for a vehicle with unit and verifies the search results 3. Searches for a service location and verifies that the search results were displayed correctly 4. Creates service request for th... | def test_FleetRequest_FromSearchPage
# Navigate to the volvo demo site
@driver.get $env
#1. Login to the application
Login($uname, $pwd, "1.0")
#2. Perform vehicle search with unit# and verify the search results
VehicleSearchWithUnit_No("222", "2")
#3. Perform service locat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Create_Service_Request(vehicle_no, complaint, note, contact_no, driver_name, driver_no, breakdown_location, breakdown_city, breakdown_state, testcase_no)\n service_location = @driver.find_element(:xpath, ServiceRequestFirstServiceLocationName_ID).text\n @driver.find_element(:link, ServiceRequest_Link).cl... | [
"0.61050284",
"0.5806033",
"0.56173456",
"0.56028545",
"0.55190384",
"0.5496412",
"0.549361",
"0.54885507",
"0.5469782",
"0.54364914",
"0.5392818",
"0.53517014",
"0.5344022",
"0.5341496",
"0.5334074",
"0.5325288",
"0.5321312",
"0.53206015",
"0.52957875",
"0.5285835",
"0.52793... | 0.7215682 | 0 |
Check if a file belongs to a filtered list | def file_is_filtered?(path_cand)
filename = File.basename(path_cand)
ix = @filter_file.index(filename)
if ix
log "FILTER: #{path_cand}"
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_a_list?(file)\n !!(file =~ /list$/)\n end",
"def include?(file)\n @file_list.include?(file.basename)\n end",
"def contain?(*files)\n files.all? { |file| entries.detect { |entry| File.fnmatch(file, entry.to_s) } }\n end",
"def contain?(filename); end",
"def file_is_fil... | [
"0.6734807",
"0.6655667",
"0.6525753",
"0.6483904",
"0.64350283",
"0.6399568",
"0.63880754",
"0.62969625",
"0.62524265",
"0.621504",
"0.61851245",
"0.6160544",
"0.61192656",
"0.61191905",
"0.6102729",
"0.6097756",
"0.60534346",
"0.6006311",
"0.59216404",
"0.59093404",
"0.5908... | 0.67684704 | 0 |
Add the parameters in hash +new+ to already existing parameters. If +new+ contains a parameter with an already existing name, the old definition is clobbered. | def add_params(new)
# We do not check for duplication on purpose: multiple calls
# to add_params should be cumulative
new.each { |p| @params[p.name] = p }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def additional_parameters= new_additional_parameters\n if new_additional_parameters.respond_to? :to_hash\n @additional_parameters = new_additional_parameters.to_hash\n else\n raise TypeError,\n \"Expected Hash, got #{new_additional_parameters.class}.\"\n end\n ... | [
"0.6497428",
"0.6486421",
"0.62861806",
"0.6204003",
"0.61893255",
"0.6016598",
"0.5961347",
"0.59476674",
"0.5939137",
"0.59138423",
"0.5851895",
"0.5793666",
"0.5731276",
"0.57029235",
"0.5689811",
"0.56885016",
"0.56885016",
"0.56833327",
"0.56726336",
"0.5662137",
"0.5584... | 0.81937987 | 0 |
If the payment was successful, Cybersource will send us back a decision of 'ACCEPT' | def payment_success?
@fields['decision'] == 'ACCEPT'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_payment\n\n raise 'invalid credit card' unless @credit_card && @credit_card.valid?\n \n gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(\n :login => LOGIN_ID,\n :password => TRANSACTION_KEY\n )\n\n description = \"Concerts in the Clearing\"\n if reservation\n ... | [
"0.74086607",
"0.72222143",
"0.7098679",
"0.7033425",
"0.7023301",
"0.69044137",
"0.6863167",
"0.6825858",
"0.68253314",
"0.67931986",
"0.67634225",
"0.67404664",
"0.67167795",
"0.6715788",
"0.6700185",
"0.6697306",
"0.669595",
"0.66837645",
"0.6673283",
"0.6665256",
"0.66596... | 0.79905957 | 0 |
Raise an error if the payment failed or if the signature is invalid | def validate!
Cybersource::Security.validate_signature!(@fields['signature'], signed_data)
raise PaymentFailed unless payment_success?
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_signature!(signature, data)\n raise InvalidSignature unless valid_signature?(signature, data)\n end",
"def verify!(config, params)\n sent_signature = params.find { |key, _value| key.to_s.casecmp('BRQ_SIGNATURE').zero? }&.last\n generated_signature = Signature.generate(config, p... | [
"0.6430708",
"0.6408499",
"0.63765335",
"0.63765335",
"0.6338833",
"0.6285269",
"0.62163",
"0.6173898",
"0.6156996",
"0.6156",
"0.6154337",
"0.6149765",
"0.6119123",
"0.60408264",
"0.6018457",
"0.6007543",
"0.59854454",
"0.5972589",
"0.5922325",
"0.59147686",
"0.58895326",
... | 0.75968474 | 0 |
Check if a line of string contains specific hostname | def includes_hostname?(line, hostname)
/\s#{Regexp.escape(hostname.fqdn)}(\s|$)/ =~ line
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def includes_hostname?(line, hostname)\n /\\s#{Regexp.escape(hostname)}(\\s|$)/ =~ line\n end",
"def validate_hostname(hostname)\n hostname_regex = /(hostname)$/\n if hostname_regex =~ hostname\n $evm.log(\"info\",\"Hostname:<#{hostname}> found\") if @debug\n return true\n else\n ... | [
"0.8604411",
"0.704599",
"0.69021696",
"0.688287",
"0.6793343",
"0.6696327",
"0.66661876",
"0.6400066",
"0.6380634",
"0.63708377",
"0.6271574",
"0.62470645",
"0.62233603",
"0.6118068",
"0.61108977",
"0.6087012",
"0.6068708",
"0.6038921",
"0.602795",
"0.6027074",
"0.6002057",
... | 0.8479698 | 1 |
Add `hostname` to `line` from `/etc/hosts` The hostname is put into the first position. | def add_host(line, hostname)
return if line !~ /^([^\s]+)(\s+)/
i = $~.end(2)
"#{$1}#{$2}#{hostname.fqdn} #{line[i..-1]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_host(line, old_hostname, new_hostname)\n line.sub(\n /(\\s)#{Regexp.escape(old_hostname.fqdn)}(\\s|$)/,\n \"\\\\1#{new_hostname.fqdn}\\\\2\"\n )\n end",
"def rebuild_host_file(hostname_, fqdn_)\n\n # Get the old hosts file\n hosts_content = ssh.exec! \"cat /et... | [
"0.6946419",
"0.66520256",
"0.6427342",
"0.63516855",
"0.6333866",
"0.63029236",
"0.62920105",
"0.6242204",
"0.6224655",
"0.61852443",
"0.6142972",
"0.6113607",
"0.6006069",
"0.59538376",
"0.5926475",
"0.5910505",
"0.58857375",
"0.5871729",
"0.58388555",
"0.57949454",
"0.5765... | 0.8507192 | 0 |
Remove `hostname` from `line` read from `/etc/hosts` | def replace_host(line, old_hostname, new_hostname)
line.sub(
/(\s)#{Regexp.escape(old_hostname.fqdn)}(\s|$)/,
"\\1#{new_hostname.fqdn}\\2"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_line\n el = @l.split(\" \")\n\n u = URI(el[1])\n\n disable = false\n\n case u.host\n when \"releases.ubuntu.com\"\n c = u.host\n u.host = \"archive.ubuntu.com\"\n if self.uri_exists(self.get_url(u.to_s)) == false\n u.host = c\n ... | [
"0.6867215",
"0.66918683",
"0.66733414",
"0.6657802",
"0.6633702",
"0.66149694",
"0.66008675",
"0.64658237",
"0.62012243",
"0.6187825",
"0.61033654",
"0.60580856",
"0.6046851",
"0.5959034",
"0.5903639",
"0.58907056",
"0.58279264",
"0.5779136",
"0.57771736",
"0.5760028",
"0.57... | 0.70167303 | 0 |
Check if the file at `path` si writable by its user If the file doesn't exist, we take it as writable. If a block is given, it is called if `path` is writable. | def writable?(path)
begin
return if (File.stat(path).mode & 0200) != 0200
rescue Errno::ENOENT
# pass
end
yield(path) if block_given?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_writable(path)\n raise Error, \"The path '#{path}' is not writable\" if (path.exist? && !path.writable?) || !path.parent.writable?\n end",
"def writable?(path)\n info = Private.info_with(path, GLib::G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)\n GLib.g_file_info_get_attribute_boolean(info, GLib::G_... | [
"0.7443799",
"0.7016081",
"0.6727093",
"0.64556354",
"0.6385518",
"0.6381238",
"0.60249645",
"0.5928891",
"0.5914708",
"0.58233756",
"0.5812836",
"0.580924",
"0.5802117",
"0.5715689",
"0.56821775",
"0.56651014",
"0.55578613",
"0.5510112",
"0.5507942",
"0.54917246",
"0.5483227... | 0.8143976 | 1 |
Upload copy of latest run | def upload_latest_copy
upload_to_s3(report_files, prefix)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deploy!\n write_previous_revision\n update_repository\n write_revision\n end",
"def copy_site\n target_dir = File.join(@deploy_dir, @remote_path).sub(/\\/$/,'')\n FileUtils.cp_r @local + '/.', target_dir\n message = \"Site updated at: #{Time.now.utc}\"\n... | [
"0.6425221",
"0.6113231",
"0.6099149",
"0.606806",
"0.6066456",
"0.59865075",
"0.59865075",
"0.5911053",
"0.5908292",
"0.5902462",
"0.5878168",
"0.58709186",
"0.58362496",
"0.5810192",
"0.57839453",
"0.57568693",
"0.57274264",
"0.57055444",
"0.5699966",
"0.5679725",
"0.564096... | 0.71798426 | 0 |
GET /bairro_micros/1 GET /bairro_micros/1.xml | def show
@bairro_micro = BairroMicro.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @bairro_micro }
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 get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.... | [
"0.58073443",
"0.55912304",
"0.5522448",
"0.5486908",
"0.5483598",
"0.5438869",
"0.54351896",
"0.54262406",
"0.54131114",
"0.52845937",
"0.5250047",
"0.5249597",
"0.5241533",
"0.5202264",
"0.51990217",
"0.51861954",
"0.51850027",
"0.5170066",
"0.51646066",
"0.5152907",
"0.513... | 0.6093064 | 0 |
GET /bairro_micros/new GET /bairro_micros/new.xml | def new
@bairro_micro = BairroMicro.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @bairro_micro }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @bairro_micro = BairroMicro.new(params[:bairro_micro])\n\n respond_to do |format|\n if @bairro_micro.save\n flash[:notice] = 'BairroMicro was successfully created.'\n format.html { redirect_to(@bairro_micro) }\n format.xml { render :xml => @bairro_micro, :status => :cr... | [
"0.64610016",
"0.6444188",
"0.6312678",
"0.6296427",
"0.62716764",
"0.6256792",
"0.6246808",
"0.6239247",
"0.6228101",
"0.6214822",
"0.62104243",
"0.6202235",
"0.6199871",
"0.6198923",
"0.6196262",
"0.6142587",
"0.6141799",
"0.6134468",
"0.6132148",
"0.6132148",
"0.6129697",
... | 0.68609923 | 0 |
POST /bairro_micros POST /bairro_micros.xml | def create
@bairro_micro = BairroMicro.new(params[:bairro_micro])
respond_to do |format|
if @bairro_micro.save
flash[:notice] = 'BairroMicro was successfully created.'
format.html { redirect_to(@bairro_micro) }
format.xml { render :xml => @bairro_micro, :status => :created, :loca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(bin_params)\n @rest.post('save', bin_params)\n end",
"def post(buffer)\n connection.post(\"#{configuration.path}/update\", buffer, {'Content-type' => 'text/xml;charset=utf-8'})\n end",
"def request_body(xml); xml; end",
"def request(path, parameters = {})\n response = Basecamp.con... | [
"0.5432998",
"0.5312817",
"0.5043077",
"0.5004182",
"0.49646065",
"0.49444047",
"0.49055824",
"0.49004248",
"0.48742113",
"0.4802006",
"0.4799636",
"0.47852984",
"0.47813207",
"0.47717053",
"0.47582325",
"0.47353584",
"0.473396",
"0.47171095",
"0.4712434",
"0.470688",
"0.4695... | 0.5712857 | 0 |
PUT /bairro_micros/1 PUT /bairro_micros/1.xml | def update
@bairro_micro = BairroMicro.find(params[:id])
respond_to do |format|
if @bairro_micro.update_attributes(params[:bairro_micro])
flash[:notice] = 'BairroMicro was successfully updated.'
format.html { redirect_to(@bairro_micro) }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def pos... | [
"0.5635677",
"0.54242337",
"0.5412096",
"0.5296947",
"0.525578",
"0.5215971",
"0.5215148",
"0.52002347",
"0.516033",
"0.5117836",
"0.5117836",
"0.50986224",
"0.5068332",
"0.5057284",
"0.5057284",
"0.50561494",
"0.5006227",
"0.49837646",
"0.4969781",
"0.49559313",
"0.49379244"... | 0.5889715 | 0 |
DELETE /bairro_micros/1 DELETE /bairro_micros/1.xml | def destroy
@bairro_micro = BairroMicro.find(params[:id])
@bairro_micro.destroy
respond_to do |format|
format.html { redirect_to(bairro_micros_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 @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\... | [
"0.672824",
"0.6293559",
"0.62897664",
"0.628875",
"0.62621874",
"0.6260807",
"0.6259034",
"0.623915",
"0.62059665",
"0.61969817",
"0.61398375",
"0.6123344",
"0.6105961",
"0.60728836",
"0.60541666",
"0.6037351",
"0.60188174",
"0.6011678",
"0.5981924",
"0.5977341",
"0.596784",... | 0.693732 | 0 |
Formats song information to send tweet | def format(song)
artist_name = format_artist_name(song["artist"]["content"])
song_name = format_song_name(song["name"])
hashtag = format_hashtag(song["nowplaying"])
return "#{song_name} - #{artist_name} ##{hashtag}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSongInfo(tweet)\n\tthe_artist_name = tweet[/by[\\w\\W]+(((http\\:\\/\\/){1}))/i]\n\tif the_artist_name != nil\n\t\t@artist_name = the_artist_name[/(?<=^|(?<=[^a-zA-Z0-9\\_\\.]))@([A-Za-z0-9\\_]+)/i]\n\t\tif @artist_name != nil\n\t\t\t@artist_name = @artist_name[1..@artist_name.length]\n\n\t\t\t# Catch the e... | [
"0.66666615",
"0.6524269",
"0.6464781",
"0.6360947",
"0.62788695",
"0.61502916",
"0.6145508",
"0.61449444",
"0.6078103",
"0.6070553",
"0.6068057",
"0.59727097",
"0.5908821",
"0.5827892",
"0.58265084",
"0.58231413",
"0.58231413",
"0.58091754",
"0.5795549",
"0.5793214",
"0.5770... | 0.6961494 | 0 |
Formats artist name for tweet | def format_artist_name(artist_name)
if(artist_name.length > 52)
return artist_name[0 .. 48] + "..."
else
return artist_name
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name\n\t\ts = title\n\t\ts = \"#{artist.name} - #{s}\" if artist\n\t\treturn s\n\tend",
"def artist_name\n if artist_name_from_url.present?\n artist_name_from_url\n elsif api_metadata.present?\n api_metadata.dig(:author, :username)\n else\n nil\n en... | [
"0.7079218",
"0.701164",
"0.68315125",
"0.677011",
"0.67620605",
"0.6737886",
"0.66794777",
"0.6653416",
"0.66443837",
"0.6617785",
"0.6564145",
"0.6548926",
"0.64781696",
"0.6475851",
"0.6443876",
"0.63734734",
"0.6373027",
"0.6365349",
"0.63160753",
"0.63160753",
"0.6316075... | 0.70677274 | 1 |
4. block_fork : if opponent can create 2 win threats, play block_fork | def block_fork(board)
return fork(board, opponent_symbol(@symbol))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fork_check(wins, player, opponent)\n block_fork = find_fork(wins, opponent, player)\n get_fork = find_fork(wins, player, opponent)\n if get_fork.size > 0 # if possible to create fork, do it\n move = get_fork.sample\n elsif block_fork.size > 1 # if opponent can create multiple forks, force bl... | [
"0.74359304",
"0.71108514",
"0.7052763",
"0.6503178",
"0.6458734",
"0.64020795",
"0.63444376",
"0.63335246",
"0.6279534",
"0.62686825",
"0.6210135",
"0.6180599",
"0.6060795",
"0.60578907",
"0.6026725",
"0.59933126",
"0.59559053",
"0.5941965",
"0.5941581",
"0.59263384",
"0.592... | 0.74767643 | 0 |
6. opposite_corner : if the opponent is on a corner, play the opposite corner | def opposite_corner(board)
CORNERS.each do |corner|
if board[corner] == opponent_symbol(@symbol)
move = opposite(corner)
return move if board[move] == " "
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opposite_corner(board)\n #NOTE this could be cleaned up further with a function that accepts two arguments ie opposite_corner_play(0,9) and then iterating over an array of corners with it...but I'm not going to do that right now.\n # NOTE opponent_in_cell opperates on indexes, board.open? operates on i... | [
"0.7943329",
"0.76230633",
"0.7606113",
"0.7508064",
"0.7074578",
"0.70698017",
"0.70516324",
"0.63384664",
"0.63301635",
"0.63015914",
"0.62888396",
"0.6265764",
"0.6227639",
"0.6227639",
"0.62265015",
"0.621913",
"0.6178366",
"0.61719054",
"0.6161276",
"0.6077543",
"0.60710... | 0.78314024 | 1 |
Explicitly disallow phi access in a specific area of code. This does not play nicely with the mutating versions of `allow_phi!` and `disallow_phi!` At the moment, this doesn't work at all, as the instance won't necessarily look at the classlevel stack when determining if PHI is allowed. &block [block] The block in whic... | def disallow_phi
raise ArgumentError, 'block required. use disallow_phi! without block' unless block_given?
__phi_stack.push({
phi_access_allowed: false
})
yield if block_given?
__phi_stack.pop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disallow_phi!\n raise ArgumentError, 'block not allowed. use disallow_phi with block' if block_given?\n\n message = __phi_stack.present? ? \"PHI access disabled for #{__user_id_string(__phi_stack)}\" : 'PHI access disabled. No class level access was granted.'\n\n __reset_phi_stack\n\n ... | [
"0.81640065",
"0.803826",
"0.72729397",
"0.717562",
"0.69629085",
"0.67516845",
"0.655199",
"0.6528707",
"0.6485129",
"0.63645905",
"0.616724",
"0.5976554",
"0.59646726",
"0.5765009",
"0.5614054",
"0.555833",
"0.53671205",
"0.53032136",
"0.5277344",
"0.5171617",
"0.51664096",... | 0.8087484 | 1 |
Revoke last PHI access for this class, if enabled by PhiRecordallow_phi! | def disallow_last_phi!
raise ArgumentError, 'block not allowed' if block_given?
removed_access = __phi_stack.pop
message = removed_access.present? ? "PHI access disabled for #{removed_access[:user_id]}" : 'PHI access disabled. No class level access was granted.'
PhiAttrs::Logger.tagged... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disallow_last_phi!(preserve_extensions: false)\n raise ArgumentError, 'block not allowed' if block_given?\n\n PhiAttrs::Logger.tagged(*phi_log_keys) do\n removed_access = @__phi_access_stack.pop\n\n revoke_extended_phi! unless preserve_extensions\n message = removed_access.presen... | [
"0.6518896",
"0.6509298",
"0.6353209",
"0.62505233",
"0.610909",
"0.6018111",
"0.5942799",
"0.59380364",
"0.5820699",
"0.57750565",
"0.569153",
"0.5575222",
"0.5550095",
"0.5430204",
"0.54136413",
"0.541358",
"0.54036754",
"0.5397172",
"0.53721356",
"0.5371745",
"0.5363132",
... | 0.6793201 | 0 |
Whether PHI access is allowed for this class | def phi_allowed?
__phi_stack.present? && __phi_stack[-1][:phi_access_allowed]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phi_allowed?\n !phi_context.nil? && phi_context[:phi_access_allowed]\n end",
"def has_access?\n true\n end",
"def has_access?\n true\n end",
"def has_privilege?\n has_all? || has_direct?\n end",
"def require_phi!\n raise PhiAccessException, 'PHI Access required, please call... | [
"0.7995173",
"0.6944365",
"0.6944365",
"0.6652554",
"0.6504829",
"0.6499465",
"0.64774835",
"0.638429",
"0.63752407",
"0.63752407",
"0.63291174",
"0.6298908",
"0.62653935",
"0.6237007",
"0.62039125",
"0.6203814",
"0.6179676",
"0.6158496",
"0.6155603",
"0.61355007",
"0.6132566... | 0.7715687 | 1 |
Revoke all PHI access for a single instance of this class. | def disallow_phi!
raise ArgumentError, 'block not allowed. use disallow_phi with block' if block_given?
PhiAttrs::Logger.tagged(*phi_log_keys) do
removed_access_for = self.class.__user_id_string(@__phi_access_stack)
revoke_extended_phi!
@__phi_access_stack = []
message = r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revoke\n @session.do_rpc_endpoint('/revoke')\n nil\n end",
"def destroy\n __log_activity(\"LOGOUT #{current_user}\")\n __debug_route\n __debug_request\n user = current_user&.account&.dup\n opt = BS_AUTH ? { no_revoke: true?(params[:no_revoke]) } : {}\n delete_auth_... | [
"0.5888611",
"0.579848",
"0.5727517",
"0.5698714",
"0.5692734",
"0.5665577",
"0.56068414",
"0.56044024",
"0.5526789",
"0.552085",
"0.5512875",
"0.5509194",
"0.5509194",
"0.5503925",
"0.549266",
"0.5480225",
"0.5466496",
"0.54552156",
"0.5449698",
"0.5447445",
"0.5439153",
"... | 0.5926773 | 0 |
The unique identifier for whom access has been allowed on this instance. This is what was passed in when PhiRecordallow_phi! was called. | def phi_allowed_by
phi_context[:user_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def privacy_object_id\r\n\t\t\treturn self.id\r\n\t\tend",
"def owner_access_control_key # :nodoc:\n 'id'\n end",
"def all_phi_allowed_by\n self.class.__user_id_string(all_phi_context)\n end",
"def recip\n\t\tself.identity\n\tend",
"def identifier_value\n user.icn\n end",
... | [
"0.6373371",
"0.6309853",
"0.6225201",
"0.61484224",
"0.6069459",
"0.604486",
"0.60344976",
"0.59835744",
"0.5960108",
"0.5914712",
"0.5882732",
"0.58694553",
"0.58062017",
"0.5802811",
"0.57836604",
"0.5775802",
"0.5775802",
"0.5764635",
"0.5746757",
"0.5737906",
"0.5735067"... | 0.69745827 | 0 |
The access reason for allowing access to this instance. This is what was passed in when PhiRecordallow_phi! was called. | def phi_access_reason
phi_context[:reason]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def protection\n return @protection\n end",
"def phi_allowed?\n !phi_context.nil? && phi_context[:phi_access_allowed]\n end",
"def add_disallow_flag!\n @__phi_access_stack.push({\n phi_access_allowed: false\n }... | [
"0.5963926",
"0.5895669",
"0.5812808",
"0.57298714",
"0.5704143",
"0.5694744",
"0.5694744",
"0.55676234",
"0.55323106",
"0.55318356",
"0.5512706",
"0.5511024",
"0.55098116",
"0.5497229",
"0.5486193",
"0.5486193",
"0.54677814",
"0.54613286",
"0.54613286",
"0.5443621",
"0.54415... | 0.7814361 | 0 |
Whether PHI access is allowed for a single instance of this class | def phi_allowed?
!phi_context.nil? && phi_context[:phi_access_allowed]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phi_allowed?\n __phi_stack.present? && __phi_stack[-1][:phi_access_allowed]\n end",
"def has_access?\n true\n end",
"def has_access?\n true\n end",
"def has_privilege?\n has_all? || has_direct?\n end",
"def allow_member?\n true\n end",
"def priv?\n !org?\n end"... | [
"0.73977035",
"0.67593193",
"0.67593193",
"0.63658214",
"0.62343985",
"0.62260216",
"0.62142146",
"0.6196914",
"0.6186885",
"0.61813635",
"0.6175818",
"0.6162348",
"0.61538994",
"0.61538994",
"0.6144762",
"0.6131584",
"0.6103974",
"0.6090221",
"0.607106",
"0.60670555",
"0.604... | 0.75445 | 0 |
Require phi access. Raises an error preemptively if it has not been granted. | def require_phi!
raise PhiAccessException, 'PHI Access required, please call allow_phi or allow_phi! first' unless phi_allowed?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phi_allowed?\n !phi_context.nil? && phi_context[:phi_access_allowed]\n end",
"def phi_allowed?\n __phi_stack.present? && __phi_stack[-1][:phi_access_allowed]\n end",
"def disallow_phi!\n raise ArgumentError, 'block not allowed. use disallow_phi with block' if block_given?\n\n ... | [
"0.6594145",
"0.6286611",
"0.6176078",
"0.61688894",
"0.61167896",
"0.6050106",
"0.5954506",
"0.57413477",
"0.5591355",
"0.5549433",
"0.55245435",
"0.5471536",
"0.5464704",
"0.54590005",
"0.5451551",
"0.54365927",
"0.5400033",
"0.5400033",
"0.5400033",
"0.5392729",
"0.5363203... | 0.79007185 | 0 |
Adds a disallow phi flag to instance internal stack. | def add_disallow_flag!
@__phi_access_stack.push({
phi_access_allowed: false
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disallow_phi\n raise ArgumentError, 'block required. use disallow_phi! without block' unless block_given?\n\n __phi_stack.push({\n phi_access_allowed: false\n })\n\n yield if block_given?\n\n __phi_stack.pop\n end",
"def remov... | [
"0.7317745",
"0.7183306",
"0.7161934",
"0.7147925",
"0.6678703",
"0.6617949",
"0.64365196",
"0.63379455",
"0.62022114",
"0.586159",
"0.5701248",
"0.5616867",
"0.52915275",
"0.50800544",
"0.49696803",
"0.49367988",
"0.4933882",
"0.4873057",
"0.4796245",
"0.47469485",
"0.474521... | 0.81658965 | 0 |
Entry point for wrapping methods with PHI access logging. This is called by an `after_initialize` hook from ActiveRecord. | def wrap_phi
# Disable PHI access by default
@__phi_access_stack = []
@__phi_methods_extended = Set.new
@__phi_relations_extended = Set.new
# Wrap attributes with PHI Logger and Access Control
__phi_wrapped_methods.each { |m| phi_wrap_method(m) }
__phi_extended_methods.each { ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_init\n # puts 'Syslogger initialized'\n end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def initialize\n\t\t@@logger = OMLogger.getLogger(DataHelper.name)\n\tend",
"def initialize\n ... | [
"0.56423086",
"0.5560896",
"0.5560896",
"0.5560896",
"0.5560896",
"0.5560896",
"0.5560896",
"0.5560896",
"0.5560896",
"0.5557878",
"0.5507924",
"0.5496038",
"0.5496038",
"0.5496038",
"0.5496038",
"0.5496038",
"0.5496038",
"0.5496038",
"0.5496038",
"0.5496038",
"0.5496038",
... | 0.6144088 | 0 |
Core logic for wrapping methods in PHI access logging and access restriction. This method takes a single method name, and creates a new method using define_method; once this method is defined, the original method name is aliased to the new method, and the original method is renamed to a known key. | def phi_wrap_method(method_name)
unless respond_to?(method_name)
PhiAttrs::Logger.warn("#{self.class.name} tried to wrap non-existant method (#{method_name})")
return
end
return if self.class.__phi_methods_wrapped.include? method_name
wrapped_method = :"__#{method_name}_phi_wrap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_alias_for_existing_method(method_name)\n new_alias = new_name(method_name)\n unless @obj.respond_to?(new_alias)\n safe_alias_method(new_alias, method_name)\n end\n new_alias\n end",
"def create_alias_for_existing_method(method_name)\n begin\n new_alias = new_n... | [
"0.71978664",
"0.7069993",
"0.6886632",
"0.68152463",
"0.668163",
"0.6671713",
"0.6611153",
"0.6611153",
"0.651443",
"0.64577705",
"0.6443086",
"0.64276093",
"0.64140046",
"0.64104855",
"0.6367846",
"0.63619065",
"0.6343728",
"0.6333576",
"0.63164103",
"0.63136435",
"0.628572... | 0.74538535 | 0 |
Revoke PHI access for all `extend`ed relations (or only those given) | def revoke_extended_phi!(relations = nil)
relations ||= @__phi_relations_extended
relations.each do |relation|
relation.disallow_last_phi! if relation.present? && relation_klass(relation).included_modules.include?(PhiRecord)
end
@__phi_relations_extended.subtract(relations)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_disallow_flag_from_extended_phi!(relations = nil)\n relations ||= @__phi_relations_extended\n relations.each do |relation|\n relation.remove_disallow_flag! if relation.present? && relation_klass(relation).included_modules.include?(PhiRecord)\n end\n end",
"def add_disallow_fla... | [
"0.6587906",
"0.5902585",
"0.5766153",
"0.5674617",
"0.56393856",
"0.5618511",
"0.5616106",
"0.5580106",
"0.5519277",
"0.5462062",
"0.5420075",
"0.53760546",
"0.53100514",
"0.52718127",
"0.52424747",
"0.52184767",
"0.515431",
"0.515431",
"0.5129898",
"0.5124908",
"0.5096734",... | 0.79246837 | 0 |
Adds a disallow PHI access to the stack for block syntax for all `extend`ed relations (or only those given) | def add_disallow_flag_to_extended_phi!(relations = nil)
relations ||= @__phi_relations_extended
relations.each do |relation|
relation.add_disallow_flag! if relation.present? && relation_klass(relation).included_modules.include?(PhiRecord)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disallow_last_phi!(preserve_extensions: false)\n raise ArgumentError, 'block not allowed' if block_given?\n\n PhiAttrs::Logger.tagged(*phi_log_keys) do\n removed_access = @__phi_access_stack.pop\n\n revoke_extended_phi! unless preserve_extensions\n message = removed_access.presen... | [
"0.6783726",
"0.6664244",
"0.65746266",
"0.6541955",
"0.65250677",
"0.6465221",
"0.6357006",
"0.62972945",
"0.5802014",
"0.54192305",
"0.51315415",
"0.5066757",
"0.500448",
"0.5000395",
"0.49190742",
"0.4910319",
"0.48812017",
"0.48757094",
"0.48726538",
"0.48613065",
"0.4849... | 0.690083 | 0 |
=> instance method to add up the mass of all bodies in bodies and return it | def total_mass
mass = 0
@bodies.each do |body|
mass += body.mass
end
return mass
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_mass\n sum = 0\n @bodies.each{ |body| body[:mass] += sum}\n sum\n end",
"def update_masses\n self.total = 0\n masses.clear\n self.hashes.each do |hash, nodes|\n masses[hash] = nodes.first.mass * nodes.size\n masses[hash] *= (nodes.size) if identical[hash]\n self.total ... | [
"0.8550619",
"0.6276286",
"0.6268563",
"0.620096",
"0.6143025",
"0.5981379",
"0.59792024",
"0.5934948",
"0.58977157",
"0.58898675",
"0.58727676",
"0.5868477",
"0.58483446",
"0.58176804",
"0.57921505",
"0.5773891",
"0.57133293",
"0.57116896",
"0.5710129",
"0.5703177",
"0.57017... | 0.8603155 | 0 |
GET /matter_products GET /matter_products.json | def index
@matter_products = MatterProduct.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def products\n request :public, :get, :products\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def index\n @products = Product.all\n render json: @products\n end",
"def product(name)\n get(... | [
"0.7236215",
"0.71494395",
"0.6859548",
"0.68407476",
"0.6784778",
"0.67501616",
"0.6712368",
"0.670876",
"0.6702911",
"0.6684415",
"0.66695225",
"0.6669509",
"0.6669509",
"0.6669509",
"0.6654767",
"0.66505194",
"0.66505194",
"0.66505194",
"0.66505194",
"0.66339433",
"0.66322... | 0.7440614 | 0 |
POST /matter_products POST /matter_products.json | def create
@matter_product = MatterProduct.new(matter_product_params)
respond_to do |format|
if @matter_product.save
format.html { redirect_to @matter_product, notice: 'Matter product was successfully created.' }
format.json { render :show, status: :created, location: @matter_product }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n if params[:products]\n params[:products].each do |product|\n @product = Product.new(name: product[:name],\n brand: product[:brand],\n model: product[:model],\n sku: product[:sku],\n ... | [
"0.6928276",
"0.67488784",
"0.669899",
"0.659528",
"0.6541616",
"0.6527496",
"0.6520057",
"0.65105236",
"0.6391199",
"0.63861233",
"0.63775826",
"0.63674825",
"0.6341455",
"0.63356346",
"0.6334726",
"0.6328034",
"0.62777823",
"0.6272497",
"0.6265461",
"0.6213499",
"0.618649",... | 0.72924066 | 0 |
PATCH/PUT /matter_products/1 PATCH/PUT /matter_products/1.json | def update
respond_to do |format|
if @matter_product.update(matter_product_params)
format.html { redirect_to @matter_product, notice: 'Matter product was successfully updated.' }
format.json { render :show, status: :ok, location: @matter_product }
else
format.html { render :edit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def update\n updateProduct = Product.find_by_id(params[:id])\n updateProduct.update(products_params)\n ... | [
"0.71118176",
"0.66956574",
"0.6663161",
"0.6614635",
"0.65725356",
"0.6500799",
"0.64642054",
"0.6460646",
"0.6456365",
"0.64500326",
"0.64329946",
"0.63851064",
"0.6381777",
"0.6376986",
"0.6369513",
"0.6357122",
"0.6354364",
"0.6345106",
"0.6342484",
"0.6324882",
"0.632293... | 0.69816375 | 1 |
DELETE /matter_products/1 DELETE /matter_products/1.json | def destroy
@matter_product.destroy
respond_to do |format|
format.html { redirect_to matter_products_url, notice: 'Matter product was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end",
"def destroy\n unread\n\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def... | [
"0.707563",
"0.70666003",
"0.7061442",
"0.7031911",
"0.7030968",
"0.70221364",
"0.70145065",
"0.6994228",
"0.6991333",
"0.6986497",
"0.69643533",
"0.6909867",
"0.690956",
"0.6903224",
"0.6893754",
"0.6865364",
"0.6857286",
"0.6857286",
"0.6857286",
"0.6857286",
"0.6857286",
... | 0.74430215 | 0 |
launch: Pass either params or hardcoded server and client data to the auth_url via redirection | def launch
# Get a completely fresh session for each launch. This is a rails method.
reset_session
cookies.clear
redirect_to home_path, alert: "Please provide the server_url, client_id, and client_secret." and return if !all_credentials_provided?
# Set auth sessions with params values
session[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate!\n @client = Octokit::Client.new\n url = @client.authorize_url(CLIENT_ID)\n redirect url\nend",
"def signin\n embed_screen api_args.select_keys(\"redirect_uri\", \"client_id\", \"response_type\")\n end",
"def index\n res = create_request2(root_url + '/login/auth', 'tequila.epfl.ch')\... | [
"0.6678311",
"0.6362986",
"0.6335776",
"0.62370044",
"0.6176067",
"0.61650795",
"0.6118643",
"0.60888183",
"0.60588706",
"0.60541135",
"0.60386896",
"0.6026132",
"0.5991819",
"0.59854573",
"0.59653205",
"0.59389",
"0.59188396",
"0.5917868",
"0.59024245",
"0.59006095",
"0.5899... | 0.6880365 | 0 |
Removes the given object from the dispatcher queue of the message +msgName+. | def del_msg_listener( msgName, object )
@msgNames[msgName].delete object if defined? @msgNames
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_msg_name( msgName )\n @msgNames.delete msgName if defined? @msgNames\n end",
"def remove_message(name)\n\t\tend",
"def remove_message(id)\n with_queue_control do |control|\n control.remove_message(id)\n end\n end",
"def unsubscribe(message_name)\n @transport.unb... | [
"0.7025907",
"0.65422636",
"0.6183906",
"0.61722475",
"0.6163905",
"0.60788625",
"0.5942539",
"0.58861667",
"0.58853036",
"0.5862394",
"0.58507943",
"0.58303237",
"0.5804372",
"0.5757792",
"0.5730907",
"0.5727485",
"0.5708007",
"0.5686499",
"0.5677829",
"0.56621295",
"0.56615... | 0.75973785 | 0 |
Adds a new message target called +msgName+ | def add_msg_name( msgName )
@msgNames = {} unless defined? @msgNames
@msgNames[msgName] = [] unless @msgNames.has_key? msgName
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_message(name, message)\n\t\tend",
"def addTarget(name=nil, note=nil)\n @addTargetBtn.click\n return EditTarget.new.enterTargetInformation(name)\n end",
"def setup_log_message\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n text = @acts[1].gsub(/<name>/i) { self.name }\... | [
"0.6601231",
"0.6339349",
"0.6111804",
"0.5882971",
"0.57765985",
"0.5632621",
"0.5603092",
"0.55837256",
"0.55542886",
"0.5527673",
"0.55179965",
"0.5507411",
"0.54249394",
"0.5408368",
"0.53592014",
"0.52734494",
"0.5268719",
"0.5240212",
"0.5216382",
"0.51726377",
"0.51214... | 0.6440258 | 1 |
Deletes the message target +msgName+. | def del_msg_name( msgName )
@msgNames.delete msgName if defined? @msgNames
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end",
"def remove_message(name)\n\t\tend",
"def del_msg_listener( msgName, object )\n @msgNames[msgName].delete object if defined? @msgNames\n end",
"def delete_msg()\n MsgUtil.delete_msg(params[:ch])\n end",
"d... | [
"0.76744175",
"0.73386955",
"0.7197245",
"0.7181386",
"0.6937953",
"0.6749326",
"0.66964567",
"0.6694406",
"0.66046596",
"0.6551827",
"0.65110856",
"0.6469001",
"0.6410771",
"0.63640195",
"0.6360717",
"0.6360717",
"0.63413745",
"0.6288525",
"0.6240895",
"0.62289816",
"0.62200... | 0.82614136 | 0 |
Dispatches the message +msgName+ to all listeners for this message, providing the given arguments | def dispatch_msg( msgName, *args )
if defined? @msgNames and @msgNames.has_key? msgName
@msgNames[msgName].each do |obj|
obj.call( *args )
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispatch_event(event_name, args)\n @event_message_channels[event_name].each do |message_channel|\n message_channel.send [:event, event_name, args]\n end\n end",
"def notify_listeners(event_name, *args)\n listeners.each_value { |listener|\n if listener.respo... | [
"0.68110913",
"0.6788161",
"0.62809247",
"0.6202623",
"0.6138758",
"0.6074418",
"0.60267806",
"0.58162886",
"0.55855316",
"0.5562728",
"0.5497522",
"0.549229",
"0.54807943",
"0.5463088",
"0.5438406",
"0.5430428",
"0.5416576",
"0.5369889",
"0.53564143",
"0.5346126",
"0.5345655... | 0.75376266 | 0 |
Log websocket level errors | def on_error(env, error)
logger.debug "Websocket error: #{error.message}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inject_error(e)\n websocket_error(e)\n end",
"def error(event)\n Firehose.logger.error \"WS connection `#{@req.path}` error. Message: `#{event.message.inspect}`\"\n end",
"def on_error(env, error)\n Firehose.logger.error \"WS connection `#{cid}@#{path}` error `#{error}`: ... | [
"0.7010622",
"0.6873135",
"0.670333",
"0.64622253",
"0.61725646",
"0.6074077",
"0.60400975",
"0.594101",
"0.59091365",
"0.59008425",
"0.5869451",
"0.5869451",
"0.5869451",
"0.5821708",
"0.5821708",
"0.5798314",
"0.5760141",
"0.57395995",
"0.57081443",
"0.56787705",
"0.5677368... | 0.7805862 | 0 |
TODO: more than one bullet? | def bullet
@bullet ||= load_data.first.bullet
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_bullet(bullet)\n @bullets << bullet\n end",
"def bullet(name, options={}, &block)\n cur_page.bullet(name, options, &block)\n end",
"def prepare_bullet_data\n [\"*\", self]\n end",
"def bullet(str)\n [*str].each { |s| @parts.push(bullet: s) }\n end",
"def player_fire_bullet()... | [
"0.75124717",
"0.7439275",
"0.6829142",
"0.6815622",
"0.6788822",
"0.66167885",
"0.6506522",
"0.641715",
"0.63753724",
"0.6371628",
"0.6364791",
"0.63384837",
"0.6282106",
"0.6262739",
"0.6236886",
"0.6218436",
"0.62153554",
"0.6179613",
"0.6142401",
"0.6119371",
"0.59584105"... | 0.7533692 | 0 |
Returns joke from ICNDB | def icndb_joke
url = "http://api.icndb.com/jokes/random"
begin
joke = open(url).read()
hash = JSON.parse joke
joke_string = hash['value']['joke']
rescue
joke_string=''
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def joke(id)\n path = id.nil? ? \"/\" : \"/j/#{id}\"\n resp = http.get(path).tap do |resp|\n if resp.body.status == 404\n raise FunnyGuy::HTTPError::NotFound, error_handler.response_values(resp.env)\n end\n end\n FunnyGuy::DataSource::ICanHasDadJoke::Joke.new resp.body\n end",
"def ... | [
"0.6224704",
"0.59733707",
"0.5640795",
"0.5559783",
"0.55182016",
"0.54919726",
"0.5325014",
"0.52230704",
"0.52155465",
"0.5209845",
"0.5145834",
"0.5134466",
"0.51216155",
"0.5080215",
"0.50569725",
"0.50364983",
"0.50310045",
"0.501427",
"0.5013942",
"0.50120306",
"0.5005... | 0.69345134 | 0 |
Construtor Cria um programa de shaders | def initialize
@id = glCreateProgram
@shaders = []
@linked = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_shaders(widget)\n context = widget.context\n\n if context.use_es?\n vertex_path = \"/glarea/glarea-gles.vs.glsl\"\n fragment_path = \"/glarea/glarea-gles.fs.glsl\"\n else\n vertex_path = \"/glarea/glarea-gl.vs.glsl\"\n fragment_path = \"/glarea/glarea-gl.fs.glsl\"\n end\n ... | [
"0.78125066",
"0.6928768",
"0.67964166",
"0.6714616",
"0.64758843",
"0.6113041",
"0.58382887",
"0.5825165",
"0.58169854",
"0.57286125",
"0.5671796",
"0.56446886",
"0.5626977",
"0.550136",
"0.5473906",
"0.538306",
"0.53658396",
"0.5308355",
"0.52918667",
"0.5257406",
"0.521044... | 0.79877937 | 0 |
Adiciona um shader de fragmento ao programa a partir de um arquivo | def add_fragment_shader name
raise 'O programa já está linkado, não é possível adicionar mais shaders' if @linked
file = File.open "shaders/#{name}.frag"
source = file.read
file.close
shader = glCreateShader GL_FRAGMENT_SHADER
glShaderSource shader, 1, [source.cptr].pack("L").cptr, 0
glCompileShader... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_shaders(widget)\n context = widget.context\n\n if context.use_es?\n vertex_path = \"/glarea/glarea-gles.vs.glsl\"\n fragment_path = \"/glarea/glarea-gles.fs.glsl\"\n else\n vertex_path = \"/glarea/glarea-gl.vs.glsl\"\n fragment_path = \"/glarea/glarea-gl.fs.glsl\"\n end\n ... | [
"0.6816895",
"0.65912825",
"0.6151664",
"0.60401577",
"0.59396833",
"0.5902404",
"0.5325893",
"0.52054155",
"0.511485",
"0.49794608",
"0.49179956",
"0.49107358",
"0.47824085",
"0.47394258",
"0.4709167",
"0.4672516",
"0.46669614",
"0.4666518",
"0.46074077",
"0.4606476",
"0.460... | 0.79679126 | 0 |
Register plugin with name in internal array | def register(name, plugin = false)
return unless plugin && !loaded?(name)
@plugins << plugin
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register(plugin, id); end",
"def plugin(name)\n @plugins[name]\n end",
"def register!\n # Register the plugin.\n @manager.register_plugin! self\n end",
"def plugin(name); end",
"def << plugin\n @plugins[plugin.to_s] = plugin\n end",
"def load_plugin(name); end",
"def ad... | [
"0.7747027",
"0.7406852",
"0.73945683",
"0.73907757",
"0.73562616",
"0.72290117",
"0.72211283",
"0.72204417",
"0.72193795",
"0.7164622",
"0.70767844",
"0.70114243",
"0.69876015",
"0.6931228",
"0.68947953",
"0.6870711",
"0.68464464",
"0.68297637",
"0.67886204",
"0.6771686",
"0... | 0.78041494 | 0 |
Loads gemspec from a file and registers gems matching pattern. | def load_from(gemspec_path, pattern)
Gem.refresh
spec = Gem::Specification.load(gemspec_path)
dependencies = spec.runtime_dependencies.concat(spec.development_dependencies)
dependencies.each do |gem|
gem_name = gem.name[pattern]
next if gem_name.to_s.empty?
register(gem_n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_gemspec!\n @gemspec = eval(File.read(@gemspec_file))\n end",
"def load_gemspec\n\n text = File.read(gemspec_file)\n if text =~ /\\A---/ \n require 'yaml'\n spec = YAML.load(text)\n else\n #spec = eval(text) #, gemspec_file)\n spec = ::Gem... | [
"0.7242673",
"0.69334483",
"0.6797337",
"0.65715325",
"0.65404963",
"0.6473995",
"0.6406423",
"0.6385486",
"0.6342654",
"0.62927926",
"0.6113445",
"0.6079612",
"0.6001457",
"0.5971521",
"0.59482914",
"0.59412575",
"0.5929736",
"0.591711",
"0.591711",
"0.5914992",
"0.5895672",... | 0.7375221 | 0 |
Include an Octicon! (see | def octicon(name)
%(<span class="octicon octicon-#{name}"></span>)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def octicon(name, options)\n content_tag :svg, options do\n content_tag :use, '', 'xlink:href' => \"#icon-#{name}\"\n end\n end",
"def rocticon_css(symbol, parameters = {})\n octicon = ::Octicons::Octicon.new(symbol, parameters.merge({xmlns: 'http://www.w3.org/2000/svg'}))\n [:width... | [
"0.7008846",
"0.6281313",
"0.6156053",
"0.6120124",
"0.60483295",
"0.6034941",
"0.58948696",
"0.58718336",
"0.58489734",
"0.58489734",
"0.5822725",
"0.5807627",
"0.5795426",
"0.57802445",
"0.5754399",
"0.5754399",
"0.5724942",
"0.57214034",
"0.5697736",
"0.56935656",
"0.56890... | 0.75193274 | 0 |
Get the directoryTree from the root of the repo | def tree_root
repo.tree
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repository_root\n return unless available?\n root = Licensed::Shell.execute(\"git\", \"rev-parse\", \"--show-toplevel\", allow_failure: true)\n return nil if root.empty?\n root\n end",
"def get_svn_repo_root( dir='.' )\n\tinfo = get_svn_info( dir )\n\treturn info['Repository ... | [
"0.72790486",
"0.6908844",
"0.6906041",
"0.67978346",
"0.6332378",
"0.63251656",
"0.63149714",
"0.6272349",
"0.6106052",
"0.60321736",
"0.6029437",
"0.60287106",
"0.5997431",
"0.5995607",
"0.5966819",
"0.59331894",
"0.5915845",
"0.5880715",
"0.5866433",
"0.58440495",
"0.58265... | 0.76856315 | 0 |
URL helper for the History page of a document | def history_path(path)
url('/h/' + path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_url(first, hsh)\n hsh = hsh.merge item_type: model.class.to_s,\n item_id: model.id.to_i\n api_history_path(first, hsh)\n end",
"def redirection_history; end",
"def history\r\n\r\n end",
"def add_to_history(page); end",
"def history\n # blank\n end",
"def document_... | [
"0.6869474",
"0.65658134",
"0.6473387",
"0.6469171",
"0.6433061",
"0.642693",
"0.64180875",
"0.64180875",
"0.64180875",
"0.6360034",
"0.6259342",
"0.6259342",
"0.62400496",
"0.620006",
"0.619646",
"0.6159481",
"0.6153468",
"0.61135805",
"0.61122423",
"0.6109527",
"0.6074837",... | 0.70901227 | 0 |
URL helper for the Edit page of a document | def edit_path(path)
url('/e/' + path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_edit\n cname = self.class.classname.to_s.downcase\n return \"?show=#{cname}_edit&#{cname}_id=#{self.id}\"\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
... | [
"0.7392644",
"0.7212802",
"0.7170562",
"0.7170562",
"0.7170562",
"0.7170562",
"0.7170562",
"0.7170562",
"0.7170562",
"0.7170562",
"0.7170562",
"0.7170562",
"0.7170562",
"0.7170562",
"0.7170562",
"0.7170562",
"0.71617776",
"0.71538025",
"0.7147042",
"0.7146872",
"0.7144504",
... | 0.73278123 | 1 |
CSS class for a diff line | def class_for_diff(line)
case line[0]
when '+'
'addition'
when '-'
'removal'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diff_line_class(line)\n case line[0, 1]\n when '+' then 'added'\n when '-' then 'deleted'\n end\n end",
"def colorized_diff\n diff.lines.map do |line|\n self.class.colorize_line(line)\n end.join\n end",
"def colorized_diff\n return unless diff\n\n diff.lines.map(&... | [
"0.74846035",
"0.675893",
"0.6689632",
"0.6309649",
"0.6116834",
"0.60038835",
"0.5964602",
"0.586575",
"0.58221835",
"0.5816642",
"0.56416863",
"0.56178",
"0.5612193",
"0.5609927",
"0.5604306",
"0.5591892",
"0.55917454",
"0.5588305",
"0.55746365",
"0.55416924",
"0.55124146",... | 0.737318 | 1 |
GET /commands GET /commands.json | def index
@commands = Command.all
render :json => @commands
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commands(params = {})\n res = @client.get(\"#{path}/commands\", params)\n\n res.json[\"commands\"].map { |atts| M2X::Client::Command.new(@client, atts) } if res.success?\n end",
"def index\n @commands = Command.all\n end",
"def index\n @commands = Command.all\n end",
"def index\n @comma... | [
"0.78649783",
"0.7111867",
"0.7111867",
"0.6937871",
"0.69377637",
"0.67611986",
"0.6751875",
"0.6694443",
"0.6670576",
"0.664987",
"0.6609053",
"0.65806025",
"0.65446085",
"0.6470076",
"0.64382315",
"0.63795847",
"0.6256752",
"0.61963713",
"0.61805284",
"0.6176437",
"0.61572... | 0.7855072 | 1 |
POST /commands POST /commands.json | def create
@command = Command.new(command_params)
respond_to do |format|
if @command.save
format.json { render json: @command }
else
format.json { render json: @command.errors, status: 401 }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_params\n params.require(:command).permit(:name, :json)\n end",
"def create\n @command = current_user.commands.build(command_params)\n\n respond_to do |format|\n if @command.save\n format.html { redirect_to @command, notice: \"Command is queued to run...\" }\n format.json ... | [
"0.7092538",
"0.6900521",
"0.6764133",
"0.67391413",
"0.64927304",
"0.6273162",
"0.6253894",
"0.62021655",
"0.6165331",
"0.6063389",
"0.6036017",
"0.6025217",
"0.6019788",
"0.5955273",
"0.59393644",
"0.59293926",
"0.59288085",
"0.5922161",
"0.58942914",
"0.58630234",
"0.58289... | 0.7124352 | 0 |
PATCH/PUT /commands/1 PATCH/PUT /commands/1.json | def update
respond_to do |format|
if @command.update(command_params)
format.json { render :json => @command }
else
format.json { render json: @command.errors, status: 401 }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @command.update(command_params)\n format.html { redirect_to @command, notice: 'Command was successfully updated.' }\n format.json { render :show, status: :ok, location: @command }\n else\n format.html { render :edit }\n format.json {... | [
"0.64716566",
"0.62544644",
"0.6223385",
"0.6166207",
"0.5989352",
"0.59023935",
"0.5902321",
"0.59014827",
"0.58701193",
"0.58631754",
"0.585324",
"0.5769708",
"0.56984615",
"0.5689745",
"0.56885976",
"0.56885976",
"0.56767225",
"0.5673897",
"0.5664423",
"0.56581366",
"0.565... | 0.70265263 | 0 |
DELETE /commands/1 DELETE /commands/1.json | def destroy
@command.destroy
respond_to do |format|
msg = { :status => 'ok', message: 'Deleted Successfully'}
format.json { render json: msg }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @command.destroy\n respond_to do |format|\n format.html { redirect_to commands_url, notice: 'Command was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @command.destroy\n respond_to do |format|\n format.html { redirect_to co... | [
"0.72264004",
"0.7218138",
"0.7183386",
"0.7077406",
"0.6934684",
"0.6799898",
"0.6723346",
"0.67077225",
"0.6700849",
"0.6689655",
"0.6689467",
"0.6684283",
"0.6684283",
"0.6684283",
"0.6684283",
"0.6642257",
"0.6591556",
"0.6577685",
"0.65410274",
"0.65145236",
"0.6500549",... | 0.73457795 | 0 |
Get the latest level checked into git | def git_level
# Assumes PWD is a valid git repo
return nil unless File.exists? ".git/current_cmvc_level"
return File.read(".git/current_cmvc_level").chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tree_sha\n sha = nil\n trees = open('https://api.github.com/repos/twitter/bootstrap/git/trees/master').read\n trees = JSON.parse trees\n trees['tree'].find{|t| t['path'] == 'less'}['sha']\n end",
"def last_updated\n repo = Grit::Repo.init_bare_or_open(File.join(path , '.git'))\n repo.c... | [
"0.6758579",
"0.6517996",
"0.6277419",
"0.6273922",
"0.62135893",
"0.61986846",
"0.61426157",
"0.61346644",
"0.6130961",
"0.61237556",
"0.61158574",
"0.610153",
"0.60702115",
"0.6048304",
"0.6031471",
"0.60132146",
"0.6009787",
"0.6004033",
"0.5981083",
"0.59733486",
"0.59495... | 0.7167405 | 0 |
Given an rmap, extract the changed or created files, and delete any deleted files | def cmvc_extract_changed rmap
raise "oops, not done"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_maps\n own_maps.each do | map |\n logger.debug \"deleting map #{map.inspect}\"\n map.destroy\n end\n end",
"def delete_maps\n own_maps.each do | map |\n logger.debug \"deleting map #{map.inspect}\"\n map.destroy\n end\n end",
"def clear!\n \n # Removes old files i... | [
"0.58131886",
"0.58131886",
"0.57415473",
"0.57370746",
"0.57355213",
"0.5688566",
"0.5562375",
"0.555419",
"0.55425036",
"0.55397713",
"0.55250263",
"0.5472779",
"0.5387711",
"0.53839636",
"0.5354738",
"0.53215075",
"0.52835786",
"0.526592",
"0.5239939",
"0.5214151",
"0.5212... | 0.6385133 | 0 |
Stick the rmap onto disk | def write_rmap rmap
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nmap_save()\n print_status \"Nmap: saving nmap log file\"\n fh = self.nmap_log[0]\n nmap_data = fh.read(fh.stat.size)\n saved_path = store_local(\"nmap.scan.xml\", \"text/xml\", nmap_data, \"nmap_#{Time.now.utc.to_i}.xml\")\n print_status \"Saved NMAP XML results to #{saved_path}\"\nend",
"def place_rov... | [
"0.6154629",
"0.56928957",
"0.5682441",
"0.5649068",
"0.5532678",
"0.54314995",
"0.53476137",
"0.5338205",
"0.53369904",
"0.5307179",
"0.5303931",
"0.5278246",
"0.52771723",
"0.5268454",
"0.5267135",
"0.52585363",
"0.52557874",
"0.5237185",
"0.52332973",
"0.52055043",
"0.5194... | 0.6827883 | 0 |
User defines a platform block | def platform(platform_name, &block)
SupportedPlatforms.verify!platform_name
@current_platform = platform_name
block.call
@current_platform = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform(&block)\n Loquacious::Configuration.for :platform, &block\n end",
"def platform; end",
"def platform; end",
"def platform; end",
"def is_platform_block?(key)\n raise 'No key given'.red unless key\n\n return false if (self.runner.blocks[nil][key.to_sym] rescue false)\n re... | [
"0.7160809",
"0.6378967",
"0.6378967",
"0.6378967",
"0.60587245",
"0.59745026",
"0.5950207",
"0.5921882",
"0.5689245",
"0.5686215",
"0.56734484",
"0.56674194",
"0.56674194",
"0.56674194",
"0.5665567",
"0.5665188",
"0.5644594",
"0.5636268",
"0.5595199",
"0.5595199",
"0.5515746... | 0.666566 | 1 |
Is the given key a platform block or a lane? | def is_platform_block?(key)
raise 'No key given'.red unless key
return false if (self.runner.blocks[nil][key.to_sym] rescue false)
return true if self.runner.blocks[key.to_sym].kind_of?Hash
raise "Could not find '#{key}'. Available lanes: #{self.runner.available_lanes.join(', ')}".red
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block_tile?\n BLOCK_SIZES.has_key?(kind)\n end",
"def key?(p0) end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def is_elkey?(); @type == GRT_ELKEY; end",
"def capable?(key); end",
"def key?(key)\n... | [
"0.64562213",
"0.64370704",
"0.6307505",
"0.6307505",
"0.6307505",
"0.6307505",
"0.6307505",
"0.6307505",
"0.617565",
"0.60650945",
"0.60525006",
"0.60525006",
"0.6050762",
"0.60384357",
"0.59404975",
"0.5932974",
"0.5930782",
"0.5859019",
"0.5847788",
"0.5832562",
"0.5822329... | 0.85934603 | 0 |
Retrieves list of supported file formats. | def get_supported_file_formats(request)
begin
data, _status_code, _headers = get_supported_file_formats_with_http_info(request)
rescue ApiError => e
if e.code == 401
request_token
data, _status_code, _headers = get_supported_file_formats_with_http_info(reque... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formats\n @formats ||= Dir[File.join(path, \"#{name}.{otf,svg,ttf,woff,woff2,eot}\")].map {|file| File.extname(file)[1..-1] }.sort\n end",
"def supported_formats\n output = `vips --list` + `convert --version`\n\n formats = %w[jpg png webp gif jp2 avif].select do |format|\n output.include? form... | [
"0.78444517",
"0.78438896",
"0.76918375",
"0.7190886",
"0.7004789",
"0.6818506",
"0.67250556",
"0.6519861",
"0.6485713",
"0.6476558",
"0.6431124",
"0.63256305",
"0.6300773",
"0.62428296",
"0.6236999",
"0.62342894",
"0.6222733",
"0.61798805",
"0.61551636",
"0.61292005",
"0.612... | 0.7956081 | 0 |
Gets device data from backend service and updates its color and ALS state. Params: +info+:: +DeviceInfo+ object. +state+:: +DeviceState+ object which will be updated with data from backend. Returns true if devState has been changed, false otherwise. | def getDeviceState(info, state)
res = apiGet("devices/#{info.deviceId}")
succeed = false
if res.status == 200
response = nil
begin
response = JSON.parse(res.body)
rescue Exception => e
$LOG.warn("Invalid body received! Err: #{e.message}")... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update?\n state == STATE_UPDATE\n end",
"def postReadings(info, state)\r\n params = {\r\n :device_id => info.deviceId,\r\n :sensor_data => [\r\n {\r\n :type => \"Temperature\",\r\n :value => state.temperature,\r\n :time => Time.now.to_i... | [
"0.51228786",
"0.4943882",
"0.4931239",
"0.49310255",
"0.4870755",
"0.47812158",
"0.47313583",
"0.46843687",
"0.46770492",
"0.4640897",
"0.46286714",
"0.46241808",
"0.46197292",
"0.4594584",
"0.45819145",
"0.45283353",
"0.45273665",
"0.4526295",
"0.4526295",
"0.45201463",
"0.... | 0.8010385 | 0 |
Send device SW version and serial number to backend service. Params: +info+:: +DeviceInfo+ object. | def putDeviceInfo(info)
params = {
:software_version => info.swVersion,
:serial_number => info.serialNb
}
res = apiPut("devices/#{info.deviceId}", params)
if res.status != 200
$LOG.warn("Failed to put device info to backend! Status: #{res.status}, Response: #{res.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendInfo(devInfo)\r\n msg = {\r\n :type => \"info\",\r\n :version => devInfo.swVersion\r\n }\r\n sendMsg(msg)\r\n end",
"def device_params\n params.require(:device).permit(:name, :sn, :model, :coordinate, :address, :floor, :power, :powerstatu, :repottime, :status, :imsi, :t... | [
"0.7553182",
"0.57382566",
"0.546619",
"0.53908426",
"0.5350636",
"0.53383636",
"0.5246511",
"0.52329963",
"0.5203288",
"0.51399523",
"0.5123751",
"0.51146525",
"0.510888",
"0.50191617",
"0.5002172",
"0.49679103",
"0.49671125",
"0.49658668",
"0.49487564",
"0.4938252",
"0.4931... | 0.79654753 | 0 |
Send device color to backend service. Params: +info+:: +DeviceInfo+ object. +color+:: HSV collor array. | def putColor(info, color)
params = {
:color_hue => color[0].to_s,
:color_saturation => color[1].to_s,
:color_value => color[2].to_s
}
res = apiPut("devices/#{info.deviceId}", params)
if res.status != 200
$LOG.warn("Failed to put color to backend! Status: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendUserColor(devInfo, color)\r\n msg = {\r\n :type => \"user-color\", \r\n :device_id => devInfo.deviceId,\r\n :user_color => {\r\n :hue => color[0],\r\n :saturation => color[1],\r\n :value => color[2]\r\n }\r\n }\r\n sendMsg(msg)\r\n en... | [
"0.77770764",
"0.60814154",
"0.59698147",
"0.59685755",
"0.5828013",
"0.58269525",
"0.5738051",
"0.573183",
"0.5708938",
"0.5617696",
"0.5591413",
"0.5582966",
"0.5569477",
"0.55513763",
"0.5540315",
"0.5514176",
"0.55106395",
"0.5499607",
"0.5475196",
"0.5474615",
"0.5460296... | 0.8330073 | 0 |
Send device readings (temp. and humid.) to backend service. Params: +info+:: +DeviceInfo+ object. +state+:: +DeviceState+ object. | def postReadings(info, state)
params = {
:device_id => info.deviceId,
:sensor_data => [
{
:type => "Temperature",
:value => state.temperature,
:time => Time.now.to_i
},
{
:type => "Humidity",
:valu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendStreaming(devInfo, devState)\r\n msg = {\r\n :type => \"streaming\", \r\n :version => devInfo.swVersion,\r\n :sensor_data => [\r\n {\r\n :type => \"Temperature\", \r\n :value => devState.temperature,\r\n :time => Time.now.to_i\r\n ... | [
"0.6142587",
"0.6005751",
"0.56190664",
"0.5519432",
"0.5501627",
"0.52769345",
"0.5195745",
"0.5134593",
"0.508595",
"0.50521946",
"0.50493795",
"0.50198597",
"0.4987756",
"0.49458665",
"0.48833528",
"0.48647407",
"0.4845068",
"0.4843082",
"0.48353758",
"0.48174357",
"0.4804... | 0.78722006 | 0 |
Triggers new alarm upload sound file to S3 (if given), update storage url and post new alarm. Finally +alarm+ is updated with posted alarm Id. Params: +info+:: +DeviceInfo+ object. +alarm+:: +DeviceAlarms::State+ object. +type+:: Given alarm type. | def triggerAlarm(info, alarm, type)
uploadSoundFile(info, alarm, type)
params = {
:device_id => info.deviceId,
:alarm_type => type,
:storage_url => alarm.storageUrl
}
res = apiPost("alarms", params)
if res.status == 201
begin
res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uploadSoundFile(info, alarm, type)\r\n if !alarm.sound.nil?\r\n # reset storageUrl\r\n alarm.storageUrl = nil\r\n\r\n # get new urls\r\n params = {\r\n :device_id => info.deviceId,\r\n :alarm_type => type\r\n }\r\n res = apiPost(\"storage/alarm\"... | [
"0.8175491",
"0.5168551",
"0.5042993",
"0.49938577",
"0.4908464",
"0.4809632",
"0.47915807",
"0.47878167",
"0.47438142",
"0.472263",
"0.46991295",
"0.46910834",
"0.46700853",
"0.46166387",
"0.45644194",
"0.4558445",
"0.4551017",
"0.45413992",
"0.45273748",
"0.45198497",
"0.45... | 0.78386617 | 1 |
Tries to upload associated sound, if given, and update storageUrl. | def uploadSoundFile(info, alarm, type)
if !alarm.sound.nil?
# reset storageUrl
alarm.storageUrl = nil
# get new urls
params = {
:device_id => info.deviceId,
:alarm_type => type
}
res = apiPost("storage/alarm", params)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_sound_file(data, name)\n resp = @api.UploadSoundFile({\n :FileBinary => data,\n :SoundFileID => name,\n :LicenseKey => @license_key }).uploadSoundFileResult\n resp[\"UploadSuccessful\"] == 'true' ? true : resp.ErrorResponse\n end",
"def set_audio_upl... | [
"0.60508394",
"0.60422975",
"0.59490997",
"0.59328616",
"0.5852117",
"0.577434",
"0.56545883",
"0.5580991",
"0.5579508",
"0.55746865",
"0.5565497",
"0.55517715",
"0.553066",
"0.55009806",
"0.54924077",
"0.54885375",
"0.5478615",
"0.54373944",
"0.5430214",
"0.54101914",
"0.540... | 0.6884488 | 0 |
Generates a registration key for use with the course. | def generate_registration_key
self.registration_key = 'C'.freeze + SecureRandom.base64(8)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_key; end",
"def generate_registration_key(components)\n string_to_encode = components.join('|')\n\n Digest::MD5.hexdigest(string_to_encode)\n end",
"def generate_user_key\n\t\tself.key = loop do\n random_hex = SecureRandom.urlsafe_base64\n break random_hex unless... | [
"0.7567376",
"0.7466668",
"0.68773484",
"0.6737915",
"0.6720664",
"0.67189175",
"0.66886556",
"0.66753656",
"0.66753656",
"0.6663184",
"0.6658071",
"0.6612307",
"0.6592411",
"0.6568493",
"0.6560976",
"0.65485245",
"0.653845",
"0.6535912",
"0.6535912",
"0.6526784",
"0.65215755... | 0.82896674 | 0 |
Test if the course has a root folder. | def root_folder?
if new_record?
material_folders.find(&:root?).present?
else
material_folders.find_by(parent: nil).present?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root?\n \tfolder_id.nil?\n end",
"def is_root?\n @path == '/' || @path == ''\n end",
"def is_root?()\n @rootpath == @path\n end",
"def root?\n !self.hier? || self.path == '/' || self.path.to_s.empty?\n end",
"def root?\n #%r{\\A/+\\z} =~ @path ? true : false\n @absolute and... | [
"0.7659787",
"0.75953543",
"0.75504994",
"0.75484115",
"0.7547903",
"0.72686625",
"0.7230413",
"0.7196258",
"0.7129947",
"0.700059",
"0.68827796",
"0.68824035",
"0.68342066",
"0.68228096",
"0.6741974",
"0.6735495",
"0.67177004",
"0.6713444",
"0.6677862",
"0.6677862",
"0.66391... | 0.76919776 | 0 |
Register a record with the current transaction so that its after_commit and after_rollback callbacks can be called. | def add_transaction_record(record)
current_transaction.add_record(record)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_transaction(*)\n @connection.add_transaction_record(self)\n end",
"def after_commit(&blk)\n ActiveRecord::Base.connection.add_transaction_record(\n AfterCommitWrapper.new(&blk)\n )\n end",
"def register_tx(data)\n transaction(:raw_register, data)\n end",
"def in... | [
"0.67611736",
"0.6569975",
"0.580643",
"0.5750828",
"0.572886",
"0.572886",
"0.56294",
"0.5553481",
"0.5507917",
"0.5484063",
"0.5471472",
"0.5470923",
"0.5438455",
"0.54281294",
"0.5419102",
"0.5401728",
"0.53990597",
"0.53990597",
"0.5393163",
"0.5388992",
"0.5381024",
"0... | 0.7074739 | 0 |
Validate and submit the request | def submit!
raise InvalidRequest.new(self) unless valid?
command.call(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend",
"def submit; end",
"def perform\n validate_data_from_requests\n end",
"def request \n\t\t\tif self.valid?\n\t\t\t\tpath = \"/#{Base.config.api_path}/#{self.request_action}\"\n\t\t\t\tconnection.post(path, self.to_xml).tap d... | [
"0.711916",
"0.7014459",
"0.6919038",
"0.6829978",
"0.6788692",
"0.67806745",
"0.6761566",
"0.67257017",
"0.6695757",
"0.6630653",
"0.6606051",
"0.654261",
"0.6488721",
"0.6460057",
"0.6430894",
"0.63586116",
"0.6322532",
"0.6321476",
"0.6309891",
"0.6234208",
"0.6222027",
... | 0.7029805 | 1 |
Triangulation subroutine Takes as input vertices in array vertices Returned is a list of triangular faces in the array tris These triangles are arranged in a consistent clockwise order. | def triangulate(vertices)
edges = []
tris = []
# sort by X coord
vertices = vertices.sort_by {|p|p.x}
# center/radius cache used by circum_circle
cc_cache = {}
# Set up the supertriangle
# This is a triangle which encompasses all the sample points.
# The supertriangle coordinates are ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangulate(geometry)\n ring = geometry.exterior_ring\n\n input = ring.points.map { |point| [point.x, point.y] }\n input.pop if input.first == input.last\n\n cdt = Poly2Tri::CDT.new(input)\n cdt.triangulate!\n cdt.triangles\n end",
"def validate_triangulation(triangles, messa... | [
"0.5961779",
"0.59357077",
"0.57481325",
"0.56980664",
"0.5694085",
"0.55993134",
"0.5536002",
"0.5523026",
"0.55033845",
"0.54762787",
"0.54762787",
"0.54664916",
"0.5460731",
"0.54319644",
"0.54158217",
"0.54020816",
"0.5386715",
"0.5336958",
"0.5319766",
"0.5317978",
"0.53... | 0.7567029 | 0 |
Return TRUE if a point p is inside the circumcircle made up of the points p1, p2, p3 The circumcircle center is returned in (xc,yc) and the radius r The return value is an array [ inside, xc, yc, r ] Takes an optional cache hash to use for radius/center caching NOTE: A point on the edge is inside the circumcircle | def circum_circle(p, p1, p2, p3, cache = nil)
dx,dy,rsqr,drsqr = []
cached = cache && cache[[p1, p2, p3]]
xc, yc, r = []
rsqr = 0
if cached
xc, yc, r, rsqr = cached
else
# Check for coincident points
if (points_are_coincident(p1,p2) || points_are_coincident(p2,p3) || points_are_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point_in_circle(p, c)\n difference_v = T_VECTORS.pop.set(p) - c.position\n radius_sq = c.r * c.r\n distance_sq = difference_v.lengthsq\n T_VECTORS.push(difference_v)\n # If the distance between is smaller than the radius then the point is inside the circle.\n distance_... | [
"0.6527931",
"0.64388806",
"0.6419674",
"0.6232615",
"0.6070144",
"0.60322005",
"0.59882295",
"0.5920445",
"0.5892221",
"0.58235496",
"0.5785036",
"0.57087463",
"0.56787616",
"0.567436",
"0.56622255",
"0.5594087",
"0.55539906",
"0.5534976",
"0.5505675",
"0.55012363",
"0.54830... | 0.7627279 | 0 |
The token_type of the token_permission_type Returns String | def to_s
token_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n self.token_type\n end",
"def token_type; end",
"def token_type\n \"Bearer\"\n end",
"def getTokenKind()\r\n return @curr_token.id\r\n end",
"def token_type\n 'Bearer'\n end",
"def parse_token_type\n token_type = get_element('//t:RequestSecurityTokenResponse/t:Token... | [
"0.78728765",
"0.7169333",
"0.68952453",
"0.6755076",
"0.6750078",
"0.6668135",
"0.66671294",
"0.6665158",
"0.66342777",
"0.65830404",
"0.6532922",
"0.6527771",
"0.64109445",
"0.638725",
"0.63509697",
"0.63202524",
"0.62928003",
"0.6112256",
"0.6112256",
"0.610819",
"0.610085... | 0.80233765 | 0 |
GET /prd_attributes/new GET /prd_attributes/new.xml | def new
@prd_attribute = PrdAttribute.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @prd_attribute }
format.json { render :json => @prd_attribute }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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_type }\n end\n end",
"def new\n @actattribute = Actattribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml... | [
"0.71981746",
"0.70892644",
"0.70838976",
"0.70710653",
"0.7034725",
"0.68184686",
"0.673044",
"0.66846985",
"0.66785336",
"0.6670787",
"0.6628466",
"0.65922934",
"0.65876406",
"0.6562596",
"0.65579057",
"0.6534814",
"0.6501297",
"0.648799",
"0.6471098",
"0.64651185",
"0.6458... | 0.792203 | 0 |
POST /prd_attributes POST /prd_attributes.xml | def create
@prd_attribute = PrdAttribute.new
@prd_attribute.bill_type_id = params[:prd_attribute]['bill_type'].to_i
@prd_attribute.name = params[:prd_attribute]['name']
@prd_attribute.rollover = params[:prd_attribute]['rollover']
@prd_attribute.code = params[:prd_attribute]['code']
@prd_attrib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @prd_attribute = PrdAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prd_attribute }\n format.json { render :json => @prd_attribute }\n end\n end",
"def create\n @idp_attribute = IdpAttribute.new(idp_attribute_params)\n\n... | [
"0.6226755",
"0.6016898",
"0.59168947",
"0.58473545",
"0.5731617",
"0.573151",
"0.5638003",
"0.561468",
"0.5600245",
"0.5581907",
"0.5556145",
"0.55492705",
"0.55184126",
"0.55076",
"0.54967743",
"0.5494441",
"0.54814786",
"0.5480252",
"0.54514563",
"0.5427169",
"0.5426517",
... | 0.6485095 | 0 |
PUT /prd_attributes/1 PUT /prd_attributes/1.xml | def update
@prd_attribute = PrdAttribute.find(params[:id])
@prd_attribute.code = params[:prd_attribute]['code']
@prd_attribute.name = params[:prd_attribute]['name']
@prd_attribute.rollover = params[:prd_attribute]['rollover']
@prd_attribute.description = params[:prd_attribute]['description']
@p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @catalog_product_attributes = CatalogProductAttributes.find(params[:id])\n\n respond_to do |format|\n if @catalog_product_attributes.update_attributes(params[:catalog_product_attributes])\n flash[:notice] = 'CatalogProductAttributes was successfully updated.'\n format.html { r... | [
"0.64087325",
"0.6311469",
"0.61315656",
"0.60436094",
"0.58606386",
"0.5845868",
"0.5800207",
"0.57984424",
"0.5787223",
"0.57798105",
"0.5776507",
"0.5734052",
"0.57293284",
"0.572496",
"0.5718098",
"0.57012695",
"0.5687673",
"0.5682747",
"0.5672973",
"0.56634986",
"0.56619... | 0.645485 | 0 |
DELETE /prd_attributes/1 DELETE /prd_attributes/1.xml | def destroy
@prd_attribute = PrdAttribute.find(params[:id])
@prd_attribute.destroy
#delete_rules()
respond_to do |format|
format.html { redirect_to(prd_attributes_url) }
format.xml { head :ok }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @catalog_product_attributes = CatalogProductAttributes.find(params[:id])\n @catalog_product_attributes.destroy\n\n respond_to do |format|\n format.html { redirect_to(catalog_product_attributes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @actattribute = A... | [
"0.67909056",
"0.66456294",
"0.6457805",
"0.644428",
"0.643452",
"0.64122725",
"0.64104486",
"0.63862956",
"0.6329849",
"0.6303584",
"0.63021",
"0.63020825",
"0.62941283",
"0.62666476",
"0.6243546",
"0.62334406",
"0.62334406",
"0.62170446",
"0.62099105",
"0.62030715",
"0.6202... | 0.72387856 | 0 |
Returns true if the given node is valid | def is_valid(node = @current_node)
return node != nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n inner_root.children.detect{|node| node.valid? == false} == nil # should be explicitely nil !!\n end",
"def valid?\n return true unless applicable?\n\n inclusive = spec['inclusive']\n\n case inclusive\n when true, false\n nodes.size > 0\n else\n ... | [
"0.72213846",
"0.7154274",
"0.7041897",
"0.70019966",
"0.69212425",
"0.67188084",
"0.6704628",
"0.66957223",
"0.66861844",
"0.6680971",
"0.6680971",
"0.66616297",
"0.66254604",
"0.66079724",
"0.6578558",
"0.653918",
"0.6476036",
"0.6467516",
"0.645639",
"0.64520454",
"0.64463... | 0.8611224 | 0 |
Sets the current node. | def set_current(node)
@current_node = node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_node(val)\n self.node = val\n self\n end",
"def set_node(val)\n self.node = val\n self\n end",
"def current=(node)\n\t\t\t@try_current[-1] = node\n\t\tend",
"def node=(node)\n @node = node\n end",
"def node=(val)\r\n case val\r\n when Node, NilClass\r\n @nod... | [
"0.7911279",
"0.7911279",
"0.7470951",
"0.739517",
"0.7286752",
"0.69640344",
"0.69640344",
"0.69106114",
"0.689993",
"0.689993",
"0.689993",
"0.6890156",
"0.6852821",
"0.6783472",
"0.67271954",
"0.670349",
"0.6699798",
"0.6671914",
"0.6670677",
"0.6619546",
"0.6579447",
"0... | 0.85755503 | 0 |
Returns the root node of the current xml document | def root
return @doc == nil ? nil : @doc.root;
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root_node\n if @root_node.nil?\n # TODO: Fix this so that added content at the end of the file doesn't\n # break this stuff.\n # E.g.: http://smogzer.tripod.com/smog.rdf\n # ===================================================================\n begin\n if self.xm... | [
"0.86464584",
"0.80143654",
"0.7838439",
"0.78090966",
"0.78021294",
"0.77411765",
"0.75728893",
"0.7465455",
"0.7465455",
"0.7384013",
"0.7384013",
"0.7369182",
"0.7290095",
"0.7176249",
"0.71647877",
"0.7164394",
"0.7126299",
"0.7118492",
"0.7091329",
"0.700699",
"0.6981143... | 0.80426675 | 1 |
Returns the line of the given node | def line(node = @current_node)
return is_valid(node) ? node.line : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line\n @line ||= Line.get(@attrs['LineCode'])\n end",
"def line\n return 1 unless lexing_context && locator\n locator.line_for_offset(lexing_context[:end_offset])\n end",
"def line\n @line ||= Line.get(@attrs['Line'])\n end",
"def node_at(line, column); end",
"def node_at(line, c... | [
"0.71782935",
"0.7125175",
"0.70600444",
"0.6977402",
"0.69341874",
"0.678375",
"0.67634153",
"0.6708213",
"0.670025",
"0.6694176",
"0.6694176",
"0.6694176",
"0.66926646",
"0.66926646",
"0.66926646",
"0.66926646",
"0.66926646",
"0.66711825",
"0.6632219",
"0.6618952",
"0.65936... | 0.87152517 | 0 |
Returns an array of children of the current node | def children
return children_of @current_node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children\n node.children\n end",
"def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end",
"def get_children\n return children\n end",
"def get_children\n return @children\n end",
"def children\n self.node.... | [
"0.85183483",
"0.8328256",
"0.8261618",
"0.8234224",
"0.8159584",
"0.8103686",
"0.8103686",
"0.8075742",
"0.8075742",
"0.8075742",
"0.8053072",
"0.7976374",
"0.7973109",
"0.7956186",
"0.79393244",
"0.79280365",
"0.7924833",
"0.7895326",
"0.7877886",
"0.7867015",
"0.78425753",... | 0.87402105 | 0 |
Extract children from an object into an array. Intended for use with Node and NodeSet objects | def extract_children_from(obj)
if obj.nil? then
return []
end
output = []
set = obj.children
set.each do |node|
output << node
end
return output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end",
"def children\n @children ||= {}.with_indifferent_access\n end",
"def children\n result = []\n @children.each do |_, child_group|\n result.concat(child_group... | [
"0.7106915",
"0.6998907",
"0.6959831",
"0.6923284",
"0.69081885",
"0.6811364",
"0.6805195",
"0.6761696",
"0.67529523",
"0.6745616",
"0.6731596",
"0.67303765",
"0.67075676",
"0.6700036",
"0.6700036",
"0.6700036",
"0.669388",
"0.66851604",
"0.66851604",
"0.6681883",
"0.6660352"... | 0.8473741 | 0 |
Returns the attribute keys of the current node | def attr_keys
return attr_keys_in @current_node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keys\n attribute_nodes.map(&:node_name)\n end",
"def attr_keys_in(node)\n\t\treturn is_valid(node) ? node.keys : nil\n\tend",
"def keys\n @attributes.keys\n end",
"def attribute_keys\n return [] unless self[:attributes]\n self[:attributes].keys\n end",
"de... | [
"0.90559864",
"0.81568533",
"0.80238926",
"0.798886",
"0.7812277",
"0.77941734",
"0.7712413",
"0.7712413",
"0.7712413",
"0.7467831",
"0.74057436",
"0.73241997",
"0.723899",
"0.7219216",
"0.7219216",
"0.7219216",
"0.7219216",
"0.7200891",
"0.7109218",
"0.7092491",
"0.70062256"... | 0.8992906 | 1 |
Returns the attribute keys of the given node | def attr_keys_in(node)
return is_valid(node) ? node.keys : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keys\n attribute_nodes.map(&:node_name)\n end",
"def attr_keys\n\t\treturn attr_keys_in @current_node\n\tend",
"def attributes_of(node)\n\t\tmap = Hash.new\n\t\t\n\t\tif !is_valid node then\n\t\t\treturn map\n\t\tend\n\t\t\n\t\tvarKeys = attr_keys_in node\n\t\tif !varKeys.nil? then\n\t\t\tvarKe... | [
"0.8781843",
"0.81699824",
"0.77056885",
"0.7474048",
"0.7474048",
"0.7474048",
"0.74337006",
"0.73340183",
"0.7273205",
"0.72146",
"0.7184335",
"0.6848043",
"0.68173",
"0.6806917",
"0.6763627",
"0.6697388",
"0.664985",
"0.664917",
"0.664917",
"0.664917",
"0.664917",
"0.664... | 0.8404115 | 1 |
Returns a hash of attributes for the current node | def attributes
return attributes_of @current_node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes\n attribute_nodes.each_with_object({}) do |node, hash|\n hash[node.node_name] = node\n end\n end",
"def hash\n @attrs\n end",
"def attributes\n node[1]\n end",
"def hash\n node_id.hash\n end",
"def attributes_of(node)\n\t\tmap =... | [
"0.80647045",
"0.75737137",
"0.7371458",
"0.7178217",
"0.7173893",
"0.7097687",
"0.70500326",
"0.701273",
"0.69741315",
"0.69741315",
"0.69741315",
"0.69466156",
"0.6904702",
"0.68266094",
"0.68118197",
"0.67625374",
"0.67510116",
"0.67456764",
"0.6737818",
"0.6679685",
"0.66... | 0.75875473 | 1 |
Returns a hash of attributes for a given node | def attributes_of(node)
map = Hash.new
if !is_valid node then
return map
end
varKeys = attr_keys_in node
if !varKeys.nil? then
varKeys.each do |key|
map[key] = node[key]
end
end
return map
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes\n attribute_nodes.each_with_object({}) do |node, hash|\n hash[node.node_name] = node\n end\n end",
"def xml_node_to_hash(nokogiri_node)\n\t\t\tattributes = Hash.new\n\n\t\t\tnokogiri_node.each do |k,v|\n\t\t\t\tattributes[k.to_sym] = v.value\n\t\t\tend\n\n\t\t\treturn a... | [
"0.7783991",
"0.7623897",
"0.7268262",
"0.72092825",
"0.7129924",
"0.6954855",
"0.6922437",
"0.6921246",
"0.6772712",
"0.6702666",
"0.66946703",
"0.6683129",
"0.6681362",
"0.66218",
"0.661858",
"0.654317",
"0.6523913",
"0.6523913",
"0.6523913",
"0.6508815",
"0.64791906",
"0... | 0.7868834 | 0 |
Returns the parent of the current node | def parent
return parent_of @current_node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent\n unless @node.send(@parent).nil?\n @node = @node.send(@parent)\n end\n end",
"def parent_node(node)\n return node.respond_to?(:parent) ? node.parent : node\n end",
"def parent_of node\n\t\treturn is_valid(node) ? node.parent : nil\n\tend",
"def parent\n tree.parent_fo... | [
"0.82663214",
"0.8248503",
"0.8191364",
"0.81071085",
"0.804401",
"0.78610647",
"0.77705085",
"0.7767879",
"0.7737364",
"0.76905674",
"0.7676077",
"0.7650954",
"0.7615633",
"0.7582549",
"0.7560485",
"0.74919134",
"0.7448836",
"0.7413001",
"0.7413001",
"0.7413001",
"0.7413001"... | 0.8939264 | 0 |
Returns the parent of the given node | def parent_of node
return is_valid(node) ? node.parent : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_node(node)\n return node.respond_to?(:parent) ? node.parent : node\n end",
"def parent_node(node)\n node.find(:xpath, '..', wait: 0, visible: false)\n end",
"def parent(node)\n parent = adjacent(node, :direction => :in)\n raise JumokuError, \"Inconsistent directed tree (mor... | [
"0.87993264",
"0.82078636",
"0.8191509",
"0.80812955",
"0.804595",
"0.7976806",
"0.7803221",
"0.775602",
"0.7676837",
"0.7553943",
"0.7402786",
"0.7358889",
"0.73332936",
"0.7318839",
"0.73108757",
"0.71889436",
"0.7099725",
"0.70975626",
"0.69850814",
"0.6962282",
"0.6937197... | 0.85704195 | 1 |
Returns the previous element of the current node | def prev_element
return prev_element_of @current_node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_prev()\n return @prev_node\n end",
"def prev_element_of(node)\n\t\treturn valid(node) ? node.previous_element : nil\n\tend",
"def previous\n DOM::Element.from_node `#{@el}.previousElementSibling || Opal.nil`\n end",
"def prev_sibling\n\t\treturn prev_sibling_of @current_node\n\tend",
"d... | [
"0.89247125",
"0.86669534",
"0.86544216",
"0.84210217",
"0.83924085",
"0.83458596",
"0.8042985",
"0.7991289",
"0.79548264",
"0.79286736",
"0.79207647",
"0.7859692",
"0.7843736",
"0.78401285",
"0.777309",
"0.77520114",
"0.773126",
"0.7729394",
"0.76284647",
"0.7594287",
"0.753... | 0.91436607 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.