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 |
|---|---|---|---|---|---|---|
Parses JSON from the error response sent by Chef Server and returns the error message | def format_rest_error
Array(Chef::JSONCompat.from_json(exception.response.body)["error"]).join("; ")
rescue Exception
safe_format_rest_error
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_error(response)\n ret = ''\n code = nil\n message = nil\n details = nil\n if (response.respond_to?(:status))\n code = response.status.to_s\n end\n if (response.respond_to?(:body))\n details = response.body.to_s\n begin\n ... | [
"0.8089414",
"0.79642326",
"0.79061544",
"0.788016",
"0.78290635",
"0.7773512",
"0.77034235",
"0.7693955",
"0.7609655",
"0.7559516",
"0.7519021",
"0.75165033",
"0.7495806",
"0.7411509",
"0.7334137",
"0.722973",
"0.71927655",
"0.71889746",
"0.71697897",
"0.7160005",
"0.7149038... | 0.7009725 | 24 |
Take code and convert it to the proper symbol | def to_sym
CODES[index]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code_name(code)\n Codes.code_symbol(code)\n end",
"def string=(code); end",
"def code(a_code)\n\t\ta_code\n\tend",
"def asm_symbol(s)\n sa = Word[s]\n return sa if !sa.nil?\n a = ['']\n s.each_char do |c|\n g = Graph[c]\n if g.nil?\n a[-1] << c\n else\n ... | [
"0.70740443",
"0.7037735",
"0.6746516",
"0.6705883",
"0.66921204",
"0.66504914",
"0.6611526",
"0.6611526",
"0.6558571",
"0.64993685",
"0.64993685",
"0.6488332",
"0.6472246",
"0.64112055",
"0.64099354",
"0.63987005",
"0.63919157",
"0.63525146",
"0.629272",
"0.6264481",
"0.6257... | 0.0 | -1 |
GET /emails GET /emails.json | def index
@emails = Email.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emails\n respond_with_entity(api.get('/api/v1/profile/emails'),\n NexaasID::Entities::Profile::Emails)\n end",
"def index\n @emails = @user.emails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @emails }\n end\n end",
"d... | [
"0.7948784",
"0.78588575",
"0.78588575",
"0.77112454",
"0.76923376",
"0.7650856",
"0.7587457",
"0.7543825",
"0.743756",
"0.743756",
"0.7315323",
"0.72699016",
"0.7199933",
"0.7089784",
"0.7056706",
"0.7055603",
"0.70550853",
"0.7050239",
"0.6821903",
"0.67516285",
"0.67497",
... | 0.6624831 | 35 |
GET /emails/1 GET /emails/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @email = @user.emails.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email }\n end\n end",
"def show\n @email = @user.emails.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format... | [
"0.7524141",
"0.7524141",
"0.7498546",
"0.7498546",
"0.73857564",
"0.73840266",
"0.7272946",
"0.7253986",
"0.7205888",
"0.7192127",
"0.71317375",
"0.693241",
"0.6856085",
"0.6856085",
"0.6814951",
"0.67556435",
"0.669154",
"0.66413575",
"0.6616541",
"0.6612174",
"0.66074467",... | 0.0 | -1 |
POST /emails POST /emails.json | def create
@email = Email.new(email_params)
respond_to do |format|
if @email.save
format.html { redirect_to @email, notice: 'Email was successfully created.' }
format.json { render :show, status: :created, location: @email }
else
format.html { render :new }
format.json { render json: @email.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @email = @user.emails.new(email_params)\n\n respond_to do |format|\n if @email.save\n format.html { redirect_to @email, notice: 'Email was successfully created.' }\n format.json { render json: @email, status: :created, location: @email }\n else\n format.html { rend... | [
"0.67778414",
"0.65197706",
"0.649967",
"0.6437435",
"0.6322956",
"0.63213605",
"0.6252707",
"0.62314034",
"0.6186174",
"0.6174372",
"0.61227304",
"0.6101144",
"0.6056937",
"0.60072494",
"0.60070753",
"0.5983285",
"0.5969986",
"0.5965862",
"0.5927319",
"0.59079033",
"0.587158... | 0.6063634 | 12 |
PATCH/PUT /emails/1 PATCH/PUT /emails/1.json | def update
respond_to do |format|
if @email.update(email_params)
format.html { redirect_to @email, notice: 'Email was successfully updated.' }
format.json { render :show, status: :ok, location: @email }
else
format.html { render :edit }
format.json { render json: @email.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @email = @user.emails.find(params[:id])\n\n respond_to do |format|\n if @email.update_attributes(email_params)\n format.html { redirect_to @email, notice: 'Email was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \... | [
"0.70653826",
"0.6749607",
"0.672374",
"0.6713233",
"0.67083204",
"0.66231066",
"0.6534054",
"0.6525407",
"0.6512119",
"0.65070564",
"0.6477657",
"0.6399551",
"0.6388538",
"0.636404",
"0.62731147",
"0.6165144",
"0.6155925",
"0.6141035",
"0.61153126",
"0.6112243",
"0.61045206"... | 0.64689046 | 16 |
DELETE /emails/1 DELETE /emails/1.json | def destroy
@email.destroy
respond_to do |format|
format.html { redirect_to emails_url, notice: 'Email was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @email = @user.emails.find(params[:id])\n @email.destroy\n\n respond_to do |format|\n format.html { redirect_to emails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n result = access_token.delete(\"/api/v1/emails/#{params[:id]}\")\n display_api_res... | [
"0.775269",
"0.7700378",
"0.74876124",
"0.74812347",
"0.74812347",
"0.74764925",
"0.74603796",
"0.7418117",
"0.73453873",
"0.7207522",
"0.7173364",
"0.71580994",
"0.7150805",
"0.71424913",
"0.7066294",
"0.7059281",
"0.70252615",
"0.7019183",
"0.7018966",
"0.7005701",
"0.70025... | 0.71611935 | 17 |
Use callbacks to share common setup or constraints between actions. | def set_email
@email = Email.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 email_params
params.require(:email).permit(:first_name, :last_name, :email, :club_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.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
GET /bp_pic_groups/1 GET /bp_pic_groups/1.json | def show
@bp_pic_group = BpPicGroup.find(params[:id])
if params[:delivery_mail_id].blank?
@bp_pic_group_details = BpPicGroupDetail.includes(:bp_pic => :business_partner).where(:deleted => 0 , :bp_pic_group_id => @bp_pic_group).page(params[:page]).per(current_user.per_page)
else
@delivery_mail = DeliveryMail.find(params[:delivery_mail_id]).get_informations
@attachment_files = AttachmentFile.attachment_files("delivery_mails", @delivery_mail.id)
@bp_pic_group_details = BpPicGroupDetail.includes(:bp_pic => :business_partner).where(:deleted => 0 , :bp_pic_group_id => @bp_pic_group)
end
respond_to do |format|
format.html # show.html.erb
format.json { render json: @bp_pic_group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @title = params[:group_name]\n @bp_pic_names = []\n @bp_pic_group = BpPicGroup.find(params[:id])\n @bp_pic_group_details = BpPicGroupDetail.find(:all, :conditions => [\"deleted = 0 and bp_pic_group_id = ? \", params[:id]])\n @bp_pic_group_details.each do |bp_pic_group_detail|\n bp_pi... | [
"0.745031",
"0.73246133",
"0.7289619",
"0.70413524",
"0.6973789",
"0.67677027",
"0.66595274",
"0.6589404",
"0.65878886",
"0.65410423",
"0.6527274",
"0.6527173",
"0.6516864",
"0.65125036",
"0.65073514",
"0.6432691",
"0.6432691",
"0.6413153",
"0.6404722",
"0.63956255",
"0.63895... | 0.609504 | 62 |
GET /bp_pic_groups/new GET /bp_pic_groups/new.json | def new
@bp_pic_group = BpPicGroup.new
# コピーして新規作成
if src_id = params[:src_id]
source_group = BpPicGroup.find(src_id)
@bp_pic_group.bp_pic_group_name = source_group.bp_pic_group_name
@bp_pic_group.memo = source_group.memo
end
respond_to do |format|
format.html # new.html.erb
format.json { render json: @bp_pic_group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @bp_pic_group = BpPicGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bp_pic_group }\n end\n end",
"def new\n @bp_pic_group_detail = BpPicGroupDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.j... | [
"0.79740155",
"0.75806034",
"0.75034726",
"0.7474449",
"0.7474449",
"0.7454114",
"0.745336",
"0.7433503",
"0.7433503",
"0.7433503",
"0.7433503",
"0.7433503",
"0.7433503",
"0.7433503",
"0.7433503",
"0.7410877",
"0.74057806",
"0.7382391",
"0.73788494",
"0.7358574",
"0.7358574",... | 0.75049907 | 2 |
POST /bp_pic_groups POST /bp_pic_groups.json | def create
@bp_pic_group = BpPicGroup.new(params[:bp_pic_group])
source_group_id = params[:src_id]
respond_to do |format|
begin
set_user_column(@bp_pic_group)
@bp_pic_group.save!
# params[:src_id]があった場合、グループのコピーとみなす
@bp_pic_group.create_clone_group(source_group_id) unless source_group_id.nil?
format.html { redirect_to back_to, notice: 'Bp pic group was successfully created.' }
format.json { render json: @bp_pic_group, status: :created, location: @bp_pic_group }
rescue ActiveRecord::RecordInvalid
format.html { render action: "new" }
format.json { render json: @bp_pic_group.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @bp_pic_group = create_model(:bp_pic_groups, params[:bp_pic_group])\n source_group_id = params[:src_id]\n\n respond_to do |format|\n begin\n set_user_column(@bp_pic_group)\n @bp_pic_group.save!\n\n # params[:src_id]があった場合、グループのコピーとみなす\n @bp_pic_group.create_cl... | [
"0.6991039",
"0.68670225",
"0.6763025",
"0.6763025",
"0.6711261",
"0.6633847",
"0.6633669",
"0.6389422",
"0.6248903",
"0.6247706",
"0.6245385",
"0.624254",
"0.6234463",
"0.62208563",
"0.6217484",
"0.62033546",
"0.62015635",
"0.61784524",
"0.6175693",
"0.6160823",
"0.61221737"... | 0.68879414 | 1 |
PUT /bp_pic_groups/1 PUT /bp_pic_groups/1.json | def update
@bp_pic_group = BpPicGroup.find(params[:id])
respond_to do |format|
begin
@bp_pic_group.update_attributes!(params[:bp_pic_group])
format.html { redirect_to back_to, notice: 'Bp pic group was successfully updated.' }
format.json { head :no_content }
rescue ActiveRecord::RecordInvalid
format.html { render action: "edit" }
format.json { render json: @bp_pic_group.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @bp_pic_group = BpPicGroup.find(params[:id])\n\n respond_to do |format|\n begin\n @bp_pic_group.update_attributes!(params[:bp_pic_group])\n format.html { redirect_to @bp_pic_group, notice: 'Bp pic group was successfully updated.' }\n format.json { head :no_content }\n ... | [
"0.71384776",
"0.68839043",
"0.6732258",
"0.66479325",
"0.66226697",
"0.6514658",
"0.6406277",
"0.6394733",
"0.6348363",
"0.6303851",
"0.6303036",
"0.62993544",
"0.62668526",
"0.6263855",
"0.6257289",
"0.6247166",
"0.6134444",
"0.61245155",
"0.61195374",
"0.61129475",
"0.6108... | 0.71178955 | 1 |
GET /bp_pic_groups/new_details/1 GET /bp_pic_groups/new_details/1.json | def new_details
@bp_pic_group_id = params[:id]
@delivery_mail_id = params[:delivery_mail_id]
respond_to do |format|
format.html # new_details.html.erb
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @bp_pic_group_detail = BpPicGroupDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bp_pic_group_detail }\n end\n end",
"def new\n @bp_pic_group = BpPicGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n f... | [
"0.77467436",
"0.7452934",
"0.697976",
"0.6953249",
"0.6929236",
"0.67933536",
"0.6779163",
"0.67739856",
"0.67739856",
"0.6754528",
"0.67366856",
"0.6719895",
"0.66907823",
"0.6687958",
"0.666848",
"0.6649052",
"0.6613911",
"0.6594574",
"0.65458053",
"0.65420955",
"0.6540010... | 0.6971557 | 3 |
POST /bp_pic_groups/create_details POST /bp_pic_groups/create_details.json | def create_details
@bp_pic_ids = params[:bp_pic_ids].split.uniq
@bp_pic_group_id = params[:bp_pic_group_id]
@delivery_mail_id = params[:delivery_mail_id]
errids = []
respond_to do |format|
begin
bp_pic_group_details = BpPicGroupDetail.where(:bp_pic_group_id => @bp_pic_group_id)
@bp_pic_ids.each do |bp_pic_id|
# validate
if bp_pic_id =~ /\D+/ or
BpPic.find(:first, :conditions => {:id => bp_pic_id}).nil? or
bp_pic_group_details.any?{|detail| detail.bp_pic_id == bp_pic_id.to_i}
errids << bp_pic_id
next
end
# add detail
bp_pic_group_detail = BpPicGroupDetail.new()
bp_pic_group_detail.bp_pic_group_id = @bp_pic_group_id
bp_pic_group_detail.bp_pic_id = bp_pic_id
set_user_column(bp_pic_group_detail)
bp_pic_group_detail.save!
end
if errids.empty?
format.html { redirect_to back_to, notice: 'Bp pic group details were successfully created.' }
else
format.html { redirect_to back_to, notice: 'Bp pic group details were successfully created. but erros (' + errids.join(", ") + ').' }
end
rescue ActiveRecord::RecordInvalid
format.html { render action: "new_details" }
format.json { render json: @bp_pic_group.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @bp_pic_group_detail = create_model(:bp_pic_group_details, params[:bp_pic_group_detail])\n\n if @bp_pic_group_detail.bp_pic_id\n respond_to do |format|\n begin\n if BpPicGroupDetail.where(:deleted => 0, :bp_pic_group_id => @bp_pic_group_detail.bp_pic_group_id, :bp_pic_id => ... | [
"0.73620856",
"0.7339904",
"0.6955016",
"0.6947907",
"0.68355334",
"0.6702565",
"0.6590381",
"0.65574074",
"0.6522786",
"0.6508321",
"0.6473677",
"0.6467855",
"0.6455144",
"0.6441225",
"0.6433082",
"0.6390034",
"0.6359692",
"0.63020104",
"0.6299833",
"0.62880653",
"0.626193",... | 0.7557871 | 0 |
DELETE /bp_pic_groups/1 DELETE /bp_pic_groups/1.json | def destroy
bp_pic_group = BpPicGroup.find(params[:id])
bp_pic_group.deleted = 9
bp_pic_group.deleted_at = Time.now
set_user_column(bp_pic_group)
bp_pic_group.save!
respond_to do |format|
format.html { redirect_to bp_pic_groups_path }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @bp_pic_group = BpPicGroup.find(params[:id])\n @bp_pic_group.destroy\n\n respond_to do |format|\n format.html { redirect_to bp_pic_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_group = ImageGroup.find(params[:id])\n @image_group.des... | [
"0.7846918",
"0.7277958",
"0.7121273",
"0.7102837",
"0.7054564",
"0.7034143",
"0.70188814",
"0.69936585",
"0.697095",
"0.69238913",
"0.68710774",
"0.684701",
"0.6818058",
"0.6801407",
"0.67954814",
"0.67794335",
"0.67787915",
"0.6777293",
"0.6772294",
"0.67641324",
"0.6755868... | 0.6967045 | 9 |
We've done the following exercises in Javascript, Now try them in RUBY (You can do them in Javascript again if you want extra practice not required.) The World Translator Write a Method named hello_world that: takes 1 argument, a language code (e.g. "es", "de", "en") returns "Hello, World" for the given language, for at least 3 languages. It should default to returning English. hello_world("es") should return "Hola Mundo" hello_world("de") should return "Hallo Welt" | def hello_world
if word == 'es'
p 'Hola Mundo'
elsif word == 'de'
p 'Hallo Welt'
elsif word == 'en'
p 'Hej världen'
else
return 'Hello World'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hello_world lang=\"en\"\n if lang === \"es\"\n \"Hola Mundo\"\n elsif lang === \"de\"\n \"Hallo Welt\"\n elsif lang === \"ru\"\n \"RUSSIAN Hello World\"\n elsif lang === \"ja\"\n \"JAPANESE Hello World\"\n else\n \"Hello World\"\n end\nend",
"def hello_world(lang)\n lang.downcase!\n ... | [
"0.8018149",
"0.79976743",
"0.7953724",
"0.7908342",
"0.78695095",
"0.77541196",
"0.75496393",
"0.75490797",
"0.747431",
"0.74084014",
"0.738451",
"0.7337724",
"0.7320006",
"0.7313897",
"0.7279876",
"0.72727907",
"0.71759933",
"0.71429706",
"0.71025044",
"0.7055998",
"0.69924... | 0.7497948 | 8 |
The Grade Assigner Write a Method named assign_grade that: takes 1 argument, a number score. returns a grade for the score, either "A", "B", "C", "D", or "F". assign_grade(90) should return A assign_grade(75) should return C | def assign_grade (num)
if num >= 90
p 'A'
elsif num <= 89 && num >= 80
p 'B'
elsif num <= 79 && num >= 70
p 'C'
elsif num <= 69 && num >= 60
p 'D'
elsif num <= 59
p 'F'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_grade (score)\n if (score > 100 || score < 1)\n puts \"Score (#{score}) is out of range (1-100).\"\n elsif score > 90\n puts \"A (#{score})\"\n elsif score > 80\n puts \"B (#{score})\"\n elsif score > 70\n puts \"C (#{score})\"\n elsif score > 60\n puts \"D (#{score})\"\n else\n ... | [
"0.8103696",
"0.79094875",
"0.7882008",
"0.78746766",
"0.7711911",
"0.7673142",
"0.7671061",
"0.7666841",
"0.7650829",
"0.7644549",
"0.76285726",
"0.7602283",
"0.7601387",
"0.75903404",
"0.7577776",
"0.75619906",
"0.7521783",
"0.74736774",
"0.7438235",
"0.7408708",
"0.739675"... | 0.75388765 | 16 |
The Pluralizer Write a method named pluralizer that: takes 2 arguments, a noun and a number. returns the number and pluralized form of the noun, if necessary. pluralizer(5, cat) should return "5 cats" pluralizer(1, dog) should return "1 dog" because the number one does not require a plural noun Arguments will always be a number and a singular noun. Bonus: Make it handle a few collective nouns like "sheep", "geese", "children", "people" and "species". | def dluralizer(noun,num)
if num == 1
p '#{num} #{noun}'
elsif num > 1 && noun == "sheep"
p '#{num} #{noun}'
elsif num > 1 && noun == 'goose'
p '#{num} geese'
elsif num > 1 && noun == 'child'
p '#{num} children'
elsif num > 1 && noun == 'person'
p '#{num} people'
elsif num > 1
p "#{num} #{noun}s"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pluralizer num, noun\n if num == 1\n \"#{num} #{noun}\"\n else\n \"#{num} #{noun}s\"\n end\nend",
"def pluralizer num, noun\n if num != 1\n \"#{num} #{noun}s\"\n else \"#{num} #{noun}\"\n end\nend",
"def pluralizer (num, noun)\n return \"#{num} #{noun}\"\n return \"... | [
"0.8219094",
"0.80972725",
"0.79697937",
"0.79350007",
"0.7900529",
"0.7890442",
"0.7725497",
"0.77057296",
"0.7667527",
"0.7660703",
"0.7660703",
"0.76338613",
"0.7628333",
"0.7578937",
"0.7543334",
"0.75433165",
"0.75386655",
"0.74568594",
"0.7450121",
"0.7408373",
"0.74045... | 0.70073515 | 56 |
The DateTime range for a valid value | def range
DEFAULT_RANGE
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_range\n errors.add(:start_date, 'can not be greater than end date') if start_date > end_date\n end",
"def range\n (start_date...end_date) #exclusive date range\n end",
"def date_range\n @date_range ||= start_at..end_at\n end",
"def rule_date_range_validation\n if self and self... | [
"0.70102274",
"0.6911368",
"0.68400025",
"0.6703542",
"0.6664932",
"0.66612005",
"0.65558124",
"0.65234697",
"0.6504092",
"0.6493706",
"0.6436151",
"0.64280194",
"0.6389521",
"0.6388356",
"0.6357806",
"0.63540983",
"0.6325043",
"0.63049185",
"0.63024026",
"0.63023686",
"0.630... | 0.0 | -1 |
Build the URL to access Icinga with | def to_url
"%s/web/api/%s/%s/authkey=%s/%s" % [ host, target, url_options, authkey, output ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_url(apipath)\n @base_url + \"/api/open-v1.0/\" + apipath\n end",
"def build_url(indico_id, **kargs)\n kargs[:pretty] = 'no'\n\n if ENV['INDICO_API_KEY']\n kargs[:ak] = ENV['INDICO_API_KEY']\n if ENV['INDICO_SECRET_KEY']\n kargs[:timestamp] = Time.new.to_i.to_s\n ... | [
"0.7384885",
"0.7350944",
"0.7295433",
"0.7073872",
"0.6949084",
"0.69379395",
"0.69335806",
"0.6933035",
"0.69132227",
"0.6841652",
"0.6838613",
"0.6799587",
"0.6783896",
"0.6758138",
"0.6747593",
"0.6734802",
"0.66993773",
"0.66848654",
"0.6680362",
"0.6668357",
"0.6627791"... | 0.71685886 | 3 |
Build the optional part of the URL | def url_options
[ filter_url, columns_url, order_url, column_count_url].compact.join('/')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_exclusive_url(url = nil, params = nil, params_encoder = nil)\n url = nil if url.respond_to?(:empty?) and url.empty?\n base = url_prefix\n if url and base.path and base.path !~ /\\/$/\n base = base.dup\n base.path = base.path + '/' # ensure trailing slash\n end\n ur... | [
"0.7103497",
"0.69239706",
"0.6896511",
"0.67632437",
"0.6687485",
"0.6662976",
"0.6661466",
"0.6661466",
"0.6661466",
"0.6636871",
"0.6590059",
"0.6513245",
"0.6509508",
"0.6501538",
"0.64888626",
"0.64809215",
"0.64604026",
"0.64548767",
"0.64253676",
"0.6366402",
"0.633018... | 0.5883793 | 48 |
Internal method which populates PartialData, calls the block, then empties PartialData This script is singlethreaded so using a global works fine. | def set_partial_data(**data, &blk)
PartialData.merge!(data)
result = blk.call
PartialData.clear
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_data_for_current_iteration\n @current_block_number = @last_processed_block_number + 1\n @block_data_response = {}\n @highest_block_number = nil\n @current_block_hash, @block_creation_timestamp = nil, nil\n @transactions = nil\n end",
"def ensure_full_data!\n reload! u... | [
"0.6124822",
"0.5399249",
"0.53984064",
"0.5339232",
"0.5315721",
"0.526961",
"0.5176517",
"0.51326376",
"0.51235276",
"0.5066021",
"0.5062264",
"0.50582343",
"0.5036015",
"0.5014712",
"0.50081515",
"0.49919447",
"0.49908033",
"0.4989036",
"0.49786747",
"0.49643403",
"0.49536... | 0.68849516 | 0 |
Compiles `src` slim file to html and writes to `dest` | def render_slim(src, dest, **data)
File.open(dest, "w") do |dest_file|
rendered_html = partial(src, **data)
dest_file.write(rendered_html)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(src, dest)\n content = File.open(src, \"rb\", &:read)\n template = ERB.new(content, nil, \"-\").result(binding)\n File.open(dest, \"w\") { |f| f.write(template) }\n end",
"def generate(target_dir, with_assets = true)\n target_dir = File.expand_path target_dir\n copy_assets ta... | [
"0.69731784",
"0.6315725",
"0.6264037",
"0.6229842",
"0.6218614",
"0.601047",
"0.5949997",
"0.5890349",
"0.58824784",
"0.58747274",
"0.58308345",
"0.58226484",
"0.58205926",
"0.5760364",
"0.5721926",
"0.5672184",
"0.5610733",
"0.56011117",
"0.5589265",
"0.5586158",
"0.5566525... | 0.7078815 | 0 |
NB this method is NOT idempotent! | def split_params **params
[
INTERNAL_PARAMS.each_with_object({}) do |param, acc|
acc[param] = params.delete(param)
end.reject { |_, v| v.nil? },
params
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def prepareForReuse; end",
"def refutal()\n end",
"def lock; end",
"def lock; end",
"def lock; end",
"def used?; end",
"def schubert; end",
"def probers; end",
"def pausable; end",
"def dirty; end",
"def autorestore; end",
"def suivre; end",
"def sync; end",
"def ... | [
"0.7351336",
"0.63749963",
"0.62157094",
"0.6172554",
"0.6172554",
"0.6172554",
"0.61433834",
"0.60383207",
"0.6033732",
"0.60091466",
"0.5965091",
"0.5911267",
"0.5903413",
"0.5873898",
"0.58532655",
"0.58344144",
"0.5833881",
"0.58186835",
"0.5780399",
"0.5780399",
"0.57794... | 0.0 | -1 |
Arguments: file dictionary (e.g. "sample.txt") | def sample_word file
words = []
File.open(file).readlines.each do |line|
words << line
end
words = words.select{ |word| word.length.between?(5,12) }
words.sample.chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dict(file)\n # Since wordlist is constant\n if File.file?(file)\n IO.readlines(file, chomp: true)\n else\n puts 'File not found!'\n end\n end",
"def hashdump dictfilepath\n @lookup = {}\n IO.foreach(dictfilepath) do |word|\n next unless word.size > 3\n word.chomp... | [
"0.70211565",
"0.6531199",
"0.63310826",
"0.6310596",
"0.63004917",
"0.6205607",
"0.61575574",
"0.6104374",
"0.6101102",
"0.60309666",
"0.60227853",
"0.59783083",
"0.59697723",
"0.5934653",
"0.58974385",
"0.58578515",
"0.58123827",
"0.5796274",
"0.5787314",
"0.5787198",
"0.57... | 0.0 | -1 |
Returns true if single az character guess, unique from past guesses | def valid_guess?(guess)
if guess =~ /^[a-z]$/ && !@try.include?(guess)
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repeated_guess?\r\n if @guessed_letters.include? @letter\r\n puts \"You have already guessed the letter #{@letter}, try again.\"\r\n return true\r\n end\r\n end",
"def try_guess(char)\n if self.already_attempted?(char)\n p \"that has already been attempted\"\n return false\n... | [
"0.75732315",
"0.7411662",
"0.73562944",
"0.7351963",
"0.7326451",
"0.7308981",
"0.73037446",
"0.71444297",
"0.713198",
"0.71188205",
"0.7103747",
"0.7095096",
"0.7084939",
"0.7083093",
"0.7034942",
"0.70245546",
"0.7006992",
"0.6980998",
"0.69518536",
"0.6941465",
"0.6933438... | 0.6978116 | 18 |
All methods are private | def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = UserSession.find
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def private_method\n end",
"def internal; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def implementation; end",
"def implementation; end",
"def methods() end",
"def public; end",
"def public; end",
"def private_method; end"... | [
"0.89899164",
"0.82326645",
"0.770709",
"0.762629",
"0.762629",
"0.762629",
"0.762629",
"0.74567765",
"0.74567765",
"0.7444392",
"0.72468126",
"0.72468126",
"0.7213236",
"0.7146218",
"0.69004375",
"0.6855262",
"0.68166167",
"0.68093234",
"0.68093234",
"0.6775349",
"0.67679036... | 0.0 | -1 |
Maybe patients need to be class vars, for some reason it just disappears! | def test_scan_every_patient
patient_ids = Patient.find(:all).map(&:id)
login
select_tasks ['HIV Reception']
patient_ids.each {|patient_id|
begin
patient = Patient.find(patient_id)
puts "Scanning #{patient.national_id} (#{patient.id})"
scan_patient(patient.national_id, patient.id)
assert_redirected_to "/patient/patient_detail_summary"
rescue Exception => e
puts " #{e}"
yell " #{e}"
end
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patients\r\n\t\tAppointment.all.collect do |appt|\r\n\t\t\t\tappt.patient if appt.doctor == self\r\n\t\tend\r\n\tend",
"def patients\n\t\tAppointment.all.collect do |appt|\n\t\t\t\tappt.patient if appt.doctor == self\n\t\tend\n\tend",
"def patients\n self.appointments.map do |appointment|\n app... | [
"0.69837713",
"0.69192845",
"0.6883638",
"0.68190736",
"0.68027955",
"0.68002975",
"0.67673063",
"0.67666435",
"0.67057335",
"0.6683974",
"0.66622674",
"0.66407883",
"0.66286355",
"0.6594823",
"0.6559569",
"0.6551749",
"0.65330225",
"0.6470799",
"0.64613646",
"0.63323814",
"0... | 0.0 | -1 |
Asserts that the response is one of the following types: :success: Status code was 200 :redirect: Status code was in the 300399 range :missing: Status code was 404 :error: Status code was in the 500599 range You can also pass an explicit status code number as the type, like assert_response(501) | def assert_response(type, message = nil)
raise "#{@session.response.body}" if @session.response.response_code == 500
clean_backtrace do
if [ :success, :missing, :redirect, :error ].include?(type) && @session.response.send("#{type}?")
assert_block("") { true } # to count the assertion
elsif type.is_a?(Fixnum) && @session.response.response_code == type
assert_block("") { true } # to count the assertion
else
assert_block(build_message(message, "Expected response to be a <?>, but was <?>", type, @session.response.response_code)) { false }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_response(status_code)\n case status_code\n when :success\n assert_equal 200, @response.status\n when :redirect\n assert_equal 302, @response.status\n when :error\n assert @response.status >= 500, \n \"Response status should have been >= 500 but was #{@re... | [
"0.82425547",
"0.81692505",
"0.79392016",
"0.7300437",
"0.72098505",
"0.72096",
"0.71978307",
"0.7163372",
"0.7081112",
"0.70313317",
"0.68739283",
"0.68701655",
"0.67894906",
"0.67741644",
"0.6773599",
"0.6755948",
"0.66945386",
"0.6559226",
"0.649029",
"0.64223486",
"0.6419... | 0.7275809 | 4 |
Assert that the redirection options passed in match those of the redirect called in the latest action. This match can be partial, such that assert_redirected_to(:controller => "weblog") will also match the redirection of redirect_to(:controller => "weblog", :action => "show") and so on. | def assert_redirected_to(options = {}, message=nil)
clean_backtrace do
assert_response(:redirect, message)
if options.is_a?(String)
msg = build_message(message, "expected a redirect to <?>, found one to <?>", options, @session.response.redirect_url)
url_regexp = %r{^(\w+://.*?(/|$|\?))(.*)$}
eurl, epath, url, path = [options, @session.response.redirect_url].collect do |url|
u, p = (url_regexp =~ url) ? [$1, $3] : [nil, url]
[u, (p[0..0] == '/') ? p : '/' + p]
end.flatten
assert_equal(eurl, url, msg) if eurl && url
assert_equal(epath, path, msg) if epath && path
else
@session.response_diff = options.diff(@session.response.redirected_to) if options.is_a?(Hash) && @session.response.redirected_to.is_a?(Hash)
msg = build_message(message, "response is not a redirection to all of the options supplied (redirection is <?>)#{', difference: <?>' if @session.response_diff}",
@session.response.redirected_to || @session.response.redirect_url, @session.response_diff)
assert_block(msg) do
if options.is_a?(Symbol)
@session.response.redirected_to == options
else
options.keys.all? do |k|
if k == :controller then options[k] == ActionController::Routing.controller_relative_to(@session.response.redirected_to[k], @controller.class.controller_path)
else options[k] == (@session.response.redirected_to[k].respond_to?(:to_param) ? @session.response.redirected_to[k].to_param : @session.response.redirected_to[k] unless @session.response.redirected_to[k].nil?)
end
end
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_redirected_to(options = {}, message=nil)\n clean_backtrace do\n assert_response(:redirect, message)\n return true if options == @response.redirected_to\n ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?\n\n begin\n ... | [
"0.7592413",
"0.6924887",
"0.6719342",
"0.66803557",
"0.66601485",
"0.6631618",
"0.6597372",
"0.6537246",
"0.65169513",
"0.64933836",
"0.6276631",
"0.62523955",
"0.62263536",
"0.6190503",
"0.6189882",
"0.6172898",
"0.61448675",
"0.60631984",
"0.60631114",
"0.5858406",
"0.5833... | 0.7952989 | 0 |
Asserts that the request was rendered with the appropriate template file. | def assert_template(expected = nil, message=nil)
clean_backtrace do
rendered = expected ? @session.response.rendered_file(!expected.include?('/')) : @session.response.rendered_file
msg = build_message(message, "expecting <?> but rendering with <?>", expected, rendered)
assert_block(msg) do
if expected.nil?
!@session.response.rendered_with_file?
else
expected == rendered
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_template(expected = nil, message=nil)\n clean_backtrace do\n rendered = expected ? @response.rendered_file(!expected.include?('/')) : @response.rendered_file\n msg = build_message(message, \"expecting <?> but rendering with <?>\", expected, rendered)\n assert_block(msg)... | [
"0.7627412",
"0.65754974",
"0.6421584",
"0.6368087",
"0.6194557",
"0.61821175",
"0.6122735",
"0.60270405",
"0.60270405",
"0.5988587",
"0.59817106",
"0.5976341",
"0.5899303",
"0.5853399",
"0.5841469",
"0.58386266",
"0.58147633",
"0.58048064",
"0.57957006",
"0.578664",
"0.57849... | 0.7648257 | 0 |
Asserts that the routing of the given path was handled correctly and that the parsed options match. | def assert_recognizes(expected_options, path, extras={}, message=nil)
clean_backtrace do
path = "/#{path}" unless path[0..0] == '/'
# Load routes.rb if it hasn't been loaded.
ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?
# Assume given controller
request = ActionController::TestRequest.new({}, {}, nil)
request.path = path
ActionController::Routing::Routes.recognize!(request)
expected_options = expected_options.clone
extras.each_key { |key| expected_options.delete key } unless extras.nil?
expected_options.stringify_keys!
msg = build_message(message, "The recognized options <?> did not match <?>",
request.path_parameters, expected_options)
assert_block(msg) { request.path_parameters == expected_options }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_routing(path, options, defaults={}, extras={}, message=nil)\n assert_recognizes(options, path, extras, message)\n \n controller, default_controller = options[:controller], defaults[:controller] \n if controller && controller.include?(?/) && default_controller && default_contr... | [
"0.6646993",
"0.6497711",
"0.64667827",
"0.6407363",
"0.634402",
"0.61624104",
"0.5897192",
"0.5867003",
"0.58567965",
"0.56173074",
"0.56128865",
"0.5600905",
"0.55798304",
"0.5524747",
"0.55186635",
"0.551107",
"0.549363",
"0.5441514",
"0.54219043",
"0.5408955",
"0.5401167"... | 0.7771742 | 0 |
Asserts that the provided options can be used to generate the provided path. | def assert_generates(expected_path, options, defaults={}, extras = {}, message=nil)
clean_backtrace do
expected_path = "/#{expected_path}" unless expected_path[0] == ?/
# Load routes.rb if it hasn't been loaded.
ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty?
generated_path, extra_keys = ActionController::Routing::Routes.generate(options, extras)
found_extras = options.reject {|k, v| ! extra_keys.include? k}
msg = build_message(message, "found extras <?>, not <?>", found_extras, extras)
assert_block(msg) { found_extras == extras }
msg = build_message(message, "The generated path <?> did not match <?>", generated_path,
expected_path)
assert_block(msg) { expected_path == generated_path }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_valid_options\n valid_options = {\n skip_gemfile: false,\n skip_git: false,\n skip_test_unit: false,\n edge: false\n }\n valid_options.each do |key, expected|\n next unless options.key?(key)\n actual = options[key]\n unless actual == expected\n fail Rails::Generators::Error,... | [
"0.7275865",
"0.7245576",
"0.7220769",
"0.71801233",
"0.6105678",
"0.6008643",
"0.595315",
"0.5935819",
"0.58344084",
"0.57680774",
"0.5736452",
"0.57325685",
"0.5617521",
"0.56144387",
"0.54918176",
"0.54863286",
"0.54754484",
"0.5410377",
"0.5384745",
"0.537091",
"0.5354869... | 0.6616043 | 4 |
Asserts that path and options match both ways; in other words, the URL generated from options is the same as path, and also that the options recognized from path are the same as options | def assert_routing(path, options, defaults={}, extras={}, message=nil)
assert_recognizes(options, path, extras, message)
controller, default_controller = options[:controller], defaults[:controller]
if controller && controller.include?(?/) && default_controller && default_controller.include?(?/)
options[:controller] = "/#{controller}"
end
assert_generates(path, options, defaults, extras, message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_recognizes(expected_options, path, extras={}, message=nil)\n clean_backtrace do \n path = \"/#{path}\" unless path[0..0] == '/'\n # Load routes.rb if it hasn't been loaded.\n ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty? \n \n... | [
"0.67104036",
"0.61795825",
"0.594015",
"0.5929734",
"0.59275764",
"0.5832627",
"0.5822212",
"0.57858974",
"0.57682735",
"0.57681954",
"0.5749249",
"0.5738509",
"0.5723036",
"0.56814367",
"0.5606521",
"0.5601667",
"0.5546046",
"0.5536613",
"0.5533027",
"0.5510832",
"0.5432959... | 0.56203103 | 14 |
Identical to assert_tag, but asserts that a matching tag does _not_ exist. (See assert_tag for a full discussion of the syntax.) | def assert_no_tag(*opts)
clean_backtrace do
opts = opts.size > 1 ? opts.last.merge({ :tag => opts.first.to_s }) : opts.first
tag = find_tag(opts)
assert !tag, "expected no tag, but found tag matching #{opts.inspect} in:\n#{@session.response.body.inspect}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_tag_not_in(*opts)\n target = opts.shift\n tag_opts = find_tag_opts(opts)\n assert find_tag_in(target, tag_opts).nil?, \n \"#{tag_opts.inspect} was found in \\n#{target.inspect}\"\n end",
"def test_no_tag\n @tag.on_root('t002.txt', nil)\n @tag.after_root('t002.txt', nil)\n... | [
"0.72440857",
"0.6687244",
"0.6656741",
"0.6583658",
"0.64828306",
"0.6222869",
"0.60523224",
"0.60468256",
"0.6023567",
"0.59915835",
"0.5988796",
"0.5930454",
"0.5907149",
"0.58460504",
"0.5845308",
"0.5782649",
"0.5780101",
"0.5776572",
"0.5773244",
"0.5771939",
"0.5749076... | 0.7951496 | 0 |
test 2 html strings to be equivalent, i.e. identical up to reordering of attributes | def assert_dom_equal(expected, actual, message="")
clean_backtrace do
expected_dom = HTML::Document.new(expected).root
actual_dom = HTML::Document.new(actual).root
full_message = build_message(message, "<?> expected to be == to\n<?>.", expected_dom.to_s, actual_dom.to_s)
assert_block(full_message) { expected_dom == actual_dom }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml_should_be_same(expected, actual)\n expected = Hpricot(expected)\n actual = Hpricot(actual)\n \n blame = \"\\n\\n#################### expected\\n#{expected.to_html}\\n\\n\" \"#################### actual:\\n#{actual.to_html}\\n\\n\" \n (xml_cmp(expected, actual)).should.blaming(blame).equal true\nend",
... | [
"0.68768066",
"0.6774608",
"0.6496437",
"0.6425916",
"0.6410332",
"0.63129634",
"0.61744297",
"0.61026293",
"0.60404867",
"0.5949875",
"0.5911473",
"0.58948123",
"0.5892139",
"0.5850013",
"0.5829945",
"0.57847935",
"0.57759863",
"0.57373637",
"0.57045746",
"0.56955606",
"0.56... | 0.5563024 | 25 |
negated form of +assert_dom_equivalent+ | def assert_dom_not_equal(expected, actual, message="")
clean_backtrace do
expected_dom = HTML::Document.new(expected).root
actual_dom = HTML::Document.new(actual).root
full_message = build_message(message, "<?> expected to be != to\n<?>.", expected_dom.to_s, actual_dom.to_s)
assert_block(full_message) { expected_dom != actual_dom }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_dom_not_equal(expected, actual, message = nil, strict: false, html_version: nil)\n expected_dom, actual_dom = fragment(expected, html_version: html_version), fragment(actual, html_version: html_version)\n message ||= \"Expected: #{expected}\\nActual: #{actual}\"\n assert... | [
"0.8007886",
"0.74934113",
"0.6886459",
"0.67436975",
"0.66048294",
"0.66006905",
"0.64115703",
"0.6350364",
"0.63291436",
"0.6306505",
"0.62056214",
"0.6174578",
"0.60750014",
"0.6068122",
"0.6052422",
"0.60031193",
"0.59892917",
"0.59784395",
"0.59509784",
"0.5938413",
"0.5... | 0.76783633 | 1 |
ensures that the passed record is valid by active record standards. returns the error messages if not | def assert_valid(record)
clean_backtrace do
assert record.valid?, record.errors.full_messages.join("\n")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def errors_on_object(record)\n record.errors.full_messages\n end",
"def validate(record)\n unless valid_preposition?(record.show_date_preposition)\n record.errors.add(:show_date_preposition, 'Invalid show date preposition')\n end\n\n unless valid_date?(record.show_date_beginning)\n rec... | [
"0.70756245",
"0.6841345",
"0.6833212",
"0.6751656",
"0.66842073",
"0.66452944",
"0.65660614",
"0.6546915",
"0.64626855",
"0.6456071",
"0.6372195",
"0.63627815",
"0.6336979",
"0.6307125",
"0.6302135",
"0.6282077",
"0.6277567",
"0.62758446",
"0.627565",
"0.627565",
"0.627565",... | 0.69318396 | 1 |
GET /admin Works like this because admin is SINGULAR i.e., there is no index since there is only one. | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin\n #TODO\n end",
"def index\n @admin = Admin.all\n end",
"def index\n if(!admin_signed_in?)\n redirect_back(fallback_location: root_path, notice: 'Acesso negado.')\n end\n @admins = Admin.all\n end",
"def admin\n\n end",
"def admin\n unless admin? || request.format.symbo... | [
"0.7815823",
"0.7756616",
"0.7532052",
"0.7469911",
"0.7459423",
"0.7454797",
"0.7443091",
"0.7443091",
"0.7443091",
"0.7443091",
"0.73829603",
"0.73574567",
"0.7346675",
"0.7335354",
"0.7331344",
"0.73156506",
"0.72932553",
"0.7273908",
"0.7266731",
"0.7238307",
"0.7238307",... | 0.0 | -1 |
sets the log level to FATAL for the duration of the block | def mute_logger
zk_log = Zookeeper::Logger.wrapped_logger
orig_level, zk_log.level = zk_log.level, ::Logger::FATAL
orig_zk_level, Zookeeper.debug_level = Zookeeper.debug_level, Zookeeper::Constants::ZOO_LOG_LEVEL_ERROR
yield
ensure
zk_log.level = orig_zk_level
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fatal message; write FATAL, message, caller[0] unless level > @level end",
"def fatal\n logger.add(Logger::FATAL, nil, facility) { yield } if logger && logger.fatal?\n end",
"def fatal?; @loggers.first.level <= FATAL; end",
"def fatal?; @level <= FATAL; end",
"def fatal?; @level <= FATAL; e... | [
"0.7120755",
"0.69815487",
"0.696466",
"0.6947945",
"0.6947945",
"0.6772762",
"0.667531",
"0.66676474",
"0.6665925",
"0.6647943",
"0.6538359",
"0.6498934",
"0.63468117",
"0.63131285",
"0.6297848",
"0.6292014",
"0.6230044",
"0.61214745",
"0.6118143",
"0.6099628",
"0.6057869",
... | 0.61828506 | 17 |
Use callbacks to share common setup or constraints between actions. | def set_roll
@roll = Roll.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.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def roll_params
params.require(:roll).permit(:roll_number, :pins_fallen, :frame_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 |
Use callbacks to share common setup or constraints between actions. | def set_link
@link = Link.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 link_params
params.require(:link).permit(:linkUrl, :linkWeek, :subject_id, :type_id, :creator, :editor)
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.71207976",
"0.705222",
"0.69488335",
"0.69021654",
"0.67362636",
"0.6717561",
"0.6689192",
"0.6678948",
"0.66622657",
"0.6555007",
"0.6527569",
"0.64588845",
"0.64522904",
"0.6450812",
"0.6448551",
"0.6434285",
"0.6412147",
"0.6412147",
"0.6393719",
"0.6381976",
"0.6381976... | 0.0 | -1 |
When creating a new Minesweeper game, create a new board | def initialize
@game = Board.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_board\n\t\t8.times{|x| @board.push([nil,nil,nil,nil,nil,nil,nil,nil])}\n\t\tpopulate_board\n\tend",
"def create_board\n\n 8.times do |row|\n 8.times do |col|\n new_cell = Cell.new([col + 1, row + 1])\n @@cells.push(new_cell)\n end\n end\n\n end",
"def make_board\n m... | [
"0.7784361",
"0.7723786",
"0.77078015",
"0.7698308",
"0.75475794",
"0.7526238",
"0.7330743",
"0.72227305",
"0.71921754",
"0.71763146",
"0.71329045",
"0.71262556",
"0.71003747",
"0.7081293",
"0.7076765",
"0.70484215",
"0.70446163",
"0.70278263",
"0.70206755",
"0.7011893",
"0.6... | 0.0 | -1 |
iterate through the board and print out the corresponding symbol | def render
game_over = false
game.grid.each do |row|
row_output = []
row.each do |el|
if el.revealed
if el.has_bomb
el_output = "X"
game_over = true
else
el_output = "_"
el.total_num_neighbor_bombs
#has to be changed
#find positions of neighbors
#ask each neighbor if has bomb
#count total number of bombs
#output that integer instead of flag, star, or _
end
else
el_output = el.has_flag ? "F" : "*"
end
row_output << el_output
end
p row_output.join(" ")
end
# call game_over method if game_over == true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display\n\n # Print the top of the board\n puts \"+- - - - - -+\"\n\n # Outer loop through each row\n for row in 0..BOARD_MAXIMUM_INDEX\n\n # Start the left side cell edge\n print \"| \"\n\n # Inner loop through each column\n for column in 0..BOARD_MAXIMUM_INDEX\n\n # Get... | [
"0.7496561",
"0.73744047",
"0.7240685",
"0.7170227",
"0.7168878",
"0.71625376",
"0.71353304",
"0.71339685",
"0.71199924",
"0.70666647",
"0.7059513",
"0.7026266",
"0.70132196",
"0.7001518",
"0.70004606",
"0.69935316",
"0.6986234",
"0.6965817",
"0.69656265",
"0.69601804",
"0.69... | 0.0 | -1 |
Prompt user for position Assumes user inputs correct format | def prompt
puts "Select a position e.g. 0, 0"
position = gets.chomp.split(", ").map {|i| i.to_i }
puts "Would you like to reveal or toggle flag? e.g. R or F"
action = gets.chomp.upcase
[position, action]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_move\n puts \"ENTER YOUR SHOSEN LOCATION BETWEEN 1..9\"\n @position = gets.chomp.to_i\n end",
"def mark_position\n \t@game_board.print_board\n\t\tprintf \"Make your move: \"\n\t\tinput = gets.chomp\n\t\tfrom = input[0..1]\n\t\tto = input[2..3]\n\n\t\tuntil input.length == 4 && @game_board.up... | [
"0.7412129",
"0.73619545",
"0.72913843",
"0.72836107",
"0.7055809",
"0.69986403",
"0.69901633",
"0.6982725",
"0.6975414",
"0.69039404",
"0.6827075",
"0.6810645",
"0.6808964",
"0.6770331",
"0.6704154",
"0.6678898",
"0.66604465",
"0.65962094",
"0.6569014",
"0.65254533",
"0.6521... | 0.68276316 | 10 |
Returns the filename the object was first parsed at, taking definitions with docstrings first. | def file
@files.first ? @files.first[0] : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename\n # just checking the first file (which is the file where an object\n # is first declared)\n files.first\n end",
"def full_filename (for_file = model.document.file)\n for_file\n end",
"def object_name\n @name ||= File.split(@source_path).last.gs... | [
"0.7242327",
"0.6733551",
"0.6559844",
"0.64512295",
"0.6312065",
"0.6312065",
"0.6312065",
"0.6253578",
"0.6253035",
"0.62435603",
"0.62435603",
"0.61646056",
"0.6116041",
"0.60892326",
"0.6027434",
"0.6022099",
"0.5996522",
"0.59615415",
"0.59161144",
"0.59161144",
"0.59161... | 0.0 | -1 |
Returns the line the object was first parsed at (or nil) | def line
@files.first ? @files.first[1] : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line\n lines.first\n end",
"def line\n location.nil? ? nil : location.line\n end",
"def line\n location&.line\n end",
"def line(node = @current_node)\n\t\treturn is_valid(node) ? node.line : nil\n\tend",
"def first_line; end",
"def first_line; end",
"def firs... | [
"0.7266792",
"0.71819884",
"0.70715487",
"0.7000156",
"0.69912803",
"0.69912803",
"0.69912803",
"0.69912803",
"0.69912803",
"0.69912803",
"0.69912803",
"0.69912803",
"0.69912803",
"0.69912803",
"0.69871855",
"0.69044",
"0.6853021",
"0.6841853",
"0.68234384",
"0.67813766",
"0.... | 0.6923699 | 16 |
Attaches source code to a code object with an optional file location | def source=(statement)
if statement.is_a? Parser::Statement
src = statement.tokens.to_s
blk = statement.block ? statement.block.to_s : ""
if src =~ /^def\s.*[^\)]$/ && blk[0,1] !~ /\r|\n/
blk = ";" + blk
end
@source = format_source(src + blk)
self.line = statement.tokens.first.line_no
self.signature = src
else
@source = format_source(statement.to_s)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source=(file)\n @queue << \"source #{file}\"\n end",
"def source(filename); end",
"def source_location=(_arg0); end",
"def prefix(code)\n @src << code\n end",
"def _embed_source(workdir)\n FileUtils.mkdir_p _source_dir(workdir)\n File.open(_path_to_source(workdir), 'wb') do |f|\n ... | [
"0.6360506",
"0.62759024",
"0.6174622",
"0.61230123",
"0.6019641",
"0.5996464",
"0.5897173",
"0.5855783",
"0.58465236",
"0.5832409",
"0.57891876",
"0.5783551",
"0.5773287",
"0.5769415",
"0.5751655",
"0.574362",
"0.5721866",
"0.5719037",
"0.5711493",
"0.5698253",
"0.568846",
... | 0.54565066 | 43 |
Default type is the lowercase class name without the "Object" suffix Override this method to provide a custom object type | def type
self.class.name.split(/#{NSEP}/).last.gsub(/Object$/, '').downcase.to_sym
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_object_type\n self.object_type ||= \"object\"\n end",
"def object_class object_type\n object_type.classify.constantize\n end",
"def object_type object\n object.class.to_s.underscore\n end",
"def __object_type \n @object_type \n end",
"def __object_type \n @object_type \... | [
"0.81779045",
"0.80503273",
"0.7670007",
"0.75677526",
"0.75677526",
"0.7372199",
"0.73048395",
"0.7194601",
"0.71413517",
"0.71413517",
"0.71401453",
"0.7051323",
"0.70300144",
"0.69662446",
"0.69250834",
"0.6905302",
"0.6882872",
"0.68797565",
"0.6845009",
"0.682135",
"0.66... | 0.70487756 | 12 |
Formats source code by removing leading indentation | def format_source(source)
source.chomp!
indent = source.split(/\r?\n/).last[/^([ \t]*)/, 1].length
source.gsub(/^[ \t]{#{indent}}/, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_source(source)\n source = source.chomp\n last = source.split(/\\r?\\n/).last\n indent = last ? last[/^([ \\t]*)/, 1].length : 0\n source.gsub(/^[ \\t]{#{indent}}/, '')\n end",
"def indentation; end",
"def indentation; end",
"def unindent!\n gsub!(/^[ \\t]{#{mini... | [
"0.7909037",
"0.73355615",
"0.73355615",
"0.7199624",
"0.7130086",
"0.7043433",
"0.68941593",
"0.68868446",
"0.6867517",
"0.68657136",
"0.666429",
"0.66446894",
"0.6631405",
"0.66182894",
"0.66182894",
"0.66182894",
"0.66182894",
"0.66182894",
"0.6615186",
"0.6602509",
"0.639... | 0.7914245 | 0 |
Allow user to build its own face profile for the face recognition | def train_new_face
# Temp reference number and face id must be given for the training to take place
if params[:ref] && params[:face]
# Load face image
img = Magick::ImageList.new(@user.tmp_private_location+"#{params[:ref]}/#{params[:file]}")
# Create new face in DB
face = Face.create({
:user_id => @user.id,
})
# Create directory for the face to be stored if it doesn't already exists
FileUtils.mkdir_p(face.dir)
# Copy the face image to that location
img.write(face.location)
# Remove temporary dir
FileUtils.remove_dir(@user.tmp_private_location+params[:ref]+"/")
end
# Redirect to the previous page
respond_to do |format|
format.html { redirect_to :back }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def face\n end",
"def create\n\n @face = Face.new(face_params)\n\n if @face.save\n render :show, status: :created, location: @face\n else\n render json: @face.errors, status: :unprocessable_entity\n end\n end",
"def face_params\n params.require(:face).permit(:name, :collection_id, ... | [
"0.6950198",
"0.6403184",
"0.63930583",
"0.6386709",
"0.6367686",
"0.63157403",
"0.628751",
"0.62112206",
"0.62112206",
"0.6206186",
"0.6204863",
"0.61595684",
"0.61230296",
"0.610831",
"0.6093096",
"0.60706097",
"0.6037653",
"0.6022602",
"0.5985153",
"0.59275365",
"0.5877133... | 0.67806524 | 1 |
dont underestimate; resist the urge to dive into code read the description 3 times, produce an outline if necessary (what are the requirements??) communicate and clarify have a plan (algorithm), and verify with that test cases (happy paths, fail paths, edge cases) manage your energy character set consisting of letters, a space, and a point words consist of one or more, but at most 20 letters input text consists of one or more words separated by one or more spaces words are terminated by 0 or more spaces followed by a point input should be read from, and including the first letter of the first word up to and including the terminating point output: odd words are copied in reverse order even words are merely echoed "whats the matter with kansas." => "whats eht matter htiw kansas." BONUS POINTS: the characters must be read and printed one at a time in: string of words delimited by spaces terminating in a point out: same as in, but with odd words (the second word is odd therefore odd index) put in reverse order characters must be read and printed one at a time can use putc to print to the same line key is informing an "odd" state at which point to print characters in reverse order think splitting and reading each word letter by letter should still work fine also, how to manage the terminating point can just split on it as well, and reintroduce it at the end happy path algo split string on ' ' and '.' (' ' to compensate for cases of one or more spaces) map with index and call reverse on every odd index element iterate through each words characters letter by letter and print with putc edge cases we need to consider input validation? words more than 20 letters? assuming that our inputs will conform empty string? assuming valid input one word string? shouldn't be a problem what if it doesn't terminate in a period? assume that it does multiple spaces for separating words (captured by split) | def odd_reverser(sentence)
words = sentence.split(/ +|\./)
odds_reversed = words.map.with_index { |word, index| index.odd? ? word.reverse : word }
puts odds_reversed.join(' ') + '.' # honestly reading each character at this point and printing out seems against the spirit of the bonus
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segment_string(str)\n \n \n #Purpose: Initialize incidence variables\n #\n #Inputs: none\n #\n #Returns: \n #array1 = An Array that contains the component words of the original String. \n #@s = An Integer. The index of the start point of a test word.\n #@e = An Integer. The i... | [
"0.6884109",
"0.62621826",
"0.6103964",
"0.6079168",
"0.60770273",
"0.5950991",
"0.59197235",
"0.590989",
"0.5869749",
"0.5832445",
"0.5813417",
"0.5809612",
"0.5795104",
"0.5786402",
"0.57841426",
"0.5781457",
"0.5778189",
"0.5758795",
"0.57395804",
"0.56993634",
"0.56889004... | 0.53492045 | 69 |
Supports `find_or_create_by(file: file)`. Similar to +find_or_initialize_by+, it will try to return an attachment with the same hash, otherwise, a new attachment is created. | def find_or_create_by(attributes, &block)
result = find_or_initialize_by(attributes, &block)
result.save! unless result.persisted?
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file=(file)\n self.name = filename(file)\n self.attachment = Attachment.find_or_initialize_by(file: file)\n end",
"def find_or_create(path)\n path = full_path(path)\n if page_blob = find_blob(path)\n new(page_blob, path)\n else\n new(create_blob_for(path), path)\... | [
"0.62931955",
"0.62120813",
"0.6114899",
"0.60022986",
"0.59596604",
"0.59473044",
"0.5934015",
"0.58141464",
"0.57810396",
"0.5779047",
"0.57614577",
"0.56844074",
"0.56647414",
"0.5634969",
"0.5621685",
"0.5523973",
"0.55194646",
"0.5502842",
"0.5487863",
"0.54290414",
"0.5... | 0.53914726 | 25 |
Get the SHA256 hash of the file. | def file_digest(file)
# Get the actual file by #tempfile if the file is an `ActionDispatch::Http::UploadedFile`.
Digest::SHA256.file(file.try(:tempfile) || file).hexdigest
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_sha256_hash(file_path)\n file = File.read(file_path)\n Digest::SHA256.hexdigest(file) if file\n end",
"def file_sha256\n Digest::SHA256.file(self).hexdigest\n end",
"def digest\n OpenSSL::Digest::SHA256.file(path).hexdigest\n end",
"def sha256\n @sha256 ||= digest(path, :sha2... | [
"0.8817486",
"0.8539138",
"0.81339806",
"0.7963159",
"0.7752535",
"0.7419701",
"0.7359525",
"0.7338048",
"0.7286972",
"0.72279",
"0.72029287",
"0.7155302",
"0.71141374",
"0.7093099",
"0.707165",
"0.70147353",
"0.7010526",
"0.69968826",
"0.6941516",
"0.6820487",
"0.6807444",
... | 0.74204487 | 5 |
Opens the attachment for reading as a stream. The options are the same as those taken by +IO.new+ This is readonly, because the attachment might not be stored on local disk. | def open(opt = {}, &block)
return open_with_block(opt, block) if block
open_without_block(opt)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_open(*args, &block)\n if __transport_connection\n content = __transport_connection.file(args[0]).content\n string_io = StringIO.new content\n yield string_io if block_given?\n string_io\n else\n File.open(*args, &block)\n end\n end",
... | [
"0.64453",
"0.6340074",
"0.6188322",
"0.61488277",
"0.6115023",
"0.5907602",
"0.58427876",
"0.5792719",
"0.57853764",
"0.57765853",
"0.5724351",
"0.5720241",
"0.5680088",
"0.5678746",
"0.56365395",
"0.5629923",
"0.562085",
"0.56182957",
"0.5603935",
"0.55761945",
"0.556611",
... | 0.5236985 | 58 |
Opens the attachment for reading as a block. | def open_with_block(opt, block)
Tempfile.create(TEMPORARY_FILE_PREFIX, **opt) do |temporary_file|
temporary_file.write(contents)
temporary_file.seek(0)
block.call(temporary_file)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(block)\n @filemgr.read(block, @contents)\n end",
"def open(&block)\n repo.blob_pipe(sha, &block)\n end",
"def open_for_read\n end",
"def open_read(hold_open=false,&block)\n hold_open||=@read_handle # if already open, keep open\n @read_handle=File.open(filename,\"rb\") unle... | [
"0.6552771",
"0.64011925",
"0.6394134",
"0.63708156",
"0.63706416",
"0.62719345",
"0.62133616",
"0.6118637",
"0.6111847",
"0.60974973",
"0.6070756",
"0.60622656",
"0.6037244",
"0.6001357",
"0.59962976",
"0.5917334",
"0.5877136",
"0.5834766",
"0.58057725",
"0.575346",
"0.57440... | 0.0 | -1 |
Opens the attachment for reading. | def open_without_block(opt)
file = Tempfile.new(TEMPORARY_FILE_PREFIX, Dir.tmpdir, **opt)
file.write(contents)
file.seek(0)
file
rescue StandardError
file&.close!
raise
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open\n object.open\n end",
"def load_attachment\n if attachment.present?\n begin\n\t\t\t\tcontent = Paperclip.io_adapters.for(self.attachment).read\n rescue StandardError\n fail \"The attachment for this report cannot be found: \" + self.attachment.url.to_s\n end\n end\n end"... | [
"0.66871154",
"0.6622071",
"0.65813035",
"0.6521887",
"0.6453292",
"0.6326933",
"0.62943745",
"0.6220716",
"0.61871916",
"0.6177647",
"0.6169187",
"0.6130869",
"0.6109246",
"0.60928744",
"0.60699576",
"0.60488176",
"0.6014311",
"0.60101587",
"0.60098743",
"0.5991333",
"0.5972... | 0.0 | -1 |
Retrieves the contents of the attachment. | def contents
file_upload.read
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read\n result = model.fetch_attachment(@path)\n @headers = result.headers\n result.body\n end",
"def attachment\n @attachment\n end",
"def attachment_data\n @attachment_url && @client.get_file(@attachment_url)\n end",
"def contents\n\t\tconnection.file_conten... | [
"0.77159834",
"0.7241621",
"0.7111297",
"0.69680196",
"0.69680196",
"0.6933486",
"0.6867039",
"0.6861482",
"0.6842329",
"0.6809032",
"0.6799094",
"0.67821914",
"0.6772218",
"0.6772218",
"0.6772218",
"0.66437536",
"0.66082484",
"0.6527975",
"0.6507016",
"0.6473182",
"0.6468366... | 0.66368794 | 16 |
parses an input tsv file containing date\tquery | def parse_file(filename)
start = Time.now
open filename do |file|
data = {}
i = 0
file.each do |line|
date, query = line.chomp.split("\t")
insert(date, query)
i += 1
end
puts "Successfully read #{i} lines."
end
puts "Done in #{Time.now - start} seconds."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_input_string(tsv_string)\n rows = tsv_string.split(/\\r\\n/)\n row_raw_data = rows.map do |row|\n row.gsub!(/\"/, '')\n row.split(\"\\t\")\n end\n\n @header_row = row_raw_data[0]\n @data_rows = row_raw_data[1..-1]\n\n @header_row.each.with_index do |col_key, i|\n if STATI... | [
"0.68002874",
"0.65141016",
"0.63535243",
"0.60794735",
"0.60615224",
"0.5949119",
"0.59059405",
"0.58292645",
"0.57695943",
"0.57695943",
"0.5633009",
"0.5633009",
"0.56196034",
"0.5608779",
"0.5587577",
"0.54672736",
"0.5459493",
"0.54356515",
"0.5415234",
"0.53801864",
"0.... | 0.6221643 | 3 |
inserts a value in the prefix tree date: String describing a date of the form 'YYYYMMDD HHmmss' value: any query you want to insert into the tree | def insert(date, value)
date_time = DateTime.parse(date)
# Create necessary fields if they do not exist
@content[date_time.year] ||= {}
@content[date_time.year][date_time.month] ||= {}
@content[date_time.year][date_time.month][date_time.day] ||= {}
@content[date_time.year][date_time.month][date_time.day][date_time.hour] ||= {}
@content[date_time.year][date_time.month][date_time.day][date_time.hour][date_time.min] ||= {}
@content[date_time.year][date_time.month][date_time.day][date_time.hour][date_time.min][date_time.sec] ||= []
@content[date_time.year][date_time.month][date_time.day][date_time.hour][date_time.min][date_time.sec] << value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []=(prefix, value)\n current = @root\n current_prefix = prefix\n\n while current_prefix != \"\"\n current, current_prefix = find_canididate_insertion_node(current, current_prefix)\n end\n\n current[:value] = value\n return value\n end",
"def set_date(date)\n param = date[:year]\n ... | [
"0.5758987",
"0.56997335",
"0.56554043",
"0.56554043",
"0.56495637",
"0.5536652",
"0.5479083",
"0.5477751",
"0.54616654",
"0.5446099",
"0.5356363",
"0.53411096",
"0.5317676",
"0.52952766",
"0.5196613",
"0.51768106",
"0.5174738",
"0.51580536",
"0.51531476",
"0.51512045",
"0.51... | 0.66466904 | 0 |
count the distinct queries for a specific timeframe should be given in the correct order: year, month, day, hour, min, sec | def count_distinct(*date)
distinct_in_structure(@content.dig(*date))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tweet_count_timeseries(params)\n \n seconds = params[:interval] * 60\n \n sSQL = \"SELECT FROM_UNIXTIME(\n CEILING(UNIX_TIMESTAMP(`posted_at`)/#{seconds})*#{seconds}\n ) AS timeslice\n , COUNT(*) AS tweets\n FROM tweets\n WHERE\n ... | [
"0.64416546",
"0.6390532",
"0.6365332",
"0.6330653",
"0.61714625",
"0.6049349",
"0.57710785",
"0.57015884",
"0.56983525",
"0.56194836",
"0.55714476",
"0.5569464",
"0.5550223",
"0.5541295",
"0.54927206",
"0.5450251",
"0.5436612",
"0.5417515",
"0.5406814",
"0.54045266",
"0.5403... | 0.56845564 | 9 |
finds all the 'limit' most popular queries | def find_popular_with_limit(limit, *date)
populars = find_popular(*date)
populars.max_by(limit) do |_, item|
item
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def miter_limit(limit)\n end",
"def limit(limit); end",
"def apply_limit\n @query = @query.limit(@options[:limit])\n end",
"def results_limit\n # max number of search results to display\n 10\n end",
"def limit; end",
"def limit; end",
"def limit; end",
"def get_max_results\n @max_r... | [
"0.6781746",
"0.6711555",
"0.66286284",
"0.6564984",
"0.6556127",
"0.6556127",
"0.6556127",
"0.65375316",
"0.6425363",
"0.64098924",
"0.63711035",
"0.62970716",
"0.6290397",
"0.62689584",
"0.6167578",
"0.61493176",
"0.6144997",
"0.6132133",
"0.6111319",
"0.60845107",
"0.60838... | 0.6680704 | 2 |
finds all queries done at a specific time and their count | def find_popular(*date)
find_popular_in_structure(@content.dig(*date))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_count_queries &block\n count = 0\n\n counter_f = ->(name, started, finished, unique_id, payload) {\n unless %w[ CACHE SCHEMA ].include? payload[:name]\n count += 1\n end\n }\n ActiveSupport::Notifications.subscribed(counter_f, \"sql.active_record\", &block)\n count\n end",
... | [
"0.6208783",
"0.61647487",
"0.5990868",
"0.5819741",
"0.5819741",
"0.58058137",
"0.580083",
"0.5775035",
"0.57480115",
"0.5738538",
"0.5738513",
"0.56284136",
"0.56216305",
"0.5621062",
"0.5614222",
"0.5551876",
"0.5546277",
"0.55376446",
"0.55345",
"0.55326754",
"0.5529549",... | 0.0 | -1 |
Override to append the name to UI urls | def to_param
"#{id}-#{name}".parameterize if id.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url(name, *args)\n return base_controller.url(name, *args) if base_controller\n super\n end",
"def url(name, *args)\n return web_controller.url(name, *args) if web_controller\n super\n end",
"def ui_url\n\t\t\thref\n\t\t\t\t.gsub(\"api/v1/companies\", \"foretak\")\n\t\t\t\t.gsub(\... | [
"0.6829752",
"0.6623777",
"0.6579332",
"0.655905",
"0.65565807",
"0.6543499",
"0.63987166",
"0.63987166",
"0.63786364",
"0.63517886",
"0.63517886",
"0.6278649",
"0.62057155",
"0.61847615",
"0.6167556",
"0.61316",
"0.6131585",
"0.6122462",
"0.6077355",
"0.60664713",
"0.6061981... | 0.0 | -1 |
Override the instance method to use the IDonly when calling the REST API, instead of to_param | def element_path(options = nil)
self.class.element_path(id, options || prefix_options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_param\n # We can't use alias_method here, because method 'id' optimizes itself on the fly.\n id && id.to_s # Be sure to stringify the id for routes\n end",
"def to_param\n # We can't use alias_method here, because method 'id' optimizes itself on the fly.\n id&.to_s # Be sure to stri... | [
"0.727242",
"0.7184108",
"0.71458536",
"0.7079675",
"0.70747185",
"0.70205426",
"0.697432",
"0.6833301",
"0.6833301",
"0.67943496",
"0.6733168",
"0.66940296",
"0.66647905",
"0.66647905",
"0.6647923",
"0.6645455",
"0.6612824",
"0.6581974",
"0.65749645",
"0.6569354",
"0.6567884... | 0.0 | -1 |
FIXME would prefer this come from REST API | def ssh_url
uri = URI.parse(git_url)
uri.scheme = 'ssh'
uri.path = ''
uri.fragment = nil
uri
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def get; end",
"def endpoint; end",
"def endpoint; end",
"def endpoint; end",
"def endpoint; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def req... | [
"0.67450005",
"0.65860105",
"0.6316102",
"0.6316102",
"0.6316102",
"0.6316102",
"0.62663716",
"0.62663716",
"0.62663716",
"0.62663716",
"0.62663716",
"0.62663716",
"0.62663716",
"0.62663716",
"0.62663716",
"0.62663716",
"0.62663716",
"0.6262724",
"0.6245145",
"0.6178775",
"0.... | 0.0 | -1 |
Helper to return the segment that would be provided for command line calls | def ssh_string
uri = ssh_url
user = "#{uri.userinfo}@" if uri.userinfo
port = ":#{uri.port}" if uri.port
[user,uri.host,port].join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segment\n return asset_on_segment_history.segment rescue nil\n end",
"def segment_0; segments[0]; end",
"def segments=(_arg0); end",
"def path_section\n $1 if @basename.to_s =~ /\\.(\\d\\w*)\\./\n end",
"def segments\n if magic32?\n command(:LC_SEGMENT)\n else\n comm... | [
"0.6513113",
"0.6506027",
"0.6328275",
"0.63217187",
"0.6251195",
"0.6100757",
"0.6043396",
"0.5980287",
"0.59271765",
"0.59216523",
"0.5905203",
"0.58183146",
"0.5792131",
"0.5770807",
"0.57685566",
"0.57537156",
"0.57297474",
"0.5709887",
"0.5700186",
"0.568685",
"0.5662237... | 0.0 | -1 |
FIXME it is assumed that eventually this will be server functionality | def destroy_build_cartridge
return true if !builds?
cart = Cartridge.new({:application => self, :as => as, :name => building_with}, true)
cart.destroy
rescue ActiveResource::ConnectionError => e
raise unless set_remote_errors(e, true)
#end.tap{ |success| cart.errors.full_messages.each{ |m| errors.add(:base, m) } unless success }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def weber; end",
"def server; end",
"def server... | [
"0.6522539",
"0.6155321",
"0.6155321",
"0.6155321",
"0.6155321",
"0.6155321",
"0.6155321",
"0.6155321",
"0.6155321",
"0.6155321",
"0.6155321",
"0.6155321",
"0.5980717",
"0.59461206",
"0.59461206",
"0.59461206",
"0.59461206",
"0.59461206",
"0.59461206",
"0.59461206",
"0.594612... | 0.0 | -1 |
add material enchantment for appropriate item_level | def add_material_enchantment(item_level)
material_enchantments = [Enchantment.null_object, Grass.new, Wooden.new,
Leather.new, Bronze.new, Iron.new, Steel.new,
Silvered.new, Platinum.new, Mithril.new,
Adamantine.new, Obsidian.new, Crystal.new,
Meteorite.new]
@armor.material_enchantment =
material_enchantments.select { |e| e.bonus_item_level == item_level }
.shuffle.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_material_enchantment(item_level)\n material_enchantments = [Enchantment.null_object, Grass.new, Wooden.new,\n Leather.new, Bronze.new, Iron.new, Steel.new,\n Silvered.new, Platinum.new, Mithril.new,\n Adamantine.new, Obs... | [
"0.82722336",
"0.676917",
"0.6580954",
"0.6406653",
"0.6069625",
"0.6054124",
"0.6024671",
"0.598104",
"0.59142095",
"0.59014714",
"0.574075",
"0.57217866",
"0.5710232",
"0.56751895",
"0.56625825",
"0.56267446",
"0.56001085",
"0.55810684",
"0.5555142",
"0.55418956",
"0.553478... | 0.8281801 | 0 |
GET /clip_apps/1 GET /clip_apps/1.xml | def show
@clip_app = ClipApp.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @clip_app }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @clip_app = ClipApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clip_app }\n end\n end",
"def show\n @app = Mms::App.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml... | [
"0.654169",
"0.6450965",
"0.64217174",
"0.63288176",
"0.63288176",
"0.6305796",
"0.6259469",
"0.62495506",
"0.6245907",
"0.62359965",
"0.6230975",
"0.6168174",
"0.60993314",
"0.6094706",
"0.60535204",
"0.6031383",
"0.6013133",
"0.59918994",
"0.5990894",
"0.59633803",
"0.59554... | 0.7360568 | 0 |
GET /clip_apps/new GET /clip_apps/new.xml | def new
@clip_app = ClipApp.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @clip_app }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @clip_app = ClipApp.new(params[:clip_app])\n\n respond_to do |format|\n if @clip_app.save\n flash[:notice] = 'ClipApp was successfully created.'\n format.html { redirect_to(@clip_app) }\n format.xml { render :xml => @clip_app, :status => :created, :location => @clip_ap... | [
"0.7252861",
"0.70330334",
"0.70330334",
"0.70330334",
"0.6961163",
"0.69610775",
"0.6865086",
"0.66899985",
"0.6594937",
"0.6582845",
"0.65546125",
"0.6505489",
"0.6489617",
"0.6468222",
"0.6468222",
"0.6448085",
"0.6387254",
"0.63644284",
"0.63191175",
"0.6314113",
"0.63023... | 0.7768972 | 0 |
POST /clip_apps POST /clip_apps.xml | def create
@clip_app = ClipApp.new(params[:clip_app])
respond_to do |format|
if @clip_app.save
flash[:notice] = 'ClipApp was successfully created.'
format.html { redirect_to(@clip_app) }
format.xml { render :xml => @clip_app, :status => :created, :location => @clip_app }
else
format.html { render :action => "new" }
format.xml { render :xml => @clip_app.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n ... | [
"0.6195119",
"0.6099283",
"0.60230374",
"0.60230374",
"0.59994435",
"0.58216953",
"0.57686466",
"0.57621473",
"0.57517856",
"0.57475436",
"0.574347",
"0.57238394",
"0.5705727",
"0.5691884",
"0.5691884",
"0.5681764",
"0.56677186",
"0.5651277",
"0.56463903",
"0.56449234",
"0.56... | 0.70052326 | 0 |
PUT /clip_apps/1 PUT /clip_apps/1.xml | def update
@clip_app = ClipApp.find(params[:id])
respond_to do |format|
if @clip_app.update_attributes(params[:clip_app])
flash[:notice] = 'ClipApp was successfully updated.'
format.html { redirect_to(@clip_app) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @clip_app.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n put(\"/apps/#{name}\", :app => attributes).to_s\n end",
"def update_app data={}\n put '/app',... | [
"0.662782",
"0.662782",
"0.6488058",
"0.6390339",
"0.6191458",
"0.6185226",
"0.6169187",
"0.6169187",
"0.6148188",
"0.6092084",
"0.6061456",
"0.6058626",
"0.5958579",
"0.5955184",
"0.59284353",
"0.58988243",
"0.588472",
"0.58208114",
"0.58208114",
"0.581205",
"0.58115417",
... | 0.71506363 | 0 |
DELETE /clip_apps/1 DELETE /clip_apps/1.xml | def destroy
@clip_app = ClipApp.find(params[:id])
@clip_app.destroy
respond_to do |format|
format.html { redirect_to(clip_apps_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @capp = Capp.find(params[:id])\n @capp.destroy\n\n respond_to do |format|... | [
"0.6747255",
"0.6747255",
"0.6548691",
"0.65244263",
"0.65156037",
"0.64601886",
"0.643043",
"0.643043",
"0.643043",
"0.6373347",
"0.6286349",
"0.6274783",
"0.62362474",
"0.6229466",
"0.6203924",
"0.6199175",
"0.6190147",
"0.6189827",
"0.6187863",
"0.6184175",
"0.61710435",
... | 0.7450046 | 0 |
TODO poorly named method. should be something like 'puzzle.submit_guess' | def guess letter
raise InvalidGuessError if letter.strip.empty? || letter.length > 1
letter = letter[0].upcase
if @guesses.include?(letter)
return {advance: false, message: "#{letter} has already been played, silly!"}
else
@guesses << letter
end
@guessed.each_with_index do |guessed_pos, index|
if guessed_pos
if letter == secret[index]
return {advance: false, message: "#{letter} has already been played, silly!"}
end
else
if letter == secret[index]
reveal_all(letter)
return {advance: true, message: "We found #{letter}!"}
end
end
end
{advance: true, message: "Sorry, we did not find #{letter}!"}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit\n solution = @entry.text\n return self.retry() if solution.empty?\n self.solved(solution)\n end",
"def game_guess\n if path == \"/game\" && verb == \"POST\"\n number = client.read\n game.guess(number)\n redirect(client)\n end\n end",
"def correct_guess(guess)\n end... | [
"0.6669285",
"0.66376674",
"0.6564657",
"0.6400997",
"0.6318366",
"0.6282764",
"0.628253",
"0.6237483",
"0.6182586",
"0.61809236",
"0.61710614",
"0.6158519",
"0.61426055",
"0.6134205",
"0.612712",
"0.6104109",
"0.6101937",
"0.6086416",
"0.6083773",
"0.60745674",
"0.60693634",... | 0.0 | -1 |
1. load template if it was changed 2. compile template if +use_compiler+ was set. 3. expand template with +model+ 4. print template to +stream+ | def expand(stream, model)
setup_template if need_update?
context = setup_context
formatter = setup_formatter(stream)
do_expand(model, context, formatter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render compiler, opt=@options\n template = File.read(opt[:template])\n renderer = ERB.new(template)\n output = renderer.result(binding)\nFile.write(opt[:ofile], output)\n FileUtils.chmod('+x', opt[:ofile])\nend",
"def generate\n\t\t\t\tbegin\n\t\t\t\t\ttemplate = @template\n\t\t\t\t\ttemplate_manager = @... | [
"0.6492735",
"0.63580465",
"0.6281894",
"0.6247282",
"0.6245191",
"0.6136416",
"0.6077905",
"0.6045061",
"0.59635264",
"0.5934613",
"0.5914335",
"0.58894724",
"0.57963926",
"0.576842",
"0.5761573",
"0.57147795",
"0.5710937",
"0.5696005",
"0.56904215",
"0.5680183",
"0.5666879"... | 0.0 | -1 |
set Hint data (undocumented now) and compile template by it. | def set_hint(hint)
@hint = hint
compile_template if @use_compiler
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_template(name)\n if @loader.needs_compile?(name)\n lua = @compiler.compile(name, @loader.load_template(name))\n @loader.save_compiled(name, lua)\n end\n end",
"def apply_template(data)\n self.class.template.apply(data)\n end",
"def use_template(template)\n @t... | [
"0.62254804",
"0.6200315",
"0.6167185",
"0.61166793",
"0.6092719",
"0.607161",
"0.6070034",
"0.59895086",
"0.5873658",
"0.5865839",
"0.58562493",
"0.58300865",
"0.5792696",
"0.5792015",
"0.57353663",
"0.5729037",
"0.5724719",
"0.5713351",
"0.56924266",
"0.56699514",
"0.566531... | 0.7663687 | 0 |
generate Hint from data and compile template by it. | def set_hint_by_sample_data(data)
hint = data.amrita_generate_hint
set_hint(hint)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_hint(hint)\n @hint = hint\n compile_template if @use_compiler\n end",
"def apply_template(data)\n self.class.template.apply(data)\n end",
"def data\n templates = @templates.deep_clone\n\n templates.each_pair do |name, value|\n if value['bindings']\n value[... | [
"0.6297596",
"0.599512",
"0.5669768",
"0.5620901",
"0.5597537",
"0.55270714",
"0.5474653",
"0.54735",
"0.54692197",
"0.5465814",
"0.54323775",
"0.5425123",
"0.541897",
"0.54050356",
"0.5378294",
"0.5364697",
"0.53357464",
"0.5335295",
"0.53274816",
"0.5327252",
"0.5320699",
... | 0.52624816 | 24 |
template will be loaded again if modified. | def need_update?
return true unless @lastread
@lastread < File::stat(@path).mtime
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_template_load\n memoize(:template) do\n self.data[:template] = api.stack_template_load(self)\n true\n end\n end",
"def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend",
"def loadTemplate\n\t\t@template = File.read(@templateFile)\n\tend",
... | [
"0.74820936",
"0.73965734",
"0.73965734",
"0.732186",
"0.6780184",
"0.6778105",
"0.67160153",
"0.66423875",
"0.65765905",
"0.6530386",
"0.651656",
"0.6513394",
"0.64740795",
"0.6381886",
"0.6375983",
"0.6368471",
"0.63536924",
"0.6335597",
"0.63343865",
"0.63112664",
"0.63083... | 0.0 | -1 |
display by plain text | def display_matrix( matrix )
return if ! matrix.keys[0]
state_names = matrix.keys
event_names = matrix[matrix.keys[0]].keys
len_ev = 8
event_names.each { |k| len_ev = k.length if k.length > len_ev }
printf( "%*s ", len_ev, "" )
state_names.each { |st| printf( "%-6s ", st ) }
printf( "\n" )
event_names.each do |ev|
printf( "%-*s ", len_ev, ev )
state_names.each do |st|
w = st.length > 6 ? st.length : 6
printf( "%-*s ", w, matrix[st][ev] )
end
printf( "\n" )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_text(text)\n print(text)\n end",
"def display_text\n\t\t\t#specifying font to be used\n\t\t\t#text_font @font, 16\n\t\t\t#text \"Mmmmm ... Strings .... \", 10, 100\n\t\tend",
"def text text\n end",
"def display_text\n return @display_text\n end",
"def displayInf... | [
"0.79402035",
"0.78044695",
"0.7430577",
"0.7404936",
"0.734457",
"0.71567637",
"0.71159726",
"0.6991924",
"0.6963024",
"0.6852001",
"0.6821213",
"0.6821213",
"0.6821213",
"0.6821213",
"0.6821213",
"0.6821213",
"0.6821213",
"0.6821213",
"0.6821213",
"0.6821213",
"0.6821213",
... | 0.0 | -1 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String | def describe_cash_detail(optional={})
args = self.class.new_params
args[:query]['Action'] = 'DescribeCashDetail'
args[:region] = optional[:_region] if (optional.key? :_region)
args[:scheme] = 'https'
if optional.key? :_method
raise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]
args[:method] = optional[:_method]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_method; end",
"def region_params\n params.require(:region).permit(:name, :type)\n end",
"def request_method\n {:filter => :post,\n :sample => :get,\n :firehose => :get,\n :retweet => :get\n }.fetch(@path, :get)\n end",
"def describe_regions(opti... | [
"0.6121899",
"0.61034864",
"0.604771",
"0.5988807",
"0.5971664",
"0.5966014",
"0.5966014",
"0.5923839",
"0.59207773",
"0.5919455",
"0.5874085",
"0.58594507",
"0.5852478",
"0.5833851",
"0.5832746",
"0.57947683",
"0.5756628",
"0.5756628",
"0.5737441",
"0.57164884",
"0.569262",
... | 0.0 | -1 |
optional parameters: name: _method, type: String, optional values: GET|POSTS name: _region, type: String name: coupon_number, type: String | def describe_coupon_detail(optional={})
args = self.class.new_params
args[:query]['Action'] = 'DescribeCouponDetail'
args[:region] = optional[:_region] if (optional.key? :_region)
args[:scheme] = 'https'
if optional.key? :_method
raise ArgumentError, '_method must be GET|POSTS' unless 'GET|POSTS'.split('|').include? optional[:_method]
args[:method] = optional[:_method]
end
if optional.key? :coupon_number
args[:query]['CouponNumber'] = optional[:coupon_number]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coupon_params\n params.require(:coupon).permit(:code, :valid_city, :value, :value_type, :qualifying_amount, :max_discount, :max_usage, :max_usage_per_user, :expire_date, :start_date, :success_message, :coupon_message, :status, :valid_product, :valid_category, :valid_company)\n end",
"def coupon_param... | [
"0.63039553",
"0.6216835",
"0.6216835",
"0.6198332",
"0.60573524",
"0.6047091",
"0.60166675",
"0.5990764",
"0.5913594",
"0.5898596",
"0.5847093",
"0.5846658",
"0.5845666",
"0.584355",
"0.5815883",
"0.5797538",
"0.5779416",
"0.5777273",
"0.577414",
"0.5773652",
"0.5766444",
... | 0.5901563 | 9 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: end_delivery_time, type: String name: page_num, type: Integer name: page_size, type: Integer name: start_delivery_time, type: String name: status, type: String | def describe_coupon_list(optional={})
args = self.class.new_params
args[:query]['Action'] = 'DescribeCouponList'
args[:region] = optional[:_region] if (optional.key? :_region)
args[:scheme] = 'https'
if optional.key? :_method
raise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]
args[:method] = optional[:_method]
end
if optional.key? :end_delivery_time
args[:query]['EndDeliveryTime'] = optional[:end_delivery_time]
end
if optional.key? :page_num
args[:query]['PageNum'] = optional[:page_num]
end
if optional.key? :page_size
args[:query]['PageSize'] = optional[:page_size]
end
if optional.key? :start_delivery_time
args[:query]['StartDeliveryTime'] = optional[:start_delivery_time]
end
if optional.key? :status
args[:query]['Status'] = optional[:status]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_parameters #:nodoc:#\n @request_parameters = [:version, :method, :startdate, :enddate,\n :email, :receiver, :receiptid,\n :transactionid, :invnum, :acct, :auctionitemnumber,\n :transactionclass... | [
"0.57417303",
"0.5623378",
"0.5605684",
"0.5581801",
"0.5560824",
"0.54760575",
"0.5420211",
"0.5415899",
"0.5387421",
"0.5360834",
"0.53264624",
"0.5298722",
"0.5291762",
"0.5228694",
"0.521636",
"0.51796734",
"0.5177015",
"0.51631093",
"0.5160689",
"0.51240826",
"0.5123607"... | 0.0 | -1 |
required parameters: name: business_status, type: String name: resource_id, type: String name: resource_type, type: String optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: owner_account, type: String name: owner_id, type: Long name: resource_owner_account, type: String name: resource_owner_id, type: Long | def set_resource_business_status(business_status, resource_id, resource_type, optional={})
args = self.class.new_params
args[:query]['Action'] = 'SetResourceBusinessStatus'
args[:query]['BusinessStatus'] = business_status
args[:query]['ResourceId'] = resource_id
args[:query]['ResourceType'] = resource_type
args[:region] = optional[:_region] if (optional.key? :_region)
if optional.key? :_method
raise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]
args[:method] = optional[:_method]
end
if optional.key? :_scheme
raise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]
args[:scheme] = optional[:_scheme]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
if optional.key? :owner_id
args[:query]['OwnerId'] = optional[:owner_id]
end
if optional.key? :resource_owner_account
args[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]
end
if optional.key? :resource_owner_id
args[:query]['ResourceOwnerId'] = optional[:resource_owner_id]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status_params\n end",
"def business_company_param\n params.require(:business_company).permit(\n :name,\n :type_identification,\n :rif,\n :email,\n :phone,\n :status,\n :address,\n :business_company_type_id,\n :firt_name_responsable,\n ... | [
"0.64747787",
"0.6233417",
"0.610401",
"0.6095689",
"0.5862478",
"0.57971114",
"0.578803",
"0.5779376",
"0.5774609",
"0.5758878",
"0.5754734",
"0.57527983",
"0.574455",
"0.57399994",
"0.5688478",
"0.56878644",
"0.5646312",
"0.56443095",
"0.56333536",
"0.5631754",
"0.561869",
... | 0.6960128 | 0 |
Returns a command appropriate for executing at the command line. | def cmd
branch = self.known_options.first || default_branch
c = ["git checkout #{branch}"]
c << "git pull"
c << "git checkout #{current_branch}"
c.join("\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command\n if args.skip?\n ''\n else\n commands.join('; ')\n end\n end",
"def command\n return @raw_command\n end",
"def command\n return \"#{@command} #{options}\"\n end",
"def command\n @command ||= command_for(:query)\n end",
"def build_command(... | [
"0.7128474",
"0.70675427",
"0.7066765",
"0.696326",
"0.6928075",
"0.69265914",
"0.68942326",
"0.6878849",
"0.6872279",
"0.6820063",
"0.68168956",
"0.6816505",
"0.6805156",
"0.6796534",
"0.6723428",
"0.66912925",
"0.6684657",
"0.6684657",
"0.66840476",
"0.6649761",
"0.6611156"... | 0.0 | -1 |
Always returns a +Result+. Successful result contains +String+ value with booking identifier on JTB side. If an error happens in any step in the process of getting a response back from JTB, a generic error message is sent back to the caller, and the failure is logged example: booking = JTB::Booking.new(credentials) booking.book(params) => | def book(params)
rate_plan = price_handler.best_rate_plan(params)
return rate_plan unless rate_plan.success?
u_id = JTB::UnitId.from_roomorama_unit_id(params[:unit_id])
message = builder.build_booking(params, rate_plan.value, u_id.room_type_code)
result = remote_call(message)
return result unless result.success?
result = response_parser.parse_booking(result.value)
return result unless result.success?
reference_number = ReferenceNumber.from_jtb_ids(result.value, rate_plan.value.rate_plan)
Result.new(reference_number.reference_number)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n begin\n @response = Booking.get_booking(params[:id])\n rescue RestClient::Exception => exception\n @error = exception.response\n end\n end",
"def returns\n @book.returns(@user)\n return render json: { object: 'Loan'}, status: :ok\n rescue Exceptions::InvalidLoan\n render... | [
"0.646627",
"0.6084998",
"0.5970742",
"0.5917201",
"0.5845662",
"0.5839527",
"0.58057135",
"0.5802752",
"0.5750317",
"0.5715851",
"0.5715851",
"0.5617162",
"0.5572017",
"0.5539328",
"0.5506153",
"0.5495355",
"0.5476203",
"0.54693884",
"0.5466819",
"0.54579586",
"0.5449032",
... | 0.59052545 | 4 |
GET /gnc_charges or /gnc_charges.json | def index
@gnc_charges = GncCharge.all
@gnc_charges = @gnc_charges.order(:name).page(params[:page] || 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_charges(opts = {})\n data, _status_code, _headers = get_charges_with_http_info(opts)\n data\n end",
"def get_charges_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ChargesApi.get_charges ...'\n end\n allowable... | [
"0.7041355",
"0.7008292",
"0.66574335",
"0.6636579",
"0.65709555",
"0.65546435",
"0.646706",
"0.6369776",
"0.63614845",
"0.6152996",
"0.6134411",
"0.6100954",
"0.60793185",
"0.59721094",
"0.59335184",
"0.5900671",
"0.58650154",
"0.5851455",
"0.58444464",
"0.5840747",
"0.57956... | 0.6775617 | 2 |
GET /gnc_charges/1 or /gnc_charges/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve(params = {})\n req = WebPay::ChargeIdRequest.create(params)\n raw_response = @client._request(:get, 'charges' + '/' + req.id.to_s, req)\n WebPay::ChargeResponse.new(raw_response)\n end",
"def get_charges_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.... | [
"0.69693613",
"0.6942043",
"0.67720336",
"0.6685739",
"0.66748536",
"0.6636077",
"0.6551578",
"0.65023655",
"0.63042474",
"0.6288575",
"0.6274015",
"0.6178675",
"0.6166512",
"0.6120984",
"0.59975225",
"0.5914405",
"0.591163",
"0.5905608",
"0.5879589",
"0.5835569",
"0.5832266"... | 0.0 | -1 |
POST /gnc_charges or /gnc_charges.json | def create
@gnc_charge = GncCharge.new(gnc_charge_params)
respond_to do |format|
if @gnc_charge.save
format.html { redirect_to @gnc_charge, notice: "Gnc charge was successfully created." }
format.json { render :show, status: :created, location: @gnc_charge }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @gnc_charge.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post\n begin\n charge = Stripe::Charge.create({\n amount: params[:amount],\n currency: 'sgd',\n customer: params[:customer_id],\n source: params[:card_id]\n })\n\n json_response(charge, :created)\n\n rescue Stripe::InvalidRequestError => exception\n respons... | [
"0.7134873",
"0.69879496",
"0.649513",
"0.64813495",
"0.6298599",
"0.62641007",
"0.62587076",
"0.62117076",
"0.6204954",
"0.61862457",
"0.61270267",
"0.6126929",
"0.6100421",
"0.60857713",
"0.60856265",
"0.6078365",
"0.60774004",
"0.6065738",
"0.6023632",
"0.59986895",
"0.599... | 0.71333915 | 1 |
PATCH/PUT /gnc_charges/1 or /gnc_charges/1.json | def update
respond_to do |format|
if @gnc_charge.update(gnc_charge_params)
format.html { redirect_to @gnc_charge, notice: "Gnc charge was successfully updated." }
format.json { render :show, status: :ok, location: @gnc_charge }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @gnc_charge.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @charge = Charge.find(params[:id])\n\n respond_to do |format|\n if @charge.update_attributes(params[:charge])\n format.html { redirect_to @charge, notice: 'Charge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ... | [
"0.64562017",
"0.6412731",
"0.6412731",
"0.63072777",
"0.6260032",
"0.6177947",
"0.6143065",
"0.60947376",
"0.595773",
"0.59409714",
"0.5932641",
"0.59081906",
"0.59028745",
"0.5895656",
"0.5854961",
"0.58538496",
"0.585377",
"0.58471537",
"0.5842341",
"0.5826301",
"0.5817577... | 0.71681064 | 0 |
DELETE /gnc_charges/1 or /gnc_charges/1.json | def destroy
@gnc_charge.destroy
respond_to do |format|
format.html { redirect_to gnc_charges_url, notice: "Gnc charge was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @charge = Charge.find(params[:id])\n @charge.destroy\n\n respond_to do |format|\n format.html { redirect_to charges_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
... | [
"0.7016987",
"0.6905841",
"0.6817412",
"0.6817412",
"0.6817412",
"0.6795485",
"0.6705489",
"0.6672524",
"0.6638497",
"0.6571137",
"0.65454775",
"0.65031546",
"0.6499636",
"0.64540356",
"0.644951",
"0.6406082",
"0.6389686",
"0.6367689",
"0.6362047",
"0.6361244",
"0.63542503",
... | 0.73027146 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_gnc_charge
@gnc_charge = GncCharge.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 list of trusted parameters through. | def gnc_charge_params
params.require(:gnc_charge).permit(:charge_moment, :weather, :celsius_temperature, :cost_on_argentinian_pesos, :car_id, :service_station_id, :client_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Default parser for rubocop output. | def initialize(id = :rubocop)
super(id, 'rubocop')
# just use sensible defaults here.
add_filter(:offenses_filter, /(\d+)\s+file.*,\s+(\d+)\s+offense/) do |matches|
result_failure(RubocopCommandDefinition.failure_msg(matches[1], matches[0]))
end
add_filter(:no_offenses_filter, /(\d+)\s+file.*,\s+no\s+offenses/) do |matches|
result_success(RubocopCommandDefinition.success_msg(matches[0]))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parser; end",
"def parser; end",
"def parser; end",
"def parser; end",
"def configure_parser; end",
"def pluggable_parser; end",
"def parser( &block )\n nested_class( 'Parser', Yacl::Define::Cli::Parser, &block )\n end",
"def parser\n if !defined?(@parser) || !@parser\n DE... | [
"0.6567499",
"0.6567499",
"0.6567499",
"0.6567499",
"0.65168035",
"0.65165186",
"0.64799666",
"0.6335054",
"0.62232894",
"0.61618423",
"0.61071616",
"0.60415214",
"0.5970573",
"0.5949657",
"0.5935999",
"0.5898791",
"0.5896296",
"0.58195615",
"0.5813305",
"0.5803259",
"0.58010... | 0.0 | -1 |
GET /rubygems/1 GET /rubygems/1.json | def show
@rubygem = Rubygem.find(params[:id])
render json: @rubygem
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_rubygems\n make_api_request(\"https://rubygems.org/api/v1/versions/alchemy_cms.json\")\n end",
"def retrieve_latest(name)\n client.url = \"https://rubygems.org/api/v1/gems/#{name}.json\"\n client.http_get\n spec = client.body_str\n gem = parse spec\n gem\... | [
"0.6802576",
"0.66162646",
"0.6544929",
"0.6260138",
"0.6186106",
"0.6175396",
"0.6130402",
"0.60706097",
"0.5998385",
"0.5746425",
"0.5692837",
"0.55853516",
"0.5555708",
"0.55157995",
"0.5412115",
"0.539517",
"0.53873324",
"0.53730893",
"0.53641295",
"0.5358713",
"0.5312424... | 0.6266129 | 3 |
POST /rubygems POST /rubygems.json | def create
@rubygem = Rubygem.new(rubygem_params)
if @rubygem.save
render json: @rubygem, status: :created, location: @rubygem
else
render json: @rubygem.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installandlaunch(token, rid, filename , grant_all_permissions )\nuri = URI.parse(\"https://device.pcloudy.com/api/install_app\")\n@toSend = {\n \"token\"=>token, \"rid\"=>rid, \"filename\"=>filename, \"grant_all_permissions\"=>grant_all_permissions\n}.to_json\n\nhttps = Net::HTTP.new(uri.host,uri.port)\nhttp... | [
"0.58653224",
"0.5798375",
"0.5694402",
"0.5658587",
"0.5392319",
"0.5369518",
"0.53573644",
"0.52233106",
"0.52200425",
"0.5044266",
"0.5004064",
"0.5003382",
"0.49725106",
"0.49707073",
"0.4965867",
"0.49505794",
"0.49052423",
"0.4878658",
"0.48764148",
"0.48667938",
"0.483... | 0.60047007 | 0 |
PATCH/PUT /rubygems/1 PATCH/PUT /rubygems/1.json | def update
@rubygem = Rubygem.find(params[:id])
if @rubygem.update(rubygem_params)
head :no_content
else
render json: @rubygem.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch(path, **args); end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch!\n request! :patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n ... | [
"0.6493283",
"0.6430437",
"0.6371671",
"0.6259125",
"0.61894447",
"0.61600393",
"0.61600393",
"0.6153663",
"0.6125336",
"0.5946855",
"0.5942016",
"0.5897154",
"0.58955175",
"0.5880322",
"0.5875909",
"0.5875909",
"0.5864003",
"0.5846471",
"0.5786326",
"0.5781631",
"0.57385606"... | 0.65224844 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.