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 |
|---|---|---|---|---|---|---|
Roundpercent_correct_by_category returns the percentage of correct turns for a category. | def percent_correct_by_category(category_select)
# Count the current cards in the turns that match the category selected.
current_cards_category = @turns.count do |element|
element.card.category == category_select
end
# Check for divide by zero. Than calculate the percentage otherwise.
if @tu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percent_correct_by_category(category)\n if deck.cards_in_category(category).length == 0\n return 0.0\n end\n ((number_correct_by_category(category) / deck.cards_in_category(category).length) * 100).to_f\n end",
"def percent_correct_by_category(card_category)\n total_by_category = ... | [
"0.82706606",
"0.7738678",
"0.6609322",
"0.64624184",
"0.6341366",
"0.62558246",
"0.6051206",
"0.5940056",
"0.5759027",
"0.5612803",
"0.5532513",
"0.5471883",
"0.5471883",
"0.54557925",
"0.5402993",
"0.53510064",
"0.5346117",
"0.534532",
"0.52232945",
"0.5217081",
"0.5202821"... | 0.8068352 | 1 |
GET a single time entry Return Teamwork::Thing | def time_entry(id)
object_from_response(:get, "time_entries/#{id}", "time-entry")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_entry(id:)\n ::TimeEntry.find_by(id: id)\n end",
"def get_time_entry(xero_tenant_id, project_id, time_entry_id, opts = {})\n data, _status_code, _headers = get_time_entry_with_http_info(xero_tenant_id, project_id, time_entry_id, opts)\n data\n end",
"def show\n @time_entry = Ti... | [
"0.7216528",
"0.64349455",
"0.6427085",
"0.6427085",
"0.63918823",
"0.6325323",
"0.6172379",
"0.61543095",
"0.59591186",
"0.59591186",
"0.58810145",
"0.5852485",
"0.5812675",
"0.5774139",
"0.57509845",
"0.57247037",
"0.5698036",
"0.5691419",
"0.5677621",
"0.56744087",
"0.5661... | 0.74449736 | 0 |
PUT a single time entry Return Teamwork::Thing | def update_time_entry(options = {})
object_from_response(:put, "time_entries/#{id}", "time-entry", "time-entry" => options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { head :no_content }\n else\n format... | [
"0.6965347",
"0.6965347",
"0.6869413",
"0.6804477",
"0.67620814",
"0.67620814",
"0.6738317",
"0.67042065",
"0.66030246",
"0.65654945",
"0.64484155",
"0.6312628",
"0.6235547",
"0.622376",
"0.62197775",
"0.6194042",
"0.61843306",
"0.6176379",
"0.61600506",
"0.6133451",
"0.60666... | 0.70273554 | 0 |
This method adds an +after_validation+ callback. ==== Parameters +polymorphic_association_name+ Name of the tree polumorphic association with container and component as the name of polymorphic attributes +type+ The component type in which to look for collection +collection_name+ The association name that should be used... | def validates_uniqueness_in_memory_for_tree_polymorphism(polymorphic_association_name, type, collection_name, attribute, options = {})
after_validation do
validate_unique_nested_attributes_for_tree_polymorphism self, polymorphic_association_name, type, collection_name, attribute, options
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_unique_nested_attributes_for_tree_polymorphism(parent, polymorphic_association_name, type, collection_name, attribute, options = {})\n types_with_collection = find_types_and_all_collections(parent, polymorphic_association_name, type, collection_name)\n return true if types_with_collectio... | [
"0.58034647",
"0.54024005",
"0.5094982",
"0.4961085",
"0.48483062",
"0.480316",
"0.4736302",
"0.46594498",
"0.4463328",
"0.4432931",
"0.4426734",
"0.4411381",
"0.43567568",
"0.43483585",
"0.43428823",
"0.43267116",
"0.43225652",
"0.42918825",
"0.42668375",
"0.426508",
"0.4246... | 0.70403355 | 0 |
POST /managers POST /managers.json | def create
@manager = Manager.new(manager_params)
if @manager.save
render :show, status: :created, location: @manager
else
render json: @manager.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @manager = Manager.new(params[:manager])\n\n respond_to do |format|\n if @manager.save\n format.html { redirect_to @manager, notice: 'Manager was successfully created.' }\n #format.json { render json: @manager, status: :created, location: @manager }\n else\n format... | [
"0.721417",
"0.67620224",
"0.66251385",
"0.655345",
"0.6453598",
"0.63925993",
"0.6375221",
"0.63662505",
"0.6348309",
"0.63447255",
"0.6299406",
"0.629245",
"0.6257339",
"0.6234327",
"0.62203383",
"0.61756915",
"0.6146879",
"0.6106687",
"0.6087594",
"0.60547906",
"0.6016857"... | 0.71298426 | 1 |
GET /brothers GET /brothers.xml | def index
@brothers = Brother.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @brothers }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @brothers = Brother.all\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @brother }\n end\n end",
"def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # ... | [
"0.73023427",
"0.64718395",
"0.619665",
"0.6172347",
"0.61217886",
"0.6118232",
"0.6065591",
"0.6045527",
"0.6019558",
"0.59852296",
"0.59852296",
"0.59692013",
"0.5957953",
"0.59242517",
"0.59165835",
"0.58907324",
"0.58901817",
"0.58817494",
"0.58806276",
"0.5870787",
"0.58... | 0.7340559 | 0 |
GET /brothers/1 GET /brothers/1.xml | def show
@brothers = Brother.all
@brother = Brother.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @brother }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @brothers = Brother.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @brothers }\n end\n end",
"def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { rend... | [
"0.7219056",
"0.63309246",
"0.6278176",
"0.6262042",
"0.6239098",
"0.611427",
"0.6110006",
"0.6108222",
"0.6091106",
"0.609063",
"0.60477924",
"0.60189563",
"0.6010542",
"0.6006859",
"0.6006859",
"0.5982755",
"0.5959786",
"0.5951936",
"0.59075636",
"0.59024906",
"0.5885215",
... | 0.7269294 | 0 |
GET /brothers/new GET /brothers/new.xml | def new
@brother = Brother.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @brother }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end",
"def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bro... | [
"0.71615607",
"0.71490526",
"0.71388006",
"0.7043233",
"0.7028396",
"0.70106125",
"0.70029837",
"0.69805753",
"0.6937177",
"0.691787",
"0.69136286",
"0.68756163",
"0.6863917",
"0.68307054",
"0.68270946",
"0.6811362",
"0.6790906",
"0.6787047",
"0.67855257",
"0.6775386",
"0.677... | 0.78451896 | 0 |
POST /brothers POST /brothers.xml | def create
@brother = Brother.new(params[:brother])
respond_to do |format|
if @brother.save
flash[:notice] = 'Brother was successfully created.'
format.html { render :back }
format.xml { render :xml => @brother, :status => :created, :location => @brother }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r... | [
"0.61392224",
"0.6081564",
"0.58604574",
"0.5848659",
"0.55267984",
"0.5439152",
"0.54050064",
"0.5393558",
"0.53862566",
"0.53813714",
"0.5363521",
"0.5346834",
"0.5332638",
"0.5318381",
"0.5315566",
"0.53073955",
"0.5303928",
"0.5262948",
"0.5262113",
"0.52343315",
"0.52331... | 0.6692793 | 0 |
PUT /brothers/1 PUT /brothers/1.xml | def update
@brother = Brother.find(params[:id])
respond_to do |format|
if @brother.update_attributes(params[:brother])
flash[:notice] = 'Brother was successfully updated.'
format.html { redirect_to roster_show_path(@brother) }
format.xml { head :ok }
else
#debugger
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def upd... | [
"0.61944085",
"0.61622566",
"0.6067706",
"0.60124433",
"0.587071",
"0.5719319",
"0.55922663",
"0.55847657",
"0.55485606",
"0.54673594",
"0.5457736",
"0.5447154",
"0.5438106",
"0.54122555",
"0.5402323",
"0.53718936",
"0.5357636",
"0.5349355",
"0.5331841",
"0.53261787",
"0.5319... | 0.6233822 | 0 |
DELETE /brothers/1 DELETE /brothers/1.xml | def destroy
@brother = Brother.find(params[:id])
@brother.destroy
respond_to do |format|
format.html { redirect_to(brothers_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(brow... | [
"0.6724334",
"0.6706081",
"0.6682589",
"0.6617006",
"0.64082694",
"0.6338538",
"0.63118607",
"0.6292326",
"0.62902135",
"0.6250445",
"0.62392855",
"0.62373847",
"0.6232365",
"0.6214394",
"0.62100387",
"0.62057966",
"0.61704373",
"0.61657697",
"0.6152545",
"0.61333907",
"0.612... | 0.7327873 | 0 |
author ahmed jihad called to show answer view for questionnaires finds the selected questionnaire Args : | def answer_show
@questionnaire = Questionnaire.find(params[:id])
answer = @questionnaire.answer_questionnaires.build
render 'answer_show'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n idx = params[:id]\n @question = Question.find(params[:id])\n @newAnswer = Answer.new(:question_id => params[:id])\n @Answers = Answer.where(question_id: idx)\n @answer = Answer.all\n end",
"def show\n @question = Question.find(params[:id])\n @answerlist = Answer.where(\"question_... | [
"0.7262069",
"0.72015166",
"0.69205433",
"0.68985146",
"0.68927073",
"0.6833385",
"0.67852485",
"0.67852485",
"0.67852485",
"0.6750978",
"0.6734262",
"0.6731386",
"0.67247146",
"0.6673209",
"0.6656468",
"0.6646929",
"0.6636093",
"0.6631575",
"0.65606964",
"0.6538327",
"0.6537... | 0.75555646 | 0 |
Send to reviewer Questionnaire Args : | def sendQuestionnaire
email=params[:email]
emails=email.split(",")
description=params[:description]
questionnaire_id = params[:questionnaire_id]
emails.each do |one|
ReviewerInviter.task_invitation(one, description, "http://localhost:3000/questionnaires/answer_show?id="+questionnaire_id).deliv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rreply_params\n params.require(:rreply).permit(:text, :user_id, :relpy_id)\n end",
"def send_reply\n if self.response_changed?\n @notifiable = self\n @tutor = User.find(self.user_id)\n @student = User.find(self.pupil_id)\n\n if self.response == \"Declined\"\n @descriptio... | [
"0.64253783",
"0.64250964",
"0.6405494",
"0.6399295",
"0.6331919",
"0.629761",
"0.62583584",
"0.6222392",
"0.61396784",
"0.6128877",
"0.6072317",
"0.604679",
"0.60286707",
"0.6027854",
"0.6021975",
"0.5994871",
"0.59911704",
"0.5988208",
"0.5962552",
"0.59617734",
"0.595377",... | 0.65418077 | 0 |
GET /test_results/1 GET /test_results/1.json | def show
@test_result = TestResult.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @test_result }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_results(test_id)\n if !(/\\A\\d+\\z/ === test_id.to_s)\n print \"ERROR: get_results called with non-numeric :test_id = '#{test_id}'\\n\"\n exit -1\n end\n uri = \"get_results/#{test_id}\"\n begin\n @all_results = @tr_con.send_get(uri)\n rescue Exception => ex\n pr... | [
"0.7090772",
"0.7015706",
"0.69446945",
"0.6914466",
"0.69076174",
"0.68909407",
"0.6815277",
"0.6809064",
"0.67920184",
"0.67350894",
"0.6675372",
"0.6635104",
"0.66128606",
"0.6562649",
"0.6532864",
"0.6493189",
"0.6473844",
"0.6472095",
"0.6424695",
"0.63957787",
"0.635841... | 0.7047055 | 1 |
GET /test_results/new GET /test_results/new.json | def new
@test_result = TestResult.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @test_result }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @ptest_result = PtestResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ptest_result }\n end\n end",
"def new\n @test_run = TestRun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render jso... | [
"0.7486512",
"0.7464759",
"0.7310779",
"0.7304909",
"0.71513826",
"0.7114189",
"0.7114189",
"0.71105796",
"0.70877385",
"0.70877385",
"0.70877385",
"0.70877385",
"0.70831954",
"0.70797867",
"0.70424134",
"0.7036366",
"0.6900908",
"0.68955636",
"0.68915385",
"0.68748975",
"0.6... | 0.78427535 | 0 |
PUT /test_results/1 PUT /test_results/1.json | def update
@test_result = TestResult.find(params[:id])
respond_to do |format|
if @test_result.update_attributes(params[:test_result])
format.html { redirect_to @test_result, notice: 'Test result was successfully updated.' }
format.json { head :no_content }
else
format.html {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @test_result.update(test_result_params)\n format.html { redirect_to @test_result, notice: 'Test result was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_result }\n else\n format.html { render :edit, sta... | [
"0.6577382",
"0.65503144",
"0.6545797",
"0.6506658",
"0.63523626",
"0.6328727",
"0.63231087",
"0.6296146",
"0.62795126",
"0.61922",
"0.6187594",
"0.61627996",
"0.6160539",
"0.61596817",
"0.61444026",
"0.61444026",
"0.61444026",
"0.6138076",
"0.6122951",
"0.6120557",
"0.608582... | 0.6770564 | 0 |
DELETE /test_results/1 DELETE /test_results/1.json | def destroy
@test_result = TestResult.find(params[:id])
@test_result.destroy
respond_to do |format|
format.html { redirect_to test_results_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\... | [
"0.7386734",
"0.7290677",
"0.72806805",
"0.7278433",
"0.7278433",
"0.72536355",
"0.7250621",
"0.721006",
"0.72016776",
"0.72016776",
"0.7165767",
"0.71167696",
"0.70826536",
"0.7032146",
"0.70120174",
"0.7005103",
"0.6998391",
"0.6984183",
"0.6984183",
"0.6984183",
"0.6984183... | 0.7513926 | 0 |
GET /schools/1 GET /schools/1.xml | def show
@school = School.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @school }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @schools = @person.schools\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @schools }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @school }\n end\n end",
"... | [
"0.7350768",
"0.69110984",
"0.679336",
"0.6679314",
"0.6603744",
"0.65010524",
"0.633042",
"0.6311579",
"0.62451464",
"0.62447923",
"0.6243469",
"0.6231281",
"0.623046",
"0.6227592",
"0.61801016",
"0.617874",
"0.61722845",
"0.61722845",
"0.61722845",
"0.61722845",
"0.61722845... | 0.70818865 | 1 |
DELETE /schools/1 DELETE /schools/1.xml | def destroy
@school = School.find(params[:id])
@school.destroy
respond_to do |format|
format.html { redirect_to(schools_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @school.destroy\n\n respond_to do |format|\n format.html { redirect_to(schools_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @school_rec = SchoolRec.find(params[:id])\n @school_rec.destroy\n\n respond_to do |format|\n format.html { redirect_to(scho... | [
"0.7277967",
"0.69591266",
"0.6726892",
"0.6639786",
"0.6625366",
"0.66029966",
"0.65740836",
"0.6548256",
"0.6548256",
"0.6548256",
"0.6548256",
"0.6548256",
"0.6548256",
"0.65432864",
"0.65332454",
"0.65332454",
"0.65231234",
"0.6508441",
"0.65078074",
"0.6503284",
"0.64849... | 0.7190573 | 1 |
Makes this session handle cookies and store them in in +file+. If file is nil they will be stored in memory. Otherwise the +file+ must be readable and writable. Calling multiple times will add more files. | def handle_cookies(file = nil)
if file
path = Pathname(file).expand_path
unless File.exists?(file) and File.writable?(path.dirname)
raise ArgumentError, "Can't create file #{path} (permission error)"
end
unless File.readable?(file) or File.writable?(path)
raise ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_cookies(file_path = nil)\n if file_path\n path = Pathname(file_path).expand_path\n \n if !File.exist?(file_path) && !File.writable?(path.dirname)\n raise ArgumentError, \"Can't create file #{path} (permission error)\"\n elsif File.exist?(file_path) && !File.writ... | [
"0.7640086",
"0.6427692",
"0.5976608",
"0.58384496",
"0.5711887",
"0.5650596",
"0.5573927",
"0.5558675",
"0.5527936",
"0.54916537",
"0.54678315",
"0.54678315",
"0.54677385",
"0.5453353",
"0.5447955",
"0.54229385",
"0.53891724",
"0.5345292",
"0.5298096",
"0.5278311",
"0.526418... | 0.7927546 | 0 |
Enable debug output to stderr or to specified +file+. | def enable_debug(file = nil)
set_debug_file(file.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable_debug(file = nil)\n set_debug_file(file.to_s)\n self\n end",
"def debug_output_file\n \"debug.log\"\nend",
"def toggle_debug!\n stream = @config[:debug]\n\n if stream.respond_to?(:<<)\n self.class.debug_output(stream)\n else\n self.class.debug_output\n ... | [
"0.82929975",
"0.62470144",
"0.6213392",
"0.60847056",
"0.6025371",
"0.6018709",
"0.6002329",
"0.59215146",
"0.5903736",
"0.58767444",
"0.58767444",
"0.57986104",
"0.57913",
"0.57783",
"0.5774603",
"0.5730017",
"0.5712333",
"0.5695378",
"0.5695378",
"0.5695378",
"0.5693432",
... | 0.8562488 | 0 |
Uploads the passed +data+ to the specified +url+ using HTTP PUT. +data+ must be a string. | def put(url, data, headers = {})
request(:put, url, headers, :data => data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(url, data={}, headers={}, redirect_limit=max_redirects)\n # parse the URL\n uri = URI.parse(url)\n\n debug(\"PUT #{uri} #{headers.inspect}\")\n\n # unless the data is already a string, assume JSON and convert to string\n data = data.to_json unless data.is_a? String\n ... | [
"0.77118224",
"0.7607027",
"0.7374744",
"0.7371776",
"0.73673177",
"0.7344699",
"0.73156166",
"0.73110235",
"0.7270493",
"0.72618616",
"0.7184285",
"0.70555466",
"0.7042689",
"0.6990701",
"0.698433",
"0.69083244",
"0.6903627",
"0.6879228",
"0.68719953",
"0.68228966",
"0.68113... | 0.8293644 | 1 |
Uploads the contents of a file to the specified +url+ using HTTP PUT. | def put_file(url, filename, headers = {})
request(:put, url, headers, :file => filename)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end",
"def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end",
"def put(url, vars={})\n send_request url, vars, 'PUT'\n end",
"def put url, body, headers = {}\n http_requ... | [
"0.7282661",
"0.7282661",
"0.7264141",
"0.7235265",
"0.7119471",
"0.693486",
"0.6930544",
"0.6883299",
"0.6877091",
"0.68665636",
"0.68636316",
"0.68402976",
"0.68169767",
"0.6750699",
"0.66450846",
"0.6615274",
"0.65965635",
"0.6585323",
"0.64565015",
"0.6437783",
"0.6432159... | 0.8358026 | 1 |
Uploads the passed +data+ to the specified +url+ using HTTP POST. +data+ must be a string. | def post(url, data, headers = {})
request(:post, url, headers, :data => data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_part(url, data)\n conn = Faraday.new(url: url) do |faraday|\n faraday.adapter :net_http\n end\n resp = conn.put do |req|\n req.body = data\n # to prevent Faraday from adding garbage header\n req.headers['Content-Type'] = ''\n ... | [
"0.73014164",
"0.710283",
"0.6953084",
"0.6922987",
"0.681095",
"0.6749596",
"0.67080754",
"0.66812557",
"0.66390383",
"0.6630966",
"0.6600273",
"0.65825564",
"0.6553531",
"0.65181434",
"0.64601964",
"0.644824",
"0.64291996",
"0.6427009",
"0.6342407",
"0.6341938",
"0.6328047"... | 0.71998215 | 1 |
Uploads the contents of a file to the specified +url+ using HTTP POST. | def post_file(url, filename, headers = {})
request(:post, url, headers, :file => filename)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit_file_by_url(**options)\n post_request(\"/submit/url-to-file\", options)\n end",
"def submit_file_by_url(**options)\n post_request(\"/submit/url-to-file\", options)\n end",
"def upload_url(url, options = {})\n params = upload_params(options).for_url_upload(url)\n fil... | [
"0.72392786",
"0.72392786",
"0.7205245",
"0.7163972",
"0.68863684",
"0.6812116",
"0.67100185",
"0.67100185",
"0.6650342",
"0.6631915",
"0.66068155",
"0.65517277",
"0.6490836",
"0.64717126",
"0.6429676",
"0.6407607",
"0.63749534",
"0.63616776",
"0.6282497",
"0.6279639",
"0.627... | 0.78589755 | 1 |
WebDAV methods Sends a WebDAV COPY request to the specified +url+. | def copy(url, dest, headers = {})
headers['Destination'] = dest
request(:copy, url, headers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_copy(src_repo,data)\n curl_post(\"#{self.host}/api2/repos/#{src_repo}/fileops/copy/\",data).body_str\n end",
"def http_copy(request, response)\n path = request.path\n\n copy_info = @server.copy_and_move_info(request)\n\n return false unless @server.emit('beforeBind', [copy... | [
"0.632978",
"0.6106217",
"0.5981723",
"0.5804542",
"0.5715317",
"0.5651573",
"0.5603437",
"0.55654824",
"0.55093294",
"0.5505272",
"0.54435843",
"0.5443364",
"0.54273534",
"0.5416223",
"0.5378505",
"0.53065944",
"0.5273033",
"0.5161088",
"0.5085909",
"0.5072235",
"0.50692123"... | 0.66529083 | 0 |
Looking for all Helper checks, which by convention start with attribute 'helper_start_with' value. Returns a array of strings, method names. | def __list_helper_methods
# avoiding '__self__' and '__id__' symbols with last regex part
methods.grep(/^#{@@helper_start_with}.*?[^__]$/) do |method|
method.to_s
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_helper_methods\n @helper_methods ||= __list_helper_methods\n @check_methods ||= __list_check_methods\n end",
"def __list_check_methods\n methods.grep(/^#{@@checks_start_with}/) do |method|\n method.to_s\n end\n end",
"def all_application_helpers\n extract =... | [
"0.7056782",
"0.65636903",
"0.64053917",
"0.6373913",
"0.6370293",
"0.63323843",
"0.6151387",
"0.60207075",
"0.59538853",
"0.58915854",
"0.58915854",
"0.58915854",
"0.58915854",
"0.5873438",
"0.585504",
"0.5682456",
"0.5680701",
"0.56630313",
"0.5651014",
"0.55674255",
"0.555... | 0.7836861 | 0 |
Look for method names that start with attribute 'checks_start_with' value. Returns a array of strings. | def __list_check_methods
methods.grep(/^#{@@checks_start_with}/) do |method|
method.to_s
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_methods_matching_orig name\n found = []\n find_methods name do |store, klass, ancestor, types, method|\n if types == :instance or types == :both then\n methods = store.instance_methods[ancestor]\n if methods then\n matches = methods.grep(/^#{Regexp.escape method.to_s}/)\n... | [
"0.57357746",
"0.5697502",
"0.5663597",
"0.5624484",
"0.55450225",
"0.55113536",
"0.5456413",
"0.5442157",
"0.54063785",
"0.53691465",
"0.53523296",
"0.53294444",
"0.532096",
"0.5291416",
"0.52908707",
"0.52880853",
"0.527789",
"0.5270463",
"0.5265387",
"0.5263434",
"0.525366... | 0.7139151 | 0 |
Similar to match_at, but returns true/false instead of MatchData. | def match_at? rexp, pos = 0
MatchAt.match_at? self, rexp, pos
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_at? str, pos = 0\n MatchAt.match_at? str, self, pos\n end",
"def match\n true\n end",
"def match?(metadata)\n @matches.each do |match|\n if filter_select(match, metadata) and !match.negate\n return true\n end\n if filter_select(match,... | [
"0.6808222",
"0.65436393",
"0.6475774",
"0.6337492",
"0.6333967",
"0.6198542",
"0.6183951",
"0.61207825",
"0.61140245",
"0.60911065",
"0.6012992",
"0.5974394",
"0.5970091",
"0.5938045",
"0.59349865",
"0.59241116",
"0.5920414",
"0.5920414",
"0.58675194",
"0.58136535",
"0.58136... | 0.71745735 | 0 |
Similar to match_at, but returns true/false instead of MatchData. | def match_at? str, pos = 0
MatchAt.match_at? str, self, pos
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_at? rexp, pos = 0\n MatchAt.match_at? self, rexp, pos\n end",
"def match\n true\n end",
"def match?(metadata)\n @matches.each do |match|\n if filter_select(match, metadata) and !match.negate\n return true\n end\n if filter_select(matc... | [
"0.7175366",
"0.6542506",
"0.64755857",
"0.633668",
"0.63326687",
"0.6198063",
"0.61816543",
"0.6119996",
"0.6113595",
"0.6090158",
"0.6011942",
"0.5973166",
"0.59689164",
"0.5936663",
"0.59348756",
"0.5923703",
"0.5919135",
"0.5919135",
"0.586688",
"0.5812098",
"0.5812098",
... | 0.6807798 | 1 |
I worked on this challenge by myself. longest_string is a method that takes an array of strings as its input and returns the longest string +list_of_words+ is an array of strings longest_string(list_of_words) should return the longest string in +list_of_words+ If +list_of_words+ is empty the method should return nil In... | def longest_string(list_of_words)
if list_of_words.length > 0
longest_word = list_of_words[0]
for word in list_of_words
if word.length > longest_word.length
longest_word = word
end
end
return longest_word
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def longest_string(list_of_words)\n # Your code goes here!\n\n return list_of_words.max_by {|word| word.length}\n\n # max = nil\n #\n # if list_of_words == []\n # return max\n # else\n # max = list_of_words[0]\n # for i in 0...list_of_words.length\n # if list_of_words[i].length > max.length\n ... | [
"0.8686293",
"0.85057205",
"0.8470234",
"0.8446541",
"0.84464157",
"0.8362378",
"0.83612466",
"0.83458966",
"0.83437854",
"0.83410996",
"0.8329575",
"0.83033985",
"0.8294679",
"0.825028",
"0.82484376",
"0.8204588",
"0.8162662",
"0.815339",
"0.81285286",
"0.81212443",
"0.81044... | 0.85164124 | 1 |
GET /item_types/1 GET /item_types/1.xml | def show
@item_type = ItemType.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @item_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item_type }\n end\n end",
"def index\n @itemtypes = Itemtype.all\n end",
"def index\n @recipe_types = RecipeType.all\n\n respond_to do |forma... | [
"0.7195215",
"0.65795684",
"0.6447344",
"0.6431036",
"0.63674945",
"0.63319886",
"0.63209176",
"0.6313038",
"0.62947434",
"0.6290185",
"0.6276911",
"0.6197157",
"0.61479974",
"0.61471194",
"0.611879",
"0.61072236",
"0.6104964",
"0.61011845",
"0.6089136",
"0.60825175",
"0.6074... | 0.7143822 | 1 |
GET /item_types/new GET /item_types/new.xml | def new
@item_type = ItemType.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @item_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @item_type = ItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_type }\n end\n end",
"def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render... | [
"0.7940502",
"0.7273418",
"0.7221853",
"0.7215997",
"0.7215997",
"0.7215997",
"0.7215997",
"0.7215997",
"0.7215997",
"0.7215997",
"0.7215997",
"0.7191246",
"0.7184084",
"0.7169594",
"0.71622723",
"0.7156774",
"0.7074482",
"0.70645607",
"0.7010892",
"0.7006894",
"0.7006165",
... | 0.7870722 | 1 |
POST /item_types POST /item_types.xml | def create
@item_type = ItemType.new(params[:item_type])
respond_to do |format|
if @item_type.save
flash[:notice] = 'ItemType was successfully created.'
format.html { redirect_to(@item_type) }
format.xml { render :xml => @item_type, :status => :created, :location => @item_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @itemtype = Itemtype.new(itemtype_params)\n\n respond_to do |format|\n if @itemtype.save\n format.html { redirect_to @itemtype, notice: 'Itemtype was successfully created.' }\n format.json { render :show, status: :created, location: @itemtype }\n else\n format.html... | [
"0.6534142",
"0.63591176",
"0.6292417",
"0.6156293",
"0.6115572",
"0.60752225",
"0.59194267",
"0.58974105",
"0.5886337",
"0.58673686",
"0.58271915",
"0.5824956",
"0.5822386",
"0.5808868",
"0.5792994",
"0.57809806",
"0.5780694",
"0.57783705",
"0.5767671",
"0.5733091",
"0.56925... | 0.637711 | 1 |
PUT /item_types/1 PUT /item_types/1.xml | def update
@item_type = ItemType.find(params[:id])
respond_to do |format|
if @item_type.update_attributes(params[:item_type])
flash[:notice] = 'ItemType was successfully updated.'
format.html { redirect_to(@item_type) }
format.xml { head :ok }
else
format.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n if @item_type.update_attributes(params[:item_type])\n format.html { render :action => 'edit', :notice => 'Item type was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { r... | [
"0.71110517",
"0.6520673",
"0.64976186",
"0.64485735",
"0.64379025",
"0.6312937",
"0.62140137",
"0.61865044",
"0.61409885",
"0.61078036",
"0.6091348",
"0.6023158",
"0.5976565",
"0.59679115",
"0.5936291",
"0.5933633",
"0.5870948",
"0.5834867",
"0.5795623",
"0.5759428",
"0.5748... | 0.68993264 | 1 |
DELETE /item_types/1 DELETE /item_types/1.xml | def destroy
@item_type = ItemType.find(params[:id])
@item_type.destroy
respond_to do |format|
format.html { redirect_to(item_types_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @item_type = ItemType.find(params[:id])\n # You cannot destroy item types\n respond_to do |format|\n format.html { redirect_to(item_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item_type.destroy\n respond_to do |format|\n format.html { redi... | [
"0.7154503",
"0.6880605",
"0.675248",
"0.6601346",
"0.6601346",
"0.6601346",
"0.6601346",
"0.6601346",
"0.6601346",
"0.65828943",
"0.65648097",
"0.6552533",
"0.6535749",
"0.6530758",
"0.6519838",
"0.65167946",
"0.65074176",
"0.65044165",
"0.64941686",
"0.6457169",
"0.6430654"... | 0.7449789 | 0 |
GET /computer_cases GET /computer_cases.json | def index
@computer_cases = ComputerCase.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:problems].blank?\n @cases = Case.all\n else\n @cases = Case.as(:c).where('c.stock <= 1').pluck(:c)\n @cases.map!{|c| {\n id: c.id,\n name: c.name,\n stock: c.stock\n }}\n\n @cases.sort_by! {:name}\n\n render json: @cases\n end\n en... | [
"0.6782567",
"0.67478627",
"0.65031207",
"0.634706",
"0.634706",
"0.63232917",
"0.61729354",
"0.6007817",
"0.59757996",
"0.59757996",
"0.5956582",
"0.593697",
"0.5898582",
"0.5896633",
"0.58709645",
"0.5781257",
"0.57515156",
"0.5704119",
"0.56831974",
"0.5677729",
"0.5672228... | 0.7167471 | 0 |
POST /computer_cases POST /computer_cases.json | def create
@computer_case = ComputerCase.new(computer_case_params)
respond_to do |format|
if @computer_case.save
format.html { redirect_to @computer_case, notice: 'Computer case was successfully created.' }
format.json { render :show, status: :created, location: @computer_case }
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to cases_path, notice: 'Case was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cases_path }\n else\n format.html { ren... | [
"0.6467076",
"0.6266084",
"0.6266084",
"0.6186823",
"0.6148943",
"0.5934998",
"0.5881844",
"0.587662",
"0.587662",
"0.58539176",
"0.5840979",
"0.5798991",
"0.57792073",
"0.5759277",
"0.5684881",
"0.5684881",
"0.5684881",
"0.56545305",
"0.5653701",
"0.56327206",
"0.56313896",
... | 0.6972714 | 0 |
PATCH/PUT /computer_cases/1 PATCH/PUT /computer_cases/1.json | def update
respond_to do |format|
if @computer_case.update(computer_case_params)
format.html { redirect_to @computer_case, notice: 'Computer case was successfully updated.' }
format.json { render :show, status: :ok, location: @computer_case }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @clientcase = Clientcase.find(params[:id])\n\n respond_to do |format|\n if @clientcase.update_attributes(params[:clientcase])\n format.html { redirect_to @clientcase, :notice => 'Clientcase was successfully updated.' }\n format.json { head :ok }\n else\n format.htm... | [
"0.66333616",
"0.6458671",
"0.64299965",
"0.6353033",
"0.6353004",
"0.6338028",
"0.63350564",
"0.6300484",
"0.6285271",
"0.6266507",
"0.62547123",
"0.62547123",
"0.62513596",
"0.62374556",
"0.62067026",
"0.61962",
"0.6183611",
"0.61707747",
"0.61301947",
"0.6126106",
"0.61261... | 0.6847098 | 0 |
DELETE /computer_cases/1 DELETE /computer_cases/1.json | def destroy
@computer_case.destroy
respond_to do |format|
format.html { redirect_to computer_cases_url, notice: 'Computer case was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @clientcase = Clientcase.find(params[:id])\n @clientcase.destroy\n\n respond_to do |format|\n format.html { redirect_to clientcases_url }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @case.destroy\n re... | [
"0.71422833",
"0.69885117",
"0.69159096",
"0.67867106",
"0.6781758",
"0.6777597",
"0.6732555",
"0.6691837",
"0.6690607",
"0.6681213",
"0.6681213",
"0.6681213",
"0.6681213",
"0.66681045",
"0.66646785",
"0.6655183",
"0.664974",
"0.664533",
"0.6638623",
"0.663419",
"0.6623732",
... | 0.710179 | 1 |
Track an event for a previously identified user | def track_user_event(event, user, props=nil)
analytics_provider_instance.track_user_event(event, user, props) if analytics_provider_instance && Rails.configuration.analytics[:enabled]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def track_server_event(name, user, properties = {})\n user_id = user ? user.id : 'anonymous'\n @last_event = { name: name, user_id: user_id, properties: properties }\n\n if enabled?\n @segment_io.track(\n user_id: user_id,\n event: name,\n properties: properties\n ... | [
"0.6900716",
"0.6708107",
"0.6690832",
"0.66451657",
"0.6464324",
"0.63249314",
"0.63192886",
"0.62284917",
"0.62187856",
"0.61510795",
"0.6131353",
"0.61215115",
"0.61215115",
"0.61215115",
"0.6061356",
"0.6057039",
"0.60425735",
"0.60139596",
"0.6008025",
"0.60079294",
"0.5... | 0.7105728 | 0 |
returns either nil if should not skip sync true if shoudl skip sync hash with Boolean key :error | def skip_sync?
if R8::Config[:node_agent_git_clone][:mode] == 'skip'
return true
end
skip_sync = nil
@head_git_commit_id = nil #nil means dont skip
installed_agent_git_commit_id = @node.get_field?(:agent_git_commit_id)
begin
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failed_full_sync_required?\n\t\t\treturn request_status == REQUEST_STATUS['failed_full_sync_required']\n\t\tend",
"def need_sync?\n if is_ignored || err_count >= MAX_SYNC_ERR\n false\n elsif last_sync == DUMMY_TIMESTAMP\n true\n else\n case sync_type.to_sym\n when :... | [
"0.6264902",
"0.6094702",
"0.5827929",
"0.58164674",
"0.5795311",
"0.57661176",
"0.5717203",
"0.5659842",
"0.56358916",
"0.5545872",
"0.5491107",
"0.5489838",
"0.54891515",
"0.54668653",
"0.5465773",
"0.5437599",
"0.54146254",
"0.5412291",
"0.538771",
"0.5379755",
"0.53759766... | 0.60984695 | 1 |
Does PostgreSQL support migrations? | def supports_migrations?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supports_migrations?\n true\n end",
"def supports_migrations?\n true\n end",
"def supports_migrations?\n true\n end",
"def supports_migrations?\n false\n end",
"def supports_migrations?\n false\n end",
"def migration\n end",
"def migrate... | [
"0.74455017",
"0.74455017",
"0.74455017",
"0.71099716",
"0.71099716",
"0.7081053",
"0.70517933",
"0.70061463",
"0.6878439",
"0.6753264",
"0.6726949",
"0.6721073",
"0.67103",
"0.6654258",
"0.6637816",
"0.6585741",
"0.653311",
"0.65126055",
"0.65126055",
"0.64790964",
"0.647123... | 0.7510341 | 1 |
Returns the configured supported identifier length supported by PostgreSQL, or report the default of 63 on PostgreSQL 7.x. | def table_alias_length
@table_alias_length ||= (
postgresql_version >= 80000 ?
select_one('SHOW max_identifier_length')['max_identifier_length'].to_i :
63
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_identifier_length\n @max_identifier_length ||= select_one('SHOW max_identifier_length', 'SCHEMA'.freeze)['max_identifier_length'].to_i\n end",
"def table_alias_length\n @table_alias_length ||= (postgresql_version >= 80000 ? select_one('SHOW max_identifier_length')['max_identifier_length'].to... | [
"0.77626705",
"0.7425341",
"0.7415166",
"0.6890104",
"0.6768359",
"0.66681993",
"0.6570243",
"0.6568709",
"0.6445401",
"0.6145001",
"0.6134166",
"0.6008519",
"0.59177303",
"0.584478",
"0.5800081",
"0.57869506",
"0.57863003",
"0.5786278",
"0.5784538",
"0.5777665",
"0.56965554"... | 0.74968874 | 1 |
Returns an array of schema names. | def schema_names
select_values(
"SELECT nspname FROM pg_namespace" <<
" WHERE nspname !~ '^pg_.*' AND nspname NOT IN ('information_schema')" <<
" ORDER by nspname;",
'SCHEMA')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schema_names\n select_value(<<-SQL, 'SCHEMA')\n SELECT nspname\n FROM pg_namespace\n WHERE nspname !~ '^pg_.*'\n AND nspname NOT IN ('information_schema')\n ORDER by nspname;\n SQL\n end",
"def all_schemas\n query('SE... | [
"0.7825486",
"0.755717",
"0.7349362",
"0.725099",
"0.70116794",
"0.6907281",
"0.6817294",
"0.67592704",
"0.67592704",
"0.6630236",
"0.6606849",
"0.6363766",
"0.6285879",
"0.61717385",
"0.6136126",
"0.60941684",
"0.6042356",
"0.60274166",
"0.6021593",
"0.5923801",
"0.5906087",... | 0.77769697 | 1 |
Returns true if schema exists. | def schema_exists?(name)
select_value("SELECT COUNT(*) FROM pg_namespace WHERE nspname = '#{name}'", 'SCHEMA').to_i > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists?\n schema.exists?(self)\n end",
"def schema_exists?(name)\n select_value(\"SELECT COUNT(*) FROM pg_namespace WHERE nspname = '#{name}'\", 'SCHEMA').to_i > 0\n end",
"def schema_loaded?\n @schema_loaded\n end",
"def db_exist?(db_name)\n list_schemas.include?(db_... | [
"0.870376",
"0.80718994",
"0.7772462",
"0.7356496",
"0.73484826",
"0.7221219",
"0.7111925",
"0.70547426",
"0.70278955",
"0.7027433",
"0.695713",
"0.6954786",
"0.69057137",
"0.6826998",
"0.6826858",
"0.67104733",
"0.66710407",
"0.66590893",
"0.6653367",
"0.6620029",
"0.6575495... | 0.8083377 | 1 |
Returns the current database encoding format. | def encoding
select_value(
"SELECT pg_encoding_to_char(pg_database.encoding)" <<
" FROM pg_database" <<
" WHERE pg_database.datname LIKE '#{current_database}'",
'SCHEMA')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encoding\n select_value(\"SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname LIKE '#{current_database}'\", 'SCHEMA')\n end",
"def encoding\n if @connection.respond_to?(:encoding)\n @connection.encoding.to_s\n else\n @connection.execute('PRAGMA ... | [
"0.7547709",
"0.74738336",
"0.711562",
"0.6880602",
"0.6549058",
"0.6508679",
"0.6423461",
"0.62985575",
"0.62985575",
"0.6177421",
"0.61548644",
"0.61548644",
"0.6118205",
"0.5982267",
"0.5982267",
"0.5922049",
"0.5922049",
"0.5922049",
"0.5922049",
"0.5922049",
"0.5922049",... | 0.76479644 | 0 |
Returns the current database ctype. | def ctype
select_value(
"SELECT pg_database.datctype FROM pg_database WHERE pg_database.datname LIKE '#{current_database}'",
'SCHEMA')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_type\n @db_type || self.class.db_type\n end",
"def db_type\n @db_type || self.class.db_type\n end",
"def type_c\n @type_c ||= type[1]\n end",
"def database_type(database)\n Contrib::Utils::Database.normalize_vendor(database.database_type.to_s)\n ... | [
"0.7150052",
"0.7150052",
"0.64715785",
"0.64613974",
"0.62984645",
"0.6184572",
"0.6184572",
"0.60145676",
"0.59682935",
"0.5932123",
"0.59283537",
"0.59283537",
"0.586733",
"0.5854627",
"0.57934284",
"0.5772028",
"0.5751685",
"0.5742475",
"0.57380474",
"0.57376844",
"0.5732... | 0.7906427 | 0 |
Drops the schema for the given schema name. | def drop_schema schema_name
execute "DROP SCHEMA #{schema_name} CASCADE"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_schema(schema_name)\n execute(\"DROP SCHEMA \\\"#{schema_name}\\\"\")\n end",
"def drop_schema(schema_name, options = {})\n execute \"DROP SCHEMA#{' IF EXISTS' if options[:if_exists]} #{quote_schema_name(schema_name)} CASCADE\"\n end",
"def drop_schema_sql(name, opts = {})\n ... | [
"0.868982",
"0.81105715",
"0.80482227",
"0.80474216",
"0.80239207",
"0.79456204",
"0.7939613",
"0.7935808",
"0.7896766",
"0.71207494",
"0.7069183",
"0.6863048",
"0.6859939",
"0.68088716",
"0.6804522",
"0.6749315",
"0.6711258",
"0.66265017",
"0.6604161",
"0.6492391",
"0.648983... | 0.82089806 | 1 |
Set the client message level. | def client_min_messages=(level)
# NOTE: for now simply ignore the writer (no warn on Redshift) so that
# the AR copy-pasted PpstgreSQL parts stay the same as much as possible
return nil if redshift? # not supported on Redshift
execute("SET client_min_messages TO '#{level}'", 'SCHEMA')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def level=(new_level)\n @logger.level=Logger::Severity.const_get(new_level.to_sym.upcase)\n end",
"def set_modchat(level)\n send \"/modchat #{level}\"\n end",
"def client_min_messages=(level)\n # Not supported on Redshift\n redshift? ? nil : super\n end",
"def level=(value)\n ... | [
"0.6183599",
"0.6176054",
"0.6138289",
"0.61173695",
"0.6086171",
"0.6086171",
"0.6045444",
"0.60372514",
"0.6020798",
"0.6020798",
"0.60202146",
"0.5968639",
"0.5922183",
"0.5891322",
"0.58826494",
"0.58706677",
"0.58356607",
"0.5827471",
"0.579654",
"0.5785428",
"0.5769103"... | 0.68401873 | 0 |
Returns true if table exists. If the schema is not specified as part of +name+ then it will only find tables within the current schema search path (regardless of permissions to access tables in other schemas) | def table_exists?(name)
schema, table = extract_schema_and_table(name.to_s)
return false unless table
binds = [[nil, table]]
binds << [nil, schema] if schema
sql = "#{TABLE_EXISTS_SQL_PREFIX} AND n.nspname = #{schema ? "?" : 'ANY (current_schemas(false))'}"
log(sql, 'SCHEMA', bind... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_exists?(name)\n return false unless name\n schema ? @connection.table_exists?(name, schema) : @connection.table_exists?(name)\n end",
"def table_exists?(name)\n begin \n if respond_to?(:tables)\n tables.include?(name.to_sym)\n else\n from(name).first\n ... | [
"0.8448597",
"0.8000776",
"0.79579175",
"0.7742698",
"0.7547951",
"0.7493043",
"0.74601924",
"0.7431377",
"0.73941594",
"0.7381231",
"0.73081815",
"0.72593695",
"0.7224052",
"0.7195111",
"0.7169875",
"0.7106428",
"0.7104358",
"0.709668",
"0.7078591",
"0.69815505",
"0.6957576"... | 0.8454061 | 0 |
Attempt to authorize using the given authorization code, return access token TODO: Determine what errors this can throw | def authorize(authcode)
@client.authorization.code = authcode
@client.authorization.fetch_access_token!
@client.authorization.access_token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_code(authorization_code)\n client.authorization.code = authorization_code\n client.authorization.fetch_access_token!\n client.authorization.refresh_token ||= oauth_data[:refresh_token]\n oauth_data[:refresh_token] = client.authorization.refresh_token\n end",
"def get_access_t... | [
"0.8084547",
"0.78736",
"0.7850902",
"0.77837133",
"0.77837133",
"0.7754566",
"0.76840526",
"0.7636256",
"0.763521",
"0.76308954",
"0.7617653",
"0.7614504",
"0.7613277",
"0.7565406",
"0.7549716",
"0.7549393",
"0.7526828",
"0.74922484",
"0.7442042",
"0.74347395",
"0.7433079",
... | 0.82728106 | 0 |
Return current user info, fetch if it does not exist | def user_info
@user_info ||= fetch_latest_user_info
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def user_info\n @user_info ||= raw_info\n end",
"def get_user_info user\n unless user.known_user.nil?\n known_user = user.known_user\n is_me = known_user.is_current_user || false\n retur... | [
"0.7667246",
"0.7362351",
"0.732454",
"0.72923386",
"0.72852415",
"0.7163969",
"0.7163969",
"0.70978266",
"0.70874846",
"0.7052589",
"0.70329577",
"0.70177907",
"0.7006135",
"0.6982538",
"0.696204",
"0.6957681",
"0.69249",
"0.6922428",
"0.6921659",
"0.69210094",
"0.69159395",... | 0.8045458 | 0 |
Fetch and return latest user info | def fetch_latest_user_info
@user_info = @client.execute(api_method: @info.userinfo.get).data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_info\n\t\t@user_info ||= fetch_latest_user_info\n\tend",
"def fetch_user(id)\n fetch( :user, id ).last_result_item\n end",
"def fetch_user_extended_detail\n @user_extended_detail_obj = UserExtendedDetail.using_client_shard(client: @client).\n get_from_memcache(@user_kyc_detail.us... | [
"0.77316165",
"0.71417767",
"0.667179",
"0.65796137",
"0.65777415",
"0.65751195",
"0.6480807",
"0.6464767",
"0.643755",
"0.64349127",
"0.64223015",
"0.6402471",
"0.63906056",
"0.63583046",
"0.6332724",
"0.6331648",
"0.63311136",
"0.62712324",
"0.62709326",
"0.6245452",
"0.623... | 0.85675085 | 0 |
Return current task lists, fetch if it does not exist | def task_lists
@task_lists ||= fetch_latest_task_lists
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tasklists\n @tasklists = []\n array = @client.execute(@api.tasklists.list).data.to_hash[\"items\"]\n array.each { |h|\n @tasklists.push Tasklist[h]\n }\n end",
"def tasklists\n get gtasks_tasklists_url\n end",
"def fetch_latest_task_lists\n\t\tresponse = @client.ex... | [
"0.77946144",
"0.7519247",
"0.74978673",
"0.7494753",
"0.7430635",
"0.7329773",
"0.72395253",
"0.70719504",
"0.70499635",
"0.70225465",
"0.6927442",
"0.6907527",
"0.68976074",
"0.689159",
"0.6852834",
"0.68283844",
"0.68044907",
"0.67201483",
"0.6699318",
"0.6694184",
"0.6643... | 0.8443579 | 0 |
Fetch and return latest task lists | def fetch_latest_task_lists
response = @client.execute(api_method: @gtasks.tasklists.list)
puts "***************** ERROR FETCHING TASK LISTS *****************" if response.status != 200
puts response.body
@task_lists = response.data.items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_lists\n\t\t@task_lists ||= fetch_latest_task_lists\n\tend",
"def fetch_latest_everything\n\t\t@user_info = @client.execute(api_method: @info.userinfo.get).data\n\t\t@task_lists = @client.execute(api_method: @gtasks.tasklists.list).data.items\n\t\t@tasks = Hash.new\n\t\t@task_lists.each do |list|\n\t\t\t... | [
"0.7961965",
"0.79400176",
"0.79162365",
"0.70104474",
"0.6898594",
"0.6695779",
"0.66131246",
"0.64955795",
"0.64618474",
"0.643127",
"0.64099044",
"0.63433474",
"0.63433474",
"0.63433474",
"0.62394035",
"0.6236967",
"0.61826205",
"0.61590946",
"0.6141767",
"0.6120137",
"0.6... | 0.8560403 | 0 |
Return the tasks for a list, fetch if it does not exist | def tasks_for(list)
@tasks[list] ||= fetch_latest_tasks_for(list)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_latest_tasks_for(list)\n\t\t@tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => list.id }).data.items\n\tend",
"def tasks(list)\n list_obj = list.is_a?(Wunderlist::List) ? list : lists[list]\n list = list.id if list.is_a? Wunderlist::List\n\n reques... | [
"0.8088946",
"0.76756036",
"0.7486368",
"0.72100013",
"0.7197292",
"0.71461475",
"0.71006256",
"0.7067179",
"0.694145",
"0.6938234",
"0.6799937",
"0.67341805",
"0.66838557",
"0.6632372",
"0.6575473",
"0.65546745",
"0.6546469",
"0.65215236",
"0.6471903",
"0.6462661",
"0.640722... | 0.8037698 | 1 |
Fetch and return latest tasks for a list | def fetch_latest_tasks_for(list)
@tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => list.id }).data.items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_latest_task_lists\n\t\tresponse = @client.execute(api_method: @gtasks.tasklists.list)\n\t\tputs \"***************** ERROR FETCHING TASK LISTS *****************\" if response.status != 200\n\t\tputs response.body\n\t\t@task_lists = response.data.items\n\tend",
"def tasks_for(list)\n\t\t@tasks[list] ||= ... | [
"0.79894245",
"0.75466865",
"0.7431826",
"0.733321",
"0.6784899",
"0.64888614",
"0.6403375",
"0.6303735",
"0.6271653",
"0.6237344",
"0.61682165",
"0.6163538",
"0.6136898",
"0.6099376",
"0.5972703",
"0.5923752",
"0.59213805",
"0.5901405",
"0.5857239",
"0.5857239",
"0.5857239",... | 0.8564092 | 0 |
Not sure if the functions below are still needed Fetch user information, task lists, and tasks | def fetch_latest_everything
@user_info = @client.execute(api_method: @info.userinfo.get).data
@task_lists = @client.execute(api_method: @gtasks.tasklists.list).data.items
@tasks = Hash.new
@task_lists.each do |list|
@tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_user_tasks\n\t\t@tasks = current_user.get_developer_tasks\n\tend",
"def index\n secretary = is_secretary?\n if secretary\n user_ids = [current_user.id]\n cluster_livian_user_ids = @cluster_livian_users.map(&:id)\n else\n cluster_livian_user_ids = @user_ids\n user_ids = get_u... | [
"0.73423994",
"0.7002985",
"0.6926264",
"0.69018227",
"0.6771736",
"0.66724",
"0.6665811",
"0.6665607",
"0.66279423",
"0.66275036",
"0.65956444",
"0.65941924",
"0.65798354",
"0.65619224",
"0.65557986",
"0.6530871",
"0.65145993",
"0.65111333",
"0.6486124",
"0.6482184",
"0.6481... | 0.75269526 | 0 |
GET /rate_ups GET /rate_ups.json | def index
@rate_ups = RateUp.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rates; end",
"def rates; end",
"def get_rates(options={})\n post 'rates/full', options\n end",
"def saw\n @rates = Rate.all\n end",
"def set_rate_up\n @rate_up = RateUp.find(params[:id])\n end",
"def ups_info\n ups_client.find_rates(order.origin, order.destination, order.pa... | [
"0.668675",
"0.668675",
"0.6684046",
"0.6479226",
"0.6473042",
"0.6435121",
"0.6271397",
"0.6271397",
"0.6271397",
"0.6271397",
"0.61497074",
"0.61411524",
"0.61362785",
"0.61137503",
"0.6081196",
"0.60706735",
"0.6032721",
"0.6031574",
"0.6014538",
"0.59166175",
"0.59119964"... | 0.7315471 | 0 |
PATCH/PUT /rate_ups/1 PATCH/PUT /rate_ups/1.json | def update
respond_to do |format|
if @rate_up.update(rate_up_params)
format.html { redirect_to @rate_up, notice: 'Rate up was successfully updated.' }
format.json { render :show, status: :ok, location: @rate_up }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @rate.update(rate_params)\n format.html { redirect_to @rate, notice: 'Rate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rate.errors, stat... | [
"0.6832943",
"0.68065256",
"0.68061864",
"0.68061864",
"0.6804451",
"0.671245",
"0.6548282",
"0.6506951",
"0.6424184",
"0.6413859",
"0.6364725",
"0.6325781",
"0.63136166",
"0.6294606",
"0.6291954",
"0.62176543",
"0.61737746",
"0.61660653",
"0.61460245",
"0.6133424",
"0.612302... | 0.725162 | 0 |
DELETE /rate_ups/1 DELETE /rate_ups/1.json | def destroy
@rate_up.destroy
respond_to do |format|
format.html { redirect_to rate_ups_url, notice: 'Rate up was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redirect_to rates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run_at_rate = RunAtRate.find(params[:id])\n @run_at_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to r... | [
"0.7090342",
"0.69682384",
"0.69595873",
"0.69362783",
"0.69362783",
"0.69362783",
"0.6928985",
"0.69173586",
"0.6830869",
"0.67984116",
"0.6658632",
"0.66104424",
"0.6567958",
"0.65498245",
"0.6532136",
"0.6531539",
"0.6520857",
"0.6515044",
"0.65133095",
"0.65014076",
"0.64... | 0.7572211 | 0 |
GET /capitals GET /capitals.json | def index
@capitals = Capital.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @capital_account = CapitalAccount.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @capital_account }\n end\n end",
"def show\n @capacitacion = Capacitacion.find(params[:id])\n\n respond_to do |format|\n format.html... | [
"0.61255276",
"0.60732526",
"0.60420364",
"0.60246193",
"0.6008408",
"0.5995294",
"0.5935017",
"0.5818346",
"0.5816992",
"0.57894486",
"0.5707944",
"0.56671935",
"0.56671935",
"0.56094515",
"0.55417603",
"0.54989976",
"0.54947513",
"0.5493647",
"0.5491327",
"0.5487513",
"0.54... | 0.72020435 | 0 |
POST /capitals POST /capitals.json | def create
@capital = Capital.new(capital_params)
respond_to do |format|
if @capital.save
format.html { redirect_to @capital, notice: 'Capital was successfully created.' }
format.json { render :show, status: :created, location: @capital }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @capacitacion = Capacitacion.new(params[:capacitacion])\n\n respond_to do |format|\n if @capacitacion.save\n format.html { redirect_to @capacitacion, notice: 'Capacitacion was successfully created.' }\n format.json { render json: @capacitacion, status: :created, location: @cap... | [
"0.5806922",
"0.57922095",
"0.5767812",
"0.5743742",
"0.56486183",
"0.5571623",
"0.5560296",
"0.55600256",
"0.55354446",
"0.5509604",
"0.5467003",
"0.54452866",
"0.54282606",
"0.54127556",
"0.5378213",
"0.53546536",
"0.53362435",
"0.5321196",
"0.5315702",
"0.5315051",
"0.5308... | 0.666186 | 0 |
PATCH/PUT /capitals/1 PATCH/PUT /capitals/1.json | def update
respond_to do |format|
if @capital.update(capital_params)
format.html { redirect_to @capital, notice: 'Capital was successfully updated.' }
format.json { render :show, status: :ok, location: @capital }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capi... | [
"0.6725625",
"0.6518976",
"0.65039986",
"0.6434508",
"0.6331531",
"0.6330417",
"0.6322905",
"0.6280592",
"0.6259024",
"0.6253814",
"0.62430626",
"0.622729",
"0.6154257",
"0.6148737",
"0.61179936",
"0.6101319",
"0.60961574",
"0.608188",
"0.60817695",
"0.6079272",
"0.6078945",
... | 0.6729756 | 0 |
DELETE /capitals/1 DELETE /capitals/1.json | def destroy
@capital.destroy
respond_to do |format|
format.html { redirect_to capitals_url, notice: 'Capital was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @capacitacion = Capacitacion.find(params[:id])\n @capacitacion.destroy\n\n respond_to do |format|\n format.html { redirect_to capacitacions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capa = Capa.find(params[:id])\n @capa.destroy\n\n respon... | [
"0.7183522",
"0.71001416",
"0.7071206",
"0.7071206",
"0.7002908",
"0.6964451",
"0.6943694",
"0.6906855",
"0.6889307",
"0.68581843",
"0.6825944",
"0.67325497",
"0.6714653",
"0.6671501",
"0.66505015",
"0.6623366",
"0.6622422",
"0.6608271",
"0.65936106",
"0.65738434",
"0.6573587... | 0.71858335 | 0 |
This method gets called when your app is installed. setup any webhooks or services you need on Shopify inside here. | def install
shopify_session do
# create an uninstall webhook, this webhook gets sent
# when your app is uninstalled from a shop. It is good
# practice to clean up any data from a shop when they
# uninstall your app.
uninstall_webhook = ShopifyAPI::Webhook.new({
topic: "app/unin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_shopify_auth\n shopify_session do |shop_name| # => Shopify hook\n\n ##################################################\n ##################################################\n\n #######################\n ## Uninstall Webhook ##\n #######################\n\n # => Allows us to re... | [
"0.66865647",
"0.65800947",
"0.6484519",
"0.60223085",
"0.5997042",
"0.59952474",
"0.5979839",
"0.5829347",
"0.58125526",
"0.57698256",
"0.57695323",
"0.57381105",
"0.5611748",
"0.5538578",
"0.54266423",
"0.5418646",
"0.5403521",
"0.54015595",
"0.5400087",
"0.5398531",
"0.538... | 0.7315784 | 0 |
Helper to get filtering backends, defaulting to no backends. | def get_filter_backends
return self.class.filter_backends || []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_filter_backends\n return self.class.filter_backends || [\n RESTFramework::ModelFilter, RESTFramework::ModelOrderingFilter\n ]\n end",
"def backends; end",
"def merged_backends\n return []\n end",
"def backends\n # Lets cache the values and return the cache\n if @backends... | [
"0.77599996",
"0.62652385",
"0.6212729",
"0.6174745",
"0.59901464",
"0.5923429",
"0.5895099",
"0.5834676",
"0.5815357",
"0.5686847",
"0.5680805",
"0.56532794",
"0.5641446",
"0.55821127",
"0.5556181",
"0.55240047",
"0.5494901",
"0.5485515",
"0.54396737",
"0.5438238",
"0.542687... | 0.7855189 | 0 |
Helper to filter an arbitrary data set over all configured filter backends. | def get_filtered_data(data)
self.get_filter_backends.each do |filter_class|
filter = filter_class.new(controller: self)
data = filter.get_filtered_data(data)
end
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_filter_backends\n return self.class.filter_backends || []\n end",
"def filter *filters\n spawn :@filters, @filters + parse_filter_input(filters)\n end",
"def filter_on(values)\n @filters << values\n end",
"def get_filter_backends\n return self.class.filter_backends || [\n REST... | [
"0.654663",
"0.64333403",
"0.6421861",
"0.63987684",
"0.6263033",
"0.6263033",
"0.6263033",
"0.6214779",
"0.6214779",
"0.6075352",
"0.6073691",
"0.60722715",
"0.6064449",
"0.6044223",
"0.60286736",
"0.6003177",
"0.59896576",
"0.5983842",
"0.5948163",
"0.5943584",
"0.5929396",... | 0.66097534 | 0 |
DELETE /owners/1 DELETE /owners/1.json | def destroy
@owner.destroy
respond_to do |format|
format.html { redirect_to owners_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @owner = Owner.find(params[:id])\n @owner.destroy\n\n respond_to do |format|\n format.html { redirect_to owners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @owner.destroy\n respond_to do |format|\n format.html { redirect_to owners_url, not... | [
"0.78404737",
"0.76345766",
"0.7601915",
"0.7505621",
"0.7505621",
"0.7505621",
"0.7463591",
"0.7370988",
"0.71954787",
"0.7117315",
"0.7089099",
"0.7048217",
"0.6943018",
"0.68213993",
"0.6809423",
"0.6751331",
"0.6738986",
"0.6735351",
"0.67319787",
"0.669673",
"0.66813034"... | 0.7822245 | 1 |
get styles sorted by size from largest to smallest :original if it exists is always first | def weighted_styles(input)
Hash[input.sort_by do |meta_style_name,meta_style|
r = if meta_style_name == :original
-9999999999999
else
0 - (meta_style[:width].to_i + meta_style[:height].to_i)
end
end]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def styles\n return if @styles.empty?\n @styles.uniq.sort\n end",
"def closest_size(object, size)\n sizes = object.options[:styles].values.collect{ |x| { x => parse_size(x) } }.sort_by{ |x| x.values }\n closest_size_hash = sizes.min_by { |x| ( x.values.first.to_f - Column.sizes[size] ).abs }\n ... | [
"0.69042706",
"0.60257554",
"0.57862645",
"0.5618286",
"0.5600652",
"0.5464023",
"0.54195535",
"0.53988194",
"0.5328606",
"0.5220255",
"0.51080793",
"0.5108019",
"0.5072314",
"0.5069812",
"0.5060404",
"0.49429885",
"0.48961172",
"0.48839307",
"0.48715746",
"0.48672637",
"0.48... | 0.67744756 | 1 |
Baseline implementation for the abandon_instances REST call | def abandon_instances request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
uri, body, query_string_params = transcode_abandon_instances_request request_pb
response = @client_stub.make_post_request(
uri: uri,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unmonitor_instances( options = {} )\n options = { :instance_id => [] }.merge(options)\n raise ArgumentError, \"No :instance_id provided\" if options[:instance_id].nil? || options[:instance_id].empty?\n params = pathlist(\"InstanceId\", options[:instance_id])\n return response_genera... | [
"0.60044473",
"0.59776807",
"0.5977602",
"0.5635921",
"0.5525691",
"0.55182695",
"0.55030507",
"0.54494196",
"0.5436976",
"0.541044",
"0.5407295",
"0.5401262",
"0.539516",
"0.5370092",
"0.5358628",
"0.53511506",
"0.5342512",
"0.5342512",
"0.5320943",
"0.5306046",
"0.5306046",... | 0.7635395 | 0 |
Baseline implementation for the aggregated_list REST call | def aggregated_list request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
uri, _body, query_string_params = transcode_aggregated_list_request request_pb
response = @client_stub.make_get_request(
uri: uri,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aggregated_list request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_aggregated_list_request request_pb\n query_string_params = if query_string_params.any?... | [
"0.677039",
"0.6543518",
"0.64048564",
"0.6356955",
"0.6265128",
"0.60694504",
"0.5953424",
"0.5902644",
"0.5884521",
"0.5846486",
"0.5786312",
"0.5777131",
"0.57170635",
"0.5693815",
"0.56825435",
"0.5665302",
"0.5664142",
"0.56616646",
"0.5660386",
"0.56501734",
"0.5619399"... | 0.66661304 | 1 |
Baseline implementation for the apply_updates_to_instances REST call | def apply_updates_to_instances request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
uri, body, _query_string_params = transcode_apply_updates_to_instances_request request_pb
response = @client_stub.make_post_request(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n @parameters = args[:parameters] if args.key?(:parameters)\n end",
"def update!(**args)\n @instances = args[:instances] if args.key?(:instances)\n end",
"def update!(**args)\n @instan... | [
"0.6883882",
"0.68352866",
"0.6265813",
"0.62466383",
"0.6238221",
"0.6211436",
"0.6211436",
"0.6191201",
"0.61702627",
"0.6146737",
"0.61356735",
"0.6107843",
"0.61044765",
"0.60995483",
"0.60612357",
"0.5985783",
"0.5940671",
"0.5932814",
"0.59143525",
"0.59143525",
"0.5914... | 0.774701 | 0 |
Baseline implementation for the create_instances REST call | def create_instances request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
uri, body, query_string_params = transcode_create_instances_request request_pb
response = @client_stub.make_post_request(
uri: uri,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_instances(count)\n fail DTK::Error::Usage, \"Attribute 'admin_state' cannot be set to powered_off if node not created\" if admin_state_powered_off?\n aws_api_operation(:create).create_instances(count)\n end",
"def list_instances\n puts \"OK, Listing instances..\"\n\n respons... | [
"0.6584818",
"0.6575652",
"0.6542225",
"0.6496084",
"0.6481429",
"0.6430838",
"0.6359172",
"0.6347453",
"0.631569",
"0.6275118",
"0.6216435",
"0.6196346",
"0.6187581",
"0.6183696",
"0.6154394",
"0.6144067",
"0.6094609",
"0.60598737",
"0.6059305",
"0.6059305",
"0.6059305",
"... | 0.6957502 | 0 |
Baseline implementation for the delete_instances REST call | def delete_instances request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
uri, body, query_string_params = transcode_delete_instances_request request_pb
response = @client_stub.make_post_request(
uri: uri,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @instance = @provider.instances.find(params[:id])\n InstanceOperations.terminate_instances(@provider.connect!, @instance)\n @instance.destroy\n redirect_to cloud_provider_path(@provider) \n end",
"def delete_instance request_pb, options = nil\n raise ::ArgumentError, \... | [
"0.7173356",
"0.69271666",
"0.6916623",
"0.6858635",
"0.68051195",
"0.67992944",
"0.6747067",
"0.6720948",
"0.66915864",
"0.6668431",
"0.661892",
"0.6613864",
"0.66122",
"0.65790457",
"0.65720403",
"0.6541037",
"0.6516814",
"0.65114725",
"0.65038973",
"0.6482585",
"0.64782053... | 0.75676584 | 0 |
Baseline implementation for the delete_per_instance_configs REST call | def delete_per_instance_configs request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
uri, body, _query_string_params = transcode_delete_per_instance_configs_request request_pb
response = @client_stub.make_post_request(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n results = submit_cmd('delete app instance',:db, \" -env #{self.belongs_to.env} -app_instance #{self.name}\")\n\n\t if ( results.to_s =~ /failure/i || results.to_s =~ /error/i)\n\t \t raise \"update attribute failed\" \n\t else\n\t \t self.belongs_to.appTemplates.delete(self)\n\t ... | [
"0.666113",
"0.6406594",
"0.63268644",
"0.63054687",
"0.6301974",
"0.6280173",
"0.622278",
"0.6214791",
"0.61849886",
"0.6165851",
"0.6144899",
"0.6134959",
"0.61263174",
"0.61263174",
"0.60994625",
"0.6043661",
"0.6042849",
"0.602909",
"0.602001",
"0.6015857",
"0.6013635",
... | 0.7935633 | 0 |
Baseline implementation for the list_managed_instances REST call | def list_managed_instances request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
uri, _body, query_string_params = transcode_list_managed_instances_request request_pb
response = @client_stub.make_post_request(
ur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instances\n IbmCloudRest.get \"#{@uri}/instances\"\n end",
"def list_instances request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_instances_request reque... | [
"0.6785314",
"0.6707827",
"0.67024165",
"0.66163045",
"0.6592045",
"0.6518914",
"0.6486547",
"0.6375934",
"0.6336464",
"0.62879074",
"0.6271091",
"0.62462926",
"0.6223105",
"0.61295605",
"0.6087064",
"0.6024314",
"0.5995872",
"0.5994039",
"0.5987333",
"0.594529",
"0.59224355"... | 0.72735983 | 0 |
Baseline implementation for the list_per_instance_configs REST call | def list_per_instance_configs request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
uri, _body, query_string_params = transcode_list_per_instance_configs_request request_pb
response = @client_stub.make_post_request(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_instances\n return { reservations: [] } unless configured?\n\n @client.describe_instances.to_h\n end",
"def enum_configs\n host = session.session_host\n port = session.session_port\n exec_commands = [\n {\n 'cmd' => '/export verbose',\n 'fn' => 'get_config',\n ... | [
"0.5900954",
"0.5900258",
"0.5876186",
"0.57415944",
"0.5683448",
"0.56613314",
"0.5642259",
"0.55652124",
"0.5553273",
"0.55482",
"0.55456716",
"0.5534673",
"0.5513303",
"0.5498094",
"0.54680383",
"0.5464475",
"0.5461902",
"0.5444085",
"0.54376256",
"0.5437029",
"0.53954875"... | 0.72597617 | 0 |
Baseline implementation for the patch_per_instance_configs REST call | def patch_per_instance_configs request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
uri, body, query_string_params = transcode_patch_per_instance_configs_request request_pb
response = @client_stub.make_post_request(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_update_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\... | [
"0.68494856",
"0.5918646",
"0.5859882",
"0.5859882",
"0.5806079",
"0.57658654",
"0.57304156",
"0.56215",
"0.560534",
"0.5602159",
"0.55409354",
"0.5531964",
"0.5418074",
"0.54102844",
"0.54032946",
"0.53555703",
"0.53555167",
"0.5332237",
"0.5299539",
"0.5297913",
"0.5275466"... | 0.7523682 | 0 |
Baseline implementation for the recreate_instances REST call | def recreate_instances request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
uri, body, query_string_params = transcode_recreate_instances_request request_pb
response = @client_stub.make_post_request(
uri: ur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_instances(num_vms, opts, roles, disks)\n # Make a copy (the options are a simple hash so shallow copy does the\n # trick) to not modify the original.\n options = opts.clone\n options['num_vms'] = num_vms.to_s\n\n uri = URI(\"http://#{@ip}:#{SERVER_PORT}/instances\")\n headers = {'Content-... | [
"0.6358541",
"0.60766006",
"0.5926458",
"0.59236604",
"0.58288854",
"0.5812304",
"0.58088934",
"0.5766058",
"0.575676",
"0.5708074",
"0.5683103",
"0.5616821",
"0.56145215",
"0.5608361",
"0.55885017",
"0.5580009",
"0.55400705",
"0.55069363",
"0.54900926",
"0.5471066",
"0.54499... | 0.75045586 | 0 |
Baseline implementation for the set_instance_template REST call | def set_instance_template request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
uri, body, query_string_params = transcode_set_instance_template_request request_pb
response = @client_stub.make_post_request(
uri: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_template\n end",
"def set_instance_template_properties# {{{\n\t # if we got here, it means some of parameters changed\n\t # it does not matter which one - we just need to create another template\n\t # and generate refresh event (automatically)\n\t #\n\t #\tXXX may be we should have ensure propert... | [
"0.7187446",
"0.66969496",
"0.6479128",
"0.6347294",
"0.6330435",
"0.6271301",
"0.62692606",
"0.6266801",
"0.6229911",
"0.6229911",
"0.6229911",
"0.6229911",
"0.6229911",
"0.6229911",
"0.6229911",
"0.6229911",
"0.622791",
"0.6210036",
"0.61730504",
"0.61678326",
"0.6100469",
... | 0.77391225 | 0 |
Baseline implementation for the set_target_pools REST call | def set_target_pools request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
uri, body, query_string_params = transcode_set_target_pools_request request_pb
response = @client_stub.make_post_request(
uri: uri,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pools\n @pools ||= {}\n end",
"def pools\n @pools ||= {}\n end",
"def get_pool_names\n JSON.parse(get(\"http://#{@host}/loadbalancers/tenant/#{@tenant}/pools\"))['tenantpools']['pools']\n end",
"def list_pools\n handle_action_exceptions(__method__) do\n cmd_line = ... | [
"0.64109004",
"0.64109004",
"0.6296743",
"0.6281177",
"0.62099504",
"0.6116906",
"0.60760635",
"0.5974923",
"0.5969901",
"0.5969901",
"0.5969901",
"0.59464973",
"0.5939732",
"0.5929891",
"0.5927853",
"0.59101754",
"0.59054935",
"0.58772707",
"0.58763534",
"0.58741593",
"0.587... | 0.80211663 | 0 |
Baseline implementation for the update_per_instance_configs REST call | def update_per_instance_configs request_pb, options = nil
raise ::ArgumentError, "request must be provided" if request_pb.nil?
uri, body, query_string_params = transcode_update_per_instance_configs_request request_pb
response = @client_stub.make_post_request(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_patch_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n ... | [
"0.6811642",
"0.6776814",
"0.6315448",
"0.62597513",
"0.62576294",
"0.6195071",
"0.61715454",
"0.6149493",
"0.6065071",
"0.60359526",
"0.6019862",
"0.6013464",
"0.6013131",
"0.5985889",
"0.5985889",
"0.5879221",
"0.5803371",
"0.57976645",
"0.57976645",
"0.579598",
"0.5788356"... | 0.7395426 | 0 |
convert Kata in input to Hira in output | def convertFile(inputName, outputName)
# output file
outputFile = File.open(outputName, "w")
# input file
File.open(inputName, "r") do |inputFile|
pattern = /^(\S+?,){#{READ_FORM_INDEX}}/
while line = inputFile.gets
startIndex = line[pattern].size
endIndex = line... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(input); end",
"def kesha_maker(array)\n array.map {|item| item[2]=\"$\"}\n array\nend",
"def hk(str)\n \"(?:#{Moji.kata_to_hira(str)}|#{Moji.hira_to_kata(str)})\"\n end",
"def kesha_maker(array)\n kesha_array = []\n\n array.each do |name|\n name_array = name.split(\"\")\n ... | [
"0.5797281",
"0.55033416",
"0.54750913",
"0.5437725",
"0.54106593",
"0.5397252",
"0.5396641",
"0.53965914",
"0.5274228",
"0.52720547",
"0.5245476",
"0.5235038",
"0.52141094",
"0.5209762",
"0.5170602",
"0.51662713",
"0.5155222",
"0.51332945",
"0.51222545",
"0.5111949",
"0.5105... | 0.5815053 | 0 |
inits a new FormVersion with same form_id increments sequence sets self.is_current = false | def upgrade!
upgraded = self.class.new(form_id: form_id, is_current: true)
self.is_current = false
save
upgraded.save!
upgraded
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_new_revision\n new_revision = Form.new(version_independent_id: version_independent_id,\n description: description, parent_id: parent_id, status: status,\n version: version + 1, name: name, oid: oid,\n created_by: created_... | [
"0.6447004",
"0.6347048",
"0.61970085",
"0.6055881",
"0.588652",
"0.58547413",
"0.58372754",
"0.5676159",
"0.56503123",
"0.5439611",
"0.5434107",
"0.54320484",
"0.54302776",
"0.54217315",
"0.5354525",
"0.53467596",
"0.5339406",
"0.53387105",
"0.53312725",
"0.53083193",
"0.529... | 0.6391297 | 1 |
double checks that code is still unique | def ensure_unique_code
# keep trying new random codes until no match
while self.class.find_by_code(self.code = Random.letters(CODE_LENGTH)); end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_unique_code\n # keep trying new random codes until no match\n while self.class.find_by_code(self.code = Random.letters(CODE_LENGTH)); end\n return true\n end",
"def generate_code\n # only need to do this if code not set\n return if code\n ensure_unique_code\n end",
"def v... | [
"0.8103135",
"0.7022466",
"0.68688595",
"0.68060386",
"0.66699076",
"0.6409783",
"0.64094245",
"0.63625747",
"0.62836593",
"0.60936177",
"0.60100603",
"0.6002641",
"0.6001788",
"0.59650755",
"0.5952886",
"0.5931408",
"0.59253776",
"0.5901258",
"0.5879698",
"0.5866913",
"0.584... | 0.8073653 | 1 |
Updates the portlets hash from the routes and configuration options. Changes the path variables to a format supported by the Railsportlet. | def portlets(routes=@routes)
raise 'No configuration' unless @config
portlets = []
@config.instances.flatten.each do |portlet|
### route to path
if portlet[:path]
# take user-given path & do not parse routes
path = portlet[:path]
#
# parse the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_routes\n insert_into_file 'config/routes.rb', %(\n root :to => 'portal#page'\n DrgCms.routes\n\n put '/portal/process_login'\n post '/reports/diary'\n\n resources :init # remove after initial run\n\n get '*path' => 'portal#page'\n\n),\n after: 'Rails.application.routes.draw do'\nend",
"def p... | [
"0.54691124",
"0.54313755",
"0.5422103",
"0.52584773",
"0.52584773",
"0.5255144",
"0.52341664",
"0.5232783",
"0.5198125",
"0.51792955",
"0.51554805",
"0.5000673",
"0.49684203",
"0.49314374",
"0.48687118",
"0.48135903",
"0.4780192",
"0.47723714",
"0.47446775",
"0.4742579",
"0.... | 0.64452714 | 0 |
Moves the :max, :min, :before, and :after options to data attributes, formats the value, and merges this with any other options. | def input_html_options
data = {}
data[:min] = options[:min] if options[:min].present?
data[:max] = options[:max] if options[:max].present?
data[:before] = options[:before] if options[:before].present?
data[:after] = options[:after] if options[:after].present?
super.deep_merge(
value: form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_data # :nodoc:\n if @y_axis_increment && !@hide_line_markers\n self.maximum_value = [@y_axis_increment, maximum_value, (maximum_value.to_f / @y_axis_increment).round * @y_axis_increment].max\n self.minimum_value = [minimum_value, (minimum_value.to_f / @y_axis_increment).round * @y_axis... | [
"0.59231603",
"0.5723215",
"0.56251204",
"0.5608272",
"0.55394286",
"0.5490469",
"0.54865164",
"0.5455183",
"0.5399323",
"0.53972495",
"0.5333362",
"0.5323261",
"0.52647763",
"0.512813",
"0.51078725",
"0.51040256",
"0.51040256",
"0.51040256",
"0.51040256",
"0.51040256",
"0.51... | 0.7302364 | 0 |
Remove specific conflicts from the conflict_list. Use the :parse option to add an unparsed conflict string. Example: conflict_list.remove("Sad", "Lonely") conflict_list.remove("Sad, Lonely", :parse => true) | def remove(*names)
extract_and_apply_options!(names)
delete_if { |name| names.include?(name) }
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(*names)\r\n extract_and_apply_options!(names)\r\n delete_if { |name| names.include?(name) }\r\n self\r\n end",
"def remove_item(grcy_list, string)\n grcy_list.delete(string)\nend",
"def remove_item(list, string)\n\tlist.delete(string.to_sym)\n\tlist\nend",
"def remove(*names); end",
"d... | [
"0.6092978",
"0.57151985",
"0.57040054",
"0.54154533",
"0.5376303",
"0.5375382",
"0.5375382",
"0.5310719",
"0.52998656",
"0.5270083",
"0.5243265",
"0.5234724",
"0.5183906",
"0.51521015",
"0.5139484",
"0.51394594",
"0.5112362",
"0.5074133",
"0.5056825",
"0.5041495",
"0.5029751... | 0.61348784 | 0 |
Transform the conflict_list into a conflict string suitable for edting in a form. The conflicts are joined with conflictList.delimiter and quoted if necessary. Example: conflict_list = conflictList.new("Round", "Square,Cube") conflict_list.to_s 'Round, "Square,Cube"' | def to_s
conflicts = frozen? ? self.dup : self
conflicts.send(:clean!)
conflicts.map do |name|
name.include?(delimiter) ? "\"#{name}\"" : name
end.join(delimiter.ends_with?(" ") ? delimiter : "#{delimiter} ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_to_delimited_string(list, delimiter = '|')\n str = \"\"\n list.each do |e|\n str << e\n str << delimiter unless e == list.last\n end\n str\n end",
"def to_s\r\n clean!\r\n \r\n map do |name|\r\n name.include?(delimiter) ? \"\\\"#{name}\\\"\" : name\r\n end.join(de... | [
"0.62634116",
"0.59690505",
"0.59026366",
"0.5868843",
"0.58570594",
"0.56341285",
"0.5612332",
"0.5567862",
"0.55377406",
"0.553639",
"0.5528089",
"0.55161923",
"0.5475692",
"0.5423438",
"0.5410157",
"0.5407309",
"0.53934014",
"0.53701013",
"0.5269722",
"0.5250278",
"0.52325... | 0.7489193 | 0 |
Remove whitespace, duplicates, and blanks. | def clean!
reject!(&:blank?)
map!(&:strip)
uniq!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean!\r\n reject!(&:blank?)\r\n map!(&:strip)\r\n uniq!\r\n end",
"def strip\n lambda do |rec, acc|\n acc.collect! do |v|\n # unicode whitespace class aware\n v.sub(/\\A[[:space:]]+/,'').sub(/[[:space:]]+\\Z/, '')\n end\n end\n end",
"de... | [
"0.7524463",
"0.7369265",
"0.72860473",
"0.7224176",
"0.7224176",
"0.71872914",
"0.71574855",
"0.71574855",
"0.71334136",
"0.71145606",
"0.7099433",
"0.7046403",
"0.7019657",
"0.69951665",
"0.69925207",
"0.6948776",
"0.6926586",
"0.6926586",
"0.69107604",
"0.689238",
"0.68513... | 0.7433913 | 1 |
Configure how to run remote SSH commmands on server. | def config_ssh(username, host, options = nil)
@ssh = SSH.new(username, host, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_serverspec(node)\n set :backend, :ssh\n host = node.ssh_info[:host].to_s\n options = Net::SSH::Config.for(host)\n options[:user] = node.ssh_info[:username].to_s\n options[:keys] = node.ssh_info[:private_key_path][0].to_s\n options[:port] = node.ssh_info[... | [
"0.6837605",
"0.6781286",
"0.6702748",
"0.6665643",
"0.6654404",
"0.6588082",
"0.6540874",
"0.6530356",
"0.65055656",
"0.6496589",
"0.6444951",
"0.64258236",
"0.63801986",
"0.6363892",
"0.635593",
"0.63513607",
"0.6343348",
"0.6331936",
"0.63174146",
"0.6316927",
"0.62806",
... | 0.7224722 | 0 |
Configure how to communicate with Travis | def config_travis(api_key, private_repo)
@travis = TravisCI.new(api_key: api_key, private_repo: private_repo)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def travis\n Log.fatal('You did not configure Travis yet.') unless @travis\n @travis\n end",
"def create_travis(name, platforms)\n\n File.open('.travis.yml', 'w') { |file| \n file.puts(\"language: objective-c\")\n file.puts(\"osx_image: xcode8.2\")\n file.puts(\"env:\")\n fi... | [
"0.74411035",
"0.6312183",
"0.6096012",
"0.6034233",
"0.5999066",
"0.5999066",
"0.58172834",
"0.57950306",
"0.57585853",
"0.5740117",
"0.5728505",
"0.5686742",
"0.5658344",
"0.5652492",
"0.5639438",
"0.5622121",
"0.561829",
"0.561829",
"0.561829",
"0.561829",
"0.561829",
"0... | 0.6768809 | 1 |
Get instance of GitHub class to run commands against GitHub | def github
Log.fatal('You did not configure GitHub yet.') unless @github
@github
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def github\n\n @github = Github.new({ client_id: CONFIG[:GITHUB_CLIENT_ID], client_secret: CONFIG[:GITHUB_CLIENT_SECRET] })\n end",
"def github_client\n Octokit::Client.new(:login => username, :oauth_token => token)\n end",
"def github\n @github ||= begin\n if username.present? && github_... | [
"0.68239033",
"0.64665717",
"0.6461043",
"0.6412371",
"0.6291616",
"0.6260287",
"0.62471646",
"0.62171435",
"0.6216496",
"0.61708087",
"0.61430794",
"0.61316955",
"0.6023944",
"0.6015977",
"0.60138416",
"0.5982394",
"0.59594345",
"0.59146583",
"0.58963484",
"0.589361",
"0.589... | 0.64671826 | 1 |
Generate a sitemap.xml file We reimplement the default Jekyll sitemap generator, because we want to leverage the GTN::ModificationTimes class to obtain the last modification date of a page, in a more efficient way than the default Jekyll sitemap Params: +site+:: The +Jekyll::Site+ object | def generate(site)
puts '[GTN/Sitemap] Generating'
result = '<?xml version="1.0" encoding="UTF-8"?>'
result += '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' \
'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 ' \
'http://www.sitemaps.or... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate(site)\n puts \"Generating sitemap...\"\n @site = site\n @site.config[\"time\"] = Time.new\n @site.config[\"html_files\"] = html_files.map(&:to_liquid)\n unless sitemap_exists?\n write\n @site.keep_files ||= []\n @site.keep_files << \"sitemap.xml\... | [
"0.8111135",
"0.7054567",
"0.698701",
"0.688247",
"0.6801285",
"0.6734294",
"0.66676944",
"0.6653475",
"0.6587433",
"0.6587433",
"0.6539907",
"0.65021485",
"0.6482737",
"0.63853204",
"0.6373777",
"0.6358131",
"0.6342161",
"0.6325158",
"0.6301099",
"0.627928",
"0.62694514",
... | 0.8603455 | 0 |
SQL to COMMIT a transaction. | def commit_transaction_sql
SQL_COMMIT
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit_db_transaction\n execute(\"COMMIT\")\n end",
"def commit_db_transaction\n execute(\"COMMIT\")\n end",
"def commit_transaction(tx)\n tx.execute\n end",
"def commit()\n check_return_code(PureHailDB.ib_trx_commit(@trx_ptr))\n end",
"def commit_db_tran... | [
"0.8168222",
"0.8168222",
"0.76139814",
"0.7527497",
"0.74450666",
"0.7280488",
"0.7276991",
"0.7221815",
"0.721497",
"0.7214349",
"0.71709657",
"0.7129977",
"0.71051455",
"0.7083729",
"0.7083729",
"0.7081063",
"0.7064411",
"0.70503277",
"0.7020082",
"0.69886315",
"0.69886315... | 0.838998 | 1 |
SQL to ROLLBACK a transaction. | def rollback_transaction_sql
SQL_ROLLBACK
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rollback_db_transaction\n execute(\"ROLLBACK\")\n end",
"def rollback_db_transaction\n execute(\"ROLLBACK\")\n end",
"def exec_rollback_db_transaction\n log('ROLLBACK', 'TRANSACTION') { @connection.rollback }\n end",
"def rollback\n @MySQLConnection.quer... | [
"0.8181803",
"0.8181803",
"0.77769566",
"0.74661136",
"0.7351645",
"0.7266504",
"0.72538483",
"0.7232466",
"0.7177316",
"0.71110255",
"0.70692456",
"0.701413",
"0.701413",
"0.7002328",
"0.69809246",
"0.6975738",
"0.6967255",
"0.6929481",
"0.6900461",
"0.6873134",
"0.68212163"... | 0.8284415 | 1 |
Allows you to do .nolock on a query | def nolock
clone(:with => "(NOLOCK)")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nolock\n clone(:table_options => \"(NOLOCK)\")\n end",
"def without_locking(&block)\n current = ActiveRecord::Base.lock_optimistically\n ActiveRecord::Base.lock_optimistically = false if current\n begin\n block.call\n ensure\n ... | [
"0.7786487",
"0.72194034",
"0.70768726",
"0.70123297",
"0.65658885",
"0.6484154",
"0.62651074",
"0.622901",
"0.60817206",
"0.6000754",
"0.59971285",
"0.5988265",
"0.59627455",
"0.5884127",
"0.5852311",
"0.5837362",
"0.5772591",
"0.5771919",
"0.5766119",
"0.5766119",
"0.576611... | 0.7499212 | 1 |
Load template and install it. Removes temporary files during transfer and ensures desination directory is created before install. See template plugin for where template paths are loaded from. ==== Options +template_path+:: Path to template +destination+:: Remote path to evaluated template +options+:: Options (see Insta... | def install_template(template_path, destination, options = {})
# Truncate extension
tmp_file_path = template_path.gsub("/", "_").gsub(/.erb$/, "")
tmp_path = "/tmp/#{tmp_file_path}"
options[:user] ||= "root"
install_options = []
install_options << "-o #{options[:user]}"
install... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_template(path)\n puts \"Installing project template to #{path} ...\"\n template_dir = File.expand_path('../template', __FILE__)\n FileUtils.cp_r(\"#{template_dir}/.\", path)\n end",
"def template(target, options={})\n template_name = options[:source] || File.basename(target)\n locals = op... | [
"0.7118178",
"0.7028229",
"0.6262468",
"0.6239971",
"0.5836827",
"0.57992494",
"0.5749228",
"0.564967",
"0.56440383",
"0.5638322",
"0.55855095",
"0.552526",
"0.55077505",
"0.5486212",
"0.54749334",
"0.5378448",
"0.5371758",
"0.5335664",
"0.53325105",
"0.5305625",
"0.5277993",... | 0.86968935 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.