query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
TODO decide if this should be calculated from yearly_target_cost | def update_target_cost
cost = BigDecimal(0.00, 10)
self.activities.each do |activity|
cost += activity.targetCost
end
self.target_cost = cost
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internal_work_cost year\n \t\tKpi.internal_work_cost(self, year)\n \tend",
"def annual_cost\n (number_of_positions * hourly_rate * hours_per_week * number_of_weeks)\n end",
"def annual_cost\n (number_of_positions * hourly_rate * hours_per_week * number_of_weeks)\n end",
"def standard_cost_code;... | [
"0.6807114",
"0.6693918",
"0.6693918",
"0.645666",
"0.639724",
"0.6364628",
"0.6357599",
"0.63488847",
"0.63282806",
"0.62914187",
"0.6269085",
"0.62634665",
"0.6216426",
"0.6204317",
"0.6187541",
"0.61302656",
"0.61232364",
"0.6114092",
"0.60668516",
"0.60346997",
"0.6007883... | 0.67912424 | 1 |
It will fill the hash_record with data from the input file that matches the column_names | def fill_hash_record_from_line(column_names, headers, line)
hash_record = {}
fields = line.split(@sep)
fields.each_with_index do |field, field_id|
hash_record[headers[field_id]] = field if column_names.include?(headers[field_id])
end
hash_record
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_values\n #skip the first 5 bytes, don't know what they are for and they don't contain the data.\n @data.read(5)\n \n @attributes = columns.inject({}) do |hash, column|\n \n #get the unpack flag to get this data.\n value = @data.read(column.length).unpack(\"#{... | [
"0.62175995",
"0.6150782",
"0.614006",
"0.6087499",
"0.60071754",
"0.6000193",
"0.5869175",
"0.5846159",
"0.58414525",
"0.58093965",
"0.57959306",
"0.5782186",
"0.5778418",
"0.57463425",
"0.57329917",
"0.57252955",
"0.57242304",
"0.57004684",
"0.56843245",
"0.5662742",
"0.561... | 0.7244097 | 0 |
Actively searches for hubs by talking to publisher directly | def discover_hubs_for_topic
@hubs = Nelumba.feed_from_url(self.topic_url).hubs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(builder)\n send_and_receive connection_config[:url], builder.blacklight_params\n end",
"def subscribe_to_channel; end",
"def hub\n @@message_hub\n end",
"def broadcast_presence\n services = CouchModels::Service.find_all\n users = services.map {|service| se... | [
"0.6113972",
"0.59600884",
"0.5850336",
"0.5739712",
"0.573358",
"0.57098144",
"0.5695787",
"0.5596962",
"0.55593485",
"0.5538158",
"0.55335677",
"0.55157214",
"0.5513801",
"0.55004513",
"0.54968965",
"0.54825956",
"0.54433197",
"0.5424751",
"0.5365758",
"0.53638005",
"0.5348... | 0.70203334 | 0 |
Subscribe to the topic through the given hub. | def subscribe
return unless self.hub.nil?
# Discover hubs if none exist
@hubs = discover_hubs_for_topic(self.topic_url) if self.hubs.empty?
@hub = self.hubs.first
change_subscription(:subscribe, token)
# TODO: Check response, if failed, try a different hub
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe(_topic, **)\n raise 'not implemented'\n end",
"def subscribe!\n @repository.callback_url = pubsubhubbub_callback_url\n\n if @repository.valid?\n begin\n client.subscribe(\n topic,\n @repository.callback_url,\n ENV['PUBSUBHUBBUB_... | [
"0.74728787",
"0.70307046",
"0.6957174",
"0.67062706",
"0.6704016",
"0.66576546",
"0.6651502",
"0.65908444",
"0.65897375",
"0.6423702",
"0.64004534",
"0.6368169",
"0.63166356",
"0.6305598",
"0.6291053",
"0.62853944",
"0.6244622",
"0.6231099",
"0.6225057",
"0.6201193",
"0.6154... | 0.82586724 | 0 |
Change our subscription to this topic at a hub. mode: Either :subscribe or :unsubscribe hub_url: The url of the hub to negotiate with token: A token to verify the response from the hub. | def change_subscription(mode)
token ||= SecureRandom.hex(32)
@tokens << token.to_s
# TODO: Set up HTTPS foo
res = Net::HTTP.post_form(URI.parse(self.hub),
{
'hub.mode' => mode.to_s,
'hub.callback... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe\n return unless self.hub.nil?\n\n # Discover hubs if none exist\n @hubs = discover_hubs_for_topic(self.topic_url) if self.hubs.empty?\n @hub = self.hubs.first\n change_subscription(:subscribe, token)\n\n # TODO: Check response, if failed, try a different hub\n end",
... | [
"0.7160374",
"0.6106317",
"0.57910156",
"0.5741319",
"0.55150294",
"0.5457976",
"0.5431595",
"0.54250175",
"0.53621566",
"0.53432983",
"0.5337536",
"0.5233994",
"0.5226833",
"0.52050966",
"0.5175315",
"0.5174477",
"0.51672274",
"0.51595294",
"0.5157737",
"0.5157737",
"0.51490... | 0.823721 | 0 |
Determines if the given body matches the signature. | def verify_content(body, signature)
hmac = HMAC::SHA1.hexdigest(@secret, body)
check = "sha1=" + hmac
check == signature
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_post_body?(post_body, signature)\n hash = OpenSSL::HMAC.digest(OpenSSL::Digest.new('SHA256'), @channel.line_channel_secret, post_body)\n Base64.strict_encode64(hash) == signature\n end",
"def valid_integrity?(body, headers)\n request_signature = headers['X-Hub-Signature']\n signatu... | [
"0.7437906",
"0.712865",
"0.7121173",
"0.692363",
"0.6910715",
"0.6827787",
"0.6827674",
"0.6740603",
"0.6598621",
"0.6550687",
"0.64843714",
"0.6434735",
"0.6434735",
"0.6426174",
"0.64208806",
"0.63046473",
"0.6290229",
"0.6231722",
"0.6198167",
"0.6130173",
"0.60319704",
... | 0.7715647 | 0 |
Gives the content of a challenge response given the challenge body. | def challenge_response(challenge_code)
{
:body => challenge_code,
:status => 200
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def challenge\n @challenge = decode_challenge\n respond\n end",
"def response\n get_header_and_body\n end",
"def challenge(_request, _response)\n end",
"def challenge!\n response_headers = { \"WWW-Authenticate\" => %(Basic realm=\"My Application\"), 'Content-Typ... | [
"0.67253035",
"0.62437975",
"0.60938525",
"0.57907385",
"0.5765408",
"0.5646408",
"0.56344783",
"0.5613111",
"0.56094533",
"0.55950004",
"0.55777925",
"0.5523152",
"0.5489182",
"0.54876626",
"0.54464895",
"0.54340017",
"0.54340017",
"0.54257554",
"0.54189813",
"0.54122823",
"... | 0.6785793 | 0 |
GET /article_comments/1 GET /article_comments/1.xml | def show
@article_comment = ArticleComment.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @article_comment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @article = Article.find(params[:id])\n @article_comment = @article.article_comments.new(params[:article_comment])\n @article_comments = @article.article_comments.page(params[:page]||1).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @a... | [
"0.7138699",
"0.69637847",
"0.68539035",
"0.6730535",
"0.6730535",
"0.6726112",
"0.67232865",
"0.6709886",
"0.6683312",
"0.6682627",
"0.66215074",
"0.66215074",
"0.66215074",
"0.6614249",
"0.6601951",
"0.6593226",
"0.6580574",
"0.6566607",
"0.6563338",
"0.6559287",
"0.6543599... | 0.7225215 | 0 |
GET /article_comments/new GET /article_comments/new.xml | def new
@article_comment = ArticleComment.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @article_comment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @comment = @story.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @co... | [
"0.7833341",
"0.76509726",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.76506793",
"0.763149",
"0.749347",
"0.72768426",
"0.72593415",
"0.7248823",
"0.7105374",
"0.... | 0.7926563 | 0 |
POST /article_comments POST /article_comments.xml | def create
@article = Article.find(params[:article_id])
@article_comment = @article.article_comments.build()
@article_comment.content = params[:replyContent]
respond_to do |format|
if @article_comment.save
#format.html { redirect_to @article, :anchor => 'comment' }
format.html { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #@comment = Comment.new(params[:article_id])\n @comment = Article.find(params[:article_id]).comments.create(params[:comment])\n\n respond_to do |format|\n if @comment.save\n flash[:notice] = 'Article was successfully created.'\n format.html { redirect_to :back }\n f... | [
"0.6973863",
"0.67758304",
"0.67474",
"0.6717696",
"0.6668092",
"0.66457486",
"0.6593195",
"0.647",
"0.6407714",
"0.6404982",
"0.6362379",
"0.6350214",
"0.63283217",
"0.62911814",
"0.6280884",
"0.627409",
"0.62559813",
"0.62031823",
"0.6188769",
"0.61598265",
"0.611159",
"0... | 0.7053149 | 0 |
PUT /article_comments/1 PUT /article_comments/1.xml | def update
@article_comment = ArticleComment.find(params[:id])
respond_to do |format|
if @article_comment.update_attributes(params[:article_comment])
format.html { redirect_to(@article_comment, :notice => 'Article comment was successfully updated.') }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity ... | [
"0.67775",
"0.66272867",
"0.6463805",
"0.6380269",
"0.63516814",
"0.63516814",
"0.6330247",
"0.6270228",
"0.62661874",
"0.6241298",
"0.62362623",
"0.6210142",
"0.6210142",
"0.620209",
"0.6201098",
"0.6194806",
"0.6194537",
"0.619005",
"0.6178299",
"0.6148663",
"0.6148663",
... | 0.69861263 | 0 |
DELETE /article_comments/1 DELETE /article_comments/1.xml | def destroy
@article_comment = ArticleComment.find(params[:id])
@article_comment.destroy
respond_to do |format|
format.html { redirect_to(article_comments_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n puts \">>>> Destroying a comment <<<<\"\n @comment = Comment.find(params[:id])\n puts \"found comment>>> #{@comment}\"\n @article = @comment.article\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(article_path(@article)) }\n format.xml { head :ok... | [
"0.72589505",
"0.7096152",
"0.7067763",
"0.703446",
"0.6966151",
"0.68770635",
"0.6868609",
"0.68683994",
"0.6865256",
"0.68386793",
"0.68386793",
"0.6834373",
"0.6748496",
"0.67301726",
"0.6726204",
"0.67233056",
"0.67233056",
"0.67141426",
"0.67141426",
"0.67141426",
"0.671... | 0.73909175 | 0 |
add_student(db, "Bob") methoad to add a subject | def add_subject(database, name)
database.execute("INSERT INTO subjects (name) VALUES (?)", [name])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_student_to_course(student_id, name, email)\n if Student.find_by_email(email)\n student = Student.find_by_email(email)\n else\n student = Student.new\n student.email = email\n student.student_id = student_id\n student.name = name\n student.university = Faculty.find(faculty_id).university... | [
"0.74211407",
"0.7257415",
"0.7249954",
"0.71419096",
"0.7114764",
"0.70805085",
"0.7029817",
"0.69931626",
"0.693987",
"0.69269323",
"0.692504",
"0.68591183",
"0.67597145",
"0.66752774",
"0.6672282",
"0.6646676",
"0.6644185",
"0.6618015",
"0.6579783",
"0.65795845",
"0.656483... | 0.79847014 | 0 |
add_subject(db, "Math") add_subject(db, "English") add_subject(db, "Physics") add_subject(db, "Art") add_subject(db, "Chemistry") method to add a grade | def add_grade(database, student_id, subject_id, grade)
database.execute("INSERT INTO grades (grade, student_id, subject_id) VALUES (?, ?, ?)", [grade, student_id, subject_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_subject_grade(all_grades,cid)\n currentMark = mark_per(all_grades.sum(\"worth\"), all_grades.sum(\"courseMark\"))\n Subject.update(cid, :currentMark => currentMark)\n end",
"def add_subject(database, name)\r\n\tdatabase.execute(\"INSERT INTO subjects (name) VALUES (?)\", [name])\r\nen... | [
"0.67687356",
"0.65627533",
"0.6485465",
"0.6350736",
"0.626064",
"0.61422634",
"0.613574",
"0.60928875",
"0.6089411",
"0.6088551",
"0.6086325",
"0.60766816",
"0.6043076",
"0.60364455",
"0.601754",
"0.60110974",
"0.6000983",
"0.593063",
"0.59266424",
"0.58940816",
"0.5888349"... | 0.7312546 | 0 |
add_grade(db, 1, 1, 80) method to update a grade | def update_grade(database, student, subject, grade)
student_id = get_student_id(database, student)
subject_id = get_subject_id(database, subject)
database.execute("UPDATE grades SET grade=? WHERE student_id=? AND subject_id=?",[grade, student_id, subject_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_grade(database, student_id, subject_id, grade)\r\n\tdatabase.execute(\"INSERT INTO grades (grade, student_id, subject_id) VALUES (?, ?, ?)\", [grade, student_id, subject_id])\r\nend",
"def update_grade\n grade_entry_form = record\n grade_entry_student =\n grade_entry_form.grade_entry_students.... | [
"0.7757418",
"0.70768535",
"0.70141536",
"0.6971177",
"0.6917739",
"0.6823761",
"0.6667837",
"0.6667837",
"0.6667837",
"0.6667837",
"0.6667837",
"0.6667837",
"0.6667837",
"0.6667837",
"0.6644402",
"0.66316",
"0.66285104",
"0.66190195",
"0.6585793",
"0.6584383",
"0.65841913",
... | 0.7691302 | 1 |
p get_student_id(db, "Bob") method to get subject id | def get_subject_id(database, name)
subject = database.execute("SELECT * FROM subjects WHERE name=?",[name])
subject_id = subject[0][0].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def student_id\n @net_ldap_entry[:berkeleyedustuid].first\n end",
"def student_id\r\n\t\t\treturn 51875531\r\n\t\tend",
"def get_student_id(database, name)\r\n\tstudent = database.execute(\"SELECT * FROM students WHERE name=?\",[name])\r\n\tstudent_id = student[0][0].to_i\r\nend",
"def subject_id\n ... | [
"0.72265273",
"0.7163225",
"0.70819074",
"0.7021264",
"0.6876979",
"0.6489194",
"0.64713913",
"0.63267535",
"0.6314024",
"0.63004786",
"0.62624776",
"0.62099344",
"0.6209032",
"0.61056346",
"0.61007106",
"0.61007106",
"0.6090539",
"0.60806286",
"0.60690045",
"0.60500723",
"0.... | 0.77052814 | 0 |
display_students(db) method to display all subjects | def display_subjects(database)
subjects = database.execute("SELECT * FROM subjects")
subjects.each do |subject|
puts "ID: #{subject[0]} Subject: #{subject[1]}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_subjects\r\n #TODO only list subjects from my own schools \r\n #because then people can still it \r\n school = School.find(params[:nid]) rescue render_return\r\n render_return if !logged_in_user.see_course?(school)\r\n render_p 'course_display/course_selection',{'ca... | [
"0.71916765",
"0.70844215",
"0.69682807",
"0.6877798",
"0.68359965",
"0.68359965",
"0.6818311",
"0.6809174",
"0.6809174",
"0.6809174",
"0.67688406",
"0.67515945",
"0.67114455",
"0.66914874",
"0.66760284",
"0.66130507",
"0.6603461",
"0.6588587",
"0.6587552",
"0.65592146",
"0.6... | 0.74699634 | 0 |
make sure the complete key is build using the options such as scope and count | def prepare_key(key, options)
complete_key = key
# if a scope is passed in options then build the full key
complete_key = options[:scope].present? ? "#{options[:scope].to_s}.#{complete_key}" : complete_key
# add the correct count suffix
if options[:count].present? && options[:count] == 1
co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_master_key=(_arg0); end",
"def require_master_key=(_arg0); end",
"def reserve_key(key); end",
"def require_master_key; end",
"def require_master_key; end",
"def possible_keys(key); end",
"def rekey_as_needed; end",
"def flexible_key; end",
"def rekey_limit=(_arg0); end",
"def rekey_li... | [
"0.6185478",
"0.6185478",
"0.5928056",
"0.5750648",
"0.5750648",
"0.5669566",
"0.5653811",
"0.5534185",
"0.54608905",
"0.53779304",
"0.5377498",
"0.53765714",
"0.5315928",
"0.5315928",
"0.5315928",
"0.53034055",
"0.5301031",
"0.52843225",
"0.5276526",
"0.5276526",
"0.5276526"... | 0.69126046 | 0 |
You can't proxy nil or false, so remove those possibilities if they're in the type. | def proxy_simplify
ts = @types.dup.delete_if do |t|
t.is_a? NominalType and
(t.klass == NilClass or t.klass == FalseClass)
end
if ts.length == @types.length
then self
else if ts.length == 1
then ts.to_a[0]
else Uni... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proxy_types; end",
"def typecast_value_boolean(opts={});true;end",
"def skip_conversion?(obj, attr, value)\n value.nil? || !obj.class.attributes.key?(attr)\n end",
"def nonregular_type; end",
"def generic?; true; end",
"def object_type?\n !value_type?\n end",
"def proxy_type\n ... | [
"0.60454077",
"0.60138047",
"0.586154",
"0.5804956",
"0.58021206",
"0.580121",
"0.57736146",
"0.57269555",
"0.5706746",
"0.5681425",
"0.5674773",
"0.56521684",
"0.56374043",
"0.56374043",
"0.5634711",
"0.56346625",
"0.56327087",
"0.5608932",
"0.5591604",
"0.55645496",
"0.5531... | 0.6163261 | 0 |
DELETE /hookups/1 DELETE /hookups/1.xml | def destroy
@hookup = Hookup.find(params[:id])
@hookup.destroy
respond_to do |format|
format.html { redirect_to(hookups_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_hook(id)\n delete(\"/hooks/#{id}\")\n end",
"def delete(id)\n _params = {:id => id}\n return @master.call 'webhooks/delete', _params\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTT... | [
"0.66563874",
"0.6259569",
"0.6164094",
"0.6144415",
"0.6017475",
"0.60122293",
"0.59824574",
"0.59824574",
"0.5970387",
"0.5937535",
"0.58757156",
"0.5859602",
"0.5791331",
"0.5747852",
"0.5727907",
"0.57187104",
"0.5715497",
"0.5710771",
"0.56989694",
"0.5691974",
"0.568552... | 0.7322159 | 0 |
GET /product_groups/1 GET /product_groups/1.json | def show
@product_group = ProductGroup.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @product_group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @product_groups = ProductGroup.all\n end",
"def index\n @product_product_groups = ProductProductGroup.all\n end",
"def index\n render json: ProductAuth.where({group_id: params[:group_id]})\n end",
"def index\n @groupsIds = GroupsProssumer.where(prossumer_id: params[:prossumer_id]).... | [
"0.7469453",
"0.7381799",
"0.7266036",
"0.7241326",
"0.7148794",
"0.7009119",
"0.7007086",
"0.69642437",
"0.6889603",
"0.6879488",
"0.68774074",
"0.68574584",
"0.6847752",
"0.68304884",
"0.6828815",
"0.6793829",
"0.6793829",
"0.67805314",
"0.6775832",
"0.676863",
"0.6768066",... | 0.7738448 | 0 |
GET /product_groups/new GET /product_groups/new.json | def new
@product_group = ProductGroup.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @product_group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @group = Group.new\n render json: @group\n end",
"def new\n @group = Group.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n render json: @group\n end",
"def new\n @gro... | [
"0.77525693",
"0.77437204",
"0.77248377",
"0.7723919",
"0.7723919",
"0.7723919",
"0.7723919",
"0.7723919",
"0.7723919",
"0.7723919",
"0.7723919",
"0.7654325",
"0.76500785",
"0.76500785",
"0.7637246",
"0.7637246",
"0.7630681",
"0.76269585",
"0.7613564",
"0.76000494",
"0.755431... | 0.8207227 | 0 |
POST /product_groups POST /product_groups.json | def create
@product_group = ProductGroup.new(params[:product_group])
respond_to do |format|
if @product_group.save
format.html { redirect_to @product_group, notice: 'Product group was successfully created.' }
format.json { render json: @product_group, status: :created, location: @product_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @product_group = ProductGroup.new(product_group_params)\n\n respond_to do |format|\n if @product_group.save\n format.html { redirect_to @product_group, notice: \"Product group was successfully created.\" }\n format.json { render :show, status: :created, location: @product_grou... | [
"0.74873894",
"0.7404065",
"0.7276609",
"0.72105795",
"0.69572115",
"0.6926051",
"0.68251",
"0.6778822",
"0.67742246",
"0.6755118",
"0.67133766",
"0.6642443",
"0.6631938",
"0.66003615",
"0.6566832",
"0.6520253",
"0.64784855",
"0.64757067",
"0.64537245",
"0.6451597",
"0.643942... | 0.74643666 | 1 |
PUT /product_groups/1 PUT /product_groups/1.json | def update
@product_group = ProductGroup.find(params[:id])
respond_to do |format|
if @product_group.update_attributes(params[:product_group])
format.html { redirect_to @product_group, notice: 'Product group was successfully updated.' }
format.json { head :no_content }
else
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @product_group.update(product_group_params)\n format.html { redirect_to @product_group, notice: \"Product group was successfully updated.\" }\n format.json { render :show, status: :ok, location: @product_group }\n else\n format.html { rende... | [
"0.7319747",
"0.717857",
"0.7144693",
"0.7133317",
"0.6942322",
"0.69123155",
"0.6906836",
"0.68793714",
"0.67309684",
"0.67155915",
"0.6634647",
"0.66333306",
"0.6632108",
"0.66289",
"0.65920997",
"0.6582122",
"0.6545448",
"0.65433204",
"0.65422857",
"0.6541781",
"0.6521263"... | 0.74395096 | 0 |
DELETE /product_groups/1 DELETE /product_groups/1.json | def destroy
@product_group = ProductGroup.find(params[:id])
@product_group.destroy
respond_to do |format|
format.html { redirect_to product_groups_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @product_group.destroy\n respond_to do |format|\n format.html { redirect_to product_groups_url, notice: \"Product group was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_tree_group = ProductTreeGroup.find(params[:id])\n ... | [
"0.7735333",
"0.77158034",
"0.7650658",
"0.7554933",
"0.7516712",
"0.73726857",
"0.73586386",
"0.7358454",
"0.7348608",
"0.7340374",
"0.73220503",
"0.731833",
"0.7316048",
"0.73030275",
"0.7301992",
"0.7284739",
"0.7284739",
"0.7282055",
"0.7282055",
"0.7282055",
"0.7282055",... | 0.7959752 | 0 |
pass in a user_id and period in params and it will find the next or previous fab | def cycle_fab_by_period(direction, params)
user = User.find(params[:user_id])
current_fab = find_or_create_base_fab(user, params)
@fab = (direction == :forward) ? current_fab.exactly_next_fab : current_fab.exactly_previous_fab
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_fab\n fab = self.user.fabs.where('period > ?', self.period).last\n end",
"def previous_fab\n self.user.fabs.where('period < ?', self.period).first\n end",
"def find_or_create_base_fab(user, params)\n t = DateTime.parse(params[:fab_period])\n user.fabs.where(period: t..(t+7)).limit(1)... | [
"0.75222033",
"0.70780116",
"0.65194535",
"0.6234198",
"0.5811905",
"0.55975586",
"0.55639964",
"0.54987097",
"0.5474077",
"0.5444344",
"0.5439489",
"0.54295886",
"0.5351375",
"0.53465503",
"0.533704",
"0.53105617",
"0.52771693",
"0.5246108",
"0.5236079",
"0.52124244",
"0.520... | 0.71977055 | 1 |
scores for each letter | def letter_scores
{ "A"=>1, "B"=>3, "C"=>3, "D"=>2,
"E"=>1, "F"=>4, "G"=>2, "H"=>4,
"I"=>1, "J"=>8, "K"=>5, "L"=>1,
"M"=>3, "N"=>1, "O"=>1, "P"=>3,
"Q"=>10, "R"=>1, "S"=>1, "T"=>1,
"U"=>1, "V"=>4, "W"=>4, "X"=>8,
"Y"=>4, "Z"=>10
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score\n #Here are the letter values. Think about how you might put this data in a usable format for your methods above.\n scores = {a: 1, b: 3, c: 3, d: 2, e: 1,\n f: 4, g: 2, h: 4, i: 1, j: 8,\n k: 5, l: 1, m: 3, n: 1, o: 1,\n p: 3, q: 10, r: 1, s: 1, t: 1,\n u: 1, v: 4, w: 4, x: 8, ... | [
"0.824917",
"0.8168501",
"0.8113238",
"0.80915755",
"0.8042495",
"0.7853455",
"0.78430134",
"0.78368604",
"0.7829441",
"0.7805414",
"0.7702877",
"0.76888996",
"0.7581454",
"0.75517035",
"0.7524041",
"0.75231236",
"0.7522714",
"0.7490279",
"0.7487372",
"0.7485952",
"0.74232775... | 0.8268655 | 0 |
Create a Scalyr log endpoint Create a Scalyr for a particular service and version. | def create_log_scalyr_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: LoggingScalyrApi.create_log_scalyr ...'
end
# unbox the parameters from the hash
service_id = opts[:'service_id']
version_id = opts[:'version_id']
# v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.create_log_https ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id']\n... | [
"0.63094306",
"0.55148655",
"0.54828",
"0.5475669",
"0.5457197",
"0.539816",
"0.5357744",
"0.53551394",
"0.5352624",
"0.5262666",
"0.51651096",
"0.5146249",
"0.5081378",
"0.506789",
"0.5038942",
"0.5032302",
"0.5024885",
"0.5010969",
"0.4952143",
"0.49512643",
"0.49470007",
... | 0.62122124 | 1 |
Update the Scalyr log endpoint Update the Scalyr for a particular service and version. | def update_log_scalyr(opts = {})
data, _status_code, _headers = update_log_scalyr_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_log_scalyr_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingScalyrApi.update_log_scalyr ...'\n end\n # unbox the parameters from the hash\n service_id = opts[:'service_id']\n version_id = opts[:'version_id'... | [
"0.62463784",
"0.5989424",
"0.5796027",
"0.56155396",
"0.5508138",
"0.55066663",
"0.5350583",
"0.53137094",
"0.53058976",
"0.53037494",
"0.5298519",
"0.5298519",
"0.5298519",
"0.52912253",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.52901274",
"0.... | 0.6037402 | 1 |
Update the Scalyr log endpoint Update the Scalyr for a particular service and version. | def update_log_scalyr_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: LoggingScalyrApi.update_log_scalyr ...'
end
# unbox the parameters from the hash
service_id = opts[:'service_id']
version_id = opts[:'version_id']
log... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_log_scalyr(opts = {})\n data, _status_code, _headers = update_log_scalyr_with_http_info(opts)\n data\n end",
"def update_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.update_log_https ...'\... | [
"0.60364985",
"0.5988784",
"0.57954115",
"0.56161684",
"0.550915",
"0.55066377",
"0.53505254",
"0.5313251",
"0.53059125",
"0.5304225",
"0.52992487",
"0.52992487",
"0.52992487",
"0.5291028",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.5289934",
"0.52899... | 0.6245973 | 0 |
Parses a box given as a string of four numbers separated by commas. | def parse_box(key, box)
if box.kind_of?(String)
begin
raw_box = box.split(",").map(&:to_f)
box = [[raw_box[0], raw_box[1]], [raw_box[2], raw_box[3]]]
rescue
raise_error(type: "box.format", key: "key", value: box)
end
end
return bo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def separate_comma(number)\n a = number.to_s.split('')\n b = a.size/3.0\n if a.size < 4\n p number.to_s\n elsif a.size%3 == 0\n n = -4\n (b.to_i-1).times do |i|\n a.insert(n, ',')\n n -= 4\n end\n p a.join(\"\")\n else\n n = -4\n b.to_i.times do |i|\n a.insert(n, ',')\n ... | [
"0.5725185",
"0.56800514",
"0.5598327",
"0.5561332",
"0.55471665",
"0.55361533",
"0.5437865",
"0.5434925",
"0.54308045",
"0.5426325",
"0.54177195",
"0.5394734",
"0.5390538",
"0.5384195",
"0.53711957",
"0.5371127",
"0.53222734",
"0.52947557",
"0.52777505",
"0.52601725",
"0.523... | 0.6891576 | 0 |
GET /folha/fonte_recursos/1 GET /folha/fonte_recursos/1.xml | def show
@folha_fonte_recurso = Folha::FonteRecurso.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @folha_fonte_recurso }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @folha_fonte_recurso = Folha::FonteRecurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @folha_fonte_recurso }\n end\n end",
"def index\n @fontes_de_recurso = FonteDeRecurso.all\n end",
"def index\n @ficha_tematicas = FichaTemat... | [
"0.67986166",
"0.6510254",
"0.64190376",
"0.6332299",
"0.62508994",
"0.6156716",
"0.61154336",
"0.6066128",
"0.6064156",
"0.6020125",
"0.5996897",
"0.5989245",
"0.5948115",
"0.5941834",
"0.59392554",
"0.5932778",
"0.592614",
"0.5925721",
"0.59229153",
"0.59220743",
"0.5918553... | 0.7212535 | 0 |
GET /folha/fonte_recursos/new GET /folha/fonte_recursos/new.xml | def new
@folha_fonte_recurso = Folha::FonteRecurso.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @folha_fonte_recurso }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @folha_fonte_recurso = Folha::FonteRecurso.new(params[:folha_fonte_recurso])\n\n respond_to do |format|\n if @folha_fonte_recurso.save\n format.html { redirect_to(@folha_fonte_recurso, :notice => 'Fonte recurso cadastrado com sucesso.') }\n format.xml { render :xml => @folha_... | [
"0.7165466",
"0.7123394",
"0.70717293",
"0.7062308",
"0.7053969",
"0.7014244",
"0.70023257",
"0.6994842",
"0.69882905",
"0.6973694",
"0.69653803",
"0.69608945",
"0.6924424",
"0.69081575",
"0.6904836",
"0.68923503",
"0.6881837",
"0.6872291",
"0.6868262",
"0.6864104",
"0.686336... | 0.78595954 | 0 |
POST /folha/fonte_recursos POST /folha/fonte_recursos.xml | def create
@folha_fonte_recurso = Folha::FonteRecurso.new(params[:folha_fonte_recurso])
respond_to do |format|
if @folha_fonte_recurso.save
format.html { redirect_to(@folha_fonte_recurso, :notice => 'Fonte recurso cadastrado com sucesso.') }
format.xml { render :xml => @folha_fonte_recur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @fonte_de_recurso = FonteDeRecurso.new(fonte_de_recurso_params)\n\n respond_to do |format|\n if @fonte_de_recurso.save\n addlog(\"Fonte e recurso criada\")\n format.html { redirect_to @fonte_de_recurso, notice: 'Fonte de recurso criado com sucesso.' }\n format.json { re... | [
"0.6576212",
"0.6546346",
"0.5989254",
"0.59138715",
"0.5829405",
"0.5679341",
"0.5659937",
"0.5561227",
"0.5525281",
"0.54951185",
"0.5408069",
"0.54039514",
"0.5390445",
"0.53696644",
"0.53580695",
"0.5331035",
"0.53213084",
"0.5311783",
"0.52930653",
"0.52399963",
"0.52396... | 0.7028034 | 0 |
PUT /folha/fonte_recursos/1 PUT /folha/fonte_recursos/1.xml | def update
@folha_fonte_recurso = Folha::FonteRecurso.find(params[:id])
respond_to do |format|
if @folha_fonte_recurso.update_attributes(params[:folha_fonte_recurso])
format.html { redirect_to(@folha_fonte_recurso, :notice => 'Fonte recurso atualizado com sucesso.') }
format.xml { head :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @fonte_de_recurso.update(fonte_de_recurso_params)\n addlog(\"Fonte de recurso atualizada\")\n format.html { redirect_to @fonte_de_recurso, notice: 'Fonte de recurso atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: ... | [
"0.6718887",
"0.6204177",
"0.6086003",
"0.600813",
"0.5998788",
"0.59138423",
"0.58684003",
"0.5863639",
"0.57224727",
"0.57072246",
"0.568265",
"0.56784505",
"0.56596494",
"0.56312805",
"0.5617255",
"0.5592369",
"0.5580204",
"0.5570335",
"0.55690354",
"0.55552244",
"0.553742... | 0.7004521 | 0 |
DELETE /folha/fonte_recursos/1 DELETE /folha/fonte_recursos/1.xml | def destroy
@folha_fonte_recurso = Folha::FonteRecurso.find(params[:id])
@folha_fonte_recurso.destroy
respond_to do |format|
format.html { redirect_to(folha_fonte_recursos_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @orc_ficha = OrcFicha.find(params[:id])\n @orc_ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_fichas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @texte_accueil = TexteAccueil.find(params[:id])\n @texte_accueil.destroy\n\n ... | [
"0.70066607",
"0.68796295",
"0.6851178",
"0.6823986",
"0.6794931",
"0.6768692",
"0.6767139",
"0.6751718",
"0.6751042",
"0.67501384",
"0.6742871",
"0.6707887",
"0.67000794",
"0.667924",
"0.66605526",
"0.6650227",
"0.66497517",
"0.6629498",
"0.66248184",
"0.6623169",
"0.6609649... | 0.7105803 | 0 |
GET /spaceships/1 GET /spaceships/1.json | def show
@spaceship = Spaceship.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @spaceship }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_spaceship\n @Spaceship = Spaceship.find(params[:id])\n end",
"def destroy\n @spaceship = Spaceship.find(params[:id])\n @spaceship.destroy\n\n respond_to do |format|\n format.html { redirect_to spaceships_url }\n format.json { head :no_content }\n end\n end",
"def show\n @... | [
"0.6912334",
"0.6850876",
"0.6655734",
"0.6593635",
"0.6593635",
"0.6578572",
"0.65641755",
"0.65522325",
"0.64784205",
"0.645288",
"0.6362502",
"0.6340898",
"0.6309388",
"0.624591",
"0.6204399",
"0.6168204",
"0.6147271",
"0.6136464",
"0.6070756",
"0.606848",
"0.60638136",
... | 0.749515 | 0 |
GET /spaceships/new GET /spaceships/new.json | def new
@spaceship = Spaceship.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @spaceship }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @spaceship = Spaceship.new(params[:spaceship])\n\n respond_to do |format|\n if @spaceship.save\n format.html { redirect_to @spaceship, notice: 'Spaceship was successfully created.' }\n format.json { render json: @spaceship, status: :created, location: @spaceship }\n else\... | [
"0.7296353",
"0.6984411",
"0.69628364",
"0.6823614",
"0.6733631",
"0.6665979",
"0.66434836",
"0.65606123",
"0.6524445",
"0.6505506",
"0.6435907",
"0.6389318",
"0.6389318",
"0.63241774",
"0.629617",
"0.6291355",
"0.6264541",
"0.62360275",
"0.62093776",
"0.6184651",
"0.6151153"... | 0.76457113 | 0 |
POST /spaceships POST /spaceships.json | def create
@spaceship = Spaceship.new(params[:spaceship])
respond_to do |format|
if @spaceship.save
format.html { redirect_to @spaceship, notice: 'Spaceship was successfully created.' }
format.json { render json: @spaceship, status: :created, location: @spaceship }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @space = Space.new(space_params)\n @space.user = current_user\n if @space.save\n render json: @space\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def create\n @space = Space.new(space_params)\n\n respond_to do |format|\n if @s... | [
"0.6713618",
"0.6478278",
"0.6451725",
"0.6440632",
"0.6364032",
"0.63469845",
"0.62720066",
"0.6269905",
"0.62597173",
"0.6215008",
"0.61268187",
"0.61099136",
"0.61027986",
"0.60991967",
"0.6039852",
"0.6034618",
"0.6031819",
"0.6023402",
"0.5977067",
"0.5971664",
"0.595108... | 0.7412879 | 0 |
PUT /spaceships/1 PUT /spaceships/1.json | def update
@spaceship = Spaceship.find(params[:id])
respond_to do |format|
if @spaceship.update_attributes(params[:spaceship])
format.html { redirect_to @spaceship, notice: 'Spaceship was successfully updated.' }
format.json { head :no_content }
else
format.html { render act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @space.update(space_params)\n render json: @space, status: :ok\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @spaceship = Spaceship.find(params[:id])\n @spaceship.destroy\n\n respond_to do |format|\n format.html {... | [
"0.7006186",
"0.6673637",
"0.6661903",
"0.6658144",
"0.6597776",
"0.6574459",
"0.6551795",
"0.65341336",
"0.63493514",
"0.63277406",
"0.63232774",
"0.6322382",
"0.6322382",
"0.62951064",
"0.6262661",
"0.62561697",
"0.62507707",
"0.62293136",
"0.62293136",
"0.62293136",
"0.622... | 0.7239147 | 0 |
DELETE /spaceships/1 DELETE /spaceships/1.json | def destroy
@spaceship = Spaceship.find(params[:id])
@spaceship.destroy
respond_to do |format|
format.html { redirect_to spaceships_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to ships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.h... | [
"0.74584836",
"0.7456517",
"0.7437676",
"0.7378187",
"0.7368963",
"0.7368963",
"0.7284748",
"0.7280078",
"0.7257336",
"0.72509706",
"0.72509706",
"0.72509706",
"0.71888006",
"0.71787786",
"0.71521485",
"0.7068189",
"0.70637536",
"0.7053948",
"0.7050484",
"0.70380163",
"0.7018... | 0.815735 | 0 |
Make sure the message has valid message ids for the message, and fetch them | def fetch_message_ids field
self[field] ? self[field].message_ids || [self[field].message_id] : []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_existing_message_id\n id = Message.all.first&.id\n return if id.nil?\n\n get \"/messages/#{id}\"\n assert last_response.ok?\n assert_equal 'application/vnd.api+json', last_response.headers['Content-Type']\n\n response_body = JSON.parse last_response.body\n data = response_body['da... | [
"0.63826364",
"0.6215906",
"0.6174645",
"0.6132375",
"0.60798234",
"0.6048526",
"0.5982312",
"0.59225845",
"0.588637",
"0.5834074",
"0.5827028",
"0.5820203",
"0.5777928",
"0.57758",
"0.5766871",
"0.56620264",
"0.5660341",
"0.56515366",
"0.5645467",
"0.56278944",
"0.5589139",
... | 0.6604395 | 0 |
unnests all the mime stuff and returns a list of [type, filename, content] tuples. for multipart/alternative parts, will only return the subpart that matches preferred_type. if none of them, will only return the first subpart. | def decode_mime_parts part, preferred_type, level=0
if part.multipart?
if mime_type_for(part) =~ /multipart\/alternative/
target = part.body.parts.find { |p| mime_type_for(p).index(preferred_type) } || part.body.parts.first
if target # this can be nil
decode_mime_parts target, prefer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_mime_parts part, preferred_type, level=0\n if part.multipart?\n if mime_type_for(part) =~ /multipart\\/alternative/\n target = part.body.find { |p| mime_type_for(p).index(preferred_type) } || part.body.first\n if target # this can be nil\n decode_mime_parts target, preferr... | [
"0.81594896",
"0.68456435",
"0.6838694",
"0.68105495",
"0.6785661",
"0.66915774",
"0.6241558",
"0.61803854",
"0.6168737",
"0.6095913",
"0.60192",
"0.5857295",
"0.5844454",
"0.5838469",
"0.57698023",
"0.57279783",
"0.5694555",
"0.5678422",
"0.56566614",
"0.56438607",
"0.560171... | 0.81477994 | 1 |
the content of a mime part itself. if the contenttype is text/, it will be converted to utf8. otherwise, it will be left in the original encoding | def mime_content_for mime_part, preferred_type
return "" unless mime_part.body # sometimes this happens. not sure why.
content_type = mime_part.fetch_header(:content_type) || "text/plain"
source_charset = mime_part.charset || "US-ASCII"
content = mime_part.decoded
converted_content, converted_char... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mime_content_for mime_part, preferred_type\n return \"\" unless mime_part.body # sometimes this happens. not sure why.\n\n mt = mime_type_for(mime_part) || \"text/plain\" # i guess\n content_type = if mt =~ /^(.+);/ then $1.downcase else mt end\n source_charset = if mt =~ /charset=\"?(.*?)\"?(;|$)/... | [
"0.8224312",
"0.70821804",
"0.7076037",
"0.6950319",
"0.69197065",
"0.6854977",
"0.68008924",
"0.67520815",
"0.65030843",
"0.65019614",
"0.649895",
"0.64961064",
"0.64805937",
"0.6471726",
"0.64519835",
"0.6377766",
"0.6355258",
"0.63552046",
"0.63443625",
"0.63443625",
"0.63... | 0.82974017 | 0 |
Gets the shortest path from source to destination using BFS algorithm | def shortest_path
initial_position_obj = { position: start_position, source: {} }
knights_path = [initial_position_obj]
while knights_path.present?
current_position = knights_path.shift
position = current_position[:position]
if position == end_position
return path_to_destinatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_path\n dist, previous = Hash.new(Infinity), {}\n dist[@source] = 0.0\n queue = @graph.vertex_set.dup\n\n until queue.empty?\n u = queue.min { |a,b| dist[a.name] <=> dist[b.name] }\n break if dist[u.name].infinite?\n queue.delete(u)\n\n u.each_edge do |e, v|\n... | [
"0.7995144",
"0.7745324",
"0.7636586",
"0.7586582",
"0.75549906",
"0.7545491",
"0.75307226",
"0.74935955",
"0.7445026",
"0.7368284",
"0.73522717",
"0.7333823",
"0.7222897",
"0.7208352",
"0.7200845",
"0.71549547",
"0.7150209",
"0.714395",
"0.7122513",
"0.70829666",
"0.7069968"... | 0.79216474 | 1 |
Saves the given knight's position and returns the board id | def save
if self.class.valid_position?(knight_position)
unique_board_id = board_id
redis_conn.set(unique_board_id, knight_position)
{ status: :success, board_id: unique_board_id }
else
{ status: :failed, message: "Invalid knight's position" }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n\t\t[@board, @player1, @player2, @player_turn, @check]\n\tend",
"def export\n # Temporarily use first database entry for all saves\n s = ChessSave.first\n s.position = @current_state[:position].join\n s.human_to_move = @current_state[:player] == :human\n s.save\n end",
"def place_knig... | [
"0.6420481",
"0.6128735",
"0.60095066",
"0.5973782",
"0.59638786",
"0.5896512",
"0.58839715",
"0.5771361",
"0.5710182",
"0.57052237",
"0.57034415",
"0.56949437",
"0.56610554",
"0.5650523",
"0.5622209",
"0.56087404",
"0.55820096",
"0.5581498",
"0.55697507",
"0.5545929",
"0.554... | 0.79746467 | 0 |
Adds all possible destinations with respect to the knight's position | def add_possible_destination(position, knights_action, knights_path)
possible_destinations = possible_destinations(position)
possible_destinations.each do |possible_destination|
add_path(possible_destination, knights_action, knights_path)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def knight_moves(start, destination)\n\t\tnode = possible_moves(Node.new(start), destination)\n\t\tpath = []\n\t\twhile node.parent != nil\n\t\t\tpath.push(node.value)\n\t\t\tnode = node.parent\n\t\tend\n\t\tpath.push(start)\n\t\tprint_path(path.reverse)\n\tend",
"def add_path(destination, knights_action, knight... | [
"0.6738935",
"0.67211807",
"0.67088896",
"0.66092366",
"0.65555704",
"0.65023845",
"0.6478805",
"0.64724344",
"0.64675397",
"0.63763046",
"0.6321274",
"0.6287201",
"0.62555367",
"0.62447125",
"0.6160926",
"0.61265546",
"0.61096984",
"0.60430247",
"0.6032911",
"0.60122496",
"0... | 0.76067793 | 0 |
Add destination to visited destinations Adds destination with respect to the action taken by knight and adds the path taken to destination to source to track. | def add_path(destination, knights_action, knights_path)
visited_destinations << destination
knights_path << { position: destination, source: knights_action }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_possible_destination(position, knights_action, knights_path)\n\n possible_destinations = possible_destinations(position)\n\n possible_destinations.each do |possible_destination|\n add_path(possible_destination, knights_action, knights_path)\n end\n end",
"def set_destination(destination)\n... | [
"0.7589915",
"0.62062234",
"0.6092163",
"0.6044265",
"0.6023083",
"0.5994683",
"0.59566385",
"0.5937222",
"0.59344935",
"0.58746743",
"0.5832598",
"0.58178014",
"0.5743225",
"0.571955",
"0.5697374",
"0.5666418",
"0.56610596",
"0.5653673",
"0.5625447",
"0.5583469",
"0.55764425... | 0.8459319 | 0 |
Instantiates a new unifiedRoleManagementPolicyExpirationRule and sets the default values. | def initialize()
super
@odata_type = "#microsoft.graph.unifiedRoleManagementPolicyExpirationRule"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(opts = {})\n @expiration = opts[:expiration]\n end",
"def expiration\n @expiration ||= 60 * 60 * 24 * 30 # 30 days\n end",
"def add_default_expiration(vm, exps)\n return exps if vm.default_expiration\n exps << Berta::Entities::Expiration.new(vm.next_expiration_id,\n ... | [
"0.5098749",
"0.5029767",
"0.49990115",
"0.49698284",
"0.49698284",
"0.48873985",
"0.48079443",
"0.47304365",
"0.47269452",
"0.47269452",
"0.47164595",
"0.47164595",
"0.47164595",
"0.47164595",
"0.46641845",
"0.46608317",
"0.46554548",
"0.46535292",
"0.46407995",
"0.4617505",
... | 0.7127701 | 0 |
Gets the isExpirationRequired property value. Indicates whether expiration is required or if it's a permanently active assignment or eligibility. | def is_expiration_required
return @is_expiration_required
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_expiration_required=(value)\n @is_expiration_required = value\n end",
"def expiration_behavior\n return @expiration_behavior\n end",
"def can_expire?\n return !!@expiry\n end",
"def expiration\n return @expiration\n ... | [
"0.77053386",
"0.6665872",
"0.6395092",
"0.61893505",
"0.61705333",
"0.6162824",
"0.614428",
"0.6097486",
"0.608558",
"0.6029967",
"0.5965881",
"0.59582055",
"0.5946574",
"0.59443855",
"0.5938723",
"0.5925991",
"0.59085464",
"0.5901934",
"0.5898379",
"0.58736587",
"0.587226",... | 0.8223862 | 0 |
Sets the isExpirationRequired property value. Indicates whether expiration is required or if it's a permanently active assignment or eligibility. | def is_expiration_required=(value)
@is_expiration_required = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_expiration_required\n return @is_expiration_required\n end",
"def expiration_behavior=(value)\n @expiration_behavior = value\n end",
"def expiration=(value)\n @expiration = value\n end",
"def is_required=(value)\n ... | [
"0.68301517",
"0.60498744",
"0.59132427",
"0.58651066",
"0.57569396",
"0.5736499",
"0.5593959",
"0.5581465",
"0.53682905",
"0.53637195",
"0.53589004",
"0.5325741",
"0.5325741",
"0.5325741",
"0.5325741",
"0.5325741",
"0.5325741",
"0.5293934",
"0.5285521",
"0.51977193",
"0.5194... | 0.8102894 | 0 |
Gets the maximumDuration property value. The maximum duration allowed for eligibility or assignment which is not permanent. Required when isExpirationRequired is true. | def maximum_duration
return @maximum_duration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximum_duration=(value)\n @maximum_duration = value\n end",
"def max_record_duration_in_seconds\n return @max_record_duration_in_seconds\n end",
"def max_record_duration_in_seconds=(value)\n @max_record_... | [
"0.8067252",
"0.74787444",
"0.70436144",
"0.67879844",
"0.6765356",
"0.6577147",
"0.641355",
"0.63824296",
"0.63730973",
"0.6370917",
"0.63244295",
"0.631829",
"0.6298791",
"0.6234084",
"0.621521",
"0.6188506",
"0.6172675",
"0.61421794",
"0.613132",
"0.6121068",
"0.6100329",
... | 0.8593823 | 0 |
Sets the maximumDuration property value. The maximum duration allowed for eligibility or assignment which is not permanent. Required when isExpirationRequired is true. | def maximum_duration=(value)
@maximum_duration = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_record_duration_in_seconds=(value)\n @max_record_duration_in_seconds = value\n end",
"def maximum_duration\n return @maximum_duration\n end",
"def set_VideoDuration(value)\n set_input(\"VideoDuration\", value)\n ... | [
"0.7354659",
"0.70358676",
"0.6625368",
"0.6619562",
"0.661018",
"0.659481",
"0.659481",
"0.659481",
"0.659481",
"0.659481",
"0.6467129",
"0.63928545",
"0.63776976",
"0.63632476",
"0.633555",
"0.6335292",
"0.6335292",
"0.6314366",
"0.628917",
"0.6260467",
"0.621436",
"0.621... | 0.86637014 | 0 |
Creates child work with: All the appropriate metadata copied from parent title/creator copied from file_set file_set set as member of new child_work DOES save the new child work. DOES NOT actually add it to parent_work yet. That's expensive and needs to be done in a lock. DOES NOT transfer collection membership, that's... | def create_intermediary_child_work(parent, file_set)
new_child_work = GenericWork.new(title: file_set.title, creator: [current_user.user_key])
new_child_work.apply_depositor_metadata(current_user.user_key)
# make original fileset a member of our new child work
self.class.add_to_parent(new_child_work, fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spawn attributes={}\n child = self.dup\n self.work_groups.each do |wg|\n new_wg = WorkGroup.new(:institution=>wg.institution,:project=>child)\n child.work_groups << new_wg\n wg.group_memberships.each do |gm|\n new_gm = GroupMembership.new(:person=>gm.person, :work_group=>wg)\n ... | [
"0.63733083",
"0.6279779",
"0.598384",
"0.59336245",
"0.59103876",
"0.57412577",
"0.56821907",
"0.5675552",
"0.5580366",
"0.5564886",
"0.5513622",
"0.55012125",
"0.54822636",
"0.54739124",
"0.5445093",
"0.54324025",
"0.5389517",
"0.5380987",
"0.53791934",
"0.53449917",
"0.534... | 0.86703324 | 0 |
Returns the list of node configs hashes in the given scenario. | def node_configs(scenario_id)
parse_node_config_files(parse_scenario_file(scenario_id))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_subhashes(node)\n l_hash = node.left ? node.left._hash : self.class.null_hash_at(node.depth + 1)\n r_hash = node.right ? node.right._hash : self.class.null_hash_at(node.depth + 1)\n [l_hash, r_hash]\n end",
"def find_scenario_paths(scenarios)\n return [] if scenarios.nil?\n scena... | [
"0.542058",
"0.5137308",
"0.5054009",
"0.5019797",
"0.5015323",
"0.5013689",
"0.49368373",
"0.49368373",
"0.49368373",
"0.4911848",
"0.48847175",
"0.48072508",
"0.47990763",
"0.4782286",
"0.47625422",
"0.47604105",
"0.47544375",
"0.47277436",
"0.47255638",
"0.4718899",
"0.471... | 0.61751086 | 0 |
Returns the environment from the node config hash, or 'production' if it is nil or empty. | def node_environment(node_config)
env = node_config['environment']
(env.nil? || env.empty?) ? 'production' : env
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_environment\n if node['ingenerator'] && node['ingenerator']['node_environment']\n node['ingenerator']['node_environment'].to_sym\n else\n :production\n end\n end",
"def environment\n if exists?(:stage)\n stage\n elsif exists?(:rails_env)\n rails_env\n ... | [
"0.7434109",
"0.729148",
"0.729148",
"0.722927",
"0.69439954",
"0.6834882",
"0.6802396",
"0.67666334",
"0.67666334",
"0.67045647",
"0.6703618",
"0.66951555",
"0.6649619",
"0.6637568",
"0.6636658",
"0.66002995",
"0.66002995",
"0.65810573",
"0.65581447",
"0.64899784",
"0.646120... | 0.83173084 | 0 |
Group the list of node configs into a hash keyed by their environments. A nil or empty environment will be interpreted as 'production'. | def group_by_environment(node_configs)
node_configs.group_by do |config|
node_environment(config)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modules_per_environment(node_configs)\n node_configs = group_by_environment(node_configs)\n modules = node_configs.map do |env, configs|\n [env, configs.map { |c| c['modules'] }.flatten.uniq]\n end\n Hash[modules]\nend",
"def environments\n environment_config.keys\n end",
"def environments\n... | [
"0.7234255",
"0.68260694",
"0.66575277",
"0.65260625",
"0.6470043",
"0.6170826",
"0.6169138",
"0.61430985",
"0.61017185",
"0.6069006",
"0.60683566",
"0.6031708",
"0.6026988",
"0.6017535",
"0.6013884",
"0.5921596",
"0.5902307",
"0.5901868",
"0.5872974",
"0.5826732",
"0.5796940... | 0.74446887 | 0 |
Returns a hash from environments to modules; removes duplicate modules. | def modules_per_environment(node_configs)
node_configs = group_by_environment(node_configs)
modules = node_configs.map do |env, configs|
[env, configs.map { |c| c['modules'] }.flatten.uniq]
end
Hash[modules]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modules_hash\n @modules\n end",
"def modules_hash\n @modules\n end",
"def modules_hash\n @modules_hash\n end",
"def unique_modules\n @unique_modules\n end",
"def global_modules\n node['rsyncd']['globals'].reduce({}) do |hash, (key, value)|\n hash[snake_to_space(key)] = v... | [
"0.68974185",
"0.68974185",
"0.67499155",
"0.63170797",
"0.62764794",
"0.61536616",
"0.60655314",
"0.6028512",
"0.60182786",
"0.5964805",
"0.59135616",
"0.58405316",
"0.57757044",
"0.573321",
"0.56737626",
"0.56425565",
"0.56408525",
"0.56319124",
"0.5620412",
"0.5587188",
"0... | 0.71670455 | 0 |
Returns the path to the local hiera.yaml file for the specified hiera. | def hiera_configpath(hiera)
File.join('config', 'hieras', hiera, 'hiera.yaml')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hiera_datadir\n # This output lets us know where Hiera is configured to look on the system\n puppet_lookup_info = run_shell('puppet lookup --explain test__simp__test').stdout.strip.lines\n puppet_config_check = run_shell('puppet agent --configprint manifest').stdout\n\n if puppet_config_check.nil? || puppe... | [
"0.6186646",
"0.603547",
"0.6025256",
"0.5864132",
"0.5863631",
"0.5824347",
"0.5793109",
"0.5759246",
"0.5739312",
"0.5705098",
"0.5667579",
"0.5639628",
"0.560354",
"0.5603295",
"0.5563946",
"0.5553217",
"0.55365145",
"0.5533156",
"0.54939014",
"0.5479283",
"0.5479283",
"... | 0.7937551 | 0 |
Returns a list of pairs of datadir filepaths for the given hiera. The pairs contain the local and target filepaths, respectively. | def hiera_datadirs(hiera)
configpath = hiera_configpath(hiera)
config = YAML.load_file(configpath)
backends = [config[:backends]].flatten
datadirs = backends.map { |be| config[be.to_sym][:datadir] }.uniq
datadirs.map do |datadir|
localpath = File.join('config', 'hieras', hiera, File.basename(datadir))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paths(arrs)\n arrs.inject([[]]) do |paths, arr|\n arr.map {|e| paths.map {|path| path + [e]}}.flatten(1)\n end\n end",
"def hiera_datadir\n # This output lets us know where Hiera is configured to look on the system\n puppet_lookup_info = run_shell('puppet lookup --explain test__simp__te... | [
"0.60336673",
"0.60256386",
"0.601235",
"0.5936207",
"0.58613276",
"0.5835206",
"0.5623412",
"0.5613568",
"0.5536183",
"0.5530625",
"0.55179334",
"0.54826343",
"0.5477433",
"0.54733324",
"0.54641217",
"0.54577374",
"0.5449669",
"0.54428285",
"0.54393405",
"0.54370093",
"0.543... | 0.7555087 | 0 |
GET /lists/new GET /lists/new.xml | def new
@list = List.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @list }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @list = List.find(params[:id])\n @todolist = @list.todolists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todolist }\n end\n end",
"def new\n @mylist = Mylist.new\n\n respond_to do |format|\n format.html # new.html.erb\n ... | [
"0.70856327",
"0.7079035",
"0.7074122",
"0.7035158",
"0.7033077",
"0.7019581",
"0.70163757",
"0.70163757",
"0.70163757",
"0.6988978",
"0.6954271",
"0.6898971",
"0.68669724",
"0.68494916",
"0.6849325",
"0.6820026",
"0.68136185",
"0.67286146",
"0.67181563",
"0.67121124",
"0.670... | 0.73274845 | 0 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: address, type: String name: client_token, type: String name: is_public_address, type: String name: load_balancer_mode, type: String name: load_balancer_n... | def create_load_balancer(optional={})
args = self.class.new_params
args[:query]['Action'] = 'CreateLoadBalancer'
args[:region] = optional[:_region] if (optional.key? :_region)
if optional.key? :_method
raise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? ... | [
"0.6802249",
"0.65976703",
"0.6059916",
"0.5987703",
"0.57154024",
"0.5691563",
"0.56653047",
"0.56263",
"0.5624155",
"0.55704135",
"0.55603266",
"0.5530433",
"0.5448158",
"0.5448158",
"0.5448158",
"0.5448158",
"0.5431011",
"0.54160184",
"0.5415401",
"0.54129857",
"0.53938115... | 0.6680468 | 1 |
Find out what new roles need filling in, and (at the same time) which ones need saving. We need filling in if 'dont_know' is set or if an email address is given which isn't in the system. It needs saving if it needs filling in or if is has a valid email address | def needs_filling_in?
any_need_filling = false
@roles.select{|r| r.new_entry }.each do |role|
role.needs_saving = role.needs_filling_in = false
if role.dont_know
role.needs_filling_in = true
role.needs_saving = true
elsif !role.email.empty?
role.needs_saving = true
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_possible_roles\n\tif User.has_role Role.ADMINISTRATOR,session[:roles]\n\t @roles=Role.all\n\t return\n\tend\n\n\t@logged_in_user_role_id = UserRoleMap.getRoleidByUserid(session[:session_user])\n\t#@roles = Role.where(:id => RoleReportTo.select(\"user_role_id\").where(:manager_role_id => @logged_in_user_r... | [
"0.57952803",
"0.56126213",
"0.5602745",
"0.5591891",
"0.55843586",
"0.5533017",
"0.5507958",
"0.54850715",
"0.54683775",
"0.54308635",
"0.5386315",
"0.5366523",
"0.5360715",
"0.5358581",
"0.53537655",
"0.5349893",
"0.532473",
"0.5322135",
"0.5317815",
"0.5315868",
"0.5315821... | 0.75029004 | 0 |
Build notification channel with recipient's id for uniqueness | def build_notification_id(id)
"Notification-#{id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_notification(chatroom)\n last_message = chatroom.messages.last\n user = last_message.user\n other_user = chatroom.other_user user.id\n n = other_user.notification || Notification.create(user_id: other_user.id)\n n.count += 1\n n.save\n last_message.notification_id = n.id\n last_m... | [
"0.6494224",
"0.6371563",
"0.62326276",
"0.6015568",
"0.60095704",
"0.6007749",
"0.6003157",
"0.5968473",
"0.5921255",
"0.5906491",
"0.5903533",
"0.58895266",
"0.5872908",
"0.5842301",
"0.5792226",
"0.5790746",
"0.56935334",
"0.56517667",
"0.56467193",
"0.5646183",
"0.5631943... | 0.658753 | 0 |
GET /v1_users/new GET /v1_users/new.xml | def new
@user = V1::User.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n logger.debug(\"Create a new user\")\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def new\n @user = User.new\n\n respond_to do |format|\n format.xml { render xml: @user}\n end\n end"... | [
"0.7770934",
"0.7676611",
"0.7537759",
"0.7489337",
"0.7476299",
"0.7476299",
"0.7476299",
"0.7476299",
"0.7476299",
"0.7449802",
"0.7449802",
"0.7439228",
"0.74284256",
"0.74212873",
"0.7412579",
"0.7412579",
"0.7412579",
"0.7412579",
"0.7412579",
"0.7412579",
"0.7412579",
... | 0.77271026 | 1 |
PUT /v1_users/1 PUT /v1_users/1.xml | def update
@user = V1::User.find(params[:id])
respond_to do |format|
if @user.update_attributes(params[:user])
flash[:notice] = 'V1::User was successfully updated.'
format.html { redirect_to(@user) }
format.xml { head :ok }
else
format.html { render :action => "edit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end",
"def UpdateUser params = {}\n \n APICall(pa... | [
"0.672018",
"0.65514594",
"0.63528115",
"0.6310416",
"0.63083714",
"0.6283871",
"0.6262443",
"0.6235099",
"0.62273854",
"0.6217405",
"0.6203473",
"0.61896455",
"0.61524713",
"0.61441886",
"0.61353064",
"0.61217386",
"0.6071993",
"0.60674876",
"0.60571223",
"0.60388726",
"0.60... | 0.69450897 | 0 |
DELETE /v1_users/1 DELETE /v1_users/1.xml | def destroy
@user = V1::User.find(params[:id])
@user.destroy
respond_to do |format|
format.html { redirect_to(v1_users_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\... | [
"0.7400963",
"0.70577294",
"0.70307136",
"0.7027561",
"0.7009527",
"0.7004813",
"0.6991697",
"0.69428486",
"0.69428486",
"0.69428486",
"0.69428486",
"0.69428486",
"0.69428486",
"0.69428486",
"0.69428486",
"0.69428486",
"0.69428486",
"0.69428486",
"0.69428486",
"0.69428486",
"... | 0.74574465 | 0 |
Returns a hash of cards SheetName => CardName => Card Modifies defaultFile | def read_worksheet(ws, defaultFile)
cards = {}
keys = []
(1..ws.getNumRows()).each do |row|
if (row == 1)
cards[ws.getTitle()] = {}
end
card = {}
(1..ws.getNumCols()).each do |col|
cell = ws.getCell(row, col)
if cell.empty? then next end
# first row should be keys
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [color, cards, address_placement, custom_envelope, double_sided, extra_service, mail_type, return_envelope, bleed, file_original_url].hash\n end",
"def card_on_file(card)\n all_cards = cards.map(&:card)\n end",
"def digest\n @digest ||= begin\n Digest::SHA1.hexdigest \"defaults-#... | [
"0.6096654",
"0.571326",
"0.5590168",
"0.5418507",
"0.538461",
"0.5345174",
"0.5306743",
"0.5304567",
"0.5300065",
"0.5268721",
"0.5168882",
"0.5166409",
"0.515816",
"0.51117015",
"0.51057327",
"0.50802505",
"0.5061582",
"0.5029597",
"0.5029331",
"0.49997294",
"0.4990277",
... | 0.600847 | 1 |
Export the entire class definition as an OWL ontology. ==== Example Person.to_owl returns string representation of the OWL ontology in Turtle. Person.to_owl(:json) returns string representation of the OWL ontology in RDFJSON. | def to_owl(*args)
g = Graph.new
owl = Namespace.new('http://www.w3.org/2002/07/owl', 'owl', true)
foaf = Namespace.new("http://xmlns.com/foaf/0.1/", "foaf")
rdf = Namespace.new("http://www.w3.org/1999/02/22-rdf-syntax-ns", "rdf", true)
rdfs = Namespace.new("http://www.w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owl_export\r\n graph = RDF::Graph.new\r\n owl = OWL::OWLDataFactory.new(graph)\r\n otus = Otu.find(:all, :conditions => \"(proj_id = #{@proj.id})\")\r\n otus.each do |otu|\r\n Ontology::Mx2owl.translate_otu(otu, owl)\r\n end\r\n all_codings = Coding.find(:all, :conditions => \"(proj_id =... | [
"0.68955207",
"0.63211143",
"0.54239297",
"0.5383889",
"0.5383889",
"0.5290624",
"0.5257335",
"0.5232529",
"0.51571465",
"0.5136714",
"0.51310617",
"0.50712633",
"0.5068511",
"0.504956",
"0.50343484",
"0.50343484",
"0.50316393",
"0.5024953",
"0.5023942",
"0.49347442",
"0.4914... | 0.71039104 | 0 |
Create the basic OWL triples for the class, without the properties. ==== Example Person.triple_for_class_definition returns a graph of the triples representing the bare class in OWL. ==== Rules for creating the ontology The class itself will be represented by a bnode. ==== Returns | def triples_for_class_definition
declare_namespaces
g = Graph.new
b = BNode.new(self.name)
g << Triple.new(b, URIRef.new('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), URIRef.new('http://www.w3.org/2002/07/owl#Class'))
return g
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_triples (c1,rdf_class,maketype,dtypes=Array.new,rdf_type=true)\n rdf_ns=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n ipref= uri rdf_class.to_s+'/'\n is_literal=false\n dtype,lang,ret=\"\",\"\",\"\"\n object_property = nil\n triples =\"\"\n\n unless c1[:id]\n id_row = c1.sele... | [
"0.5579664",
"0.52879083",
"0.49345756",
"0.48922223",
"0.4817509",
"0.4728497",
"0.4666913",
"0.4666913",
"0.4666913",
"0.4666913",
"0.4666913",
"0.4666913",
"0.4666913",
"0.4666913",
"0.4666913",
"0.4666913",
"0.4666913",
"0.4666913",
"0.4666913",
"0.46462542",
"0.4645764",... | 0.7491388 | 0 |
Create the OWL triples for a DataMapper property. ==== Example Person.triples_for_property(Person.properties[:id]) returns a graph of the triples representing the id property on Person in OWL. ==== Returns | def triples_for_property(property)
g = Graph.new
b = BNode.new(property.field)
t = Triple.new(b, URIRef.new('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), URIRef.new('http://www.w3.org/2002/07/owl#DatatypeProperty'))
g << t
return g
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def property_ids\n result = Array.new\n self.properties.each do |p|\n result << p.id\n end\n result\n end",
"def relationship_get_all_props id\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n get_request 'relationship/' + id + '/properties', headers\n end",
... | [
"0.5753868",
"0.5497396",
"0.541085",
"0.53753597",
"0.5325469",
"0.53057456",
"0.509781",
"0.50788236",
"0.50493073",
"0.5009893",
"0.49909544",
"0.49608135",
"0.4953707",
"0.49434432",
"0.49336532",
"0.49327007",
"0.48956886",
"0.48527429",
"0.48527429",
"0.48167402",
"0.48... | 0.81186235 | 0 |
Utility method to declare a bunch of useful namespaces. ==== Example Person.declare_namespaces instantiates some useful namespaces. | def declare_namespaces
foaf = Namespace.new("http://xmlns.com/foaf/0.1/", "foaf")
rdf = Namespace.new("http://www.w3.org/1999/02/22-rdf-syntax-ns", "rdf", true)
rdfs = Namespace.new("http://www.w3.org/2000/01/rdf-schema", 'rdfs', true)
xsd = Namespace.new('http://www.w3.org/2001/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namespace_declarations(ctx); end",
"def namespace_declarations(ctx); end",
"def register_namespaces(namespaces); end",
"def register_namespaces(namespaces); end",
"def define_namespaces #:nodoc:\n unless self.respond_to?(:namespaces)\n send(:define_singleton_method, :namespaces) { @namespaces }... | [
"0.75440854",
"0.75440854",
"0.736702",
"0.736702",
"0.72799885",
"0.71502215",
"0.71502215",
"0.71502215",
"0.71502215",
"0.6645348",
"0.6449004",
"0.6407811",
"0.63631",
"0.63597524",
"0.6318325",
"0.63072926",
"0.6255909",
"0.6255909",
"0.61990136",
"0.61990136",
"0.619496... | 0.78323376 | 0 |
GET /asignaciones GET /asignaciones.json | def index
@asignaciones = Asignacione.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @asignaturas = Asignatura.all\n end",
"def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def show\n @asignatura = Asignatura.find(params[:id])\n\n res... | [
"0.66929483",
"0.64084345",
"0.64084345",
"0.6375693",
"0.62422055",
"0.6200706",
"0.6180802",
"0.6142473",
"0.613062",
"0.60766166",
"0.6075529",
"0.6066304",
"0.6054506",
"0.60474503",
"0.60399735",
"0.6017307",
"0.6016035",
"0.60146576",
"0.60071844",
"0.59974766",
"0.5989... | 0.7086205 | 0 |
Returns coordinates that will be reached after applying the +move+, starting from the +from+ coordinates | def relative_coords(from, move)
[from[0] + move[0], from[1] + move[1]]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_move\n cols = %w(a b c d e f g h)\n rows = %w(8 7 6 5 4 3 2 1)\n\n from_pos, to_pos = nil, nil\n until from_pos && to_pos\n @display.draw\n if from_pos\n row, col = from_pos\n piece = @display.board[from_pos].class\n puts \"#{piece} at #{cols[col]}#{rows[row]} sel... | [
"0.6785309",
"0.6652342",
"0.6520607",
"0.64795303",
"0.64261705",
"0.64005244",
"0.6397645",
"0.6369637",
"0.6346817",
"0.63239735",
"0.63122606",
"0.6307506",
"0.6291631",
"0.62254333",
"0.62195057",
"0.61803865",
"0.61793727",
"0.61729735",
"0.6155689",
"0.6155479",
"0.613... | 0.7902153 | 0 |
GET /despatches GET /despatches.json | def index
@despatches = Despatch.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @despatch.destroy\n respond_to do |format|\n format.html { redirect_to despatches_url, notice: 'Despatch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def set_despatch\n @despatch = Despatch.find(params[:id])\n end",
"def index\n @... | [
"0.5995585",
"0.56333554",
"0.5449495",
"0.5426829",
"0.5375252",
"0.5372147",
"0.5310042",
"0.529576",
"0.5267658",
"0.52673787",
"0.522316",
"0.52227986",
"0.5205848",
"0.5205848",
"0.51992226",
"0.5176816",
"0.513539",
"0.5132224",
"0.5118664",
"0.51121175",
"0.51109844",
... | 0.7511226 | 0 |
POST /despatches POST /despatches.json | def create
@despatch = Despatch.new(despatch_params)
respond_to do |format|
if @despatch.save
format.html { redirect_to @despatch, notice: 'Despatch was successfully created.' }
format.json { render :show, status: :created, location: @despatch }
else
format.html { render :ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @despatches = Despatch.all\n end",
"def destroy\n @despatch.destroy\n respond_to do |format|\n format.html { redirect_to despatches_url, notice: 'Despatch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def set_despatch\n @despatch = Des... | [
"0.69399965",
"0.62738734",
"0.59600383",
"0.57216907",
"0.5477452",
"0.51411057",
"0.507427",
"0.5061916",
"0.49846593",
"0.49512577",
"0.49468046",
"0.4903353",
"0.4845712",
"0.48189908",
"0.48124397",
"0.48099357",
"0.48040098",
"0.47980928",
"0.47962403",
"0.47889853",
"0... | 0.64376336 | 1 |
PATCH/PUT /despatches/1 PATCH/PUT /despatches/1.json | def update
respond_to do |format|
if @despatch.update(despatch_params)
format.html { redirect_to @despatch, notice: 'Despatch was successfully updated.' }
format.json { render :show, status: :ok, location: @despatch }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def api_patch(path, data = {}... | [
"0.62995243",
"0.6295111",
"0.6138229",
"0.5969121",
"0.59660304",
"0.59349906",
"0.5791801",
"0.576948",
"0.56792367",
"0.56792367",
"0.567347",
"0.56725097",
"0.56696016",
"0.5664288",
"0.56471527",
"0.56426495",
"0.5595384",
"0.5589089",
"0.55873764",
"0.5569512",
"0.55630... | 0.6312195 | 0 |
DELETE /despatches/1 DELETE /despatches/1.json | def destroy
@despatch.destroy
respond_to do |format|
format.html { redirect_to despatches_url, notice: 'Despatch was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.... | [
"0.70344007",
"0.6781829",
"0.66554826",
"0.66049296",
"0.65602446",
"0.65396565",
"0.64981943",
"0.6456154",
"0.6433085",
"0.6426203",
"0.6416008",
"0.6415835",
"0.6403857",
"0.6402571",
"0.636574",
"0.63648695",
"0.6362354",
"0.63610226",
"0.6354375",
"0.6349672",
"0.634677... | 0.6976659 | 1 |
remove both the local download file and remote eb config | def clean(mute=false)
return if @options[:dirty]
UI.say "Cleaning up eb remote config and local files" unless mute
eb.delete_configuration_template(
application_name: @updater.app_name,
template_name: current_name
) unless @options[:noop]
FileUtils.rm_f(@curre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end",
"def remove!\n begin\n connection.sync_clock\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n rescue Excon::Errors::SocketError; end\n end",
"def clean_remote\n ... | [
"0.67433846",
"0.6425313",
"0.6320292",
"0.62727034",
"0.6229026",
"0.6153338",
"0.61465937",
"0.61449295",
"0.61324906",
"0.6122585",
"0.6085128",
"0.6078729",
"0.60775816",
"0.60434383",
"0.602657",
"0.59735346",
"0.59546304",
"0.5900189",
"0.587504",
"0.5861206",
"0.585924... | 0.6544966 | 1 |
Baseline implementation for the create_device_registry REST call | def create_device_registry request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_create_device_registry_request request_pb
query_string_params = if query_string_params.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @registry = Registry.new(create_params)\n\n # Check the reachability of the registry.\n unless params[:force]\n msg = @registry.reachable?\n unless msg.empty?\n logger.info \"\\nRegistry not reachable:\\n#{@registry.inspect}\\n#{msg}\\n\"\n msg = \"#{msg} You can skip ... | [
"0.65665287",
"0.64571744",
"0.639681",
"0.6346075",
"0.63215065",
"0.6275868",
"0.615725",
"0.6118277",
"0.6117805",
"0.6105618",
"0.60538757",
"0.60113376",
"0.59451836",
"0.59277546",
"0.57531714",
"0.57111335",
"0.56329435",
"0.5564706",
"0.5551917",
"0.55459106",
"0.5542... | 0.7206692 | 0 |
Baseline implementation for the get_device_registry REST call | def get_device_registry request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_get_device_registry_request request_pb
query_string_params = if query_string_params.any?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_registry\n @registry = Spree::Registry.find_by_access_hash!(params[:id])\n end",
"def registry\n @registry ||= client.registry\n end",
"def create_device_registry request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n ... | [
"0.6414344",
"0.63427097",
"0.6275052",
"0.62702143",
"0.61037225",
"0.6052286",
"0.60123277",
"0.5901356",
"0.58795774",
"0.58400446",
"0.58000004",
"0.58000004",
"0.5796119",
"0.572173",
"0.56915635",
"0.56387043",
"0.5636897",
"0.56368756",
"0.56115913",
"0.5584582",
"0.55... | 0.7165653 | 0 |
Baseline implementation for the update_device_registry REST call | def update_device_registry request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_update_device_registry_request request_pb
query_string_params = if query_string_params.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @registry = Registry.find(params[:id])\n @registry.assign_attributes(update_params)\n @can_change_hostname = !Repository.any?\n\n # Check the reachability of the registry.\n check_reachability(\"edit\")\n return if @unreachable\n\n if @registry.save\n # NOTE: if we decide to ... | [
"0.6544306",
"0.6397128",
"0.60932773",
"0.6076052",
"0.60323465",
"0.60219467",
"0.59819824",
"0.5930979",
"0.5878621",
"0.58272964",
"0.58272964",
"0.57602423",
"0.5705622",
"0.5692469",
"0.5673611",
"0.56483406",
"0.5622039",
"0.55978286",
"0.55978286",
"0.5562857",
"0.554... | 0.71623635 | 0 |
Baseline implementation for the delete_device_registry REST call | def delete_device_registry request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_delete_device_registry_request request_pb
query_string_params = if query_string_params.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @registry = Registry.find(params[:id])\n @registry.destroy\n\n respond_to do |format|\n format.html { redirect_to registries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @registry = Registry.find(params[:id])\n @registry.destroy\n logger.info... | [
"0.6678598",
"0.64973116",
"0.64344144",
"0.6356241",
"0.62678915",
"0.6188022",
"0.6179569",
"0.6136864",
"0.61301553",
"0.6117857",
"0.61041653",
"0.60915935",
"0.6054046",
"0.60346687",
"0.602476",
"0.60200715",
"0.601763",
"0.601763",
"0.601763",
"0.601763",
"0.5996484",
... | 0.7706852 | 0 |
Baseline implementation for the list_device_registries REST call | def list_device_registries request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_list_device_registries_request request_pb
query_string_params = if query_string_params.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @device_registrations = DeviceRegistration.all\n end",
"def calc_reg_list(device = :all)\n registrars.find_all { |dev, reg| device.to_sym == :all || device.to_s == dev }.map { |vp| vp[1] }\n end",
"def index\n @bridal_registries = spree_current_user.bridal_registries\n respond_wit... | [
"0.6678728",
"0.66782385",
"0.62170297",
"0.616881",
"0.6099848",
"0.5954673",
"0.5906578",
"0.58905977",
"0.585306",
"0.5850263",
"0.5813769",
"0.5807204",
"0.5780627",
"0.5707221",
"0.5692937",
"0.56886655",
"0.55822414",
"0.5568046",
"0.55411273",
"0.55298465",
"0.5504572"... | 0.73563457 | 0 |
Baseline implementation for the modify_cloud_to_device_config REST call | def modify_cloud_to_device_config request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_modify_cloud_to_device_config_request request_pb
query_string_params = if query_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_configuration\n if @@initialized\n url = 'http://'+ENV['CONSUL_IP']+':8500/v1/kv/docker_nodes?raw'\n #log_message('Updating configuration from: ' + url)\n response = HTTPService.get_request(url)\n log_message('Dynamo changed, updating configuration to: ' + response.body)\n re... | [
"0.6099665",
"0.59873724",
"0.59873724",
"0.58969736",
"0.5886794",
"0.57737046",
"0.5697701",
"0.5606722",
"0.56054664",
"0.55634046",
"0.5484844",
"0.54658407",
"0.54615057",
"0.5446909",
"0.54028964",
"0.5396395",
"0.53524715",
"0.5334794",
"0.5324197",
"0.53020674",
"0.52... | 0.71567464 | 0 |
Baseline implementation for the list_device_config_versions REST call | def list_device_config_versions request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_list_device_config_versions_request request_pb
query_string_params = if query_strin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_versions\n http_get(\"#{host}/#{Configuration.versions_file}\").body\n end",
"def versions\n service_config.keys\n end",
"def versions\n JSON.parse(RestClient.get(\"#{VERSION_URL}/.json\", self.default_headers))[\"versions\"].collect { |v| v[\"id\"] }.uniq\n end",
"def versi... | [
"0.6457863",
"0.64567167",
"0.63657725",
"0.6311317",
"0.6234896",
"0.6084378",
"0.6006962",
"0.59808946",
"0.5979559",
"0.595399",
"0.59407306",
"0.59115654",
"0.58932126",
"0.5888292",
"0.58559114",
"0.58157194",
"0.5809579",
"0.58024323",
"0.5792559",
"0.57822347",
"0.5772... | 0.7709235 | 0 |
Baseline implementation for the list_device_states REST call | def list_device_states request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_list_device_states_request request_pb
query_string_params = if query_string_params.any?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_states_list\n get \"deviceStates\"\n end",
"def device_states_get(device_name)\n get \"deviceStates/#{device_name}\"\n end",
"def get_states\n perform(:get, 'enum/states', nil, nonauth_headers).body\n end",
"def device_states=(value)\n @device_states = value\... | [
"0.84070873",
"0.71763724",
"0.71014345",
"0.7092896",
"0.6907781",
"0.6382492",
"0.6299889",
"0.60669214",
"0.60669214",
"0.6060274",
"0.6016376",
"0.5996348",
"0.58977956",
"0.5868375",
"0.5862362",
"0.5826167",
"0.5825951",
"0.58122855",
"0.5782019",
"0.57624483",
"0.57489... | 0.7230817 | 1 |
Baseline implementation for the send_command_to_device REST call | def send_command_to_device request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_send_command_to_device_request request_pb
query_string_params = if query_string_params.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send command\n raise Error.new('implement me via subclass')\n end",
"def send_command_old(*args)\n # flatten the args, make sure each byte is between 0-0xFF, and send it.\n command_str = \"char-write-cmd 0x001b \" + args.flatten.map {|b| sprintf(\"%02X\", b & 0xFF)}.join\n # puts command_str... | [
"0.6634094",
"0.66100866",
"0.6499423",
"0.6493932",
"0.6484907",
"0.64073056",
"0.6402479",
"0.6402184",
"0.63448644",
"0.6315867",
"0.6311386",
"0.6297668",
"0.6290541",
"0.6260072",
"0.6249201",
"0.62179613",
"0.6203289",
"0.62021494",
"0.61958766",
"0.61686414",
"0.616793... | 0.7165435 | 0 |
Baseline implementation for the bind_device_to_gateway REST call | def bind_device_to_gateway request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_bind_device_to_gateway_request request_pb
query_string_params = if query_string_params.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind_m_f_a_device(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'BindMFADevice'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'... | [
"0.58107615",
"0.561477",
"0.55363345",
"0.5459145",
"0.5459145",
"0.5459145",
"0.5459145",
"0.54244465",
"0.5369707",
"0.53547305",
"0.53489894",
"0.53449863",
"0.533122",
"0.52646595",
"0.5228263",
"0.5228263",
"0.51684374",
"0.5138289",
"0.5137244",
"0.51328415",
"0.512777... | 0.751215 | 0 |
Baseline implementation for the unbind_device_from_gateway REST call | def unbind_device_from_gateway request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
verb, uri, query_string_params, body = ServiceStub.transcode_unbind_device_from_gateway_request request_pb
query_string_params = if query_string_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unbind\n @gateway_handler.disconnect(self)\n end",
"def unbind_m_f_a_device(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'UnbindMFADevice'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\... | [
"0.7488919",
"0.68790984",
"0.6549522",
"0.6503967",
"0.63586783",
"0.63355607",
"0.6286007",
"0.6215152",
"0.61849654",
"0.61678743",
"0.61363894",
"0.6133773",
"0.6084829",
"0.6065382",
"0.6036824",
"0.6015723",
"0.596348",
"0.5946149",
"0.59461266",
"0.59404343",
"0.591475... | 0.800281 | 0 |
If `type` is an interface, and `self` has a type membership for `type`, then make sure it's visible. | def visible_interface_implementation?(type, context, warden)
if type.respond_to?(:kind) && type.kind.interface?
implements_this_interface = false
implementation_is_visible = false
warden.interface_type_memberships(self, context).each do |tm|
if tm.abstract_typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_type\n \t self.type = TYPES[0] if !TYPES.include?(self.type)\n\t end",
"def applies_type?(scope, type); end",
"def will_be?(type)\n single_class <= type\n end",
"def type?(type)\n\t\treturn self.type == type\n\tend",
"def type?(type)\n\t\treturn self.type == type\n\tend",
"def has_ty... | [
"0.58582586",
"0.57667893",
"0.57647943",
"0.57389575",
"0.57389575",
"0.5654344",
"0.56332684",
"0.55245245",
"0.55170536",
"0.5486915",
"0.54701686",
"0.5402161",
"0.5233993",
"0.5222909",
"0.52178586",
"0.52141565",
"0.5200213",
"0.51834226",
"0.515426",
"0.51444966",
"0.5... | 0.6797543 | 0 |
GET /finger_prints GET /finger_prints.json | def index
@finger_prints = FingerPrint.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @finger_prints }
format.csv { send_data FingerPrint.scoped.to_csv, filename: "fingerprints-#{Date.today}.csv"}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n #debugger\n @finger_print = FingerPrint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finger_print }\n end\n end",
"def show\n @magnetic_finger_print = MagneticFingerPrint.find(params[:id])\n\n respond_to do |forma... | [
"0.70003617",
"0.6442571",
"0.62798816",
"0.5989847",
"0.5939047",
"0.58718115",
"0.56917995",
"0.56889105",
"0.56443363",
"0.56184477",
"0.54789317",
"0.5418445",
"0.5403665",
"0.53857815",
"0.5342019",
"0.53330874",
"0.5326029",
"0.5318693",
"0.5313361",
"0.52723336",
"0.52... | 0.6855805 | 1 |
GET /finger_prints/1 GET /finger_prints/1.jsonl | def show
#debugger
@finger_print = FingerPrint.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @finger_print }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @finger_prints = FingerPrint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @finger_prints }\n format.csv { send_data FingerPrint.scoped.to_csv, filename: \"fingerprints-#{Date.today}.csv\"}\n end\n end",
"def show\n @magnetic_fi... | [
"0.6479714",
"0.6391914",
"0.6370339",
"0.604717",
"0.60026324",
"0.588337",
"0.5803498",
"0.5600463",
"0.55965716",
"0.5577841",
"0.55751806",
"0.5539471",
"0.55241925",
"0.5510952",
"0.5508203",
"0.54869884",
"0.5478965",
"0.54719114",
"0.54546636",
"0.5420122",
"0.5414768"... | 0.6829708 | 0 |
GET /finger_prints/new GET /finger_prints/new.json | def new
@finger_print = FingerPrint.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @finger_print }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @printing_screen = PrintingScreen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @printing_screen }\n end\n end",
"def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render ... | [
"0.6946628",
"0.6929953",
"0.68610036",
"0.6812665",
"0.67136365",
"0.66725713",
"0.6641457",
"0.6638654",
"0.64757776",
"0.64066136",
"0.63722366",
"0.63675994",
"0.63521135",
"0.6331472",
"0.63280535",
"0.625957",
"0.62562996",
"0.62520987",
"0.62317044",
"0.6231045",
"0.62... | 0.7873111 | 0 |
POST /finger_prints POST /finger_prints.json | def create
@finger_print = FingerPrint.check_exist(params[:finger_print])
respond_to do |format|
format.html { redirect_to @finger_print, notice: 'FingerPrint was successfully created.' }
format.json { render json: @finger_print, status: :created, location: @finger_print }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @magnetic_finger_print = MagneticFingerPrint.new(params[:magnetic_finger_print])\n\n respond_to do |format|\n if @magnetic_finger_print.save\n format.html { redirect_to @magnetic_finger_print, notice: 'Magnetic finger print was successfully created.' }\n format.json { render j... | [
"0.63952565",
"0.6353884",
"0.6251653",
"0.6163068",
"0.60271955",
"0.59848714",
"0.5953886",
"0.58710885",
"0.58605963",
"0.5827934",
"0.5651706",
"0.5637469",
"0.5622873",
"0.56122464",
"0.55771923",
"0.55719745",
"0.55350626",
"0.5448159",
"0.54045486",
"0.53290445",
"0.53... | 0.6608446 | 0 |
PUT /finger_prints/1 PUT /finger_prints/1.json | def update
@finger_print = FingerPrint.find(params[:id])
respond_to do |format|
if @finger_print.update_attributes(params[:finger_print])
format.html { redirect_to @finger_print, notice: 'Finger print was successfully updated.' }
format.json { head :no_content }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @magnetic_finger_print = MagneticFingerPrint.find(params[:id])\n\n respond_to do |format|\n if @magnetic_finger_print.update_attributes(params[:magnetic_finger_print])\n format.html { redirect_to @magnetic_finger_print, notice: 'Magnetic finger print was successfully updated.' }\n ... | [
"0.62285423",
"0.60389096",
"0.60265845",
"0.5983842",
"0.5958007",
"0.5944725",
"0.57651126",
"0.5729494",
"0.57281893",
"0.57135636",
"0.5680018",
"0.5591839",
"0.55909795",
"0.55655414",
"0.55199784",
"0.551913",
"0.54924124",
"0.5482307",
"0.54783326",
"0.5477434",
"0.547... | 0.7068139 | 0 |
DELETE /finger_prints/1 DELETE /finger_prints/1.json | def destroy
@finger_print = FingerPrint.find(params[:id])
@finger_print.destroy
respond_to do |format|
format.html { redirect_to finger_prints_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @magnetic_finger_print = MagneticFingerPrint.find(params[:id])\n @magnetic_finger_print.destroy\n\n respond_to do |format|\n format.html { redirect_to magnetic_finger_prints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spore_print.destroy\n res... | [
"0.7033649",
"0.6689001",
"0.6592074",
"0.6592074",
"0.658346",
"0.6577583",
"0.6575321",
"0.6560739",
"0.6543123",
"0.6476248",
"0.6473159",
"0.64669645",
"0.64214",
"0.6409763",
"0.6405029",
"0.6401641",
"0.6401063",
"0.6384437",
"0.63783187",
"0.63687044",
"0.6363836",
"... | 0.7671966 | 0 |
responsible for handling the loc_page view | def loc_view
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page\n\n end",
"def show_location\n\n end",
"def set_page\n end",
"def p... | [
"0.68470365",
"0.68470365",
"0.68470365",
"0.68470365",
"0.68470365",
"0.68470365",
"0.68470365",
"0.68470365",
"0.68470365",
"0.68470365",
"0.68470365",
"0.68470365",
"0.6682881",
"0.6648841",
"0.66419846",
"0.6637194",
"0.64833814",
"0.64787585",
"0.6452935",
"0.64244103",
... | 0.78954995 | 0 |
Passes an array of fingerprint readings to the model to localize | def localization
#debugger
searched = params[:finger_print]
@coordinates = FingerPrint.KNN(searched)
puts @coordinates
respond_to do |format|
format.html
format.json {render json: @coordinates}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locale_array=(locale_array)\n begin\n @locale_array = locale_array.map { |l| l.to_sym }\n rescue\n nil\n end\n end",
"def locale_array=(locale_array)\n config.locale_array = locale_array\n end",
"def upcase_local_patient_ids\n self.local_patient_id = local_patie... | [
"0.49208415",
"0.48301882",
"0.47375816",
"0.47297955",
"0.47097278",
"0.4694174",
"0.4694174",
"0.4646421",
"0.4609651",
"0.45713994",
"0.4568629",
"0.45425078",
"0.454169",
"0.4532457",
"0.45264092",
"0.45204335",
"0.45204335",
"0.45204335",
"0.45116416",
"0.45100597",
"0.4... | 0.5311048 | 0 |
Magnetic variation in degrees | def magnetic_variation_degrees
self.class.nsew_signed_float(@fields[10], @fields[11])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magnetic_variation_degrees\n self.class.nsew_signed_float(@fields[4], @fields[5])\n end",
"def magnetic_deviation_degrees\n self.class.nsew_signed_float(@fields[5], @fields[6])\n end",
"def true_to_magnetic(heading)\r\n value = heading - @variance\r\n value += 360.... | [
"0.7892756",
"0.7360166",
"0.72956914",
"0.67894644",
"0.66193265",
"0.6564241",
"0.6343376",
"0.6274908",
"0.6244177",
"0.6169047",
"0.6157117",
"0.61421156",
"0.61395437",
"0.6133403",
"0.61273795",
"0.60327035",
"0.6023581",
"0.60170364",
"0.6009613",
"0.5999295",
"0.59915... | 0.79345196 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.