query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
GET /reviews/new GET /reviews/new.json
def new @product = Product.new respond_to do |format| format.html #If it's a html request this line tell rails to look for new_release.html.erb in your views directory format.js #If it's a js request this line tell rails to look for new_release.js.erb in your views directory end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end", "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }...
[ "0.81673604", "0.784093", "0.784093", "0.784093", "0.784093", "0.784093", "0.784093", "0.78267056", "0.77887195", "0.7446452", "0.72677046", "0.7107704", "0.7100102", "0.7100102", "0.7013424", "0.7013424", "0.7013424", "0.7013424", "0.7013424", "0.7013424", "0.7013424", "0....
0.0
-1
POST /reviews POST /reviews.json
def create @product = Product.new(myparams) respond_to do |format| if @product.save format.html {redirect_to @product, notice: 'Product was successfully created.'} else format.html { render action: "new" } format.json { render json: @product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @review = current_author.reviews.create(review_params)\n render json: @review, status: 201\n end", "def create\n review = course.reviews.new(review_params)\n \n if review.save\n render json: ReviewSerializer.new(review).serialized_json\n else\n render...
[ "0.7576602", "0.75637454", "0.7493771", "0.747111", "0.747111", "0.747111", "0.7300367", "0.72989565", "0.7201945", "0.7201945", "0.71795744", "0.717838", "0.71406734", "0.7120858", "0.7118763", "0.7002209", "0.6988962", "0.6979939", "0.69722533", "0.69606304", "0.6958055", ...
0.0
-1
PUT /reviews/1 PUT /reviews/1.json
def update respond_to do |format| if @product.update_attributes(myparams) format.html { redirect_to @product, notice: 'Product was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def update_review\n @review = Review.find(params[:id])\n @review.update(params[:review])\n redirect \"/reviews/#{@review.id}\"\n end", "def update\n @review = Review.find(param...
[ "0.74415576", "0.7076267", "0.695862", "0.695862", "0.695862", "0.69368684", "0.69190276", "0.69046", "0.67975336", "0.6762971", "0.6762971", "0.6762971", "0.6762971", "0.675068", "0.6626877", "0.6621346", "0.66203684", "0.66143364", "0.6560194", "0.6560194", "0.6560194", "...
0.0
-1
DELETE /reviews/1 DELETE /reviews/1.json
def destroy @product.destroy respond_to do |format| format.html { redirect_to products_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reviews_delete(id)\n delete id.to_s\n _response_status(204, last_response)\n end", "def destroy\n @review = reviewable.reviews.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewable_reviews_url(reviewable) }\n format.json { head :no_co...
[ "0.78339803", "0.7793395", "0.7784284", "0.77726567", "0.77726567", "0.77726567", "0.77726567", "0.77726567", "0.7675433", "0.7675356", "0.76534444", "0.76534444", "0.76534444", "0.7640298", "0.74997073", "0.74997073", "0.7471851", "0.7413653", "0.7411421", "0.7411421", "0.74...
0.0
-1
GET /notifies/1 GET /notifies/1.json
def show @notify = Notify.find(params[:id]) @notify.is_read = true ; @notify.save respond_to do |format| format.html # show.html.erb format.json { render json: @notify } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @notifies = Notify.where(:course_id => @course.id).order('created_at DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @course.notifies }\n end\n end", "def show\n @notify = @course.notifies.find(params[:id])\n ...
[ "0.6844212", "0.67529", "0.6646549", "0.64029044", "0.6353408", "0.632896", "0.62753147", "0.6224504", "0.62209016", "0.62145936", "0.61955875", "0.617665", "0.61640614", "0.61634034", "0.6156989", "0.6152265", "0.61198914", "0.6090113", "0.6030251", "0.60213304", "0.6019659"...
0.0
-1
GET /notifies/new GET /notifies/new.json
def new @notify = Notify.new respond_to do |format| format.html # new.html.erb format.json { render json: @notify } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @notice = @person.notices.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end", "def new\n @eve_notification = EveNotification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { rende...
[ "0.72891724", "0.720788", "0.7190865", "0.71595454", "0.70646733", "0.7041957", "0.70204496", "0.6970532", "0.6970532", "0.6970532", "0.6970532", "0.69502145", "0.6931167", "0.6900661", "0.6889475", "0.6877958", "0.687424", "0.6851719", "0.68263197", "0.67974806", "0.6780711"...
0.7662222
0
POST /notifies POST /notifies.json
def create @notify = Notify.new(params[:notify]) respond_to do |format| if @notify.save format.html { redirect_to @notify, notice: 'Notify was successfully created.' } format.json { render json: @notify, status: :created, location: @notify } else format.html { render action: "new" } format.json { render json: @notify.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify(params)\n client.post('/notify', params)\n end", "def create\n @notification = Notification.new(notification_params)\n if @notification.save\n Notifier.send_notification(@notification)\n render json: \"Created succesfully\", status: :ok\n else\n render json: @notificati...
[ "0.6908091", "0.6752805", "0.67457795", "0.66866416", "0.661315", "0.6523518", "0.6479741", "0.64321166", "0.6428187", "0.63793534", "0.63128704", "0.6279602", "0.6241167", "0.61394966", "0.61318505", "0.60862654", "0.60823995", "0.6075425", "0.6070833", "0.60698074", "0.6069...
0.6451875
7
PUT /notifies/1 PUT /notifies/1.json
def update @notify = Notify.find(params[:id]) respond_to do |format| if @notify.update_attributes(params[:notify]) format.html { redirect_to @notify, notice: 'Notify was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @notify.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateNotification\n read = convertToBoolean(read)\n delivered = convertToBoolean(delivered)\n\n parameters={id_user: params[:id_user].to_i, subject: params[:subject].to_s, content: params[:content].to_s, read: params[:read], delivered: params[:delivered] }\n options = {\n :body =>...
[ "0.650636", "0.6337263", "0.6284009", "0.61724764", "0.61609596", "0.60869235", "0.6076981", "0.6038033", "0.6009348", "0.5997258", "0.5989609", "0.5981908", "0.596619", "0.5934886", "0.5934886", "0.5934886", "0.5931656", "0.5931656", "0.59255636", "0.5918346", "0.5913821", ...
0.6129593
5
DELETE /notifies/1 DELETE /notifies/1.json
def destroy @notify = Notify.find(params[:id]) @notify.destroy respond_to do |format| format.html { redirect_to notifies_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @notification = Notification.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notifier.destroy\n respond_to do |format|\n format.htm...
[ "0.72010946", "0.7198548", "0.7174811", "0.71705055", "0.71705055", "0.71705055", "0.71705055", "0.7150994", "0.7103595", "0.7074628", "0.7058735", "0.70096505", "0.6997625", "0.69692254", "0.6960587", "0.69497055", "0.6943368", "0.69406766", "0.6911222", "0.691012", "0.69092...
0.7402391
0
Define batch operation inside a block
def initialize &blk @writers = [] instance_exec &blk if block_given? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch\n yield if block_given?\n end", "def batch(*args, &block)\n raise \"Block required!\" unless block_given?\n do_op(:batch, *args, &block)\n end", "def batch(*args, &block)\n raise \"Block required!\" unless block_given?\n do_op(:batch, *args, &block)\n ...
[ "0.81389767", "0.76496035", "0.76496035", "0.73745054", "0.7248513", "0.72482705", "0.72371423", "0.6968127", "0.6911174", "0.68711305", "0.68711305", "0.6754351", "0.6674515", "0.6655991", "0.6643987", "0.66007435", "0.65276766", "0.64920634", "0.645385", "0.645385", "0.6453...
0.0
-1
Define a write operation for the batch.
def write filenames, values, options={} w = MultiExiftool::Writer.new(filenames, values, options) @writers << w end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write\n command :write\n self\n end", "def write\n write_data\n end", "def add_write(key, value, binary = false)\n if (@is_commit)\n raise RuntimeError.new('No further request supported after a commit!')\n end\n @requests << {'write' => {key => JSONConnection.encode_va...
[ "0.66145045", "0.6332422", "0.6292489", "0.625028", "0.6101671", "0.6101671", "0.6004967", "0.5946159", "0.5926048", "0.5915748", "0.5846598", "0.57803243", "0.5725235", "0.5703362", "0.5661108", "0.56598943", "0.5652876", "0.5652876", "0.5652876", "0.5652799", "0.5652799", ...
0.0
-1
Getting the commandline arguments which would be executed when calling write. It could be useful for logging, debugging or whatever.
def exiftool_args @writers.map {|w| w.exiftool_args + ['-execute']}.flatten end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arguments\n arguments = visit_node_for_arguments([], root, false)\n # Don't specify -write for the last output file.\n arguments[-2] == '-write' or\n raise \"[BULLDOG BUG]: expected second last argument to be -write in: #{arguments.inspect}\"\n arguments.delete_at(-2)\n ...
[ "0.6826597", "0.6823561", "0.67863256", "0.6747927", "0.67327046", "0.6711787", "0.6702479", "0.6702479", "0.6702479", "0.6702479", "0.6702479", "0.6702479", "0.6702479", "0.6636234", "0.6636234", "0.6558838", "0.6475331", "0.640297", "0.6395194", "0.6392166", "0.6387632", ...
0.597366
50
Returns the most directly responsible party for an appeal when it is at the Board, mirroring Legacy Appeals' location code in VACOLS
def assigned_to_location return COPY::CASE_LIST_TABLE_POST_DECISION_LABEL if root_task&.status == Constants.TASK_STATUSES.completed active_tasks = tasks.where(status: [Constants.TASK_STATUSES.in_progress, Constants.TASK_STATUSES.assigned]) return most_recently_assigned_to_label(active_tasks) if active_tasks.any? on_hold_tasks = tasks.where(status: Constants.TASK_STATUSES.on_hold) return most_recently_assigned_to_label(on_hold_tasks) if on_hold_tasks.any? return most_recently_assigned_to_label(tasks) if tasks.any? status_hash[:type].to_s.titleize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coalition_leader(party)\n natural_leader = @parties.find {|p| p.id == party.natural_leader_id }\n natural_leader || @parties.max_by(&:seats_won)\n end", "def best_offense\n offense_suite\n best_offense_id = @average_goals_by_id.invert.max[1]\n @team_name_by_id[best_offense_id]\n end", "def...
[ "0.5891766", "0.5829512", "0.5767095", "0.54307795", "0.5329864", "0.531303", "0.52799463", "0.5225691", "0.5195573", "0.51468146", "0.514602", "0.51007617", "0.5095855", "0.50956285", "0.5078558", "0.5067649", "0.5025033", "0.5023163", "0.5015977", "0.5013058", "0.500838", ...
0.0
-1
For now power_of_attorney returns the first claimant's power of attorney
def power_of_attorney claimants.first&.power_of_attorney end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power_of_attorney\n claimants.first.power_of_attorney if claimants.first\n end", "def calc_am_pure_power(user, target)\n 2\n end", "def object_of_power; end", "def power\n data.power\n end", "def power\r\n return @access >> 26\r\n end", "def power_bonus(att_id)\n\t\t\t@cid = a...
[ "0.82929695", "0.6228024", "0.61443865", "0.59521675", "0.592249", "0.5920519", "0.59185344", "0.59052867", "0.5869389", "0.58402663", "0.5815954", "0.5793008", "0.57913446", "0.5772158", "0.5762761", "0.5740735", "0.57341623", "0.5720131", "0.57065344", "0.5697112", "0.56900...
0.78796595
2
needed for appeal status api
def appeal_status_id "A#{id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def statuses; end", "def retrieve_status\n \n end", "def status(*) end", "def status\n end", "def status\n ...
[ "0.7415168", "0.7415168", "0.7415168", "0.7415168", "0.7415168", "0.7415168", "0.7415168", "0.7415168", "0.7415168", "0.72959346", "0.7189796", "0.71434397", "0.7021668", "0.7021668", "0.7021668", "0.7021668", "0.7007037", "0.67824924", "0.6777188", "0.6684741", "0.6660862", ...
0.617646
59
rubocop:disable CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity
def fetch_pre_decision_status if pending_schedule_hearing_task? :pending_hearing_scheduling elsif hearing_pending? :scheduled_hearing elsif evidence_submission_hold_pending? :evidentiary_period elsif at_vso? :at_vso elsif distributed_to_a_judge? :decision_in_progress else :on_docket end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def probers; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def strategy; end", "def refutal()\n end", "def used?; end", "def suivre; end", "def isolated; ...
[ "0.7505564", "0.62114626", "0.62114626", "0.62113", "0.6049034", "0.6038803", "0.6038803", "0.6038803", "0.6038803", "0.60220784", "0.60151976", "0.58800304", "0.58698237", "0.58152044", "0.58152044", "0.58062404", "0.578759", "0.578759", "0.578759", "0.5780685", "0.5780685",...
0.0
-1
rubocop:enable CyclomaticComplexity rubocop:enable Metrics/PerceivedComplexity rubocop:disable Metrics/MethodLength rubocop:disable CyclomaticComplexity
def fetch_details_for_status case fetch_status when :bva_decision { issues: api_issues_for_status_details_issues(decision_issues) } when :ama_remand { issues: api_issues_for_status_details_issues(decision_issues) } when :post_bva_dta_decision post_bva_dta_decision_status_details when :bva_decision_effectuation { bva_decision_date: decision_event_date, aoj_decision_date: decision_effectuation_event_date } when :pending_hearing_scheduling { type: "video" } when :scheduled_hearing api_scheduled_hearing_status_details when :decision_in_progress { decision_timeliness: AppealSeries::DECISION_TIMELINESS.dup } else {} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def probers; end", "def schubert; end", "def refutal()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def strategy; end", "def suivre; end", "def offences_by; end", "def oper...
[ "0.73557204", "0.6193672", "0.6193672", "0.61274225", "0.5964895", "0.5862997", "0.5857945", "0.5857945", "0.5857945", "0.5857945", "0.58357155", "0.58067286", "0.57552665", "0.57416034", "0.57416034", "0.5735425", "0.57157385", "0.5714775", "0.5706094", "0.5706094", "0.56721...
0.0
-1
rubocop:enable CyclomaticComplexity rubocop:enable Metrics/MethodLength
def post_bva_dta_decision_status_details issue_list = remanded_sc_decision_issues { issues: api_issues_for_status_details_issues(issue_list), bva_decision_date: decision_event_date, aoj_decision_date: remand_decision_event_date } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def probers; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def strategy; end", "def used?; end", "def suivre; end", "def custom; en...
[ "0.7652754", "0.6421851", "0.6421851", "0.63809973", "0.6231824", "0.6214224", "0.6214224", "0.6214224", "0.6214224", "0.6161234", "0.60857505", "0.6006304", "0.60033596", "0.59283596", "0.59283596", "0.5927897", "0.5927897", "0.5892361", "0.58667564", "0.58412385", "0.584123...
0.0
-1
we always want to show ratings on intake
def can_contest_rating_issues? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n set_rating\n end", "def rating\n review.rating if review\n end", "def num_ratings \n 5\n end", "def rating\n rating_calculator.rate(raters)\n end", "def rating\r\n\t\t@rating\r\n\tend", "def rating\n 0\n end", "def rating\n @rating\n end", "def rating\n #...
[ "0.733439", "0.70936286", "0.70198995", "0.6919473", "0.6864956", "0.6845459", "0.67886686", "0.6786422", "0.67759085", "0.6765408", "0.67482823", "0.67391205", "0.67296636", "0.6726875", "0.6710505", "0.65838486", "0.6528316", "0.6513746", "0.6502415", "0.6496189", "0.648487...
0.0
-1
def set_light(name, action) end
def set_thermostat(location, temperature) #@nest.set_temperature(location, temperature) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def light(action = :toggle)\n case action\n when :on, :off\n @elements.light.values.each { |element| element.public_send(action) if element.respond_to? action }\n when :toggle\n light_off? ? light(:on) : light(:off)\n end\n end", "def switchLight _obj, _args\n \"_obj swi...
[ "0.70755255", "0.7064786", "0.69721156", "0.69661564", "0.69661564", "0.69661564", "0.6864522", "0.6674563", "0.6674563", "0.66683215", "0.66683215", "0.6631379", "0.65590173", "0.65462667", "0.65218025", "0.6516069", "0.6480886", "0.6479021", "0.64436436", "0.64235413", "0.6...
0.0
-1
Tell Nest that I am home when I leave work so that the house is warm when I actually get home
def car_left_work(car) @nest.home! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_home\n return unless can_go_home? && wants_to_go_home?\n pack_bags\n get_tickets\n board_plane\nend", "def work_out\n self.happiness = @happiness + 2\n self.hygiene = @hygiene - 3\n \"♪ another one bites the dust ♫\"\n end", "def do_homework\n return if backlog.empty?\n\n ...
[ "0.624075", "0.57610273", "0.5733039", "0.5732569", "0.57321596", "0.5643529", "0.5603236", "0.55918634", "0.5584835", "0.55800694", "0.55791277", "0.5536771", "0.551509", "0.5477508", "0.5473875", "0.54711694", "0.54683113", "0.5465079", "0.5447729", "0.5415201", "0.54151344...
0.7031587
0
When I get home, turn on the porch light if it's night
def car_arrived_home(car) if self.is_night? @hue.on("Porch", @@HUE_FULL_BRIGHTNESS , @@HUE_WARM) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_light_on\n puts \"*** switch_light_on\"\n true\nend", "def on\n set_power(\"on\", \"smooth\",1000)\n end", "def turnLightsOn\n @lightsOn = true\n end", "def light\n @lit = true\n \n @visible = true\n @distance_to_player = self.distance(player.location)\n @tur...
[ "0.6639072", "0.6410299", "0.64044005", "0.63252604", "0.6312118", "0.6280482", "0.6262816", "0.6262816", "0.62213415", "0.61652166", "0.6154113", "0.6139274", "0.612894", "0.6084529", "0.60606915", "0.6029116", "0.60016245", "0.5970451", "0.59455895", "0.59286743", "0.591042...
0.7500651
0
Computes the solution to equations of the form a/b = x (mod p) where a, b are given and p = Fp
def mod_inv (a, b, base = nil) base = base.nil? ? @fp : base res = Curve.ext_gcd b, base dis = res[1] x = (a - (base * dis * a)) / b Curve.mod x, base end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve\n return ((1..40).inject(:*) / ((1..20).inject(:*) ** 2))\nend", "def divmod(p0) end", "def solve(a,b,n)\n (b*a.inverse_modulo(n)) % n\nend", "def lpf (a)\r\n f = 3\r\n while (a % 2 == 0) && (a > 2)\r\n a /= 2\r\n end\r\n if a == 2\r\n return a\r\n end\r\n while f <= a\r\n if a...
[ "0.6324482", "0.6291089", "0.6045206", "0.592962", "0.5914762", "0.5885352", "0.5872081", "0.5839785", "0.58292603", "0.57683337", "0.57475543", "0.5728507", "0.5644301", "0.56398076", "0.5613875", "0.5613271", "0.56000406", "0.5549818", "0.5544975", "0.5541752", "0.553294", ...
0.567636
12
Subtracts two points on the curve See mod_add below for a description of the algorithm
def mod_sub (a, b) self.mod_add a, Ecc::Point.new(b.x, -b.y) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtract(x,y)\r\n x - y \r\nend", "def subtract a, b\n\ta - b\nend", "def -(other)\n raise TypeError, \"Subtract between Point and #{ other.class } is not defined\" unless other.is_a?(Point)\n Point.new(self.x - other.x, self.y - other.y)\n end", "def subtract(a, b)\n\treturn a - b\...
[ "0.7002318", "0.672244", "0.6706518", "0.6692486", "0.66874456", "0.6599773", "0.65433663", "0.6510937", "0.6496247", "0.6481127", "0.6481127", "0.6481127", "0.6481127", "0.64484656", "0.6442239", "0.64277405", "0.64117485", "0.6356988", "0.6305186", "0.62978077", "0.6291159"...
0.7491508
0
Adds two points on the curve
def mod_add (a, b) if b.inf return a end if a.inf return b end x1 = a.x x2 = b.x y1 = a.y y2 = b.y if x1 == x2 and y1 == -y2 return Point.new Float::INFINITY, Float::INFINITY end if x1 == x2 and y1 == y2 lambda = self.mod_inv 3 * x1 ** 2 + @a, 2 * y1 else lambda = self.mod_inv y2 - y1, x2 - x1 end x3 = Curve.mod lambda ** 2 - x1 - x2, @fp y3 = Curve.mod lambda * (x1 - x3) - y1, @fp Ecc::Point.new x3, y3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_line(point1, point2)\n end", "def addPoints(points) \n\t\t@points += points\n\tend", "def +(other_point)\n Point.new(self.x + other_point.x, self.y + other_point.y)\n end", "def addPoint( x, y) \n point = PVector.new(x, y)\n @points.push(point)\n end", "def bbpAdd(first_point, second_po...
[ "0.74962234", "0.72730726", "0.7224024", "0.695464", "0.6952536", "0.69473594", "0.6937288", "0.69153154", "0.69018894", "0.68924814", "0.67878145", "0.6770488", "0.67596537", "0.67300266", "0.67045", "0.66844267", "0.66496336", "0.6634676", "0.65250075", "0.64955175", "0.648...
0.6936576
7
Adds a point on the curve, P, to itself n times This has been implemented using the DoubleandAdd algorithm.
def mod_mult (p, n) q = p r = Point.new Float::INFINITY, Float::INFINITY while n > 0 if n % 2 == 1 r = self.mod_add r, q end q = self.mod_add q, q n = (n / 2).floor end r end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(p0) end", "def add point\n self.x += point.x\n self.y += point.y\n self\n end", "def add_to_point point\n add_to_point! point.dup\n end", "def add!(p)\n@x += p.x\n@y += p.y\nself\nend", "def add(n, p)\n return n + p\nend", "def add!(point)\r\n @x += point.x\r\n @y += ...
[ "0.67406064", "0.66404366", "0.6563374", "0.64949375", "0.64269406", "0.63768405", "0.6364868", "0.61251175", "0.60865754", "0.60459965", "0.6039418", "0.59770966", "0.5939919", "0.5935999", "0.5935999", "0.5935999", "0.5935999", "0.5867334", "0.58661383", "0.5855765", "0.580...
0.5738527
22
Which time tracking module you will use.
def tt_module mdl = read_attribute( :tt_module ) mdl.present? ? mdl : master.try(:tt_module) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_class; end", "def time_trackings\n Easybill::Api::TimeTrackings\n end", "def playtime_forever\r\n\t raw_app['playtime_forever']\r\n\t end", "def show_time\n\n end", "def get_time_label(type = \"serial\")\n \n if type == \"serial\"\n \n #ref http://stackoverflow.com/q...
[ "0.6981751", "0.64017165", "0.6151248", "0.6141517", "0.59765303", "0.59274215", "0.5882794", "0.587145", "0.58704287", "0.5851859", "0.5837378", "0.58322567", "0.58322567", "0.5773271", "0.5762978", "0.5758385", "0.57576066", "0.5752768", "0.574981", "0.5747127", "0.5747127"...
0.0
-1
Recursively sums up all stages' relative progress. This method is the heart of the software!
def relative_progress if stages.any? from_stages = stages.collect{ |pr| pr.relative_progress }.sum end sum=(relative_milestone.to_f / milestones) * relative_expected_percentage sum + from_stages.to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_stage(game, stage)\n game.cycle = self\n game.result.each { |result| stage[result - 1] += 1 }\n stages << stage\n end", "def progress\n total_steps_count = self.steps.count\n\n if total_steps_count.zero?\n 0.0\n else\n approved_steps_count = self.steps.where(state: 'app...
[ "0.63465625", "0.6313772", "0.60800815", "0.59225166", "0.5892643", "0.58419204", "0.58003575", "0.5786772", "0.573414", "0.571871", "0.56841034", "0.5656823", "0.5632879", "0.5626318", "0.5598514", "0.55951947", "0.55880904", "0.554049", "0.553995", "0.5534106", "0.55208325"...
0.78042305
0
Recursively finds the supermaster project.
def super_master master ? master.super_master : self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_project(workspace, name)\r\n project = nil\r\n if ( name != \"Parent\")\r\n project = workspace.projects.find { |p| p.name == name && p.state == \"Open\" }\r\n if project == nil\r\n print \"Project \", name, \" not found\\n\"\r\n end\r\n end\r\n project\r\nend", "def __detect_project_h...
[ "0.59155834", "0.5777824", "0.57755107", "0.5730275", "0.5728772", "0.56676817", "0.5638677", "0.560586", "0.5597221", "0.5588946", "0.5582604", "0.55790144", "0.5571555", "0.55663955", "0.5471594", "0.545317", "0.545317", "0.54037887", "0.53980625", "0.5361248", "0.5325613",...
0.59309846
0
Recursively sums up all invoices from the project and its stages.
def charged_so_far charges = stages.collect{ |pr| pr.charged_so_far }.sum invoices.collect{ |inv| inv.total }.sum + charges end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_invoice_amount(start_date, end_date)\n total = 0\n projects.each do |project|\n total += project.invoices.where(due_on_date: start_date...end_date).map(&:total_amount_inc_vat).sum\n end\n total\n end", "def calculate_invoice_total\n res = [ ]\n self.line_items.each do |item|\n ...
[ "0.68721366", "0.6070501", "0.6056011", "0.6056011", "0.6042559", "0.5907846", "0.5771606", "0.5766008", "0.56959325", "0.56777", "0.56386256", "0.5585156", "0.5567373", "0.55230254", "0.55194485", "0.5516861", "0.5503217", "0.5468044", "0.54532367", "0.5441618", "0.5422096",...
0.6412949
1
TODO: expand 'remaining_milestones', make recursive. It doesn't apply to master project.
def remaining_milestones finish - milestone end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def milestones\n process_list_response( send(:get , \"/api/v1/milestones.json\")[:body] , Unfuddled::Milestone)\n end", "def get_recalculated_milestones\n userId = params[:user_id]\n timeUnitId = params[:time_unit_id]\n moduleTitle = params[:module_title]\n\n # TODO\n # user = @use...
[ "0.7398543", "0.7002436", "0.6820392", "0.6820392", "0.67348146", "0.67230606", "0.66622704", "0.6596266", "0.65128094", "0.6463661", "0.6451744", "0.62752205", "0.6269852", "0.6267551", "0.6238759", "0.6152995", "0.61336654", "0.6023673", "0.60065", "0.6004077", "0.5991004",...
0.73773223
1
TODO: write 'remaining_hours' method.
def remaining_hours end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remaining_hours_by_day\n values_by_day(0, true) { |x| model.remaining_hours_for_day_number(x) }\n end", "def get_time_remaining\n\n end", "def hours_left\n remaining = WorkingTime::Interval.new(self, close_of_business)\n return remaining.duration\n end", "def remaining_str()\n retu...
[ "0.735803", "0.711464", "0.7050904", "0.6863293", "0.68260074", "0.6825142", "0.6747123", "0.6740025", "0.6712422", "0.6638831", "0.65863854", "0.6571771", "0.6560081", "0.6541136", "0.6513608", "0.6492945", "0.64909554", "0.6487408", "0.6466897", "0.64453876", "0.6425149", ...
0.8523543
0
This is also an important method in the software (however simple).
def next_charge ( pre_finalised_quote * relative_progress / 100 ) - charged_so_far end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def suivre; end", "def terpene; end", "def used?; end", "def berlioz; end", "def weber; end", "def ibu; end", "def verdi; end", "def anchored; end", ...
[ "0.7372562", "0.69067717", "0.6714965", "0.6540472", "0.6540472", "0.6540472", "0.6540472", "0.64493006", "0.6347023", "0.62172866", "0.61877954", "0.61691016", "0.6150092", "0.6142994", "0.6111192", "0.61104184", "0.6036329", "0.6030139", "0.60179806", "0.60087395", "0.60035...
0.0
-1
OPTIONS handle: The string to always use as handle. toggle_handle: The string handle to swap once. toggled_handle: The string handle to swap back once. visible: Whether to show the visible part or the other.
def toggle_block(options={}, &block) visible = options.has_key?(:visible) ? options[:visible] : true escapable = options.has_key?(:escapable) ? options[:escapable] : false out = "<span class='toggle_block'>" if options[:handle] out << "<span class='toggle_block_content'>#{capture(visible, &block)}</span>" out << "<span class='toggled_block_content' style='display: none;'>#{capture(!visible, &block)}</span>" out << handle_element(options[:handle]) else if options[:toggle_handle] out << "<span class='toggle_block_content'>#{capture(visible, &block)}#{handle_element(options[:toggle_handle])}</span>" else out << "<span class='toggle_block_content toggle_block_handle'>#{capture(visible, &block)}</span>" end if options[:toggled_handle] out << "<span class='toggled_block_content' style='display: none;'>#{capture(!visible, &block)}#{handle_element(options[:toggled_handle])}</span>" else out << "<span class='toggled_block_content toggle_block_handle' style='display: none;'>#{capture(!visible, &block)}</span>" end end out << "</span>" raw out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle\n set_switch(!self.switch) if @switch\n end", "def toggle\n if style![:display] == :none\n show\n else\n hide\n end\n end", "def toggle\n if visible?\n hide\n\n else\n show\n\n end\n end", "def toggle\n if on?\n off\n else\n ...
[ "0.62756747", "0.5867539", "0.5825393", "0.57135844", "0.5685415", "0.56785387", "0.567535", "0.55550504", "0.55278295", "0.54196626", "0.5399839", "0.5374587", "0.53622603", "0.53347623", "0.5332515", "0.53244996", "0.5298098", "0.5273084", "0.5271895", "0.52597195", "0.5127...
0.6292904
0
Unabashedly stolen from ActiveSupport
def constantize names = self.split('::') names.shift if names.empty? || names.first.empty? constant = Object names.each do |name| constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name) end constant end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def escaper=(_); end", "def from; end", "def from; end", "def from; end", "def from; end", "def explicit; end", "def extended(*) end", "def escaper; end", "def beautify; end", "def beautify; end", "def ext; end", "def ext; end", "def ext=(_arg0); end", "def ext=(_arg...
[ "0.6019667", "0.55566746", "0.54896253", "0.54896253", "0.54896253", "0.54896253", "0.5364515", "0.5292324", "0.52571636", "0.5255977", "0.5255977", "0.5250606", "0.5250606", "0.5201451", "0.5201451", "0.5201451", "0.5150516", "0.51358056", "0.51132333", "0.50977385", "0.5097...
0.0
-1
, :except => [:index]
def index @companies = Company.all.order('rank DESC NULLS LAST') #@companies = CompanyRating.select('company_id,avg(satisfaction+work_environment+cd+flexibility+relation+leadership+pride+opportunities+opinion+stimulatingjob+innovation+management+compensation+workload+equality+objectives+cooperation+guidance+reward+career+transparancy) as rating, COUNT(DISTINCT(user_id,company_id)) as rank').group('company_id').order("rank DESC, rating ASC") #count = CompanyRating.count #@companies = CompanyRating.select('company_id,avg(satisfaction+work_environment+cd+flexibility+relation+leadership+pride+opportunities+opinion+stimulatingjob+innovation+management+compensation+workload+equality+objectives+cooperation+guidance+reward+career+transparancy) as rating, COUNT(DISTINCT(user_id,company_id)) as rank').group('company_id').order("coalesce('rank', #{count}) ASC") #@companies=CompanyRating.select('avg(satisfaction+work_environment+cd+flexibility+relation+leadership+pride+opportunities+opinion+stimulatingjob+innovation+management+compensation+workload+equality+objectives+cooperation+guidance+reward+career+transparancy) as rating,COUNT(DISTINCT(user_id,company_id)) as rank').order('rank') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_noindex\n @noindex = true\n end", "def index?\n false\n end", "def exclude; end", "def index_valid?\n false\n end", "def index_corruption?; end", "def remove(index)\n end", "def index_disabled\n @index_disabled ||= false\n end", "def index\n set_excuses\n end"...
[ "0.70812327", "0.68375385", "0.674489", "0.67258954", "0.6723821", "0.67216265", "0.6707613", "0.6685697", "0.6610937", "0.65828615", "0.65257484", "0.6491664", "0.64786303", "0.64450425", "0.64286214", "0.6427914", "0.6423883", "0.64215803", "0.6414757", "0.6374888", "0.6293...
0.0
-1
element appears twice except for one element which appears once. Find the single element that only appears only once. Do it in O(logn) time and O(1) space! think of binary search O(logn) what consition are we checking for how do we know which direction should we go next?
def single_in_sorted(arr) lo = 0 hi = arr.length - 1 # Stopping condition is when our window has closed while lo < hi # cutting the array in half mid = ((hi - lo) / 2) + lo # returing the item if iti dosent have a pair nearby return arr[mid] if arr[mid] != arr[mid - 1] && arr[mid] != arr[mid + 1] # if the index is odd and there is a pair below, # then the single element is above us # if index is even and the pair is above,same; # otherwise, the single element is below us if (arr[mid] == arr[mid - 1] && mid.odd?) || (arr[mid] == arr[mid + 1] && mid.even?) lo = mid + 1 else hi = mid - 1 end end # if we havent redurned yet, then the single element # is at the index we closed over arr[lo] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_singleton(array)\n array.each_with_index do |element, index|\n if element != array[index - 1] and element != array[index + 1]\n return element\n end \n end\n -1\nend", "def single_in_sorted(arr)\n index = 0\n found = nil\n until found\n if arr[index] != arr[index + 1]\n found =...
[ "0.7295121", "0.71694446", "0.6959747", "0.69450253", "0.685221", "0.67540324", "0.6752411", "0.6722073", "0.6681793", "0.66581833", "0.6629451", "0.66237307", "0.66185284", "0.6612662", "0.660684", "0.6587311", "0.6587311", "0.65498495", "0.65453166", "0.654302", "0.65407014...
0.66652423
9
GET /press_releases GET /press_releases.json
def index @press_releases = PressRelease.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end", "def index\n @releases = Release.all\n end", "def index\n @releases = Release.all\n end", "def new_releases\n api_c...
[ "0.7414778", "0.72152907", "0.72152907", "0.7171297", "0.70245", "0.6861803", "0.6860327", "0.68504024", "0.6761848", "0.6735103", "0.6615795", "0.6615795", "0.6589425", "0.65626645", "0.65433186", "0.6529931", "0.6513217", "0.65011406", "0.6467608", "0.6454987", "0.6431971",...
0.7504101
0
GET /press_releases/1 GET /press_releases/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end", "def index\n @press_releases = PressRelease.all\n end", "def show\n @release = @environment.releases.find(params[:id])\n\...
[ "0.74010694", "0.7379097", "0.72256076", "0.7192834", "0.71362644", "0.71362644", "0.70560074", "0.6947183", "0.68290967", "0.6745728", "0.6642319", "0.6618137", "0.6618009", "0.65002877", "0.64635825", "0.6448798", "0.6366669", "0.6366669", "0.63298917", "0.632745", "0.63236...
0.0
-1
POST /press_releases POST /press_releases.json
def create @press_release = PressRelease.new(press_release_params) respond_to do |format| if @press_release.save format.html { redirect_to @press_release, notice: 'Press release was successfully created.' } format.json { render action: 'show', status: :created, location: @press_release } else format.html { render action: 'new' } format.json { render json: @press_release.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @release = @environment.releases.new(params[:release])\n\n respond_to do |format|\n if @release.save\n format.html { redirect_to @release, notice: 'Release was successfully created.' }\n format.json { render json: @release, status: :created, location: @release }\n else\n ...
[ "0.73085606", "0.7037447", "0.69663423", "0.6809089", "0.6587195", "0.6525527", "0.64633775", "0.6419327", "0.63655436", "0.6363195", "0.63465405", "0.6331807", "0.6322181", "0.62916243", "0.62629634", "0.6254705", "0.6224615", "0.61817414", "0.61716056", "0.6141196", "0.6071...
0.6893645
3
PATCH/PUT /press_releases/1 PATCH/PUT /press_releases/1.json
def update respond_to do |format| if @press_release.update(press_release_params) format.html { redirect_to @press_release, notice: 'Press release was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @press_release.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n if @release.update_attributes(params[:release])\n format.html { redirect_to @release, notice: 'Release was successfully updated.' }\n format.json { head :no_content }\n else\n format.ht...
[ "0.6913919", "0.6802158", "0.6421727", "0.6371001", "0.62898666", "0.62263525", "0.61692053", "0.6138312", "0.609467", "0.609467", "0.609467", "0.6094625", "0.6075729", "0.6054036", "0.6035197", "0.5976594", "0.59492695", "0.5931169", "0.5907302", "0.5887518", "0.5882795", ...
0.68432117
1
DELETE /press_releases/1 DELETE /press_releases/1.json
def destroy @press_release.destroy respond_to do |format| format.html { redirect_to press_releases_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @release = @environment.releases.find(params[:id])\n @release.destroy\n\n respond_to do |format|\n format.html { redirect_to releases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @press_release.destroy\n respond_to do |format|\n format.html...
[ "0.7599978", "0.75830764", "0.7331728", "0.7280199", "0.7220094", "0.70564556", "0.6923868", "0.6849098", "0.6839502", "0.6747978", "0.656011", "0.65568537", "0.6553798", "0.6550093", "0.65451354", "0.65429795", "0.65362513", "0.6534813", "0.6520899", "0.6494363", "0.64369124...
0.7823809
0
Use callbacks to share common setup or constraints between actions.
def set_press_release @press_release = PressRelease.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.5...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def press_release_params params.require(:press_release).permit(:media_type, :media_name, :url, :published_at, :abstract) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
deprecated not in use
def build_from_new(predicted_winners_by_match_id) @winners = {} predicted_winners_by_match_id.each do |match_id, match| @winners[match_id.to_i] = Predictable::Championship::Team.find(match[:winner].to_i) end @root.matches.each{|match| match.winner = @winners[match.id]} @root end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def internal; end", "def deprecated_key=(_arg0); end", "def refutal()\n end", "def extra; end", "def raise_deprecations; end", "def custom; end", "def custom; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def schubert; end", "def...
[ "0.7746214", "0.6687754", "0.6614516", "0.653184", "0.65142274", "0.6499014", "0.64858407", "0.64858407", "0.6446763", "0.6446763", "0.6446763", "0.6446763", "0.64296836", "0.6395863", "0.63799524", "0.63671374", "0.63671374", "0.6311634", "0.63098085", "0.62855035", "0.62699...
0.0
-1
Exposes the linked list structure in an Enumerablecompatible format
def each return enum_for(:each) unless block_given? pointer = self loop do break if pointer.null? yield pointer pointer = pointer.next end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map\n # make a copy of List\n mapped = SinglyLinkedList.new\n self.each do |n|\n mapped.append n.value\n end\n # now map\n mapped.each do |n|\n n.value = yield n.value\n end\n mapped\n end", "def each\n #if head is not nil we have a list and can interate.\n #simply it...
[ "0.65045196", "0.6359072", "0.6093369", "0.60287637", "0.6013337", "0.6000312", "0.5978901", "0.5971415", "0.5952695", "0.59513843", "0.5950208", "0.593889", "0.58454627", "0.58424884", "0.5824475", "0.5824475", "0.5797832", "0.5776844", "0.5772678", "0.5752801", "0.5745249",...
0.0
-1
Returns a unique, deterministically reproducible index into an array We are hashing based on strings, let's use the ascii value of each string as a starting point.
def index(key, size) key.sum % size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_unique(array)\n unique_id = 0\n\n array.each do |num|\n unique_id ^= num\n end\n\n unique_id\nend", "def generateKey(string)\r\n key = {}\r\n stringIterator = 0\r\n\r\n (string.length).times do\r\n charactersIterator = string[stringIterator] - 1\r\n divisorsIterator = 0\r\n divisors =...
[ "0.63831186", "0.6240291", "0.6142978", "0.6100088", "0.60602856", "0.60466117", "0.6042421", "0.60271215", "0.59920084", "0.5906661", "0.5872396", "0.5838743", "0.5826113", "0.5816591", "0.57661915", "0.575281", "0.57520026", "0.5740316", "0.573151", "0.57115084", "0.5710239...
0.0
-1
Simple method to return the number of items in the hash
def size @nodes.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n return @hash.length\n end", "def length\n hash.keys.length\n end", "def size\n @hash.size\n end", "def size\n @hash.size\n end", "def size\n @hash.size\n end", "def size\n @hash_array.length\n end", "def size\n @hash_array.length\n end", "def size\n ...
[ "0.82830465", "0.82106954", "0.8109915", "0.8109915", "0.8109915", "0.79695594", "0.79695594", "0.78124315", "0.77486163", "0.76849425", "0.7678069", "0.7656559", "0.7636084", "0.76298493", "0.761464", "0.761464", "0.7574793", "0.7569945", "0.7478816", "0.7444118", "0.7398974...
0.0
-1
Checks if the pepXML file used namespaces
def hasNamespace if @doc.xpath("msms_pipeline_analysis").to_s.length == 0 true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_namespaces?\n @strip_namespaces != false\n end", "def namespace?\n node_type == NAMESPACE_DECL\n end", "def use_namespaces?\n extensions.count > 1\n end", "def owned_namespaces?\n namespaces?.reject {|key,value| !value.owner}\n end", "def validNs?(namespace...
[ "0.6545117", "0.648211", "0.6339166", "0.619855", "0.6112893", "0.60282046", "0.6005299", "0.599883", "0.59535015", "0.5848154", "0.5816137", "0.57943016", "0.57752913", "0.57722217", "0.5729719", "0.5725884", "0.56560165", "0.5650701", "0.5600112", "0.5592591", "0.55850565",...
0.68506736
0
Finds all peptide locations and puts them in an array in the format: [[peptide, protein, start, end]]
def findAllPepLocations hits = @doc.xpath("//#{@xmlns}search_hit") all = [] @locations = [] i = 0 # Parses out each peptide and protein hits.each do |hit| all << [hit.xpath("./@peptide").to_s, proteinID(hit.xpath("./@protein").to_s)] i += 1 end all.uniq! dataHash = Hash.new Ms::Fasta.foreach(@database) do |entry| @sequences += 1 pID = proteinID(entry.header) dataHash[pID] = entry.sequence @proteinIndices << pID end all.each do |set| if dataHash[set[1]] != nil startVal = dataHash[set[1]].scan_i(set[0])[0] if startVal != nil @locations << [set[0], set[1], startVal + 1, startVal + set[0].length] end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attach_npc_positions_to_path_arrays\n paths = find_each_path_rectangle\n\n iterate_over_each_character_in_array_of_lines(@map_in_lines) do |y, x|\n c = @map_in_lines[y][x]\n\n next if c == '.' or c == 'p'\n\n if c == 'N'\n paths.each do |e|\n if y >= e[0][0] a...
[ "0.5870837", "0.57908106", "0.5693682", "0.56321305", "0.5608253", "0.55918765", "0.55516934", "0.553264", "0.5480601", "0.5480601", "0.5477308", "0.54442006", "0.5438578", "0.5372567", "0.5370879", "0.5364156", "0.53538746", "0.53369963", "0.5331086", "0.5281115", "0.5275048...
0.75177836
0
Not all pepXML files simply list the protein ID, so this method obtains it. Are there other cases to cover?
def proteinID(protein) #If a protein ID contains a "|", then it contains more than just the ID if protein.include?('|') arr = protein.split("|")[1].split(":") if arr.length == 1 arr[0] else arr[1] end #If there's no characters, then it's an index. I don't fully understand regexp, but this works. elsif (protein =~ /[A-Z]/) == nil @proteinIndices[protein.to_i] else protein end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_prot_id(pep_ev_id) \n #dbref = @pep_ev_h_dbseqRef[pep_ev_id]\n dbref = @pep_ev_h[pep_ev_id].get_db_seq_ref\n prot_id = @db_seq_h[dbref]\n prot_id\n end", "def getFtProtID\n protein_id = ARGV[1]\n protId = \"\"\n @gbkObj.each_cds do |ft|\n ftH = ft.to_hash\n ftloc...
[ "0.6808757", "0.62427807", "0.6039692", "0.5979965", "0.58701205", "0.5824189", "0.5798599", "0.5735441", "0.5715364", "0.5696525", "0.56889135", "0.5687096", "0.56840736", "0.56196", "0.55708706", "0.55544865", "0.55068547", "0.5498481", "0.5469759", "0.54546547", "0.5446748...
0.69392115
0
GET /tenant_users/1 GET /tenant_users/1.json
def show @tenant_user = TenantUser.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @tenant_user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_users_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def get_user_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def...
[ "0.8302422", "0.82009375", "0.7426273", "0.7426273", "0.7407909", "0.72966653", "0.72966653", "0.71432877", "0.69054973", "0.6775415", "0.66598725", "0.65919906", "0.6501569", "0.64879984", "0.6481523", "0.64670634", "0.6437849", "0.63844043", "0.63817525", "0.6353136", "0.63...
0.7325788
5
GET /tenant_users/new GET /tenant_users/new.json
def new @tenant_user = TenantUser.new respond_to do |format| format.html # new.html.erb format.json { render json: @tenant_user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @tenant_user = TenantUser.new(params[:tenant_user])\n\n respond_to do |format|\n if @tenant_user.save\n format.html { redirect_to @tenant_user, notice: 'Tenant user was successfully created.' }\n format.json { render json: @tenant_user, status: :created, location: @tenant_user...
[ "0.73167217", "0.71246743", "0.7085583", "0.70282733", "0.7005554", "0.69943154", "0.68793523", "0.68383646", "0.68379104", "0.68341196", "0.67695653", "0.676171", "0.67602277", "0.6750981", "0.6744705", "0.67411196", "0.6737594", "0.6730425", "0.67156917", "0.67156917", "0.6...
0.7967104
0
POST /tenant_users POST /tenant_users.json
def create @tenant_user = TenantUser.new(params[:tenant_user]) respond_to do |format| if @tenant_user.save format.html { redirect_to @tenant_user, notice: 'Tenant user was successfully created.' } format.json { render json: @tenant_user, status: :created, location: @tenant_user } else format.html { render action: "new" } format.json { render json: @tenant_user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_user_for_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def list_users_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def create\n @user = User.new(user_params)\n @user.tenant_id = current_tenant.id\n if...
[ "0.828409", "0.71948177", "0.70050967", "0.6994298", "0.6757778", "0.6344799", "0.62965655", "0.6274536", "0.6245639", "0.6242838", "0.62027794", "0.61602366", "0.6152713", "0.61314327", "0.6131366", "0.6126777", "0.6126777", "0.6125254", "0.61203235", "0.6105776", "0.6101774...
0.709508
2
PUT /tenant_users/1 PUT /tenant_users/1.json
def update @tenant_user = TenantUser.find(params[:id]) respond_to do |format| if @tenant_user.update_attributes(params[:tenant_user]) format.html { redirect_to @tenant_user, notice: 'Tenant user was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @tenant_user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_user_for_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n ...
[ "0.731575", "0.7270434", "0.68022764", "0.66275203", "0.65592164", "0.64752585", "0.6475099", "0.6405509", "0.63865846", "0.6297654", "0.6287784", "0.6256174", "0.62455285", "0.6233341", "0.6225057", "0.62185663", "0.6214867", "0.6167844", "0.6167844", "0.6167844", "0.6167844...
0.72210366
2
DELETE /tenant_users/1 DELETE /tenant_users/1.json
def destroy @tenant_user = TenantUser.find(params[:id]) @tenant_user.destroy respond_to do |format| format.html { redirect_to tenant_users_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :...
[ "0.8729901", "0.78951836", "0.7564833", "0.74884677", "0.73870534", "0.737291", "0.7357325", "0.7339405", "0.72102296", "0.72102296", "0.720869", "0.71437305", "0.7061047", "0.69885355", "0.69386333", "0.6908947", "0.69055796", "0.68617696", "0.68445355", "0.6836324", "0.6798...
0.8039165
1
Returns the mutual honor object if it's made. Nil otherwise.
def send_honor(to, champion, probability) honor = Honor.where(from: self.player_id, to: to).first if honor.nil? honor = Honor.new honor.from = self.player_id honor.to = to end honor.timestamp = Time.now honor.champion = champion honor.probability = probability mutual_honor = nil if rand(2) < 1 mutual_honor = self.chance_for_mutual(to, champion, probability) honor.seen = 1 else honor.seen = 0 end honor.save mutual_honor end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chance_for_mutual(to, champion, probability)\r\n\t\toutput = nil\r\n\t\tif rand < probability\r\n\t\t\tmutual_honor = MutualHonor.where(from: self.player_id, to: to).first\r\n\t\t\tif mutual_honor.nil?\r\n\t\t\t\tmutual_honor = MutualHonor.new\r\n\t\t\t\tmutual_honor.from = self.player_id\r\n\t\t\t\tmutual_hon...
[ "0.6019912", "0.5980395", "0.5892617", "0.58534586", "0.58534586", "0.58083546", "0.5744787", "0.56431353", "0.5639328", "0.5626036", "0.5599074", "0.5598739", "0.55454755", "0.552373", "0.5512968", "0.54559743", "0.5451468", "0.5448403", "0.5410697", "0.5410697", "0.54088366...
0.50020045
66
Returns the mutual honor object if it's made. Nil otherwise.
def chance_for_mutual(to, champion, probability) output = nil if rand < probability mutual_honor = MutualHonor.where(from: self.player_id, to: to).first if mutual_honor.nil? mutual_honor = MutualHonor.new mutual_honor.from = self.player_id mutual_honor.to = to end mutual_honor.champion = champion mutual_honor.timestamp = Time.now mutual_honor.save # Reload to ensure that the autogenerated id is filled. output = MutualHonor.where(from: self.player_id, to: to).includes(:from_object, :to_object, :champion_object).first end output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invited_or_captain\n self.captain || invited?\n end", "def senior\n # * pickup any exiting from mem_... attribute\n # * fetch using the role, when above fails\n # * insitantiate a new if all above failed\n # * Assign the final instance to mem... attribute, for next time\n # \n #...
[ "0.5980395", "0.5892617", "0.58534586", "0.58534586", "0.58083546", "0.5744787", "0.56431353", "0.5639328", "0.5626036", "0.5599074", "0.5598739", "0.55454755", "0.552373", "0.5512968", "0.54559743", "0.5451468", "0.5448403", "0.5410697", "0.5410697", "0.54088366", "0.5356273...
0.6019912
0
Returns an array of successful mutual honors
def chance_old_honor honors = Honor.where(from: self.player_id).where(seen: 0) mutual_honors = Array.new honors.each do |honor| honor.seen = 1; honor.save mutual_honor = self.chance_for_mutual(honor.to, honor.champion, honor.probability) unless mutual_honor.nil? mutual_honors.push(mutual_honor) end end mutual_honors end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chat_participants \n friends.map do |friend|\n friend.combination(2).to_a\n end.flatten(1)\nend", "def successors\n return @successors if @successors\n @successors = (data['successors']||[]).map { |s| function.blocks.by_name(s) }.uniq.freeze\n end", "def potential_pairs\n potentials = ...
[ "0.52789223", "0.52411467", "0.5210182", "0.51161635", "0.5051965", "0.50228256", "0.5008176", "0.50039065", "0.49947527", "0.4969605", "0.49670795", "0.49561384", "0.49518645", "0.4934573", "0.49289706", "0.4916604", "0.49164742", "0.4908686", "0.48940137", "0.4893727", "0.4...
0.535338
0
GET /guardianships GET /guardianships.json
def index @guardianships = Guardianship.all respond_to do |format| format.html # index.html.erb format.json { render json: @guardianships } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @guardianship = Guardianship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guardianship }\n end\n end", "def index\n @guardianships = Guardianship.all\n end", "def new\n @guardianship = Guardianship.new\n\n resp...
[ "0.7731873", "0.73670226", "0.6843749", "0.6412813", "0.6354523", "0.6354523", "0.6223187", "0.6172545", "0.61429626", "0.611875", "0.6010319", "0.59876794", "0.585261", "0.5822683", "0.5817951", "0.57909894", "0.5771006", "0.5758456", "0.5745943", "0.5745722", "0.5736845", ...
0.78329575
0
GET /guardianships/1 GET /guardianships/1.json
def show @guardianship = Guardianship.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @guardianship } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @guardianships = Guardianship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @guardianships }\n end\n end", "def index\n @guardianships = Guardianship.all\n end", "def new\n @guardianship = Guardianship.new\n\n respond_to do ...
[ "0.77268803", "0.72183675", "0.7133891", "0.6539829", "0.6539829", "0.6520422", "0.6391949", "0.62239563", "0.62183845", "0.60981375", "0.6095303", "0.60427356", "0.6033489", "0.5976163", "0.59457904", "0.59131396", "0.5902558", "0.589335", "0.5887191", "0.58724594", "0.58585...
0.79683775
0
GET /guardianships/new GET /guardianships/new.json
def new @guardianship = Guardianship.new respond_to do |format| format.html # new.html.erb format.json { render json: @guardianship } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @guardianship = Guardianship.new(params[:guardianship])\n\n respond_to do |format|\n if @guardianship.save\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully created.' }\n format.json { render json: @guardianship, status: :created, location: @gua...
[ "0.7794247", "0.7305265", "0.69828546", "0.6950017", "0.68569696", "0.6828653", "0.68091786", "0.6796393", "0.6743946", "0.6743946", "0.6743946", "0.67363465", "0.67339295", "0.66844666", "0.66827255", "0.6679456", "0.66728425", "0.6666971", "0.66616154", "0.6658567", "0.6656...
0.82165366
0
POST /guardianships POST /guardianships.json
def create @guardianship = Guardianship.new(params[:guardianship]) respond_to do |format| if @guardianship.save format.html { redirect_to @guardianship, notice: 'Guardianship was successfully created.' } format.json { render json: @guardianship, status: :created, location: @guardianship } else format.html { render action: "new" } format.json { render json: @guardianship.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @guardianship = Guardianship.new(guardianship_params)\n @guardianship.user_id = current_user.id\n\n respond_to do |format|\n if @guardianship.save\n format.html { redirect_to root_path, notice: 'Guardianship was successfully created.' }\n format.json { render :show, status:...
[ "0.75782794", "0.71038777", "0.6781831", "0.65669876", "0.6303177", "0.62367153", "0.62367153", "0.6186352", "0.6071257", "0.59728646", "0.59707654", "0.5968699", "0.5927449", "0.58966047", "0.588447", "0.5864133", "0.58359873", "0.581296", "0.57867855", "0.57743037", "0.5769...
0.79171264
0
PUT /guardianships/1 PUT /guardianships/1.json
def update @guardianship = Guardianship.find(params[:id]) respond_to do |format| if @guardianship.update_attributes(params[:guardianship]) format.html { redirect_to @guardianship, notice: 'Guardianship was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @guardianship.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @guardianship.update(guardianship_params)\n format.html { redirect_to @guardianship, notice: 'Guardianship was successfully updated.' }\n format.json { render :show, status: :ok, location: @guardianship }\n else\n format.html { render :edit...
[ "0.7333053", "0.6891642", "0.6891642", "0.6852429", "0.6841136", "0.67517424", "0.6175291", "0.61095816", "0.6083545", "0.60093784", "0.5902715", "0.5810329", "0.57628214", "0.57432055", "0.5726148", "0.5717856", "0.5712531", "0.5668891", "0.5657254", "0.5639566", "0.561592",...
0.7311316
1
DELETE /guardianships/1 DELETE /guardianships/1.json
def destroy @guardianship = Guardianship.find(params[:id]) @guardianship.destroy respond_to do |format| format.html { redirect_to guardianships_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @guardianship.destroy\n respond_to do |format|\n format.html { redirect_to guardianships_url, notice: 'Guardianship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @guardian = Guardian.find(params[:id])\n @guardian.destroy\n\n...
[ "0.7551266", "0.6966094", "0.67274165", "0.67274165", "0.6716747", "0.67054224", "0.6698005", "0.66936904", "0.6638706", "0.66364527", "0.6633589", "0.6632886", "0.6626076", "0.6624628", "0.66208225", "0.6617505", "0.6611876", "0.6609789", "0.65932065", "0.6571866", "0.656521...
0.78139114
0
Evaluates a block in the context of a DSL instance
def evaluate!(scope, &block) new(scope).evaluate(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval\n @block.eval\n end", "def evaluate(&block)\n instance_eval(&block)\n end", "def evaluate\n context = Context.new(self, node)\n context.instance_exec(&block)\n node\n end", "def dsl_eval(block)\n @dsl ||= DSL.new(self)\n @dsl.instance_eval(&b...
[ "0.7760194", "0.7685161", "0.76149297", "0.75146145", "0.7363156", "0.7172347", "0.7151496", "0.7133446", "0.7110556", "0.69198334", "0.69198334", "0.6900511", "0.671066", "0.6696336", "0.6696336", "0.6696336", "0.6664486", "0.65856606", "0.6571115", "0.65255344", "0.6457061"...
0.6677027
16
Evaluates a block specifically for a join. In this case, we'll return an array of Arel join nodes and a list of bind parameters.
def evaluate_joins(scope, &block) dependency = evaluate!(scope, &block)._arel join_arel = Nodes.unwrap(dependency._arel) [join_arel, dependency.bind_values] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def joins(&block)\n scope.joins(*build_join_path(&block))\n end", "def visit_Arel_Nodes_JoinSource o, collector\n if o.right.any?\n # We need to visit the right to get remove bind values, but we don't\n # add it to the collector\n collector.join_source << inject_join...
[ "0.66821665", "0.6243861", "0.5804078", "0.57838035", "0.5401465", "0.5396925", "0.5388532", "0.5353458", "0.5314748", "0.5286763", "0.52793914", "0.524661", "0.51993847", "0.5176329", "0.51732635", "0.5156276", "0.5137817", "0.5104237", "0.5100834", "0.5095799", "0.50930595"...
0.78211224
0
Evaluates a block in the context of a new DSL instance and passes all arguments to the block.
def evaluate_sifter(scope, *args, &block) evaluate scope do |root| root.instance_exec(*args, &block) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dsl_eval_with_block_return(dsl, *args, **_arg2, &block); end", "def dsl_eval_with_block_return(dsl, *args, **_arg2, &block); end", "def dsl_eval(block)\n @dsl ||= DSL.new(self)\n @dsl.instance_eval(&block)\n self\n end", "def evaluate(block, *args)\n return if block.nil?\n ...
[ "0.71977603", "0.71977603", "0.7172122", "0.7123822", "0.71037036", "0.7076061", "0.70251554", "0.7014804", "0.70136887", "0.6946778", "0.6946778", "0.6946778", "0.6900622", "0.687367", "0.6840213", "0.6749934", "0.6707413", "0.6672536", "0.66624534", "0.65511286", "0.6537895...
0.0
-1
Quotes a string and marks it as SQL
def quoted(value) sql _scope.connection.quote(value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quote_string(string)\n @logger.unknown(\"ODBCAdapter#quote_string>\") if @trace\n\n # MySQL requires backslashes to be escaped\t\t\t\t\n string.gsub(/\\\\/, '\\&\\&').gsub(/'/, \"''\")\n end", "def sql_string(value)\n \"'#{value.gsub(\"'\", \"''\")}'\" \nend", "def quote(s, column = nil)\n ...
[ "0.75477934", "0.7530987", "0.75047475", "0.7425209", "0.7389419", "0.7336978", "0.7282331", "0.7279858", "0.7233335", "0.7217757", "0.7178834", "0.7145263", "0.7130365", "0.7124313", "0.71122277", "0.7110103", "0.70954", "0.7064483", "0.7049399", "0.7046927", "0.70350045", ...
0.74910843
4
Evaluates a DSL block. If arity is given, this method `yield` itself, rather than `instance_eval`.
def evaluate(&block) if block.arity.zero? instance_eval(&block) else yield(self) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(&block)\n if block.arity > 0\n yield self\n else\n instance_exec(&block)\n end\n end", "def dsl_eval(dsl, *args, **_arg2, &block); end", "def arity_based &block\n block.arity == 0 ? proc { |obj| obj.instance_eval &block }\n : block...
[ "0.69986343", "0.6847398", "0.6840901", "0.67608947", "0.67608947", "0.67580175", "0.67006016", "0.66018623", "0.65191615", "0.6502285", "0.6502285", "0.64812857", "0.62827003", "0.6244749", "0.6189365", "0.6166125", "0.6133801", "0.6113563", "0.6112431", "0.6071587", "0.6029...
0.68368673
3
REVIEW: change/remove this when status.py is doing the updating
def update_dip(id, uuid) dataset = Dlibhydra::Dataset.find(id) @dip = dataset.aips[0] dip_info = get_dip_details(uuid) ingest_dip(dip_info['current_path']) dip_current_path(dip_info['current_path']) dip_uuid(dip_info['uuid']) dip_status(dip_info['status']) dip_size(dip_info['size']) dip_current_location(dip_info['current_location']) # api location dip_resource_uri(dip_info['resource_uri']) # api uri dip_size(dip_info['size']) dip_origin_pipeline(dip_info['origin_pipeline']) save_dip 'AIP updated with dissemination objects' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outdated; end", "def update_status_to_processed\n fail 'child class to implement'\n end", "def update() end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; en...
[ "0.69088715", "0.68517333", "0.684086", "0.6826766", "0.6826766", "0.6826766", "0.6826766", "0.6826766", "0.6826766", "0.6826766", "0.6826766", "0.6826766", "0.68116415", "0.6779681", "0.676772", "0.67179084", "0.67179084", "0.67179084", "0.67179084", "0.67179084", "0.6717908...
0.0
-1
inside the dip location folder, there will be: a folder called "objects" containing the actual files of the dip a folder called "thumbnails" containing thumbnails for each file in the dip a file called "METS.xxxx.xml" a file called "ProcessingMCP.xml" Need to create a FileSet for METS.xxxx.xml, a FileSet for Processing.MCP.xml, and a FileSet for each actual file in the dip (which will consist of a primary file (in "objects") and an additional file (in "thumbnails"))
def ingest_dip(dip_location) # uncomment the next 2 lines, and add 2nd parameter "dataid" to the function spec in order to call this method standalone # dataset = Dlibhydra::Dataset.find(dataid) # @dip = dataset.aips[0] location = File.join(ENV['DIP_LOCATION'], dip_location) # for each file/folder in the dip location Dir.foreach(location) do |item| # if it's the "objects" folder if File.directory?(File.join(location, item)) && item == 'objects' # for each file in the "objects" folder Dir.foreach(File.join(location, item)) do |object| # skip any directories inside the objects folder next if File.directory?(File.join(location, item, object)) # create a new FileSet obj_fs = Dlibhydra::FileSet.new # add this file to the FileSet obj_fs.preflabel = object path = File.join(location, item, object) f = open(path) Hydra::Works::UploadFileToFileSet.call(obj_fs, f) # get the first 36 characters of the filename - the "thumbnail" and "ocr text" corresponding to this file will have this prefix prefix = object[0..35] # find the "thumbnail" that corresponds to this file (it'll have the same filename prefix) if it exists and add it to the FileSet thumbnail_file = prefix + '.jpg' thumbnail_path = File.join(location, 'thumbnails', thumbnail_file) if File.file?(thumbnail_path) f2 = open(thumbnail_path) Hydra::Works::AddFileToFileSet.call(obj_fs, f2, :thumbnail, update_existing: false) end # find the OCR file that corresponds to this file if it exists and add it to the FileSet ocrfile = prefix + '.txt' ocrfile_path = File.join(location, 'OCRfiles', ocrfile) if File.file?(ocrfile_path) f3 = open(ocrfile_path) Hydra::Works::AddFileToFileSet.call(obj_fs, f3, :extracted_text, update_existing: false) end # add this FileSet to the dip obj_fs.save @dip.members << obj_fs save_dip end # otherwise, if it's a file (not a folder) elsif File.file?(File.join(location, item)) # create a new FileSet obj_fs = Dlibhydra::FileSet.new # add this file to the FileSet obj_fs.preflabel = item f = open(File.join(location, item)) Hydra::Works::UploadFileToFileSet.call(obj_fs, f) # add this FileSet to the dip obj_fs.save @dip.members << obj_fs save_dip end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_filesets_for_export(object_files, include_files = true)\n %w[metadata text].inject([]) do |ret, fileset_type|\n next ret if object_files[fileset_type.to_sym].blank?\n object_fileset = {\n created_at: create_date,\n updated_at: modified_date,\n fi...
[ "0.60919565", "0.6091542", "0.60529244", "0.5971123", "0.5943735", "0.5939176", "0.5922606", "0.5859848", "0.58018744", "0.5798016", "0.57485", "0.573722", "0.5709881", "0.5688754", "0.5650202", "0.564628", "0.56439203", "0.562648", "0.5622234", "0.5590091", "0.5572442", "0...
0.5753249
10
REVIEW: may not be needed after status.py update
def get_dip_details(uuid) url = ENV['ARCHIVEMATICA_SS_URL'] conn = Faraday.new(url: url) do |faraday| faraday.request :url_encoded # form-encode POST params faraday.response :logger # log requests to STDOUT faraday.adapter Faraday.default_adapter # make requests with Net::HTTP end params = { 'username' => ENV['ARCHIVEMATICA_SS_USER'], 'api_key' => ENV['ARCHIVEMATICA_SS_API_KEY'] } response = conn.get do |req| req.url '/api/v2/file/' + uuid + '/' req.headers['Accept'] = 'application/json' req.params = params end JSON.parse(response.body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status(*) end", "def statuses; end", "def last_status; end", "def status=(status); end", "def status_message; end"...
[ "0.7393665", "0.7393665", "0.7393665", "0.7393665", "0.7393665", "0.7393665", "0.7393665", "0.7393665", "0.7393665", "0.7347041", "0.7080498", "0.69859135", "0.6947157", "0.68530875", "0.68003523", "0.68003523", "0.68003523", "0.68003523", "0.66600287", "0.6611623", "0.652644...
0.0
-1
Return a has of aip_uuids where dip creation has been approved but the dip has yet to be uploaded
def waiting_for_dips q = 'dip_status_tesim:APPROVED' dips = {} num_results = get_number_of_results(q) unless num_results == 0 solr_query_short(q, 'id,aip_uuid_tesim', num_results)['docs'].each do | aip | dips[aip['id']] = aip['aip_uuid_tesim'].first end end dips end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pending_invoices\n database.select { |id, invoice| !invoice.successful? }\n end", "def not_approved?\n status_map = employee_vacation_responses.map(&:status).uniq\n status_map.size == 1 && status_map.include?(\"not_approved\")\n end", "def no_appts_avail?\n appointments.empty?\n end", ...
[ "0.59087116", "0.58684665", "0.5666443", "0.55964154", "0.5565137", "0.5564552", "0.5557245", "0.5556968", "0.55232847", "0.547609", "0.546023", "0.5448225", "0.5441946", "0.5435489", "0.5429253", "0.5421272", "0.54135066", "0.5396769", "0.53853375", "0.5371271", "0.53607255"...
0.5952063
0
Use callbacks to share common setup or constraints between actions.
def set_recruitment @recruitment = Recruitment.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.5...
0.0
-1
Return the project root path.
def root_path Pathname.new(File.expand_path(File.join(__dir__, '..', '..'))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_root\n return File.join('/root/path', SETTINGS[:project])\n end", "def project_root\n if server_environment\n server_environment['project-root'] || ''\n end\n end", "def root_path\n ENV['TM_PROJECT_DIRECTORY'] || File.join(ENV['TM_DIRECTORY'], \"..\")\n end", "def root_path\n @...
[ "0.9091598", "0.8452685", "0.8442884", "0.8190616", "0.8175919", "0.8128879", "0.8128879", "0.81154823", "0.802166", "0.78954184", "0.7878617", "0.7870664", "0.78443", "0.7843973", "0.78417397", "0.78324455", "0.78324455", "0.78191453", "0.78130984", "0.77910084", "0.77773994...
0.7738341
25
Return the test suite temporary path.
def tmp_path root_path.join('tmp') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def temporary_directory\n \"#{ROOT}/spec/tmp\"\n end", "def get_temp_directory\n defined?(Rails) ? \"#{Rails.root}/tmp\" : \"/tmp\"\n end", "def tmp_path\n File.join gem_root, 'tmp'\n end", "def temp_dir\n name = 'tmp_' + rand.to_s.gsub(/\\D/, '')\n File.join(@temp_root, name)\n...
[ "0.7789942", "0.75857866", "0.7583217", "0.75632066", "0.75362986", "0.7337198", "0.7322641", "0.73212314", "0.72998583", "0.72806257", "0.716804", "0.7135022", "0.7122463", "0.70994043", "0.70462507", "0.70259434", "0.70247626", "0.69757235", "0.69269514", "0.68636906", "0.6...
0.68609
20
Return the test suite fixtures path.
def fixtures_path root_path.join('spec', 'fixtures') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_path\n if File.exists?(FIXTURE_DIR)\n FIXTURE_DIR\n else\n File.join(Rails.root, 'test', 'fixtures')\n end\n end", "def fixture_path\n if File.exists?(FIXTURE_DIR)\n FIXTURE_DIR\n else\n File.join(Rails.root, 'test', 'fixture...
[ "0.85671073", "0.85671073", "0.8338028", "0.8310602", "0.82196265", "0.81024873", "0.8061822", "0.794122", "0.77860004", "0.77853763", "0.77752167", "0.77457446", "0.7687394", "0.7658605", "0.7624142", "0.7597632", "0.7597632", "0.74827266", "0.7481996", "0.7476985", "0.74534...
0.8261674
4
the length of the Collatz Conjecture for any given n.
def collatz(n, arr = []) while n != 1 arr << n n = n.even? ? n/2 : n*3+1 end arr.push(1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collatz(n)\r\n\t\t\tlen = 0\r\n\t\t\twhile n > 1\r\n\t\t\t\tn = 3*n + 1 if n%2 != 0\r\n\t\t\t\tn = n/2 if n%2 == 0\r\n\t\t\t\tlen += 1\r\n\t\t\tend\r\n\t\t\treturn len\r\n\t\tend", "def collatz(n)\n sequence = [n]\n length = 1\n\twhile n != 1\n\t\tn = n.even? ? n/2 : n*3 + 1\n\t\tsequence << n\n\t\tlength ...
[ "0.8271018", "0.7529633", "0.7418252", "0.713448", "0.6872021", "0.6770015", "0.66174567", "0.6572476", "0.65473706", "0.6490807", "0.6466627", "0.64247847", "0.6362093", "0.6351804", "0.6339196", "0.6303988", "0.61476034", "0.61274683", "0.6097332", "0.60653675", "0.60489094...
0.0
-1
Write a method that will take a string and return an array of vowels used in that string. Difficulty: 4/10 Example: count_vowels("The quick brown fox") should return ["e","u","i","o","o"] count_vowels("Hello World") should return ["e","o","o"] Check your solution by running the tests: ruby tests/04_vowels_test.rb
def vowels (string) vowel_list = ["a", "e", "i", "o", "u"] result = [] string.split("").each do |letter| if vowel_list.include? letter.downcase result.push letter end end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vowels (string)\n vowels_arr = []\n count_vowels = string.scan(/[aeoui]/)\n vowels_arr << count_vowels\n puts vowels_arr\nend", "def count_vowels(str)\n vowels = 0\n str.split('').each do |char|\n vowels += 1 if ['a', 'e', 'i', 'o', 'u'].include? char\n end\n vowels\nend", "def count_vowels (str...
[ "0.8288056", "0.8010037", "0.8001394", "0.78326744", "0.78217447", "0.77840394", "0.77683365", "0.77438056", "0.77401686", "0.771902", "0.7703744", "0.76755446", "0.76733327", "0.7657911", "0.76565087", "0.76490843", "0.7635598", "0.76141167", "0.76066214", "0.7603718", "0.76...
0.7597729
21
example move = (a2:a3), move piece at (6, 0) to square at (5, 0)
def move_piece(move, color) squares = find_start_and_end(move) # [start, end] return false if @display[squares[0][0]][squares[0][1]].guest == ' ' start_piece = @display[squares[0][0]][squares[0][1]].guest return false if start_piece.color != color moves = get_legal_moves(squares[0], start_piece, start_piece.poss_moves(squares[0])) if moves.include?(squares[1]) # castling if start_piece.id == 'king' && start_piece.color == 'white' && squares[1] == [7, 1] make_move(squares[0], squares[1], start_piece) make_move([7, 0], [7, 2], @display[0][0].guest) elsif start_piece.id == 'king' && start_piece.color == 'black' && squares[1] == [] make_move(squares[0], squares[1], start_piece) make_move([0, 0], [0, 2], @display[7][0].guest) # pawn -> queen upgrade elsif start_piece.id == 'pawn' && start_piece.color == 'white' && squares[1][0].zero? make_move(squares[0], squares[1], Queen.new('white')) elsif start_piece.id == 'pawn' && start_piece.color == 'black' && squares[1][0] == 7 make_move(squares[0], squares[1], Queen.new('black')) else make_move(squares[0], squares[1], start_piece) end else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_piece(from, to)\n return move_piece_in_square(@board[from], @board[to])\n end", "def move_piece(from, to)\n return move_piece_in_square(@board[from], @board[to])\n end", "def move_piece(org,dest)\n # remove catured piece if capture move\n if (dest[0] - org[0]).abs == 2\n captured_bo...
[ "0.7368139", "0.7368139", "0.72732013", "0.7250606", "0.7248146", "0.72313404", "0.72233725", "0.7214407", "0.71581626", "0.71577424", "0.715606", "0.715606", "0.7111271", "0.7094672", "0.7074128", "0.7031068", "0.69940686", "0.69904965", "0.6987864", "0.69729817", "0.6956996...
0.7035671
15
methods for moving a piece on the board
def find_start_and_end(move) mv_start = move[0..1].split('') mv_end = move[3..4].split('') start_row = 8 - mv_start[1].to_i start_col = @@horizontal_key[mv_start[0].downcase] start_location = [start_row, start_col] end_row = 8 - mv_end[1].to_i end_col = @@horizontal_key[mv_end[0].downcase] end_location = [end_row, end_col] [start_location, end_location] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(dest, crown?) # called in :turn > active_piece.move()\n # updates dest in board array\n # updates piece with new coordinates\n # updates jumped pieces?\nend", "def move_piece(coord)\n @game.move_piece_to(coord)\n end", "def move(piece, column, row) \n piece.column = column\n piece.row = ...
[ "0.8251823", "0.82434034", "0.8092314", "0.8057756", "0.8057756", "0.8026749", "0.7932612", "0.7877355", "0.78575456", "0.78403425", "0.7788185", "0.7773487", "0.766082", "0.7654612", "0.7633349", "0.76228595", "0.76084495", "0.7542641", "0.75411", "0.7532961", "0.7516527", ...
0.0
-1
resets background colors after showing possible moves in different color
def reset_background(colors, moves) moves.each do |move| (0..7).each do |row| (0..7).each do |col| @display[row][col].background = colors.shift if move == [row, col] end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart\n pbBGMStop(0)\n 51.times do\n @viewport.tone.red-=5\n @viewport.tone.green-=5\n @viewport.tone.blue-=5\n self.updateElements\n Graphics.update\n end\n raise Reset.new\n end", "def colorize!(fg, bg)\n set_colors(fg, bg)\n num = @cwin.maxx * @cwin.maxy\n ...
[ "0.67560405", "0.6548178", "0.64613676", "0.6415993", "0.6356734", "0.6325662", "0.63128746", "0.6224831", "0.62128246", "0.61966574", "0.6182825", "0.61577314", "0.61432576", "0.61271137", "0.6081569", "0.60767955", "0.6067993", "0.60555184", "0.605529", "0.5979636", "0.5978...
0.8452587
0
methods for building the initial board
def build_first_row(board) (0..7).each do |col| if col.zero? board[1][col] = BoardSquare.new('cyan', Rook.new('white'), 1) elsif col == 7 board[1][col] = BoardSquare.new('magenta', Rook.new('white')) elsif col == 1 board[1][col] = BoardSquare.new('magenta', Knight.new('white')) elsif col == 6 board[1][col] = BoardSquare.new('cyan', Knight.new('white')) elsif col == 2 board[1][col] = BoardSquare.new('cyan', Bishop.new('white')) elsif col == 5 board[1][col] = BoardSquare.new('magenta', Bishop.new('white')) elsif col == 3 board[1][col] = BoardSquare.new('magenta', King.new('white')) elsif col == 4 board[1][col] = BoardSquare.new('cyan', Queen.new('white')) end end board end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_board\n make_blank_board\n populate_board\n end", "def setup_board\n gameboard.build_board\n build_white_side\n build_black_side\n end", "def initialize\n self.make_board\n end", "def initialize_board\n init_board = \"-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,0,...
[ "0.799483", "0.78477526", "0.77917165", "0.76924646", "0.76711076", "0.7647136", "0.76423115", "0.7590954", "0.75210196", "0.75131404", "0.7510589", "0.7496093", "0.74956876", "0.74854535", "0.74476683", "0.74391794", "0.7429478", "0.74101645", "0.74012136", "0.7385538", "0.7...
0.7049156
53
methods for filtering possible moves
def filter(location, guest, poss_moves) case guest.id when 'pawn' filter_pawn(location, guest, poss_moves) when 'rook' filter_rook(location, guest, poss_moves) when 'knight' filter_knight(location, guest, poss_moves) when 'bishop' filter_bishop(location, guest, poss_moves) when 'queen' filter_queen(location, guest, poss_moves) when 'king' filter_king(location, guest, poss_moves) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def possible_moves\n # p possible_non_attack_moves\n # p possible_attack_moves\n moves = possible_non_attack_moves + possible_attack_moves\n moves.reject! { |move| move.any? { |c| c < 0 || c > 7} }\n moves\n end", "def get_valid_moves\n possible_moves.select do |dir, moves| \n moves.selec...
[ "0.7418731", "0.7177759", "0.7100945", "0.7054787", "0.7049459", "0.70133805", "0.69971395", "0.6990848", "0.687329", "0.6829647", "0.6810687", "0.6809835", "0.67858315", "0.67723745", "0.67313313", "0.67286664", "0.6703829", "0.669497", "0.6693276", "0.66212094", "0.65952224...
0.67162275
16
Number of documents stored locally via nightly RetrieveDocumentsForReaderJob. Fall back to count from VBMS if no local documents are found.
def number_of_documents_from_caseflow count = Document.where(file_number: veteran_file_number).size (count != 0) ? count : number_of_documents end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_docs\n @client[:documents].count\n end", "def num_docs\n @client[DOCUMENTS_COLLECTION].count\n end", "def get_all_documents_count\n get_all_documents_ids.count\n end", "def num_corpus_documents\n @corpus_size ||= begin\n solr_query = {}\n ...
[ "0.7815855", "0.77930063", "0.72505826", "0.71302795", "0.7117782", "0.7039338", "0.7025306", "0.69475865", "0.685938", "0.66659313", "0.66659313", "0.65283287", "0.6460925", "0.64382344", "0.64263386", "0.6393648", "0.6374159", "0.63524085", "0.6345766", "0.6345496", "0.6247...
0.71291035
4
Returns the most directly responsible party for an appeal when it is at the Board, mirroring Legacy Appeals' location code in VACOLS rubocop:disable Metrics/PerceivedComplexity
def location_code location_code = nil if root_task && root_task.status == Constants.TASK_STATUSES.completed location_code = COPY::CASE_LIST_TABLE_POST_DECISION_LABEL else active_tasks = tasks.where(status: [Constants.TASK_STATUSES.in_progress, Constants.TASK_STATUSES.assigned]) if active_tasks == [root_task] location_code = COPY::CASE_LIST_TABLE_CASE_STORAGE_LABEL elsif !active_tasks.empty? most_recent_assignee = active_tasks.order(updated_at: :desc).first.assigned_to location_code = if most_recent_assignee.is_a?(Organization) most_recent_assignee.name else most_recent_assignee.css_id end end end location_code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coalition_leader(party)\n natural_leader = @parties.find {|p| p.id == party.natural_leader_id }\n natural_leader || @parties.max_by(&:seats_won)\n end", "def best_offense\n offense_suite\n best_offense_id = @average_goals_by_id.invert.max[1]\n @team_name_by_id[best_offense_id]\n end", "def...
[ "0.61755145", "0.5874454", "0.5757729", "0.5729524", "0.55956674", "0.55607194", "0.5408324", "0.5389137", "0.5289591", "0.52733123", "0.5269336", "0.5259253", "0.5203752", "0.5182173", "0.5168103", "0.5142838", "0.5141149", "0.5095498", "0.5095276", "0.5091457", "0.5049188",...
0.0
-1
For now power_of_attorney returns the first claimant's power of attorney
def power_of_attorney claimants.first&.power_of_attorney end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power_of_attorney\n claimants.first.power_of_attorney if claimants.first\n end", "def calc_am_pure_power(user, target)\n 2\n end", "def object_of_power; end", "def power\n data.power\n end", "def power\r\n return @access >> 26\r\n end", "def metric_power\n #noinspection Rub...
[ "0.82922316", "0.6229766", "0.6150345", "0.5959085", "0.59275705", "0.59242177", "0.5920765", "0.5908395", "0.5874283", "0.5845044", "0.58187234", "0.580003", "0.5796094", "0.5777687", "0.5770085", "0.57449734", "0.5740305", "0.5722346", "0.5712445", "0.57023597", "0.5692533"...
0.787793
1
Only select completed tasks because incomplete tasks will appear elsewhere on case details page. Tasks are sometimes assigned to organizations for tracking, these will appear as duplicates if they have child tasks, so we do not return those organization tasks.
def tasks_for_timeline tasks.where(status: Constants.TASK_STATUSES.completed).order("completed_at DESC") .reject { |t| t.assigned_to.is_a?(Organization) && t.children.pluck(:assigned_to_type).include?(User.name) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def incomplete_tasks\n\t\ttasks.select{ |t| !t.completed? }\n\tend", "def completed_tasks\n self.tasks.where('is_completed =?', is_completed = true)\n end", "def complete_tasks\n # Give me all the tasks such that the task is complete\n # results = @tasks.select { |task| task.complete? }\n ...
[ "0.75408995", "0.7515006", "0.7407701", "0.7174434", "0.715693", "0.7050861", "0.6972618", "0.69623095", "0.6813828", "0.6795062", "0.6708203", "0.64747894", "0.6360759", "0.63596976", "0.6359295", "0.6345468", "0.63160175", "0.62811273", "0.6279875", "0.627403", "0.6246177",...
0.71969795
3
we always want to show ratings on intake
def can_contest_rating_issues? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n set_rating\n end", "def rating\n review.rating if review\n end", "def num_ratings \n 5\n end", "def rating\n rating_calculator.rate(raters)\n end", "def rating\r\n\t\t@rating\r\n\tend", "def rating\n 0\n end", "def rating\n @rating\n end", "def rating\n #...
[ "0.73354393", "0.7094088", "0.7022072", "0.692056", "0.68658984", "0.68464655", "0.6789711", "0.6786944", "0.6776948", "0.6765893", "0.6749371", "0.67395765", "0.67303157", "0.6727587", "0.67110884", "0.65848255", "0.6529498", "0.6514811", "0.650233", "0.6497202", "0.64861625...
0.0
-1
clean up string so it can be a sql identifier
def s(string) string.to_s.gsub('[].:', '') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_2_id( a_string ) \n return a_string.gsub(\"[\",\"_\").gsub(\"]\",\"\");\n end", "def clean_identifier(str)\n str = str.to_s.gsub(%r{[[:blank:]]+}, \"\")\n str =~ %r{@} ? \"<#{str.gsub(%r{(<|>)}, \"\")}>\" : str.upcase\n end", "def normalizeField(string)\n string.gsub /_...
[ "0.69503653", "0.6942258", "0.6762436", "0.664475", "0.6626908", "0.662426", "0.6535243", "0.6520202", "0.64824134", "0.6382899", "0.6310478", "0.63102615", "0.63102615", "0.6255674", "0.62167317", "0.62167317", "0.62117255", "0.620411", "0.6160723", "0.6117888", "0.6085733",...
0.0
-1
The version the program is currently in
def version '1.5.1.2' # Version number <major>.<minor>.<patch>.<monthly commit> end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_version\n version_number rev\n end", "def current_version\n @version\n end", "def version\n \"\\e[36mThis program is currently in version number: #{v_num}\\e[0m\"\n end", "def current_version\r\n version = File.read(\"VERSION\").strip\r\n fail \"Invalid version information\" unl...
[ "0.8156844", "0.8008359", "0.7921632", "0.7915961", "0.78845674", "0.78776705", "0.7871148", "0.78511965", "0.7819416", "0.7805027", "0.77695876", "0.7768347", "0.7768347", "0.7768347", "0.77643967", "0.7704105", "0.76999456", "0.76666564", "0.7640471", "0.76345366", "0.76334...
0.73705095
61
Constructs a new instance of a database connection with the specified options hash. Accepts the following options: :default_string_column_size :: The default size of string columns, 255 by default. :identifier_mangling :: Whether to support nondefault identifier mangling for the current database. :logger :: A specific logger to use. :loggers :: An array of loggers to use. :name :: A name to use for the Database object. :preconnect :: Whether to automatically connect to the maximum number of servers. :quote_identifiers :: Whether to quote identifiers. :servers :: A hash specifying a server/shard specific options, keyed by shard symbol . :single_threaded :: Whether to use a singlethreaded connection pool. :sql_log_level :: Method to use to log SQL to a logger, :info by default. All options given are also passed to the connection pool.
def initialize(opts = OPTS) @opts ||= opts @opts = connection_pool_default_options.merge(@opts) @loggers = Array(@opts[:logger]) + Array(@opts[:loggers]) @opts[:servers] = {} if @opts[:servers].is_a?(String) @sharded = !!@opts[:servers] @opts[:adapter_class] = self.class @opts[:single_threaded] = @single_threaded = typecast_value_boolean(@opts.fetch(:single_threaded, Sequel.single_threaded)) @default_string_column_size = @opts[:default_string_column_size] || DEFAULT_STRING_COLUMN_SIZE @schemas = {} @prepared_statements = {} @transactions = {} @symbol_literal_cache = {} @timezone = nil @dataset_class = dataset_class_default @cache_schema = typecast_value_boolean(@opts.fetch(:cache_schema, true)) @dataset_modules = [] @loaded_extensions = [] @schema_type_classes = SCHEMA_TYPE_CLASSES.dup self.sql_log_level = @opts[:sql_log_level] ? @opts[:sql_log_level].to_sym : :info self.log_warn_duration = @opts[:log_warn_duration] self.log_connection_info = typecast_value_boolean(@opts[:log_connection_info]) @pool = ConnectionPool.get_pool(self, @opts) reset_default_dataset adapter_initialize if typecast_value_boolean(@opts.fetch(:identifier_mangling, true)) # SEQUEL5: Remove extension(:_deprecated_identifier_mangling) end unless typecast_value_boolean(@opts[:keep_reference]) == false Sequel.synchronize{::Sequel::DATABASES.push(self)} end Sequel::Database.run_after_initialize(self) if typecast_value_boolean(@opts[:preconnect]) && @pool.respond_to?(:preconnect, true) concurrent = typecast_value_string(@opts[:preconnect]) == "concurrently" @pool.send(:preconnect, concurrent) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize options\n host = options['host'] || 'localhost'\n port = options['port'] || 5432\n database = options['database']\n username = options['username']\n\n # always reuse an existing connection if it matches on these connection options\n conn_options = {:host => ...
[ "0.7521988", "0.7294382", "0.67854095", "0.6767909", "0.6699676", "0.6573191", "0.64947", "0.64589053", "0.6436071", "0.6434783", "0.6425981", "0.6361566", "0.6345742", "0.63254035", "0.62744004", "0.6253118", "0.62489694", "0.62476593", "0.6246423", "0.62409467", "0.6236418"...
0.64364636
8
Freeze internal data structures for the Database instance.
def freeze valid_connection_sql metadata_dataset @opts.freeze @loggers.freeze @pool.freeze @dataset_class.freeze @dataset_modules.freeze @schema_type_classes.freeze @loaded_extensions.freeze # SEQUEL5: Frozen by default, remove this @default_dataset.freeze metadata_dataset.freeze super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freeze\n dataset_module.freeze\n overridable_methods_module.freeze\n\n @finder_loaders.freeze # SEQUEL5: Remove\n\n if @dataset\n @dataset.freeze\n @instance_dataset.freeze\n db_schema.freeze.each_value(&:freeze)\n columns.freeze\n setter...
[ "0.6765147", "0.6468942", "0.63098174", "0.6265448", "0.6214151", "0.6214151", "0.61635923", "0.61635923", "0.6125169", "0.6117258", "0.60580003", "0.6024745", "0.60143214", "0.6008031", "0.5987939", "0.59844863", "0.59752005", "0.59534615", "0.5897359", "0.5877466", "0.58736...
0.67266506
1
Cast the given type to a literal type DB.cast_type_literal(Float) double precision DB.cast_type_literal(:foo) foo
def cast_type_literal(type) type_literal(:type=>type) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arel_cast(value, type, quote_value: true, literalize_type: true)\n value = arel_quoted(value) if quote_value\n type = Arel.sql(type) if literalize_type\n\n as_expr = Arel::Nodes::As.new value, type\n\n arel_fn 'CAST', as_expr\n end", "def cast(val, type)\n ...
[ "0.6988179", "0.6824231", "0.67499065", "0.6748528", "0.67441684", "0.6679899", "0.6561403", "0.6512974", "0.6347855", "0.6207837", "0.61929905", "0.6082754", "0.60521156", "0.603328", "0.60105735", "0.60089767", "0.5997157", "0.59802514", "0.5967669", "0.59590304", "0.595219...
0.8148927
0
Convert the given timestamp from the application's timezone, to the databases's timezone or the default database timezone if the database does not have a timezone.
def from_application_timestamp(v) Sequel.convert_output_timestamp(v, timezone) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timezone\n @timezone || Sequel.database_timezone\n end", "def to_application_timestamp(v)\n Sequel.convert_timestamp(v, timezone)\n end", "def convert_timestamp(timestamp)\n timestamp = db.to_application_timestamp(timestamp) if timestamp.is_a?(String)\n timestamp\n end", "def...
[ "0.64990586", "0.64090383", "0.6375464", "0.6200379", "0.5950318", "0.58946115", "0.5882815", "0.5882815", "0.5882815", "0.5882815", "0.5882815", "0.5874864", "0.5866882", "0.58243126", "0.58108205", "0.5778377", "0.5778377", "0.57736176", "0.5762536", "0.57400864", "0.573840...
0.63362724
3
Returns a string representation of the database object including the class name and connection URI and options used when connecting (if any).
def inspect a = [] a << uri.inspect if uri if (oo = opts[:orig_opts]) && !oo.empty? a << oo.inspect end "#<#{self.class}: #{a.join(' ')}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n \"RDS DBInstance: #{@dbi_name}\"\n end", "def to_s\n \"RDS DBInstance: #{@dbi_name}\"\n end", "def database_name # :nodoc:\n return nil unless Module.constants.include? 'DataMapper' or Module.constants.include? :DataMapper\n raise \"No such database ...
[ "0.6682262", "0.6682262", "0.65253216", "0.6491473", "0.6462967", "0.64000726", "0.62670565", "0.62350756", "0.61628574", "0.61399853", "0.61307466", "0.61161053", "0.6096781", "0.6096781", "0.6061487", "0.60310984", "0.60263556", "0.600335", "0.5995143", "0.5969432", "0.5968...
0.0
-1
Proxy the literal call to the dataset. DB.literal(1) 1 DB.literal(:a) a DB.literal('a') 'a'
def literal(v) schema_utility_dataset.literal(v) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def literal(v)\n schema_utility_dataset.literal(v)\n end", "def literal(v)\n schema_utility_dataset.literal(v)\n end", "def sql_literal(*)\n @dataset.sql\n end", "def sql_literal(ds)\n ds.literal(sql_expr)\n end", "def literal; end", "def literal(v)\n case v\n...
[ "0.7359322", "0.7359322", "0.72207606", "0.7206215", "0.69728357", "0.6900053", "0.6765317", "0.6736966", "0.6736953", "0.6721731", "0.6721001", "0.66926277", "0.6649559", "0.66234446", "0.6593598", "0.6593598", "0.64249414", "0.6328042", "0.6297928", "0.600468", "0.59647393"...
0.734128
2
Return the literalized version of the symbol if cached, or nil if it is not cached.
def literal_symbol(sym) Sequel.synchronize{@symbol_literal_cache[sym]} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing sym, *args\n response = ( !@cache.nil? && @cache.has_key?(sym) )? @cache[sym] : @ref.send(sym)\n return (response.nil?) ? String.new : response\n end", "def simple_get(symbol)\n @engine.get(symbol.to_s, nil, false)\n end", "def cache_get(key)\n nil\n end", "def cache key...
[ "0.6284992", "0.60796434", "0.55420995", "0.552674", "0.5505356", "0.5468994", "0.543161", "0.53786135", "0.5328546", "0.5303015", "0.52315605", "0.5215582", "0.51968235", "0.5171067", "0.5171067", "0.5171067", "0.5171067", "0.5171067", "0.5171067", "0.5171067", "0.5171067", ...
0.6670135
0
Set the cached value of the literal symbol.
def literal_symbol_set(sym, lit) Sequel.synchronize{@symbol_literal_cache[sym] = lit} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def literal_symbol(sym)\n Sequel.synchronize{@symbol_literal_cache[sym]}\n end", "def init_value(aLiteral)\n self.value = aLiteral.dup\n end", "def set_literal\n <<-CODE\n next_int;\n tuple_put(state, cpu_current_literals(state, c), _int, stack_top());\n CODE\n end", "def set_const\n...
[ "0.7176819", "0.6463257", "0.62933266", "0.6242512", "0.61245036", "0.58722264", "0.5863681", "0.5821044", "0.5821044", "0.57240736", "0.56877947", "0.5682074", "0.55532146", "0.5492333", "0.5492333", "0.54681176", "0.5458696", "0.54348177", "0.54327965", "0.54003865", "0.536...
0.8097506
0