query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Use callbacks to share common setup or constraints between actions.
def set_article @article = ::Article.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865...
0.0
-1
Only allow a trusted parameter "white list" through.
def article_params params.require(:article).permit( :title, :description, :published, :published_at, :photo ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
for controllers aside from session management where a session_key is expected, call :authenticate method as a before_action
def authenticate authenticate_token || render_unauthorized end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_user!\n if request.headers['sid'].present? && !request.headers['sid'].nil? && request.headers['utoken'].present? && !request.headers['utoken'].nil?\n session = Session.active_sessions.find_by_id(request.headers['sid'])\n if session.nil? || session.utoken != request.headers['utoken']\n...
[ "0.72938335", "0.718559", "0.71266204", "0.7062437", "0.7043023", "0.7020977", "0.7005062", "0.69851834", "0.6981905", "0.6979767", "0.69214153", "0.6900031", "0.6861073", "0.68092376", "0.6797532", "0.67878693", "0.6781582", "0.67796206", "0.6769922", "0.67582226", "0.675606...
0.65605086
49
GET /envelopes/1 GET /envelopes/1.xml
def show @envelope = Envelope.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @envelope } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def envelope\n Hancock::Request.send_get_request(\"/envelopes/#{envelope_id}\")\n end", "def index\n @envelopes = Envelope.all\n end", "def envelope\n get_meta(:envelope)\n end", "def show\n @transactions = @envelope.transactions if @envelope.present?\n\n respond_to do |format|\n ...
[ "0.7535521", "0.7115806", "0.6547185", "0.63976353", "0.6288323", "0.61331165", "0.60994565", "0.6093301", "0.6093301", "0.60590094", "0.60450315", "0.5831211", "0.57670385", "0.57586735", "0.57584345", "0.5721553", "0.5703387", "0.56566435", "0.56417364", "0.5632278", "0.562...
0.7211642
1
GET /envelopes/new GET /envelopes/new.xml
def new @envelope = Envelope.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @envelope } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @envelope = Envelope.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @envelope }\n end\n end", "def create\n @envelope = Envelope.new(params[:envelope])\n\n respond_to do |format|\n if @envelope.save\n format.html { redirect...
[ "0.762909", "0.67870647", "0.6645444", "0.649276", "0.62807614", "0.62023115", "0.62023115", "0.6178899", "0.617878", "0.61757773", "0.61732143", "0.61683035", "0.61626136", "0.6130912", "0.6130912", "0.6130106", "0.6094337", "0.6089539", "0.6085175", "0.6061983", "0.6054156"...
0.7952011
0
POST /envelopes POST /envelopes.xml
def create @envelope = Envelope.new(params[:envelope].merge({:account_id => Docusign::Config[:account_id]})) respond_to do |format| if @envelope.save flash[:notice] = 'Envelope was successfully created.' format.html { redirect_to(@envelope) } format.xml { render :xml => @envelope, :status => :created, :location => @envelope } else format.html { render :action => "new" } format.xml { render :xml => @envelope.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @envelope = Envelope.new(envelope_params)\n\n respond_to do |format|\n if @envelope.save\n format.html { redirect_to @envelope, notice: 'Envelope was successfully created.' }\n format.json { render :show, status: :created, location: @envelope }\n else\n format.html...
[ "0.68518", "0.68430334", "0.6522314", "0.62481874", "0.60469073", "0.60341686", "0.5751369", "0.5751369", "0.5729569", "0.56819886", "0.5662662", "0.5645686", "0.5628477", "0.56262255", "0.5560694", "0.5545689", "0.54899955", "0.54442406", "0.54320925", "0.5420121", "0.540118...
0.67567295
2
PUT /envelopes/1 PUT /envelopes/1.xml
def update @envelope = Envelope.find(params[:id]) respond_to do |format| if @envelope.update_attributes(params[:envelope]) flash[:notice] = 'Envelope was successfully updated.' format.html { redirect_to(@envelope) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @envelope.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @envelope.update_attributes(params[:envelope])\n format.html { redirect_to @envelope, notice: 'Envelope was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render j...
[ "0.69729793", "0.69304186", "0.66656476", "0.66656476", "0.6260774", "0.6158875", "0.6150992", "0.6074127", "0.5938064", "0.5931254", "0.5878007", "0.56634146", "0.56576186", "0.565645", "0.56496036", "0.5624662", "0.55959296", "0.5430336", "0.54257715", "0.5414153", "0.53655...
0.71635216
0
DELETE /envelopes/1 DELETE /envelopes/1.xml
def destroy @envelope = Envelope.find(params[:id]) @envelope.destroy respond_to do |format| format.html { redirect_to(envelopes_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @envelope.destroy\n\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :ok }\n end\n end", "def destroy\n @envelope.destroy\n respond_to do |format|\n format.html { redirect_to envelopes_url, notice: 'Envelope was successfully destroyed....
[ "0.76387495", "0.7443277", "0.63236994", "0.6294701", "0.62609905", "0.6228585", "0.6191495", "0.6190803", "0.6156685", "0.61500823", "0.613764", "0.6134649", "0.60966575", "0.60966456", "0.60909075", "0.6088816", "0.60710835", "0.6061954", "0.60609967", "0.6055636", "0.60556...
0.8091663
0
GET /reviews GET /reviews.json
def index params[:search] ? @reviews=Review.search(params[:search]) : @reviews= Review.where("user_id = ?", current_user.id) @reviews = @reviews.order(:heading).paginate(page: params[:page], per_page: 18) respond_to do |format| format.html # index.html.erb format.json { render json: @reviews } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n en...
[ "0.8128604", "0.76803666", "0.76803666", "0.76768506", "0.7594319", "0.7533078", "0.75313497", "0.75313497", "0.7528348", "0.7404546", "0.7360395", "0.7340902", "0.7319881", "0.73067623", "0.7281126", "0.72661823", "0.721507", "0.7189025", "0.7180426", "0.71802807", "0.711558...
0.68228954
50
GET /reviews/1 GET /reviews/1.json
def show @review = Review.find(params[:id]) respond_to do |format| format.html {} format.json {} format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n en...
[ "0.78798026", "0.751587", "0.751587", "0.7503942", "0.7390879", "0.7352559", "0.73425764", "0.7342495", "0.7331215", "0.7331215", "0.7281798", "0.7159771", "0.71292806", "0.71292806", "0.71292806", "0.71292806", "0.71292806", "0.7086854", "0.7068903", "0.7065639", "0.70534414...
0.64677906
82
POST /reviews POST /reviews.json
def create @review = Review.new(review_params) @review.user_id = current_user.id respond_to do |format| if @review.save @reviews = Review.order(:heading).paginate(page: params[:page], per_page: 18) format.html { redirect_to @review; flash[:success]= 'review was successfully created.' } format.json { render :show, status: :created, location: @review } format.js else format.html { render :new } format.json { render json: @review.errors, status: :unprocessable_entity } format.js end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @review = current_author.reviews.create(review_params)\n render json: @review, status: 201\n end", "def create\n review = course.reviews.new(review_params)\n \n if review.save\n render json: ReviewSerializer.new(review).serialized_json\n else\n render...
[ "0.7576602", "0.75637454", "0.7493771", "0.747111", "0.747111", "0.747111", "0.7300367", "0.72989565", "0.7201945", "0.7201945", "0.71795744", "0.71406734", "0.7120858", "0.7118763", "0.7002209", "0.6988962", "0.6979939", "0.69722533", "0.69606304", "0.6958055", "0.6953352", ...
0.717838
11
PATCH/PUT /reviews/1 PATCH/PUT /reviews/1.json
def update @set_def_avt=params[:review][:default_avatar] @review.cover_page.destroy if @set_def_avt respond_to do |format| if @review.update(review_params) @reviews = Review.order(:heading).paginate(page: params[:page], per_page: 18) format.html { redirect_to @review; flash[:info]= 'review was successfully updated.' } format.json { render :show, status: :ok, location: @review } format.js else format.html { render :edit } format.json { render json: @review.errors, status: :unprocessable_entity } format.js end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def update\n @review = reviewable.reviews.find(params[:id])\n\n respond_to do |format|\n if @review.update_attributes(params[:review])\n format.html { redirect_to reviewable...
[ "0.74383867", "0.7083873", "0.7033043", "0.7033043", "0.7033043", "0.69490635", "0.6926377", "0.69172275", "0.69172275", "0.69172275", "0.69172275", "0.6889173", "0.6832784", "0.6780694", "0.6780694", "0.6780694", "0.673641", "0.67214686", "0.67171437", "0.67171437", "0.67171...
0.62174875
60
DELETE /reviews/1 DELETE /reviews/1.json
def destroy @review.destroy respond_to do |format| format.html { redirect_to reviews_url, notice: 'Review was successfully destroyed.' } format.json { head :no_content } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reviews_delete(id)\n delete id.to_s\n _response_status(204, last_response)\n end", "def destroy\n @review = reviewable.reviews.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewable_reviews_url(reviewable) }\n format.json { head :no_co...
[ "0.7832335", "0.77927166", "0.77836365", "0.77720547", "0.77720547", "0.77720547", "0.77720547", "0.77720547", "0.76754755", "0.7674994", "0.76527554", "0.76527554", "0.76527554", "0.7640212", "0.74983084", "0.74983084", "0.74714994", "0.7413043", "0.7410794", "0.7410794", "0...
0.6650371
97
Use callbacks to share common setup or constraints between actions.
def set_review @review = Review.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def review_params params.require(:review).permit(:heading, :review, :book_id, :user_id, :status, :cover_page) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Returns a hashmap with all the necessary data to output else an empty hash
def fetch_user_details(iam_id) result = {} # Each we use ___[0] because get_from_api returns an array # We know we only need [0] because we are querying by iamId # Get ids, names and affiliations basic_info = get_from_api("api/iam/people/search", "iamId" => iam_id) result["basic_info"] = !basic_info || basic_info.empty? ? [] : basic_info # Get email, postaladdress, phone numbers contact_info = get_from_api("api/iam/people/contactinfo/search", "iamId" => iam_id) result["contact_info"] = !contact_info || contact_info.empty? ? [] : contact_info # Get kerberos loginid kerberos_info = get_from_api("api/iam/people/prikerbacct/search", "iamId" => iam_id) result["kerberos_info"] = !kerberos_info || kerberos_info.empty? ? [] : kerberos_info # Get PPS department, title, and position type pps_info = get_from_api("api/iam/associations/pps/search", "iamId" => iam_id) result["pps_info"] = !pps_info || pps_info.empty? ? [] : pps_info # Get ODR department and title odr_info = get_from_api("api/iam/associations/odr/#{iam_id}") result["odr_info"] = !odr_info || odr_info.empty? ? [] : odr_info # Get student information student_info = get_from_api("api/iam/associations/sis/search", "iamId" => iam_id) result["student_info"] = !student_info || student_info.empty? ? [] : student_info return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_hash; end", "def wrestler_hash_output\n\t\twrestler_hash_output = self.values\n\n\t\twrestler_hash_output[\"name\"] = wrestler_hash_output.delete :name\n\t\twrestler_hash_output[\"set\"] = wrestler_hash_output.delete :set\n\n\t\twrestler_hash_output[\"gc02\"] = wrestler_hash_output.delete :gc02\n\t\tw...
[ "0.76577294", "0.6772557", "0.6513285", "0.6347994", "0.6300414", "0.6266258", "0.626012", "0.62476915", "0.6217728", "0.62121886", "0.61759925", "0.6142313", "0.6093911", "0.60845584", "0.60786927", "0.6052131", "0.6052131", "0.6052131", "0.6052131", "0.6052131", "0.6052131"...
0.0
-1
Returns an array of iam_ids, a string if no iam_id is found
def get_iam_id(query) command = query.shift command = command[0].downcase # required since shift returns an array query = query.join(" ") # Convert query to a string case command when "first" api = "api/iam/people/search"; query = {"dFirstName" => query} when "last" api = "api/iam/people/search"; query = {"dLastName" => query} when "iamid" # Return the iamid in a array return [query] when "loginid" # TODO: Could also be non-kerberos? HSAD # api/iam/people/prihsadacct/search api = "api/iam/people/prikerbacct/search" query = {"userId" => query} when "email" query = {"email" => ChatBotCommand.decode_slack(query)} api = "api/iam/people/contactinfo/search" else # Search by login ID, e-mail, first name, and last name # Return if the search retrieves an iamid, otherwise try another search query = query == nil ? command : "#{command} #{query}" search = get_iam_id "loginid #{query}".scan(/(\S+)/) return search unless search.class == String search = get_iam_id "email #{query}".scan(/(\S+)/) return search unless search.class == String search = get_iam_id "last #{query}".scan(/(\S+)/) return search unless search.class == String # Last option for searching, return regardless of result search = get_iam_id "first #{query}".scan(/(\S+)/) return search end result = get_from_api(api, query) # get_from_api returns a string message if iamId is not found unless result.empty? iam_id = [] result.each do |data| iam_id.push data["iamId"] end else return "No result found" end return iam_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowlisted_ids\n if Ohai.config[:additional_dmi_ids]\n if [ Integer, Array ].include?(Ohai.config[:additional_dmi_ids].class)\n return ID_TO_CAPTURE + Array(Ohai.config[:additional_dmi_ids])\n else\n Ohai::Log.warn(\"The DMI plugin additional_dmi_ids config must ...
[ "0.6547448", "0.6448394", "0.62410825", "0.61620235", "0.61123013", "0.6070029", "0.6065504", "0.60379684", "0.5994635", "0.5994635", "0.5994635", "0.5976715", "0.5943013", "0.59308475", "0.5911662", "0.5907664", "0.5904367", "0.590193", "0.5892932", "0.58854043", "0.5881404"...
0.5451472
48
Formats the data from IAM API to a prettier format
def format_data(data, private_allowed) # Store all formatted data in this array formatted_data = [] # Format name with flags # Name Mark Diez (student, employee, staff) # IAM ID 1234566 if !data["basic_info"].empty? data["basic_info"].each do |info| name = "*Name* " + info["dFullName"] flags = [] if info["isEmployee"] flags.push "employee" end if info["isHSEmployee"] flags.push "hs employee" end if info["isFaculty"] flags.push "faculty" end if info["isStudent"] flags.push "student" end if info["isStaff"] flags.push "staff" end if info["isExternal"] flags.push "external" end flags = " _(" + flags.join(", ") + ")_" name += flags formatted_data.push name formatted_data.push "*IAM ID* #{info["iamId"]}" if private_allowed formatted_data.push "*Student ID* #{info["studentId"]}" unless info["studentId"] == nil formatted_data.push "*PPS ID* #{info["ppsId"]}" unless info["ppsId"] == nil end end end # Format Kerberos information # Login ID msdiez, anotherid, ... if !data["kerberos_info"].empty? ids = [] data["kerberos_info"].each do |info| id = info["userId"] == nil ? "Not Listed" : info["userId"] ids.push id end formatted_data.push "*Login ID* " + ids.join(", ") else login_id = "*Login ID* Not Listed" formatted_data.push login_id end # Format contact information # E-mail my@email.com, my@otheremail.com # Office kerr 186, social science 133, ... if !data["contact_info"].empty? email = [] office = [] data["contact_info"].each do |info| email.push info["email"] unless info["email"] == nil office.push info["addrStreet"] unless info["addrStreet"] == nil end formatted_data.push "*E-mail* " + email.join(", ") formatted_data.push "*Office* " + office.join(", ") else formatted_data.push "*E-mail* Not Listed" formatted_data.push "*Office* Not Listed" end # Format ODR information # ODR Affiliation DSSIT: STD4 (Casual) require 'pp' pp data if !data['odr_info'].empty? data['odr_info'].each do |info| odr = '*ODR Affiliation* ' odr += info['deptDisplayName'] + ': ' unless info['deptDisplayName'].nil? odr += info['titleDisplayName'] unless info['titleDisplayName'].nil? formatted_data.push odr end end # Format PPS information # PPS Affiliation DSSIT: STD4 if !data['pps_info'].empty? data['pps_info'].each do |info| dept_name = info['deptDisplayName'] || 'Unknown Department' dept_code = info['deptCode'] || 'Unknown Department Code' title_name = info['titleDisplayName'] || 'Unknown Title' title_code = info['titleCode'] || 'Unknown Title Code' position_type = info['positionType'] || 'Unknown Position Type' employee_class = info['emplClassDesc'] || 'Unknown Employee Class' formatted_data.push "*PPS Affiliation*" formatted_data.push " Department: #{dept_name} (#{dept_code})" formatted_data.push " Title: #{title_name} (#{title_code}) (#{position_type})" formatted_data.push " Employee Class: #{employee_class}" end end # Format student information # Student Affiliation Computer Science (Undergraduate, Junior) if !data['student_info'].empty? data['student_info'].each do |info| student = '*Student Affiliation* ' student += info['majorName'] + ' (' student += info['levelName'].scan(/\S+/)[0] # Only grab the first word student += ', ' + info['className'] + ')' formatted_data.push student end end return formatted_data.join("\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_data(data)\n case format\n when :json\n JSON.pretty_generate(data)\n else # default to YAML\n data.to_yaml.sub(/\\A\\-\\-\\-\\n/, '')\n end\n end", "def formatted_data\n self.data['bids'] = adjusted('bids')\n self.data['asks'] = adjusted('asks')\n ...
[ "0.61687845", "0.6100789", "0.6078017", "0.5914991", "0.5803413", "0.58017045", "0.5798461", "0.57787997", "0.5723188", "0.5723188", "0.5723188", "0.5700606", "0.5678063", "0.5668399", "0.5668399", "0.5668399", "0.5668399", "0.5668399", "0.5668399", "0.5668399", "0.5668399", ...
0.62097186
0
Returns an object containing the result from an api call, else a string with the error message
def get_from_api(api, query = {}) uri = URI.parse($SETTINGS['IAM_HOST'] + '/' + api); query['key'] = $SETTINGS['IAM_API_TOKEN'] uri.query = URI.encode_www_form(query) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Get.new(uri.request_uri) response = http.request(request) if response.code == '200' data = JSON.parse(response.body) case data['responseStatus'] when 0 # Success return data['responseData']['results'] when 1 # Sucess but no data in results return data['responseData']['results'] when 2 # Invalid API key $logger.error 'Invalid IAM API key' return false when 3 # Generic System Error $logger.error 'IAM encountered a generic system error' $logger.error response.body return false when 4 # Data error $logger.error 'IAM encountered a data error' $logger.error response.body return false when 5 # Missing parameters $logger.error 'Missing parameters in IAM API call' $logger.error response.body return false else $logger.error 'Unknown response code from IAM' $logger.error response.body return false end else $logger.error "Could not connect to IAM API due to #{response.code}" $logger.error response.body return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raise_api_error_msg(res)\n \"HTTP status code: #{res.status}, \" \\\n \"Error message: #{res.body['message']}, \" \\\n \"Reference: #{res.body['reference']}\"\n end", "def api_error\n return nil if @api_response.nil?\n\n m = \"#{@api_method.to_s.upcase} \"...
[ "0.7173268", "0.71133566", "0.68809557", "0.67210096", "0.6677097", "0.6670403", "0.65865827", "0.65618634", "0.6511677", "0.6426993", "0.6383295", "0.62967086", "0.626718", "0.6226124", "0.62238413", "0.62138695", "0.62101936", "0.6194562", "0.6176406", "0.61540496", "0.6152...
0.0
-1
add a new student to the Students table
def create @student = Student.new(student_params) #set foreign key to match session id @student.user_id = session[:user_id] if @student.save #Need a success flash notice here puts "student was saved" else #Need to create a flash error here puts "not saved :(" end redirect_to '/class-attendance/students' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n Student.conn.exec('INSERT INTO students (name, age, spirit_animal, squad_id) values ($1,$2,$3,$4)', [ name, age, spirit_animal, squad_id])\n end", "def addStudent(studentId, fName, lName)\n @studentOne = Student.new(studentId, fName, lName)\n end", "def add_student(new_student)\n @stu...
[ "0.7757175", "0.7748057", "0.7740852", "0.77334636", "0.7672202", "0.74970347", "0.7476617", "0.74432087", "0.7377253", "0.73707134", "0.7314871", "0.72865343", "0.72629625", "0.72560984", "0.72353905", "0.7218461", "0.7215268", "0.719078", "0.719078", "0.7171747", "0.7171506...
0.0
-1
assiging lawyer to livian from central pool when lawyer is verified
def assign_lawyer sp_session = current_service_provider_session employee = Employee.find(params[:employee_id],:include=>[:user=>[:service_provider_employee_mappings]]) service_session = Physical::Liviaservices::ServiceSession.create(:employee_user_id =>employee.user.id, :sp_session => sp_session, :session_start => Time.now , :company_id => current_user.company_id) session[:service_session] = service_session.id assignment_user = employee.user lawyer = assignment_user lawyer.verified_lawyer session[:verified_lawyer_id] = assignment_user.id current_user.verified_lawyer_id_by_secretary = assignment_user.id sp_id= employee.user.nil? ? "" : employee.user.service_provider_employee_mappings.blank? ? "" : employee.user.service_provider_employee_mappings.first.service_provider_id redirect_to new_communication_path(:service_provider_id=>sp_id,:call_id=>params[:call_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verified_lawyer #(userid)\n #$employee_id = userid\n $employee_id = self.id\n end", "def show_lawyer\n end", "def enroll_pur_user(params)\n $tracer.trace(\"LoyaltyEnrollmentServiceDSL: #{__method__}, Line: #{__LINE__}\")\n $tracer.report(\"Should #{__method__}.\")\n first_name = params['fi...
[ "0.63963616", "0.6378475", "0.5945049", "0.5943872", "0.59282917", "0.58878994", "0.58850294", "0.58620805", "0.58503914", "0.58015686", "0.57919705", "0.5773038", "0.576614", "0.5747616", "0.57211953", "0.5706105", "0.5690821", "0.567662", "0.56738377", "0.5673167", "0.56714...
0.63392216
2
displaying lawyer list to livian from central pool when lawyer is not verified
def show_lawyer_list authorize!(:show_lawyer_list,current_user) unless current_user.role?:secretary #session[:verified_secretary_id1] = params[:service_provider_id] if params[:search].nil? @employees = Employee.paginate :page => params[:page], :order => 'employees.created_at DESC', :per_page=>20, :include=>[:user=>[:role,:service_provider_employee_mappings]] else @employees = Employee.get_employees(params) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_lawyer\n end", "def filtered_list\n if !(current_user.belongs_to_common_pool || current_user.belongs_to_back_office)\n @lawfirms = []\n @assigned_lawfirm_users.each do |lawyer|\n @lawfirms << lawyer.company if lawyer.company\n end\n @lawfirms.uniq!\n @logged_by_users ...
[ "0.7111818", "0.63285965", "0.6321633", "0.61826116", "0.6145381", "0.6006175", "0.59207636", "0.5888368", "0.5845152", "0.58299154", "0.57901645", "0.56836444", "0.56684506", "0.5613727", "0.5595405", "0.5549617", "0.5519993", "0.549419", "0.5483361", "0.5481926", "0.5476339...
0.64495856
1
Logs a header for validation
def validation_header(_file_pattern, _validation_class) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_header!\n [:date, :from].each do |field|\n raise \"No '#{field}' header field provided\" unless self.send(field)\n end\n end", "def add_log_header(file)\n end", "def validate_header(header)\n import_failed(0, t(:header_invalid)) if self.class.csv_header != header\n end...
[ "0.68611884", "0.65673226", "0.64647996", "0.6375263", "0.61525124", "0.6079296", "0.6059327", "0.60561556", "0.6026288", "0.59904456", "0.59904456", "0.59904456", "0.58640164", "0.58606017", "0.5854596", "0.5827804", "0.582142", "0.57685703", "0.5758132", "0.5754076", "0.571...
0.65137327
2
dataset_accessor :thing Not needed, but ensures correct exception message during failures.
def dataset_key :id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset\n @dataset ||= data_maker.dataset\n end", "def assign_dataset_attributes\n if dataset\n reset_dataset_attributes\n @dataset_attributes = (dataset.data[dataset_group][dataset_key] ||= {})\n end\n rescue => e\n raise \"Qernel::Dataset: missing dataset item for #{dataset_group.in...
[ "0.5801379", "0.5743024", "0.56941056", "0.5693356", "0.5583441", "0.5548888", "0.54872", "0.54348046", "0.5422414", "0.5401371", "0.53979397", "0.53026915", "0.52927595", "0.5267012", "0.52616936", "0.5219041", "0.5165917", "0.5165917", "0.51614594", "0.51614594", "0.5161459...
0.0
-1
TODO: add data to buffer, and flush buffer, so when control conn goes down we keep everything in buffer, and flush when it comes up
def receive_data(data) @client.send_command(SendDataCommand.new(@connection_id, data)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flush_buffer; self.input_buffer = \"AAAA\"; end", "def connection_completed\n# @keepalive = EM::PeriodicTimer.new(60) { send_data ' ' }\n start\n end", "def receive_data(data)\n log_debug { '[server] receive_data: %s' % data }\n\n @request_buffer << data\n @request_d...
[ "0.6401586", "0.62997586", "0.62989527", "0.62765086", "0.6194918", "0.6114416", "0.6114416", "0.6114416", "0.6085323", "0.6069009", "0.60182095", "0.600528", "0.5998252", "0.59705395", "0.59390146", "0.59283525", "0.591276", "0.5911474", "0.59093034", "0.5900156", "0.5876959...
0.0
-1
Retrieve an Asset or Live Stream ID Retrieves the Identifier of the Asset or Live Stream associated with the Playback ID.
def get_asset_or_livestream_id(playback_id, opts = {}) data, _status_code, _headers = get_asset_or_livestream_id_with_http_info(playback_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_song_url_by_id(id)\n resp = get_stream_auth_by_songid(id)\n \"http://#{resp['ip']}/stream.php?streamKey=#{resp['stream_key']}\"\n end", "def playlist_id\n @ole.playlistID\n end", "def playlist_id\n @ole.playlistID\n end", "def playlist_id\n @ole.playlistID\n end",...
[ "0.58725756", "0.57117397", "0.57117397", "0.57117397", "0.57117397", "0.5669693", "0.5666333", "0.5633655", "0.55956364", "0.5562233", "0.5561768", "0.55386436", "0.5520118", "0.5500024", "0.54927784", "0.5464585", "0.5451272", "0.54409915", "0.5417634", "0.53700054", "0.536...
0.6679655
0
Retrieve an Asset or Live Stream ID Retrieves the Identifier of the Asset or Live Stream associated with the Playback ID.
def get_asset_or_livestream_id_with_http_info(playback_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PlaybackIDApi.get_asset_or_livestream_id ...' end # verify the required parameter 'playback_id' is set if @api_client.config.client_side_validation && playback_id.nil? fail ArgumentError, "Missing the required parameter 'playback_id' when calling PlaybackIDApi.get_asset_or_livestream_id" end # resource path local_var_path = '/video/v1/playback-ids/{PLAYBACK_ID}'.sub('{' + 'PLAYBACK_ID' + '}', CGI.escape(playback_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetAssetOrLiveStreamIdResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"PlaybackIDApi.get_asset_or_livestream_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PlaybackIDApi#get_asset_or_livestream_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_asset_or_livestream_id(playback_id, opts = {})\n data, _status_code, _headers = get_asset_or_livestream_id_with_http_info(playback_id, opts)\n data\n end", "def get_song_url_by_id(id)\n resp = get_stream_auth_by_songid(id)\n \"http://#{resp['ip']}/stream.php?streamKey=#{resp['strea...
[ "0.66795456", "0.5875707", "0.5712913", "0.5712913", "0.5712913", "0.5712913", "0.5669359", "0.5633405", "0.5595869", "0.5563904", "0.55617744", "0.5538359", "0.5519828", "0.5501563", "0.54936427", "0.54648983", "0.545135", "0.54403424", "0.5419738", "0.5369856", "0.53626734"...
0.5666642
7
Find the sum of all the primes below two million.
def is_prime k 2.upto(Math.sqrt(k).to_i) do |x| return false if k % x == 0 or (k - 1) <= 1 end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ten\n acc = 0\n (find_primes_below 2000000).each do |i|\n acc = acc + i\n end\n return acc \nend", "def run\n puts sum_of_primes_below(10)\n #=> 17\n\n puts sum_of_primes_below(2_000_000)\n #=> ??\nend", "def consecutive_prime_below_one_million\n @max_limit = 1000_000\n generate_prime_...
[ "0.82160825", "0.78906024", "0.75564945", "0.75232756", "0.7479366", "0.7477097", "0.74588966", "0.7440184", "0.74295956", "0.7331621", "0.73256236", "0.7311697", "0.7295443", "0.72817844", "0.72037166", "0.71868205", "0.7185547", "0.7127194", "0.7119031", "0.7118858", "0.708...
0.0
-1
Returns the augmented code.
def to_a() return @augmented_code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def augment_code()\n @augmented_code = \"\"\n\n # Configure variable tracing (the variables to be traced are declared at the\n # beginning of the program)\n @augmented_code += generate_tracing_configuration()\n\n # Iterate over the original code's lines\n @code.each_line do |line|\n @state[:...
[ "0.72014666", "0.6867652", "0.6675771", "0.66471815", "0.66471815", "0.6592931", "0.6592931", "0.65491045", "0.63755506", "0.63755506", "0.63755506", "0.63755506", "0.63755506", "0.63755506", "0.63755506", "0.6373828", "0.62728477", "0.62199265", "0.60984147", "0.6090227", "0...
0.7569475
0
Does the actual work of augmenting the code.
def augment_code() @augmented_code = "" # Configure variable tracing (the variables to be traced are declared at the # beginning of the program) @augmented_code += generate_tracing_configuration() # Iterate over the original code's lines @code.each_line do |line| @state[:line_number] += 1 # Remove trailing whitespace. If the line is not empty, parse and process it. line.rstrip! if !line.empty? # Update our state based on the current line parse_line(line) # Add stuff if necessary line = possibly_add_line_number_comment(line) line = possibly_add_trace_info_calls(line) end @augmented_code += line + "\n" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def augment_target\n # Capture this data in the closure.\n proxy_class = @proxy_class\n builder_class = @builder_class\n defines = Proc.new do\n # Assembles code.\n def assemble(&block)\n _assemble block\n end\n \n # Internal method for assembling code.\n #\n #...
[ "0.65209776", "0.621126", "0.621126", "0.621126", "0.621126", "0.621126", "0.621126", "0.621126", "0.6169734", "0.60114616", "0.60029495", "0.5968372", "0.59492", "0.5945812", "0.5945812", "0.591622", "0.5913954", "0.5877608", "0.586264", "0.5846664", "0.5819154", "0.581915...
0.75075203
0
Generates the necessary library calls to trace variables.
def generate_tracing_configuration() result = "" if @tracing_vars @tracing_vars.each_with_index do |var_name, var_index| result += "garbledwebpiratenlibraryname.add_traced_variable('#{var_name}', #{var_index})\n" end result += "\n" end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_vars\n\n end", "def set_trace_func(p0) end", "def visit_trace(code, ins, local_vars, ln, info)\r\n end", "def __trace(*args, **opt, &block)\n __trace_impl(*args, **opt, &block)\nend", "def initialize(vars)\n @vars = vars # hash table of attribute_name/value pairs\n @hitbreak = fal...
[ "0.5802079", "0.56544626", "0.5585495", "0.55217105", "0.5338705", "0.5325671", "0.53145546", "0.530437", "0.52758086", "0.5267248", "0.52609366", "0.5257754", "0.52437407", "0.5212706", "0.5188268", "0.51394105", "0.51366735", "0.51272917", "0.5121431", "0.5096113", "0.50845...
0.6164956
0
Returns a version of the line with a line number comment added, if this line should in fact have the line number comment added. Otherwise, simply returns the line as is. This will also add a line number comment to a commentonly line, but that doesn't hurt.
def possibly_add_line_number_comment(line) if @state[:ll_end] return line + " # WPLINE_#{@state[:line_number]}" else return line end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment_line?(line_source); end", "def comment_line?(line_source); end", "def comment_line?(line_source)\n /^\\s*#/.match?(line_source)\n end", "def line_comments_option; end", "def is_comment?(line)\n line =~ /^\\s*#/\n end", "def is_comment?(line)\n true if line =~ /^\\#.*$...
[ "0.7230098", "0.7230098", "0.6817237", "0.668827", "0.6490199", "0.6457737", "0.64105755", "0.632897", "0.625587", "0.6248044", "0.6209692", "0.62085605", "0.6178726", "0.6109211", "0.60621935", "0.6051056", "0.6017504", "0.6014734", "0.6014734", "0.6014734", "0.6009569", "...
0.7699014
0
Returns a version of the line with calls to the tracing methods prepended. These are calls to send the current line number and values of watched variables back to the server. If this line shouldn't have these calles added, simply returns the line as is.
def possibly_add_trace_info_calls(line) # If the current line does not start a logical line, don't bother if not @state[:ll_start] return line end # We will be making decisions based on the first word on the line line_words = line.split if line_words.empty? # The line is empty, so we disregard it return line end first_word = line_words[0] # Extract first word and check if it makes us want to refrain from adding a line number call if KEYWORDS_WITHOUT_LINE_NUMBERS.include?(first_word) # It's one of the statements we don't want return line elsif ["'", '"', "#"].include?(first_word[0]) # The line starts with a string or with a comment return line end # Do include a line number call return "#{@state[:indent_string]}garbledwebpiratenlibraryname.debug(locals(), globals())\n" + "#{@state[:indent_string]}garbledwebpiratenlibraryname.line(#{@state[:line_number]})\n" + "#{line}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line\n return 0 unless self.method\n # We subtract 1 because the ip is actually set to what it should do\n # next, not what it's currently doing (unless we are at the start of\n # a new context).\n if self.from_eval? and self.env.caller_env\n ip = self.env.caller_env.registration_ip - 1\n ...
[ "0.62964934", "0.60811275", "0.59508646", "0.5837636", "0.5837636", "0.5837636", "0.5837636", "0.5837636", "0.5837636", "0.5837636", "0.5837636", "0.5837636", "0.5837636", "0.5837636", "0.5837636", "0.5837636", "0.5837636", "0.5837636", "0.57413137", "0.57348585", "0.57348585...
0.73472583
0
Parses the current line and updates our current state. That state is what several of our decisions depends on when it comes to deciding whether or not to add certain debug information. Note: This method expects to be called on a line that has had trailing whitespace removed.
def parse_line(line) # If the previous line didn't and a logical line, we're not going to start one. If it did, # we're indeed going to start a new logical line @state[:ll_start] = @state[:ll_end] # We will start with the assumption that we're going to end the current logical line. We may layer # find out that we did not, in fact, do so. @state[:ll_end] = true # Reset the line continuator flag the the last line may have set to true @state[:line_continuator] = false # Find the first non-(space/tab) character index = 0 while index < line.length && [" ", "\t"].include?(line[index]) index += 1 end @state[:indent_string] = line[0...index] # Iterate over the line's characters as long as there are any. We use different iteration # methods depending on whether we're inside a string or not index = 0 while index < line.length if @state[:in_string].nil? index = parse_characters_normal(line, index) else index = parse_characters_in_string(line, index) end end # We have reached the end of the line. Decide whether or not the logical line ends here. @state[:ll_end] = @state[:in_string].nil? && @state[:open_braces] == 0 && !@state[:line_continuator] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse!\n set :line => @line\n @context.run_with_current(&self.class.get_parsable)\n self\n end", "def parse_line\n s0 = @scanner.pos\n match_spaces\n s2 = parse_te\n if s2 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n ma...
[ "0.6825828", "0.628224", "0.6175689", "0.61514974", "0.6083741", "0.6038013", "0.5950708", "0.58755577", "0.58650756", "0.58615386", "0.5829019", "0.5824398", "0.57877284", "0.57575405", "0.57494915", "0.57379824", "0.5707236", "0.5699989", "0.5694314", "0.5688079", "0.567395...
0.6594313
1
Parses a line starting at the given index under the assumption that the start index is not inside a string. Returns the index of the next character to be parsed. This method parses either until the end of the line is reached (in which case the returned index is equal to the line's length) or until it runs inside a string (in which case the returned index points to the string's first character). Note: This method expects to be called on a line that has had trailing whitespace removed.
def parse_characters_normal(line, start_index) index = start_index while index < line.length if [ "(", "{", "[" ].include?(line[index]) # Opening brace @state[:open_braces] += 1 index += 1 elsif [ ")", "}", "]" ].include?(line[index]) # Closing brace @state[:open_braces] -= 1 index += 1 elsif line[index] == "#" # We have found the start of a comment, so ignore the rest of the line index = line.length elsif line[index] == "\\" && index == line.length - 1 # We have found a backslash as the last character -> line continuation @state[:line_continuator] = true index += 1 elsif line[index] == '"""' # We have found a triple-quoted string. Advance index and leave @state[:in_string] = '"""' index += 3 break elsif line[index] == "'''" # We have found a triple-quoted string. Advance index and leave @state[:in_string] = "'''" index += 3 break elsif line[index] == '"' # We have found a single-quoted string. Advance index and leave @state[:in_string] = '"' index += 1 break elsif line[index] == "'" # We have found a single-quoted string. Advance index and leave @state[:in_string] = "'" index += 1 break else # Advance a character index += 1 end end return index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_from_char(index = -1)\n send_message(:LINEFROMCHAR, index.to_i)\n end", "def compute_line_index\n scanner = StringScanner.new(@string)\n result = [0] # first line starts at 0\n while scanner.scan_until(/\\n/)\n result << scanner.pos\n end\n @line_index = result\n ...
[ "0.7028019", "0.6657401", "0.6435948", "0.62314737", "0.6224804", "0.61923087", "0.6153539", "0.6144367", "0.5970555", "0.5966883", "0.59609795", "0.5932271", "0.5885439", "0.58705604", "0.582157", "0.58144754", "0.5749121", "0.57360226", "0.57318914", "0.57234037", "0.569083...
0.6398851
3
Parses a line starting at the given index under the assumption that the start index is inside a string. Returns the index of the next character to be parsed. This method parses either until the end of the line is reached (in which case the returned index is equal to the line's length) or until it finds the end of the string (in which case the returned index points to the character after the string's closing delimiter(s)). We almost completely disregard escape characters, except for when they precede the current string delimiter. This is because all other escapes are of no concern to us. We don't even need to check whether a singlequoted string ends with an escape character to continue at the next line, because if the escape character weren't there, the code wouldn't have passed syntax validation in the first place. Note: This method expects to be called on a line that has had trailing whitespace removed.
def parse_characters_in_string(line, start_index) index = start_index # The delimiter that would end the current string delim = @state[:in_string] while index < line.length if line[index] == delim[0] # We have encountered the string's delimiter character. Check whether the user has escaped it if index > 0 && line[index - 1] == "\\" # It was escaped, so simply advance one character index += 1 else # It was not escaped. Check whether we have as many delimiting characters as we need if line[index...index + delim.length] == delim # We have indeed reached the end of the string @state[:in_string] = nil index += delim.length break else # We have not reached the end of the string yet. Advance to the next character index += 1 end end else # Advance a character index += 1 end end return index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_characters_normal(line, start_index)\n index = start_index\n\n while index < line.length\n if [ \"(\", \"{\", \"[\" ].include?(line[index])\n # Opening brace\n @state[:open_braces] += 1\n index += 1\n\n elsif [ \")\", \"}\", \"]\" ].include?(line[index])\n # Cl...
[ "0.67579234", "0.6156957", "0.59752715", "0.5926413", "0.5747184", "0.57238555", "0.56371343", "0.56250733", "0.55413306", "0.5534771", "0.5502382", "0.5502261", "0.55008113", "0.54952234", "0.54776293", "0.5457325", "0.54088736", "0.540388", "0.5380807", "0.5360562", "0.5355...
0.7862305
0
Number of methods definitions
def initialize(base_path, path) @path = path @full_path = File.join(base_path, path) init_metrics calculate_file_metrics calculate_code_metrics end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_method_count\n repository.files.map do |file|\n content = repository.read(file)\n content.to_s.scan(/define_method/).size\n end.sum\n end", "def count_method\n @method_count += 1\n end", "def define_methods\n count = 0\n Kernel.send(:define_method, :list) do \n ...
[ "0.81960005", "0.77093583", "0.73550254", "0.73059815", "0.73059815", "0.73059815", "0.7265893", "0.7103927", "0.70878065", "0.69808865", "0.6899272", "0.6893922", "0.6893922", "0.6743966", "0.6683728", "0.6643012", "0.6612481", "0.656727", "0.6550257", "0.65297216", "0.64484...
0.0
-1
Umozliwia wysylanie wiadomosci do danego uzytkownika jid [Jabber::JID] adres kontaktu do ktorego ma zostac wyslana wiadomosc wiadomosc [String] wiadomosc do wyslania typ [String] typ wiadomosci do wyslania
def wyslij_wiadomosc(jid,wiadomosc,typ=:chat) kontakty(jid) do |znajomy| unless subskryp? znajomy dodaj_do_listy(znajomy.jid) return dodaj_do_wyslania_po_akceptacji(znajomy.jid,wiadomosc,typ) end wiad=Message.new(znajomy.jid) wiad.type=typ wiad.body=wiadomosc wyslij(wiad) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dodaj_do_wyslania_po_akceptacji(jid,wiadomosc,typ)\n\twiad={:do => jid, :wiadomosc => wiadomosc, :typ => typ}\n\t@wiadomosci_do_wyslania << wiad\n end", "def jid; end", "def jid\n \"#{@username}@#{@domain}\"\n end", "def jid\n JID::new(attributes['jid'])\n end", "def jid\n JID::ne...
[ "0.68990713", "0.5795355", "0.54590344", "0.53859085", "0.53859085", "0.53859085", "0.5381387", "0.53446615", "0.52907526", "0.52467257", "0.5206537", "0.5194017", "0.51900524", "0.51857686", "0.5175732", "0.5145756", "0.5112902", "0.50962496", "0.50640935", "0.50422305", "0....
0.6862407
1
Loguje uzytkownika do konta
def loguj(jids,haslo) jid=JID::new(jids) @klient=Client::new(jid) @klient.connect @klient.auth(haslo) @klient.send(Presence.new.set_type(:available)) @wiadomosci_do_wyslania=Queue.new def_callback sleep(1) Thread.new{ while(true) next if @wiadomosci_do_wyslania.length<1 wiadomosci=[@wiadomosci_do_wyslania.pop] wiadomosci.each{ |wiadomosc| if subskryp?(JID::new(wiadomosc[:do])) wyslij_wiadomosc(wiadomosc[:do],wiadomosc[:wiadomosc],wiadomosc[:typ]) else @wiadomosci_do_wyslania << wiadomosc end } end } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log\n end", "def autoflush_log; end", "def autoflush_log; end", "def logs\n end", "def logs\n\n end", "def log=(log); end", "def log()\n @log\n ...
[ "0.70531243", "0.70531243", "0.70531243", "0.70531243", "0.70531243", "0.70531243", "0.70531243", "0.70531243", "0.7034735", "0.6691827", "0.6691827", "0.6642658", "0.6562899", "0.6464248", "0.6454762", "0.63565636", "0.6295509", "0.626751", "0.6260704", "0.6260704", "0.62519...
0.0
-1
Zmienia status uzytkownika status [String] status do zmiany opis [String] opis do ustawienia Mozliwe statusy do ustawienia nil Dostepny :away Zaraz wracam :chat Pogadam :dnd Nie przeszkadzac :xa Nieosiagalny :unavailable Niedostepny
def zmien_status(status,opis) @status=status @opis=opis stat=Presence.new(@status,@opis) wyslij(stat) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n if caberawit?\n 'caberawit'\n elsif praremaja?\n 'praremaja'\n elsif remaja?\n 'remaja'\n elsif dewasa?\n 'dewasa'\n end\n end", "def status\t\n\t\t# a = [\"test1: test,\n\t\t# \ttest2: test2\"]\n\t\t# \tputs a.join(\\n)\n\t\tidentitas_motor = [\"Merk #{@merk}\",...
[ "0.664545", "0.63794386", "0.6249846", "0.6202992", "0.6197656", "0.6161809", "0.6145117", "0.61210513", "0.6106015", "0.6086255", "0.6070663", "0.60424393", "0.6041791", "0.60356873", "0.59634554", "0.5957991", "0.5951173", "0.5929565", "0.59281933", "0.59238863", "0.5906151...
0.6899745
0
Dodaje uzytkownika do listy kontaktow jid [Jabber::JID] jid uzytkownika do dodania
def dodaj_do_listy(*jid) kontakty(*jid) do |kontakt| next if subskryp?(kontakt) kontakt.autoryzacja end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def usun_z_listy(*jid)\n\tkontakty(*jid) do |usun|\n\t\tusun.usun_subskrypcje\n\t\treq=Iq.new_rosterset\n\t\treq.query.add(Roster::RosterItem.new(usun.jid,nil,:remove))\n\t\twyslij(req)\n\tend\n end", "def jid; end", "def list_jobs(username, password, uuid = nil)\n jobs = get_json('jobs.json', username, pass...
[ "0.73649704", "0.57683754", "0.556923", "0.5547613", "0.54438484", "0.543481", "0.5406016", "0.5398136", "0.53967476", "0.5375282", "0.53117824", "0.53105354", "0.5288415", "0.5281119", "0.52691257", "0.52200407", "0.5214732", "0.5213205", "0.5200995", "0.51880485", "0.517797...
0.69191694
1
Zwraca wiadomosci ktore zostaly wyslane do uzytkownika od ostatniego sprawdzenia Typ zwracany: Jabber::Message
def otrzymane_wiadomosci wiadomosci=[] while(!@kolejka_wiadomosci.empty?) wiadomosc=@kolejka_wiadomosci.pop(true) rescue nil break if wiadomosc.nil? wiadomosci << wiadomosc yield wiadomosc if block_given? end wiadomosci end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message_types; end", "def get_message_types; end", "def human_message_type\n self[:message_type].to_human\n end", "def message_type\n @message_type ||= \"message\"\n end", "def sendmsg(type, where, message, chan=nil, ring=0,plain=nil)\n #if !plain\n # p = PirateTransl...
[ "0.6413273", "0.6413273", "0.6371579", "0.63272864", "0.62834316", "0.6273311", "0.6212584", "0.6146783", "0.61374843", "0.613473", "0.6127949", "0.6120245", "0.61173683", "0.6099759", "0.60544014", "0.6017544", "0.60143155", "0.6005737", "0.59834534", "0.59771985", "0.596622...
0.0
-1
Zwraca zmiany statusow ktore zostaly zmienione przez znajomych na liscie kontaktow
def zmiany_statusow statusy=[] while(!@kolejka_statusow.empty?) status=@kolejka_statusow.pop(true) rescue nil break if status.nil? statusy << status yield status if block_given? end statusy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status(*) end", "def status\n end", "def status\n end", "def status\n end", "def status\n end", "def retriev...
[ "0.6978043", "0.6978043", "0.6978043", "0.6978043", "0.6978043", "0.6978043", "0.6978043", "0.6978043", "0.6978043", "0.69261897", "0.68368024", "0.68368024", "0.68368024", "0.68368024", "0.6831864", "0.6827925", "0.6815323", "0.67998356", "0.677485", "0.6600501", "0.6562564"...
0.0
-1
Zwraca prosby o subskrycje wyslane do uzytkownika
def prosby_o_subskrypcje subskrypcje=[] while(!@prosba_subskrypcja.empty?) sub=@prosba_subskrypcja.pop(true) rescue nil break if sub.nil? subskrypcje << sub yield sub if block_given? end subskrypcje end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suivre; end", "def zuruecksetzen()\n end", "def topsman_periphacitis_urosteon()\n end", "def upc_e; end", "def unsichtbar_machen()\n end", "def schubert; end", "def terpene; end", "def ToCoStoiPrzyA()\n return @RownanieWielomianu.first.WspolczynnikPomocniczy\n end", "def ausschalten()...
[ "0.6528358", "0.63383836", "0.6007862", "0.5973304", "0.5663285", "0.565248", "0.56429756", "0.5604018", "0.5581136", "0.5570425", "0.5564416", "0.5468422", "0.5453473", "0.543679", "0.5422764", "0.5416298", "0.5393353", "0.535708", "0.53447515", "0.5316138", "0.52991927", ...
0.0
-1
Akceptuje prosbe o subskrypcje wyslana do uzytkownika jid [Jabber::JID] jid uzytkownika do zaakceptowania
def akceptuj_subskrypcje(jid) roster.accept_subscription(jid) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def odrzuc_subskrypcje(jid)\n\troster.decline_subscription(jid)\n end", "def jid=(_arg0); end", "def jid; end", "def jid=(jid)\n unsubscribe[:jid] = jid\n end", "def wyslij_wiadomosc(jid,wiadomosc,typ=:chat)\n\tkontakty(jid) do |znajomy|\n\t\tunless subskryp? znajomy\n\t\t\tdodaj_do_listy(znajomy....
[ "0.6208618", "0.60723084", "0.6044663", "0.5673997", "0.5603294", "0.5516772", "0.54707605", "0.54035866", "0.5379775", "0.52723944", "0.524005", "0.51990974", "0.51974416", "0.51746136", "0.5128014", "0.51215655", "0.50982296", "0.50973994", "0.5076428", "0.50635064", "0.506...
0.7074507
0
Odrzuca prosbe o subskrypcje wyslana do uzytkownika jid [Jabber::JID] jid uzytkownika do odrzucenia
def odrzuc_subskrypcje(jid) roster.decline_subscription(jid) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def akceptuj_subskrypcje(jid)\n\troster.accept_subscription(jid)\n end", "def jid; end", "def wyslij_wiadomosc(jid,wiadomosc,typ=:chat)\n\tkontakty(jid) do |znajomy|\n\t\tunless subskryp? znajomy\n\t\t\tdodaj_do_listy(znajomy.jid)\n\t\t\treturn dodaj_do_wyslania_po_akceptacji(znajomy.jid,wiadomosc,typ)\n\t\te...
[ "0.63847893", "0.6350276", "0.6191088", "0.59735864", "0.5923016", "0.5880922", "0.5790614", "0.56643784", "0.56305677", "0.5549017", "0.55130744", "0.54382443", "0.538942", "0.53620684", "0.53390265", "0.53201026", "0.5319795", "0.5295209", "0.52936625", "0.52936625", "0.529...
0.6226068
2
Usuwa kontakt z listy znajomych jid [Jabber::JID] jid kontaktu do usuniecia
def usun_z_listy(*jid) kontakty(*jid) do |usun| usun.usun_subskrypcje req=Iq.new_rosterset req.query.add(Roster::RosterItem.new(usun.jid,nil,:remove)) wyslij(req) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dodaj_do_listy(*jid)\n\tkontakty(*jid) do |kontakt|\n\t\tnext if subskryp?(kontakt)\n\t\tkontakt.autoryzacja\n\tend\n end", "def jid; end", "def add_user(jid)\n users << jid.to_s.downcase\n users.sort!\n users.uniq!\n end", "def jid=(jid)\n unsubscribe[:jid] = jid\...
[ "0.62557286", "0.60726076", "0.6016798", "0.590932", "0.5623191", "0.5611223", "0.55844116", "0.55667436", "0.5525532", "0.5452906", "0.54255337", "0.54137605", "0.5387662", "0.5361989", "0.53599983", "0.53548867", "0.5345816", "0.5345816", "0.5345816", "0.5307221", "0.527187...
0.71056235
0
Wysyla wiadomosc na serwer
def wyslij(wiadomosc) proba=0 begin proba+=1 @klient.send(wiadomosc) rescue retry unless proba>3 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dodaj_do_wyslania_po_akceptacji(jid,wiadomosc,typ)\n\twiad={:do => jid, :wiadomosc => wiadomosc, :typ => typ}\n\t@wiadomosci_do_wyslania << wiad\n end", "def witcher; end", "def wyslij_wiadomosc(jid,wiadomosc,typ=:chat)\n\tkontakty(jid) do |znajomy|\n\t\tunless subskryp? znajomy\n\t\t\tdodaj_do_listy(znaj...
[ "0.6209968", "0.6011667", "0.5964127", "0.5900237", "0.5812383", "0.5801276", "0.5718616", "0.56385404", "0.5621147", "0.561796", "0.56135535", "0.5592794", "0.55686975", "0.5567674", "0.5560629", "0.55571514", "0.55571514", "0.5545838", "0.55435", "0.554324", "0.550502", "...
0.62334347
0
Zwraca roster polaczenia, w przypadku braku, tworzy nowy Typ zwracany [Jabber::Roster::Helper]
def roster return @roster if @roster self.roster=Roster::Helper.new(@klient) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roster\r\n @roster\r\n end", "def roster\r\n @roster\r\n end", "def roster\n end", "def roster\n @roster\n end", "def roster\n @roster\n end", "def my_roster\n client.roster\n end", "def roster(m)\n return unless @game\n\n m.reply I18n.mixer.roster(show_player...
[ "0.6264929", "0.6264929", "0.6248835", "0.62232643", "0.62232643", "0.6133201", "0.58422166", "0.5624182", "0.5583151", "0.55669475", "0.55112785", "0.53524095", "0.52914494", "0.5251408", "0.52164334", "0.52110755", "0.505188", "0.50469893", "0.50469893", "0.50469893", "0.50...
0.6358799
0
Metoda zwraca obiekt typu Kontakt z listy kontaktow. W przypadku braku kontaktu na liscie zostaje on dodany, a nastepnie wysylane jest do kontaktu zapytanie o autoryzacje
def kontakty(*kontakt) @kontakty||={} k=[] kontakt.each do |kon| jid=kon.to_s unless @kontakty[jid] @kontakty[jid]=kon.respond_to?(:autoryzacja) ? kon : Kontakt.new(self,kon) end yield @kontakty[jid] if block_given? k << @kontakty[jid] end k.size > 1 ? k : k.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dodaj_do_listy(*jid)\n\tkontakty(*jid) do |kontakt|\n\t\tnext if subskryp?(kontakt)\n\t\tkontakt.autoryzacja\n\tend\n end", "def index\n @kundenkontos = Kundenkonto.all\n end", "def index\n @konta = Kontum.all\n end", "def liste()\n puts(\"LISTE DES ORDRES\\n\");\n printf(\"%8s %8s...
[ "0.6471394", "0.56709516", "0.56614476", "0.5647999", "0.56242365", "0.5610267", "0.5609822", "0.54511696", "0.5446612", "0.5434499", "0.54209363", "0.54035777", "0.53784454", "0.5358825", "0.53025436", "0.52908224", "0.5285741", "0.5260766", "0.52448475", "0.52410567", "0.52...
0.6205067
1
Dodaje wiadomosc do kolejki oczekujacej na akceptacje aubskrypcji
def dodaj_do_wyslania_po_akceptacji(jid,wiadomosc,typ) wiad={:do => jid, :wiadomosc => wiadomosc, :typ => typ} @wiadomosci_do_wyslania << wiad end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wydajPrzesylkeKierowcy(kierowca)\n # wybor przesylki\n # przesylka = ...wybieramy jakas\n # usuniecie tej przesylki z @przesylki\n kierowca.push(przesylka) \n end", "def ToCoStoiPrzyA()\n return @RownanieWielomianu.first.WspolczynnikPomocniczy\n end", "def suivre; end", ...
[ "0.60940063", "0.5989877", "0.58565414", "0.5734351", "0.57070416", "0.5628222", "0.5613928", "0.56125236", "0.5598227", "0.5569524", "0.55633557", "0.5550504", "0.5524605", "0.5455431", "0.5447034", "0.5406431", "0.5386263", "0.537698", "0.5352016", "0.53400075", "0.5335104"...
0.6576078
0
request state to perform validations for
def aasm_states_to_check created? || (planned? && !aasm_state_changed? ) || # exclude validation on transition from created to planned started? || ignore_states end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_state(state = {}); end", "def validate_state(state = {}); end", "def set_accounting_validation_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end", "def accounting_validation_state\n super\n end", "def validate\r\n @invalid=false\r\n end", "def req...
[ "0.7288715", "0.7288715", "0.67898077", "0.6746589", "0.6745949", "0.67400205", "0.668152", "0.6656516", "0.662978", "0.65482414", "0.654305", "0.65348554", "0.6527186", "0.6511961", "0.65064824", "0.6502677", "0.64900047", "0.64589417", "0.6456274", "0.6454208", "0.6454208",...
0.0
-1
Prints parsing result of the string
def print_result(str) begin puts Terminal.green("syntax:") stree = DocumentParser.new.parse(str).first pp stree if @transform puts Terminal.green("model:") pp DocumentTransformer.new.apply(stree) end rescue Pione::Parser::ParserError, Parslet::UnconsumedInput, Parslet::ParseFailed => e msg = "Pione syntax error: %s (%s)" % [e.message, e.class.name] @readline_mode ? puts(msg) : abort(msg) rescue Pione::Model::PioneModelTypeError, Pione::Model::VariableBindingError => e msg = "Pione model error: %s (%s)" % [e.message, e.class.name] @readline_mode ? puts(msg) : abort(msg) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_result(result)\n puts result.solutions\n result.fragments.each do |fragment|\n puts fragment\n end\n end", "def print_result(formatted_result)\n puts formatted_result\n end", "def pretty_print(result)\n result.each_with_index do |line, index|\n puts \"#{index+1...
[ "0.6663321", "0.63769186", "0.61823565", "0.61276263", "0.604199", "0.6023145", "0.5989256", "0.5921824", "0.5921824", "0.5905837", "0.58760023", "0.58733827", "0.58558637", "0.58009136", "0.5785853", "0.57829183", "0.5766339", "0.5734457", "0.57337666", "0.57240635", "0.5704...
0.7097808
0
Starts Github Repo Explorer
def run greet menu end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute\n current = GitHub::PullRequest.current\n\n if current\n cli.say \"Opening Pull Request #{current.number}\"\n cli.open current.pull_request.html_url\n end\n end", "def launch(path)\n # force leading slash\n path.insert(0, '/') unless path[0] == '/'\n ...
[ "0.6816446", "0.6795773", "0.59275985", "0.59157896", "0.5887781", "0.5867371", "0.58375704", "0.5836108", "0.5764995", "0.5755515", "0.5725261", "0.5717024", "0.5699554", "0.56827533", "0.5681311", "0.5663664", "0.56584895", "0.56522703", "0.56443954", "0.5632289", "0.559699...
0.0
-1
gets the user input. If input is "exit", leave the program.
def gets_user_input input = gets.chomp puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" # binding.pry if input == "exit" exit end return input end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_input\n user_input = gets.chomp\n user_input == \"exit\" ? exit : user_input\nend", "def exit?(input)\n input == \"exit\"\n end", "def prompt_and_handle_exit(message)\n puts message\n user_input = gets.strip\n \n if user_input.downcase == \"exit\" \n puts \"\\nThanks f...
[ "0.8412108", "0.80942607", "0.7987256", "0.78843486", "0.77687", "0.7548082", "0.74881923", "0.7485723", "0.7465754", "0.7430789", "0.7379376", "0.7343002", "0.7341505", "0.7187348", "0.71590465", "0.7078806", "0.7067296", "0.70634484", "0.7060815", "0.7059599", "0.7046937", ...
0.7928289
3
checks to see if a github username exists
def username_exists?(github_username) !!User.all.find_by(github_username: github_username) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_user(github_username)\n if username_exists?(github_username)\n User.all.find_by(github_username: github_username)\n else\n false\n end\n end", "def test_github_profile_exists\n people.each do |name, info|\n github_username = info.fetch(\"github\", false)\n if github_user...
[ "0.7339824", "0.71845007", "0.7065369", "0.69889367", "0.6870947", "0.6852076", "0.68222016", "0.6820944", "0.6788984", "0.6717754", "0.6657835", "0.66564673", "0.6642805", "0.6573611", "0.65582347", "0.6556292", "0.6450387", "0.64468396", "0.64214814", "0.64173365", "0.63981...
0.82724875
0
checks to see if a repo has a user.
def already_on_repo?(user, repo) repo.users.include?(user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_user?(repo, options = {})\n response = get(repo.public_users_path, options)\n if response[:id].present?\n true\n else\n raise Github::UserNotFound, [NO_USER,\n '[',\n response[:message].to_s...
[ "0.7677949", "0.72075623", "0.7150944", "0.69297755", "0.6791755", "0.6758576", "0.67515016", "0.672826", "0.66763633", "0.6620732", "0.65727615", "0.657062", "0.6547432", "0.6544536", "0.65229636", "0.649949", "0.64875406", "0.64496356", "0.6446707", "0.64324754", "0.6394740...
0.82787746
0
finds a user through github username
def find_user(github_username) if username_exists?(github_username) User.all.find_by(github_username: github_username) else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @user = User.find_by_github_name params[:github_name]\n end", "def get_username\n user_response = Faraday.get \"https://api.github.com/user\", {}, {'Authorization'=>\"token #{self.access_token}\", 'Accept' => 'application/json'}\n user_json = JSON.parse(user_response.body)\n user_json[\"l...
[ "0.7636575", "0.73829395", "0.716371", "0.70464426", "0.7036635", "0.70225173", "0.6875102", "0.68219054", "0.6813279", "0.67496395", "0.6738631", "0.67231774", "0.67165166", "0.66986233", "0.6677872", "0.6675861", "0.66726977", "0.66726977", "0.6670515", "0.6662484", "0.6661...
0.7877664
0
Find by username Menu options
def find_by_username_menu puts puts "Enter a GitHub username with *EXACT* capitalization to list that user's repos:" input = gets_user_input #if username exists in our DB, don't make API call. if !username_exists?(input) #making an API call get_data(input) end if find_user(input) == false puts "That user doesn't exist or doesn't have any public repos" menu else @user = find_user(input) end @repos = find_repos(@user) if show_repos(@repos) == false puts "User has no repos" menu end find_by_username_sub_menu end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_user\n puts \"Please enter your name.\"\n name_input = gets.chomp\n system \"clear\"\n actual_user = User.find_by(name: name_input) #look up user name\n if !actual_user #check if name matches user input\n puts \"we could not find that user name. Please try again.\"\n find_user\n ...
[ "0.6810114", "0.65572774", "0.6270093", "0.62483037", "0.6242715", "0.6159332", "0.61587626", "0.61482286", "0.6108352", "0.60970324", "0.6087779", "0.6068651", "0.60253084", "0.6016672", "0.592034", "0.5911519", "0.589854", "0.5894874", "0.5883342", "0.58583015", "0.5832458"...
0.7025419
0
It will only show multiple users if we added them in this program. We only make a check in our local DB for repo. Todo Find a way to get the collaborators for a repo from Github AP
def find_all_collabs_for_repo puts "Enter a repo name with *EXACT* spelling and capitalization:" input = gets_user_input repo_by_project_name = find_repo_by_project_name(input) if repo_by_project_name == nil puts "No repo found" else repo_by_project_name.users.each do |user| puts user.github_username end end menu end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n user= params[:user]\n repo= params[:repo]\n puts user\n puts repo\n url = BASE_URL + \"repos/\" + user + \"/\" + repo + \"/collaborators\"+ \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n # url = BASE_URL + \"repos/rails/rails/collaborators\...
[ "0.7590898", "0.73227113", "0.72034156", "0.7128978", "0.6967263", "0.6947356", "0.6925678", "0.6898962", "0.6876359", "0.6765229", "0.6720184", "0.67102283", "0.6702244", "0.6648041", "0.65510464", "0.65318346", "0.65277576", "0.6411244", "0.64068735", "0.6406198", "0.639997...
0.64118373
17
Finds the USER_REPO for a given user and repo
def find_user_repo(user, repo) UserRepo.find_by("user_id = ? AND repo_id = ?", user.id, repo.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_repos(user)\n user.repos\n end", "def repo_user\n # TODO: Clarify what repo_user actually is.\n # github is currently using the repo's 'owner', gitlab is using the user who pushed.\n case @vcs\n when 'github'\n @data['repository']['owner']['login']\n when ...
[ "0.71823525", "0.6798617", "0.67792165", "0.6545039", "0.651274", "0.65033156", "0.64222455", "0.6403283", "0.63970876", "0.63750434", "0.6204777", "0.6193192", "0.61754256", "0.61545014", "0.6141189", "0.6130649", "0.6120728", "0.61113304", "0.6111093", "0.6109785", "0.60992...
0.8545253
0
Returns all of a user's repos
def find_repos(user) user.repos end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_user_repos\n user = User.find_by(uuid: params[:uuid])\n\n client = Octokit::Client.new(:access_token => user.password)\n repo_list = []\n client.repositories(:user => user.gh_username).each { |repo|\n repo_list.push(repo.name)\n }\n render :json => {:repos => repo_list}\n end", ...
[ "0.8628239", "0.83014166", "0.81374943", "0.79916614", "0.7936535", "0.7908491", "0.790339", "0.7857646", "0.78492117", "0.78342134", "0.77074414", "0.76639444", "0.7661988", "0.7585843", "0.7554443", "0.7409814", "0.73843443", "0.735112", "0.7348083", "0.7278906", "0.7272771...
0.84191203
1
Displays repos if there are any repos.
def show_repos(repos) if repos.length == 0 false else repos.each_with_index do |repo, index| puts "#{index+1}. #{repo.project_name}" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_org_repos(org)\n repos = Commitchamp::Repo.where(organization: org).order(name: :asc)\n puts \"\\n## Repositories for Organization: #{org}\"\n repos.each do |r|\n puts \"#{r.name}\"\n end\n end", "def print_existing_repos\n puts \"\\n### Existing Organizations ###\"...
[ "0.75763303", "0.7115826", "0.6780938", "0.6618577", "0.6587124", "0.6537974", "0.6447927", "0.64366525", "0.6362216", "0.63511574", "0.6320346", "0.6298403", "0.6275894", "0.6266842", "0.6215385", "0.621097", "0.61617893", "0.61551034", "0.6144876", "0.6108936", "0.5992864",...
0.78446364
0
Selects all repos that have the given keyword in the description
def find_repo_by_keyword(keyword) Repo.all.select do |repo| if repo.description != nil repo.description.downcase.include?(keyword) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_repo(query)\n repos = load_and_cache_user_repos\n results = repos.select do |repo|\n repo['name'] =~ Regexp.new(query, 'i')\n end\n results += search_all_repos(query) if query =~ %r{\\/}\n results.uniq\n end", "def repos(*args)\n params = args.extract_options!\n normaliz...
[ "0.5827881", "0.57840055", "0.5771168", "0.5670516", "0.5631988", "0.56175935", "0.55345917", "0.5532598", "0.5526055", "0.55028856", "0.55007595", "0.54960185", "0.5421794", "0.5408232", "0.54023707", "0.535989", "0.5356457", "0.5286098", "0.5238361", "0.5219566", "0.5214244...
0.80776453
0
Finds the first repo with a given project name
def find_repo_by_project_name(project_name) Repo.all.find_by(project_name: project_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_project\n identifier = params[:project_id]\n scope = Project.active.has_module(:repository)\n project = scope.find_by_identifier(identifier.downcase)\n raise ActiveRecord::RecordNotFound unless project\n return project\n end", "def repo_named(full_name)\n pry(Git::Multi.repositories.fin...
[ "0.7472569", "0.7423936", "0.7340326", "0.718138", "0.71427166", "0.71395224", "0.71395224", "0.7131724", "0.69775975", "0.6953056", "0.69261134", "0.6854857", "0.6812614", "0.6770096", "0.6739286", "0.6687238", "0.6583686", "0.6548292", "0.6496133", "0.6490013", "0.64599943"...
0.82118005
0
GET /items GET /items.json
def index @items = Item.includes(:category).with_attached_cover.with_filter(params[:sort]) @items = @items.search(params[:query]) if params[:query].present? @items = @items.page(params[:page]).per(24) authorize @items end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend", "def getItems()\n return mergeWithAPI(@item_json)['data']\n end", "def index\n @items =...
[ "0.79562956", "0.7546286", "0.74375594", "0.7434485", "0.73975587", "0.7358414", "0.7358414", "0.7358414", "0.7358414", "0.7357372", "0.7313286", "0.73129123", "0.7311041", "0.7306297", "0.7281173", "0.7273615", "0.72629416", "0.72484964", "0.72301924", "0.71767205", "0.71181...
0.0
-1
GET /items/1 GET /items/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end", "def show\n item = I...
[ "0.7736526", "0.7547988", "0.74948645", "0.73696035", "0.7328169", "0.7293223", "0.7287578", "0.71326286", "0.71247333", "0.71196556", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "0.70882183", "...
0.0
-1
POST /items POST /items.json
def create @item = Item.new(item_params) if params[:item][:cover].present? @item.cover.attach(params[:item][:cover]) end respond_to do |format| if @item.save format.html { redirect_to items_path, notice: "El producto ha sido creado." } format.json { render :show, status: :created, location: @item } else format.html { render :new } format.json { render json: @item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend", "def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { ...
[ "0.7971939", "0.7285761", "0.7231758", "0.721958", "0.71792215", "0.71131957", "0.7062943", "0.7053179", "0.6988855", "0.69712186", "0.6903009", "0.68806237", "0.6871792", "0.6840092", "0.6840092", "0.6840092", "0.6840092", "0.6840092", "0.6840092", "0.6840092", "0.6839645", ...
0.0
-1
PATCH/PUT /items/1 PATCH/PUT /items/1.json
def update if params[:item][:cover].present? @item.cover.attach(params[:item][:cover]) end respond_to do |format| if @item.update(item_params) format.html { redirect_to edit_item_path(@item), notice: "El producto ha sido actualizado." } format.json { render :show, status: :ok, location: @item } else format.html { render :edit } format.json { render json: @item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end", "def update\n\n #update the item of request_item\n if (par...
[ "0.7441001", "0.7142895", "0.71386164", "0.70232433", "0.7000995", "0.6993764", "0.6979378", "0.69357854", "0.6920251", "0.6870769", "0.68316454", "0.68161404", "0.6805157", "0.6805157", "0.6793825", "0.67872477", "0.67872477", "0.67872477", "0.67872477", "0.67872477", "0.678...
0.0
-1
DELETE /items/1 DELETE /items/1.json
def destroy @item.destroy respond_to do |format| format.html { redirect_to items_url, notice: "El producto ha sido eliminado." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end", "def destroy\n @item = Item.find(params[:id...
[ "0.7906849", "0.76885504", "0.7604411", "0.7585917", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.758546", "0.7547388", "0.7539847", "0.7528851", ...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_item @item = Item.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def item_params params.require(:item).permit(:title, :price, :description, :category_id, :with_discount, :discount) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6979893", "0.6781746", "0.6746611", "0.6742344", "0.6735229", "0.6592651", "0.65027124", "0.6498011", "0.648163", "0.647716", "0.64556813", "0.64386255", "0.63784456", "0.63756156", "0.636574", "0.6319542", "0.63004524", "0.6299559", "0.62925464", "0.62923217", "0.6289894"...
0.0
-1
Read File Contents contents = File.read("event_attendees.csv") Read File Line by Line lines = File.readlines("event_attendees.csv") lines.each_with_index do |line, row_index| next if row_index == 0 columns = line.split(",") name = columns[2] end Parsing using CSV Library and Google API Client Using an ERB Template
def clean_zipcode(zipcode) if zipcode.nil? "00000" elsif zipcode.length < 5 zipcode.rjust(5, "0") elsif zipcode.length > 5 zipcode[0..4] else zipcode end # One line code -> zipcode.to_s.rjust(5, "0")[0..4] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_from_csv(file_name)\r\n #implementation goes here\r\n csv_text = File.read(file_name)\r\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\r\n # #8 iterate over table rows, create hash for each, then convert to Entry using 'add_entry' method\r\n csv.each do |row...
[ "0.6008913", "0.5999142", "0.58534825", "0.57968885", "0.56920034", "0.5681582", "0.5681582", "0.5534668", "0.55276257", "0.5483217", "0.5479187", "0.54735196", "0.5430181", "0.5417413", "0.53606445", "0.5312355", "0.5263729", "0.52403474", "0.5235028", "0.52002263", "0.51998...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_wit @wit = Wit.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def wit_params params.require(:wit).permit(:body, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
trigger.before(:insert) do %q( SET NEW.last_name_hint = (SELECT dictionary.dictionary_ip FROM dictionary JOIN student ON NEW.student_fname = dictionary.dictionary_id LIMIT 1), NEW.first_name_hint = (SELECT dictionary.dictionary_ip FROM dictionary JOIN student ON NEW.student_iname = dictionary.dictionary_id LIMIT 1), NEW.patronym_hint = (SELECT dictionary.dictionary_ip FROM dictionary JOIN student ON NEW.student_oname = dictionary.dictionary_id LIMIT 1) ) end trigger.before(:update) do |t| t.where('NEW.student_fname OLD.student_fname OR NEW.student_iname OLD.student_iname OR NEW.student_oname OLD.student_oname') do %q( SET NEW.last_name_hint = (SELECT dictionary.dictionary_ip FROM dictionary JOIN student ON NEW.student_fname = dictionary.dictionary_id LIMIT 1), NEW.first_name_hint = (SELECT dictionary.dictionary_ip FROM dictionary JOIN student ON NEW.student_iname = dictionary.dictionary_id LIMIT 1), NEW.patronym_hint = (SELECT dictionary.dictionary_ip FROM dictionary JOIN student ON NEW.student_oname = dictionary.dictionary_id LIMIT 1) ) end end
def to_nokogiri Nokogiri::XML::Builder.new(encoding: 'UTF-8') { |xml| xml.person { xml.id_ student_id xml.sex (male? ? 1 : 0) xml.hostel hostel.address if student_room xml.foreign student_foreign if student_foreign xml.benefits student_benefits if student_benefits == BENEFITS_ORPHAN name_to_nokogiri.children[0].children.each { |part| xml << part.to_xml } } }.doc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_update_save(record); end", "def after_update_save(record); end", "def on_upsert\n #\n end", "def before_update; end", "def modify_after_insert(conn, postgres_cmd, default_cmd)\n conn = ActiveRecord::Base.connection\n cmd = if conn.instance_values[\"config\"][:adapter].in? %...
[ "0.5677841", "0.55306965", "0.5348253", "0.52701896", "0.5192869", "0.5181096", "0.5170977", "0.51324016", "0.512983", "0.5104654", "0.5077664", "0.505964", "0.5036906", "0.5036666", "0.50329185", "0.5031072", "0.4973346", "0.49622774", "0.4959098", "0.49553138", "0.49553138"...
0.0
-1
Converts a hash or hashlike object that indexes elements on strings or symbols to an object that provides access to attributes through dot notation. Returns an OpenStruct instance
def attributes_for(params) if params.kind_of?(Hash) attrs = OpenStruct.new attrs.refresh_token = params[:refresh_token] || params['refresh_token'] attrs.access_token = params[:access_token] || params['token'] attrs.expires_at = params[:expires_at] || params['expires_at'] params = attrs end params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_ostruct(obj)\n return OpenStruct.new(Hash[obj.map { |k, v| [k, _convert_ostruct(v)] }]).freeze if obj.is_a?(Hash)\n return obj.map { |v| _convert_ostruct(v) }.freeze if obj.is_a?(Array)\n obj\n end", "def hashes_to_ostruct object # {{{\n\n return case object\n when Hash\n object...
[ "0.67353827", "0.66664326", "0.66274494", "0.6583433", "0.6532927", "0.64831895", "0.64831895", "0.6376638", "0.6287113", "0.6285097", "0.6210139", "0.61592805", "0.5975898", "0.5962704", "0.5851432", "0.5846276", "0.58368737", "0.56753796", "0.56401217", "0.5583778", "0.5417...
0.0
-1
current prod and iterator ruby needs to pass res and nums eventho theyd be inscope for js/py
def recurse(curr, k, nums, res, start) # add, recurse, undo # basically forcing a base case if k == 0 res << curr[0..-1] return end # start elims duplicates (like [3, 2] [2, 3]) i = start while i < nums.length curr << nums[i] recurse(curr, k - 1, nums, res, i + 1) curr.pop i+=1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_13(val, _values, result)\n @handler.start_object \n result\nend", "def results=(_arg0); end", "def results=(_arg0); end", "def next_result()\n #This is a stub, used for indexing\n end", "def workload\n [@nodeid,@data.count]\n end", "def _reduce_496(val, _values, r...
[ "0.56891155", "0.55999136", "0.55999136", "0.55566823", "0.55215466", "0.5519974", "0.55083555", "0.5480621", "0.54275924", "0.5418251", "0.54147154", "0.54039013", "0.5402955", "0.54006934", "0.5390441", "0.5383393", "0.5374907", "0.53552896", "0.53438586", "0.53270423", "0....
0.0
-1
GET /request_services GET /request_services.json
def index @request_services = RequestService.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_request(service); end", "def index\n endpoint(get(services_url).body)\n end", "def services\n params = { command: 'account_services' }\n get('/json.php', params)\n end", "def services(query = {})\n get('service', query)\n end", "def service(id)\n request :g...
[ "0.7087363", "0.707337", "0.7035932", "0.68809634", "0.6822776", "0.67689013", "0.668224", "0.66465676", "0.6605129", "0.6582652", "0.6520311", "0.64002717", "0.6399248", "0.6328442", "0.63054484", "0.62628126", "0.62454337", "0.6242674", "0.6207485", "0.618999", "0.61790353"...
0.7121037
0
GET /request_services/1 GET /request_services/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service(id)\n request :get, \"/services/#{id}\"\n end", "def service_request(service); end", "def index\n @request_services = RequestService.all\n end", "def index\n endpoint(get(services_url).body)\n end", "def index\n @service_requests = ServiceRequest.all\n end", "def services(...
[ "0.7070424", "0.69753677", "0.6972877", "0.67665744", "0.662034", "0.6411179", "0.63580173", "0.6355132", "0.63343805", "0.6327788", "0.6261548", "0.61813897", "0.6177567", "0.6165123", "0.6093947", "0.60446036", "0.60322344", "0.60319954", "0.6024766", "0.60019755", "0.59716...
0.0
-1
POST /request_services POST /request_services.json
def create @request_service = RequestService.new(request_service_params) respond_to do |format| if @request_service.save format.html { redirect_to requests_path, notice: 'Request service was successfully created.' } format.json { render :show, status: :created, location: @request_service } else format.html { render :new } format.json { render json: @request_service.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_service(service={})\n request :post, '/services', service\n end", "def service_request(service); end", "def register_services(request)\n return unless request.is_a? RestfulRequest\n @active_requests[request.id][:arduino_responses][request.address[:name]].match /^(?:[A-Za-z].*\\n)*...
[ "0.71580625", "0.71028316", "0.6737767", "0.6483286", "0.6414795", "0.64019334", "0.63253605", "0.6229667", "0.61948496", "0.6177731", "0.6130899", "0.612519", "0.6122685", "0.6122343", "0.61215824", "0.61071044", "0.6100956", "0.6086778", "0.6042731", "0.6031596", "0.6025071...
0.6913603
2
PATCH/PUT /request_services/1 PATCH/PUT /request_services/1.json
def update respond_to do |format| if @request_service.update(request_service_params) format.html { redirect_to @request_service, notice: 'Request service was successfully updated.' } format.json { render :show, status: :ok, location: @request_service } else format.html { render :edit } format.json { render json: @request_service.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n #@service_request = ServiceRequest.find(params[:id])\n\n respond_to do |format|\n if @service_request.update_attributes(service_request_params)\n format.html { redirect_to @service_request, notice: 'Service request was successfully updated.' }\n format.json { head :no_content ...
[ "0.67236817", "0.6592012", "0.6511706", "0.64438397", "0.6306632", "0.6301016", "0.61602074", "0.61107343", "0.6084369", "0.6081926", "0.6072462", "0.6058602", "0.5994463", "0.5981201", "0.59780794", "0.5966572", "0.59411085", "0.5934554", "0.5934554", "0.59266865", "0.588914...
0.68162376
0
DELETE /request_services/1 DELETE /request_services/1.json
def destroy @request_service.destroy respond_to do |format| format.html { redirect_to request_services_url, notice: 'Request service was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n #@service_request = ServiceRequest.find(params[:id])\n @service_request.destroy\n\n respond_to do |format|\n format.html { redirect_to service_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_request.destroy\n respond_to do |format...
[ "0.74874973", "0.7254175", "0.7254175", "0.7254175", "0.7109953", "0.7102991", "0.7066855", "0.70497555", "0.68953276", "0.6846716", "0.6766193", "0.6735815", "0.6732323", "0.67136776", "0.67136776", "0.67136776", "0.6702062", "0.67009854", "0.6681709", "0.66807646", "0.66765...
0.73687696
1
Use callbacks to share common setup or constraints between actions.
def set_request_service @request_service = RequestService.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def request_service_params params.require(:request_service).permit(:service_id, :request_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6979893", "0.6781746", "0.6746611", "0.6742344", "0.6735229", "0.6592651", "0.65027124", "0.6498011", "0.648163", "0.647716", "0.64556813", "0.64386255", "0.63784456", "0.63756156", "0.636574", "0.6319542", "0.63004524", "0.6299559", "0.62925464", "0.62923217", "0.6289894"...
0.0
-1
API = Jira::Project The class to access the api's projects declare needed overloaded methods here copy from this.copy(that) copies that into this
def copy(project) project.tickets.each do |ticket| copy_ticket = self.ticket!(:title => ticket.title, :description => ticket.description) ticket.comments.each do |comment| copy_ticket.comment!(:body => comment.body) sleep 1 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_api_project\n @api_project = Api::Project.includes(:author, :pictures, steps: [:pictures]).find(params[:id])\n end", "def set_api_project\n @project = Project.find(params[:id])\n end", "def project; end", "def projects ; end", "def build_project\n @id ||= @project.a...
[ "0.6609208", "0.6362485", "0.62046087", "0.6161392", "0.6084315", "0.6038392", "0.6005506", "0.5987108", "0.5985973", "0.5977584", "0.5948679", "0.5908548", "0.58865774", "0.58713675", "0.58711374", "0.58711374", "0.58282053", "0.58206975", "0.57800364", "0.57789433", "0.5692...
0.0
-1
Retrieves a language by language code
def get_language(code, options = {}) root = get_root object_from_response(GogoKit::Language, GogoKit::LanguageRepresenter, :get, "#{root.links['self'].href}/languages/#{code}", options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language_from_code code\n ISO_639.find(code).english_name if not(code.nil?)\n end", "def language_code_lookup( language_code )\n\n case language_code\n when 'eng'\n return 'English'\n when 'fre'\n return 'French'\n when 'ger'\n return 'German'\n when 'spa'\...
[ "0.8134371", "0.7980619", "0.79467326", "0.7790671", "0.72376686", "0.70618623", "0.70618623", "0.69555134", "0.69136465", "0.6901044", "0.6867622", "0.6846721", "0.6832575", "0.6672108", "0.6647176", "0.66273105", "0.66273105", "0.66273105", "0.6605971", "0.66049254", "0.657...
0.78166837
3
Retrieves all languages supported by viagogo
def get_languages(options = {}) object_from_response(GogoKit::PagedResource, GogoKit::LanguagesRepresenter, :get, get_root.links['viagogo:languages'].href, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def languages\n get(\"/repos/show/#{owner.login}/#{name}/languages\")['languages']\n end", "def getLangs\r\n result = self.class.get '/getLangs', { query:{ key:@@api_key } }\r\n check_result result\r\n end", "def languages(options={})\n res = self.get \"/translate/service/languages\",...
[ "0.76657796", "0.7632284", "0.7330026", "0.73059833", "0.73059833", "0.73059833", "0.73059833", "0.73032004", "0.7302997", "0.7261865", "0.7191352", "0.70859873", "0.7085354", "0.7063622", "0.7044665", "0.7030011", "0.7010002", "0.6884094", "0.68162036", "0.68162036", "0.6793...
0.753234
2
node can be the resourceCenter node, in which case child data is loaded, otherwise child data is lazy loaded leave node and parent nil if you want to load the resourceCenter initial data here
def initialize(rc, parent = nil, node = nil) @parent = parent @rc = rc unless node @community = rc.community node = get_files_and_folders_xml.root end if node.name == 'resourcecenter' root_xml = node @node = (root_xml/'folders').first # load children later so that id is set first, since sub-files verify the parent id # matches what's given in their xml load_children = true else @node = node end @id = @node[:id].to_i @label = @node[:label] @community = @node[:community] load_children_from_xml(root_xml) if load_children end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch(*_args, &_block)\n resource = super\n return resource if top_level_element?\n\n parent_hierarchy.each do |p|\n p.first.top_level_element = true\n p.first.fetch\n end\n resource\n end", "def init_with_node(node)\n @internal_node = node\n ...
[ "0.59543777", "0.57979697", "0.56457055", "0.5446034", "0.5429945", "0.5427555", "0.54229957", "0.5411994", "0.5407169", "0.5400878", "0.5377762", "0.53429586", "0.53286564", "0.5279118", "0.52669525", "0.5259162", "0.5249492", "0.5244161", "0.5236126", "0.52248406", "0.52144...
0.57412684
2
returns [ [ file1, file2, .. fileN ] [ folder1, folder2, .. folderN ] ] parse from xml
def parse_list_response(xml) [ nodes_for(xml, 'files').collect{ |node| File.new(self, node) }, nodes_for(xml, 'folders').collect{ |node| Folder.new(@rc, self, node) } ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllXMLFiles() \n originalDir = Dir.pwd\n Dir.chdir @results_path\n filesArray = Array.new\n debug_msg \"#{@results_path}/**/*.xml\"\n Dir.glob(\"**/*.xml\") do |f|\n debug_msg \"XML: #{f}\"\n filesArray << \"#{@results_path}/\" + f\n end\n Dir.chdir originalDir\n return fil...
[ "0.6782719", "0.6507804", "0.63711464", "0.6289863", "0.6087248", "0.6042166", "0.5996094", "0.5995717", "0.5993641", "0.59721875", "0.59633535", "0.5877604", "0.5820386", "0.58015496", "0.57989454", "0.57458323", "0.57425815", "0.5717449", "0.5705044", "0.5695191", "0.568443...
0.71444905
0
Sets up models getters dynamically (events, decisions)
def define_models_getters self.class::SEEDED_MODELS.each do |seed_model| seed_model_name = seed_model.underscore.pluralize.to_sym define_singleton_method(seed_model_name) do @data[seed_model_name] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_and_model; end", "def set_model\n\n # check credentials and handle OpenStack Keystone\n # TODO: check expiration dates on Keystone tokens\n raise \"You are not authorized to use this endpoint!\" unless check_authn\n\n #\n model = get('/-/')\n @model ...
[ "0.61836195", "0.59848046", "0.59007186", "0.59007186", "0.5809176", "0.5799356", "0.5799356", "0.571037", "0.57009894", "0.569173", "0.5616575", "0.5551757", "0.5543591", "0.5489573", "0.547214", "0.5458027", "0.5444136", "0.5442101", "0.5430536", "0.54111964", "0.54097253",...
0.7178561
0
Loads data yml files in memory in data array attribute
def seed @data = {} SEEDED_MODELS.each do |model_name| pluralized_model_name = model_name.underscore + 's' filename = "app/data/#{pluralized_model_name}.yml" # Load data as an array of objects models_data = YAML.safe_load(File.read(filename)).deep_symbolize_keys # Constantize model klass model_klass = Class.const_get("CodeWars::#{model_name}") # Map models data to new Instances models_data.each_with_index do |model_data, i| model = model_klass.new model.load_attributes(model_data || {}) model.indexed_at = i # Push to DataStore memory @data[pluralized_model_name.to_sym] ||= [] @data[pluralized_model_name.to_sym] << model end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(data_file)\n puts \"FileGenTask: Loading data from YML file [ #{data_file} ]\" if @verbose\n df = DataFile.new\n @data = df.read( data_file )\n end", "def data\n YAML::load_file(files[:config])\n end", "def load_yml(filename); end", "def load_data(filename=nil)\n filename=d...
[ "0.72465354", "0.7212245", "0.6749809", "0.67061144", "0.6604775", "0.6597942", "0.65941685", "0.6581277", "0.6564522", "0.654543", "0.65336084", "0.6530803", "0.6514636", "0.64985144", "0.6469331", "0.6447375", "0.6386359", "0.6386359", "0.63774276", "0.63448846", "0.6340560...
0.0
-1
URI escapes. (CGI style space to +)
def escape(s) URI.encode_www_form_component(s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri_escape(input); end", "def uri_escape\n str = xml_escape.gsub(/\\+/, '&#43;')\n str = str.gsub(/\\s/, '+')\n end", "def escape_uri(s); Rack::Utils.escape(s); end", "def safe_escape(uri); end", "def uri_escape(string)\n if string.nil?\n nil\n else\n CGI.escape(string.en...
[ "0.86683035", "0.8432962", "0.82565814", "0.82518274", "0.8034857", "0.7911432", "0.78566945", "0.7786585", "0.7758437", "0.7758437", "0.7683176", "0.7417952", "0.73556787", "0.7342198", "0.73086315", "0.7276554", "0.72747433", "0.7227421", "0.7160111", "0.7137341", "0.708546...
0.7397488
12
Deprecated: This API will be removed in 2.7.0
def assignable_agents @assignable_agents = (Current.account.users.where(id: @inbox.members.select(:user_id)) + Current.account.administrators).uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def internal; end", "def private_method\n end", "def refutal()\n end", "def wrapper; end", "def custom; end", "def custom; end", "def deprecated_key=(_arg0); end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def schubert; end", ...
[ "0.7633257", "0.6305742", "0.6219986", "0.6196095", "0.6157999", "0.6008351", "0.6008351", "0.5989434", "0.5983314", "0.5983314", "0.5983314", "0.5983314", "0.5937738", "0.590435", "0.5881453", "0.5881453", "0.5710194", "0.5699839", "0.5661955", "0.5661955", "0.5661955", "0...
0.0
-1
GET /jobs GET /jobs.json
def index =begin if sort_column == "category_id" && params[:locale] == :en @jobs = Job.cat_by_name.paginate(:per_page => 1, :page => params[:page]) elsif sort_column == "category_id" && params[:locale] == :tr @jobs = Job.cat_by_isim.paginate(:per_page => 1, :page => params[:page]) else @jobs = Job.order(sort_column + " " + sort_direction).paginate(:per_page => 1, :page => params[:page]) end =end @title = t('general.main_list') =begin if params[:locale]=="tr" loc = "tr" end if params[:locale]=="en" loc = "en" end =end sorting # defined in the application controller respond_to do |format| format.html # index.html.erb #format.js format.json { render json: @jobs } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @jobs = Job.all\n\n render json: @jobs\n end", "def index\n @jobs = Job.all\n render json: @jobs\n end", "def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params...
[ "0.78487986", "0.78391117", "0.7709953", "0.7699296", "0.74898845", "0.7433689", "0.7387766", "0.73397416", "0.73253435", "0.72978896", "0.72852373", "0.7262688", "0.7212051", "0.72030485", "0.71915585", "0.71915585", "0.71735525", "0.7161574", "0.7146019", "0.7146019", "0.71...
0.0
-1
GET /jobs/1 GET /jobs/1.json
def show session[:time_now] = Time.now @job = Job.find(params[:id]) if (Category.where("id = ?", @job.category_id).first.nil? || Category.where("id = ?", @job.category_id).map{|p| p.isim} == ["Diğer"] || Category.where("id = ?", @job.category_id).map{|p| p.isim} == ["Other"]) @category = t('general.category_is_not_specified') elsif I18n.locale == :en @category = Category.where("id= ?", @job.category_id).first.name elsif I18n.locale == :tr @category = Category.where("id= ?", @job.category_id).first.isim end if request.xhr? render 'show_ajax', :layout => false #respond_to do |format| # format.js #end else respond_to do |format| format.html # index.html.erb format.json { render json: @job } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_single_job_sample(client)\n response = client[\"jobs/#{$job_id}\"].get\n\n p ''\n p 'Get single job'\n p response\nend", "def job(id, options = {})\n objectify get(\"/job/#{id}\", options)['joblist']['job']\n end", "def index\n @jobs = Job.all\n\n render json: @jobs\n end", "de...
[ "0.7503342", "0.7451727", "0.7444004", "0.74323505", "0.7397192", "0.7318913", "0.73015726", "0.7274568", "0.72399634", "0.72276026", "0.72276026", "0.72276026", "0.72276026", "0.72276026", "0.7223489", "0.7211026", "0.7158756", "0.7104066", "0.7104066", "0.70958894", "0.7061...
0.0
-1
GET /jobs/new GET /jobs/new.json
def new @job = Job.new session[:time_now] = Time.now 2.times do @job.references.build end respond_to do |format| format.html # new.html.erb format.json { render json: @job } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n en...
[ "0.8294962", "0.8294962", "0.8132548", "0.8099061", "0.8099061", "0.8099061", "0.8099061", "0.7864007", "0.7657739", "0.7647186", "0.7637153", "0.75673014", "0.7469147", "0.7464972", "0.7366836", "0.7366749", "0.73515695", "0.73502165", "0.7330446", "0.73140454", "0.72499764"...
0.71955156
23
POST /jobs POST /jobs.json
def create if current_user.nil? redirect_to login_path and return false end @job = current_user.jobs.new(params[:job]) @time_too_fast = '' #time_later # defined in application controller hidden_field # defined in application controller respond_to do |format| if !@job.valid? @hidden = nil @time_too_fast = nil format.html do 2.times do @job.references.build end render action: "new" end format.json { render json: @job.errors, status: :unprocessable_entity } end #puts @job.valid? #p @hidden if ((@hidden.blank? || @hidden.nil?) && @time_too_fast.blank?) && @job.save #p @job flash[:notice] = t('jobs_controller.create.success') format.html { redirect_to @job} format.json { render json: @job, status: :created, location: @job } else format.html do 2.times do @job.references.build end render action: "new" end format.json { render json: @job.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @job = current_user.posted_jobs.build(job_params)\n if @job.save\n render json: @job\n else\n render json: @job.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n job = Job.create(job_params)\n render json: job\n end", "def new_job(job...
[ "0.74641937", "0.73064774", "0.70868206", "0.70318276", "0.7020725", "0.70076245", "0.69820875", "0.6932717", "0.6932393", "0.6921801", "0.690776", "0.6904804", "0.68841195", "0.68841195", "0.68841195", "0.6880201", "0.6878812", "0.68659544", "0.6856052", "0.6820773", "0.6802...
0.0
-1
PUT /jobs/1 PUT /jobs/1.json
def update @job = current_user.jobs.find(params[:id]) respond_to do |format| if @job.update_attributes(params[:job]) flash[:notice] = t('jobs_controller.update.success') format.html { redirect_to @job} format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @job.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n job = Job.find(params[:id])\n job.update_attributes(job_params)\n render json: job\n end", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend", "def update_job_success(job_id, suc...
[ "0.7422482", "0.7243558", "0.7182451", "0.7182451", "0.7182451", "0.71784604", "0.70229214", "0.6868921", "0.68641233", "0.6817958", "0.6770402", "0.6764434", "0.6732142", "0.67181206", "0.66856176", "0.66823727", "0.66703683", "0.6648588", "0.6632802", "0.6585293", "0.656965...
0.6756657
12
DELETE /jobs/1 DELETE /jobs/1.json
def destroy if current_user.nil? redirect_to login_path and return false end #p current_user #p current_user.jobs if current_user.jobs.empty? redirect_to root_path and return false end if current_user.is_admin? @job = Job.find(params[:id]) else @job = current_user.jobs.find(params[:id]) end @job.destroy respond_to do |format| format.html { redirect_to jobs_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n end", "def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :ok }\n end\n end", "def destroy...
[ "0.7745999", "0.7699839", "0.7675849", "0.7675849", "0.7675849", "0.7675849", "0.76753676", "0.7674191", "0.765791", "0.7643319", "0.7617747", "0.7559806", "0.75549906", "0.75478464", "0.75454944", "0.75394464", "0.7536896", "0.75197124", "0.7507983", "0.7505297", "0.74646795...
0.0
-1