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 |
|---|---|---|---|---|---|---|
POST /tweets POST /tweets.json | def create
@tweet = Tweet.new(tweet_params)
@tweet.user_vote = 0
respond_to do |format|
if @tweet.save
format.html { redirect_to @tweet, notice: 'Tweet was successfully created.' }
format.json { render :show, status: :created, location: @tweet }
else
format.html { render :new }
format.json { render json: @tweet.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n user = user_from_token\n @tweet = user.tweets.new()\n @tweet.tweet = params[:tweet]\n if @tweet.save\n render :json => @tweet, :status => :created\n else\n render :json => @tweet.errors, :status => :unprocessable_entity\n end\n end",
"def create\n @tweet = current_use... | [
"0.7703366",
"0.72558355",
"0.71856695",
"0.7130213",
"0.705414",
"0.7018085",
"0.7003551",
"0.6994446",
"0.698963",
"0.69707346",
"0.69707346",
"0.69071674",
"0.6893714",
"0.68830514",
"0.6881277",
"0.6819126",
"0.67953306",
"0.678633",
"0.6756683",
"0.6734242",
"0.6720373",... | 0.6560885 | 34 |
PATCH/PUT /tweets/1 PATCH/PUT /tweets/1.json | def update
respond_to do |format|
if @tweet.update(tweet_params)
format.js
format.html { redirect_to tweets_url, notice: 'Tweet was successfully updated.' }
format.json { render :show, status: :ok, location: @tweet }
else
format.html { render :edit }
format.json { render json: @tweet.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @tweet = Tweet.find(params[:id])\n\n respond_to do |format|\n if @tweet.update_attributes(params[:tweet])\n format.html { redirect_to @tweet, notice: 'Tweet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.7197328",
"0.7197328",
"0.7197328",
"0.7190091",
"0.7104329",
"0.70864266",
"0.70808625",
"0.7032461",
"0.6948526",
"0.6948526",
"0.6948526",
"0.6948526",
"0.69477296",
"0.69121426",
"0.69121426",
"0.69121426",
"0.68921447",
"0.6882045",
"0.6846168",
"0.6831158",
"0.679819... | 0.6423269 | 36 |
DELETE /tweets/1 DELETE /tweets/1.json | def destroy
@tweet.destroy
respond_to do |format|
format.js
format.html { redirect_to tweets_url, notice: 'Tweet was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n user = user_from_token\n user.tweets.destroy(params[:id])\n head :no_content\n end",
"def destroy\n @tweet = Tweet.find(params[:id])\n @tweet.destroy\n\n respond_to do |format|\n format.html { redirect_to tweets_url }\n format.json { head :no_content }\n end\n end",... | [
"0.7619746",
"0.74507135",
"0.74507135",
"0.744736",
"0.7429372",
"0.7330026",
"0.73022366",
"0.7290246",
"0.7261834",
"0.72386956",
"0.7213443",
"0.7213443",
"0.7213443",
"0.7213443",
"0.7213443",
"0.7213443",
"0.72114694",
"0.7209884",
"0.7209884",
"0.7209884",
"0.7209884",... | 0.6557595 | 62 |
Use callbacks to share common setup or constraints between actions. | def set_tweet
@tweet = Tweet.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 tweet_params
params.require(:tweet).permit(:company_id, :text, :username, :useful, :bayesfilter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Custom sort method for AJAX sortability POST /feeds/sort | def sort
params[:feeds].each_with_index do |id, index|
Feed.update_all(['position=?', index+1], ['id=?', id])
end
render :nothing => true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_params; end",
"def sort_params; end",
"def sort_entries; end",
"def sort(collection)\n sort = params[:sort]\n return collection unless sort\n\n sort_fields = Jaf::SortFields.deserialize(sort)\n collection.order(sort_fields)\n end",
"def sortable_sort\n @sortable_sort\n end",
"de... | [
"0.7070612",
"0.7070612",
"0.6880337",
"0.6647745",
"0.65386146",
"0.64456457",
"0.6409838",
"0.6408613",
"0.6372644",
"0.63698274",
"0.6353738",
"0.63450414",
"0.6343259",
"0.6328054",
"0.6317993",
"0.6307229",
"0.62989444",
"0.62744915",
"0.6272533",
"0.6264759",
"0.624176"... | 0.6709892 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_group
@group = Group.find_by(cod_id: 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 group_params
params.require(:group).permit(:cod_id, :descr, :nom, :geometry)
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 |
GET /folha/fonte_recursos/1 GET /folha/fonte_recursos/1.xml | def show
@folha_fonte_recurso = Folha::FonteRecurso.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @folha_fonte_recurso }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @folha_fonte_recurso = Folha::FonteRecurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @folha_fonte_recurso }\n end\n end",
"def index\n @fontes_de_recurso = FonteDeRecurso.all\n end",
"def index\n @ficha_tematicas = FichaTemat... | [
"0.67986166",
"0.6510254",
"0.64190376",
"0.6332299",
"0.62508994",
"0.6156716",
"0.61154336",
"0.6066128",
"0.6064156",
"0.6020125",
"0.5996897",
"0.5989245",
"0.5948115",
"0.5941834",
"0.59392554",
"0.5932778",
"0.592614",
"0.5925721",
"0.59229153",
"0.59220743",
"0.5918553... | 0.7212535 | 0 |
GET /folha/fonte_recursos/new GET /folha/fonte_recursos/new.xml | def new
@folha_fonte_recurso = Folha::FonteRecurso.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @folha_fonte_recurso }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @folha_fonte_recurso = Folha::FonteRecurso.new(params[:folha_fonte_recurso])\n\n respond_to do |format|\n if @folha_fonte_recurso.save\n format.html { redirect_to(@folha_fonte_recurso, :notice => 'Fonte recurso cadastrado com sucesso.') }\n format.xml { render :xml => @folha_... | [
"0.7165466",
"0.7123394",
"0.70717293",
"0.7062308",
"0.7053969",
"0.7014244",
"0.70023257",
"0.6994842",
"0.69882905",
"0.6973694",
"0.69653803",
"0.69608945",
"0.6924424",
"0.69081575",
"0.6904836",
"0.68923503",
"0.6881837",
"0.6872291",
"0.6868262",
"0.6864104",
"0.686336... | 0.78595954 | 0 |
POST /folha/fonte_recursos POST /folha/fonte_recursos.xml | def create
@folha_fonte_recurso = Folha::FonteRecurso.new(params[:folha_fonte_recurso])
respond_to do |format|
if @folha_fonte_recurso.save
format.html { redirect_to(@folha_fonte_recurso, :notice => 'Fonte recurso cadastrado com sucesso.') }
format.xml { render :xml => @folha_fonte_recurso, :status => :created, :location => @folha_fonte_recurso }
else
format.html { render :action => "new" }
format.xml { render :xml => @folha_fonte_recurso.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @fonte_de_recurso = FonteDeRecurso.new(fonte_de_recurso_params)\n\n respond_to do |format|\n if @fonte_de_recurso.save\n addlog(\"Fonte e recurso criada\")\n format.html { redirect_to @fonte_de_recurso, notice: 'Fonte de recurso criado com sucesso.' }\n format.json { re... | [
"0.6576212",
"0.6546346",
"0.5989254",
"0.59138715",
"0.5829405",
"0.5679341",
"0.5659937",
"0.5561227",
"0.5525281",
"0.54951185",
"0.5408069",
"0.54039514",
"0.5390445",
"0.53696644",
"0.53580695",
"0.5331035",
"0.53213084",
"0.5311783",
"0.52930653",
"0.52399963",
"0.52396... | 0.7028034 | 0 |
PUT /folha/fonte_recursos/1 PUT /folha/fonte_recursos/1.xml | def update
@folha_fonte_recurso = Folha::FonteRecurso.find(params[:id])
respond_to do |format|
if @folha_fonte_recurso.update_attributes(params[:folha_fonte_recurso])
format.html { redirect_to(@folha_fonte_recurso, :notice => 'Fonte recurso atualizado com sucesso.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @folha_fonte_recurso.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @fonte_de_recurso.update(fonte_de_recurso_params)\n addlog(\"Fonte de recurso atualizada\")\n format.html { redirect_to @fonte_de_recurso, notice: 'Fonte de recurso atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: ... | [
"0.6718887",
"0.6204177",
"0.6086003",
"0.600813",
"0.5998788",
"0.59138423",
"0.58684003",
"0.5863639",
"0.57224727",
"0.57072246",
"0.568265",
"0.56784505",
"0.56596494",
"0.56312805",
"0.5617255",
"0.5592369",
"0.5580204",
"0.5570335",
"0.55690354",
"0.55552244",
"0.553742... | 0.7004521 | 0 |
DELETE /folha/fonte_recursos/1 DELETE /folha/fonte_recursos/1.xml | def destroy
@folha_fonte_recurso = Folha::FonteRecurso.find(params[:id])
@folha_fonte_recurso.destroy
respond_to do |format|
format.html { redirect_to(folha_fonte_recursos_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @orc_ficha = OrcFicha.find(params[:id])\n @orc_ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_fichas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @texte_accueil = TexteAccueil.find(params[:id])\n @texte_accueil.destroy\n\n ... | [
"0.70066607",
"0.68796295",
"0.6851178",
"0.6823986",
"0.6794931",
"0.6768692",
"0.6767139",
"0.6751718",
"0.6751042",
"0.67501384",
"0.6742871",
"0.6707887",
"0.67000794",
"0.667924",
"0.66605526",
"0.6650227",
"0.66497517",
"0.6629498",
"0.66248184",
"0.6623169",
"0.6609649... | 0.7105803 | 0 |
love this which comes from sandi metz, simply initializing with named arguments, and setting a default of zero. | def initialize(**opts)
@price_over = opts[:price_over] || 0
@basket_discount = opts[:basket_discount] || 0
@product_code = opts[:product_code] || 0
@product_quantity = opts[:product_quantity] || 0
@new_price = opts[:new_price] || 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default=(_arg0); end",
"def initialize(p0=\"\") end",
"def initial=(_arg0); end",
"def initialize(a = 0, b = 0, c = 0, d = 0)\n @a = a unless a.nil?\n @b = b unless b.nil?\n @c = c unless c.nil?\n @d = d unless d.nil?\n end",
"def def_zero major, minor\n def_value major, minor, 0\n ... | [
"0.7222659",
"0.6853572",
"0.68361557",
"0.67975974",
"0.6758735",
"0.67518103",
"0.66936755",
"0.66505426",
"0.6483156",
"0.6483156",
"0.64736325",
"0.6457962",
"0.6456074",
"0.64322966",
"0.6431414",
"0.642697",
"0.64018947",
"0.6396481",
"0.6390889",
"0.6362062",
"0.636206... | 0.63410795 | 30 |
SETTER: this is how you change instance variables from outside | def seconds=(new_seconds)
@seconds = new_seconds
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setter__\n \"#{self}=\"\n end",
"def instance_variable_set(p0, p1) end",
"def set!(instance, value)\n instance.instance_variable_set(instance_variable_name, value)\n end",
"def set!(instance, value)\n instance.instance_variable_set(@instance_variable_name, value)\n self\n ... | [
"0.7314075",
"0.7203706",
"0.7091228",
"0.70637614",
"0.7028197",
"0.6939434",
"0.686328",
"0.686328",
"0.67835385",
"0.67055833",
"0.6695053",
"0.6674326",
"0.6666394",
"0.6623259",
"0.65997064",
"0.65997064",
"0.65984195",
"0.65937316",
"0.6575329",
"0.6575329",
"0.6575329"... | 0.0 | -1 |
GETTER: this returns the value of the instance variable | def seconds
@seconds
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get\n @value\n end",
"def get\n val\n end",
"def get\n val\n end",
"def get_value\n @value\n end",
"def get_value\n @value \n end",
"def get(value)\n value\n end",
"def get\n @mutex.synchronize { @value }\n end",
"def value\r\n ... | [
"0.8289848",
"0.81380045",
"0.81380045",
"0.7707077",
"0.76995116",
"0.75391614",
"0.746769",
"0.7435873",
"0.73937696",
"0.7388659",
"0.7388659",
"0.7388659",
"0.73704356",
"0.73704356",
"0.73574436",
"0.73485553",
"0.7304236",
"0.7304236",
"0.7304236",
"0.7304236",
"0.73042... | 0.0 | -1 |
This is the quick smart way | def time_string
hours = @seconds/3600 #if not an hour will be stored as 0
remainder = @seconds%3600 #modulo gives the amount that remains
sprintf("%02d:%02d:%02d", hours, remainder/60, remainder%60) #string formatting
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def schubert; end",
"def suivre; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def terpene; end",
"def anchored; end",
"def stderrs; end",
"def refutal()\n end",
"def formation; end",
"def verdi; end",
"def ... | [
"0.674454",
"0.6229655",
"0.6138724",
"0.6109446",
"0.5984392",
"0.5984392",
"0.5984392",
"0.5984392",
"0.5767738",
"0.570093",
"0.565776",
"0.56045496",
"0.5586229",
"0.5579268",
"0.55474216",
"0.55465907",
"0.5529137",
"0.551397",
"0.54968756",
"0.5484835",
"0.54398924",
... | 0.0 | -1 |
Returns the api properties used to connect to the network service resource | def api
{
'host' => self['apiHost'],
'password' => self['apiPassword'],
'path' => self['apiPath'],
'port' => self['apiPort'],
'protocol' => self['apiProtocol'],
'username' => self['apiUsername']
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_properties\n end",
"def read_network_properties_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.read_network_properties ...\"\n end\n # resource path\n local_var_path = \"/node/networ... | [
"0.672411",
"0.6707109",
"0.62542915",
"0.612648",
"0.605689",
"0.5968345",
"0.59643066",
"0.5953441",
"0.5942669",
"0.5938788",
"0.5931861",
"0.5915803",
"0.58995813",
"0.58844525",
"0.5821192",
"0.5810311",
"0.5763357",
"0.5747126",
"0.57311344",
"0.5715752",
"0.57139266",
... | 0.6429231 | 2 |
Returns the network service resource type name | def type
self['type']['type']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_name\n raise TypeError, 'no type on this reply' unless\n instance_variable_defined? :@type\n\n @type.split('.').first.sub '_', ''\n end",
"def get_resource_type_identifier(type)\n get_type_identifier(type, Occi::Core::Resource.kind)\n end",
"def resource_name\n resource... | [
"0.7220518",
"0.7087991",
"0.70208895",
"0.6983821",
"0.6981845",
"0.6966585",
"0.6956692",
"0.68372697",
"0.67974854",
"0.6740067",
"0.66943884",
"0.6683098",
"0.6652709",
"0.66316104",
"0.6631166",
"0.6577122",
"0.6560205",
"0.6555105",
"0.6552634",
"0.65180606",
"0.6518060... | 0.0 | -1 |
returns a properly formatted phone number. | def format_phone_number(phone_number_str)
b = phone_number_str
c = b.gsub(" ", "").gsub(".", "").gsub("-", "")
"(" + c[0..2] + ")" + " " + c[3..5] + "-" + c[6..9]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatted_phone_number\n Phonelib.parse(phone_number).local_number\n end",
"def formatted_phone_number\n Phonelib.parse(phone_number).local_number\n end",
"def formatted_phone_number\n Phonelib.parse(phone_number).local_number\n end",
"def formatted_phone\n phone\n end",
"def fo... | [
"0.88608974",
"0.88608974",
"0.88608974",
"0.8573699",
"0.845018",
"0.8267938",
"0.82413036",
"0.8189943",
"0.81600267",
"0.81494856",
"0.81199133",
"0.81020707",
"0.80932367",
"0.80912817",
"0.80329806",
"0.7996358",
"0.79803115",
"0.79191643",
"0.7906887",
"0.78721225",
"0.... | 0.7594456 | 33 |
this is used to generate URL in development mode | def port
@presenter.port
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_url\n\t\tif self.url.blank?\n\t\t\tself.dev_stage.blank? ? dev_stage_string = \"\" : dev_stage_string = \"-\" + self.dev_stage + \"-\"\n\t\t\tcomponent_string = self.component.downcase.gsub(/[^a-zA-Z0-9]+/, \"-\").chomp(\"-\")\n\t\t\tversion_string = self.maj_version.to_s + \"-\" + self.min_version.to_s... | [
"0.7541227",
"0.7219365",
"0.7182593",
"0.71506053",
"0.71082056",
"0.7090069",
"0.70846254",
"0.70665073",
"0.7025436",
"0.693468",
"0.6905737",
"0.69050467",
"0.68797916",
"0.68797916",
"0.6853423",
"0.6839726",
"0.6835069",
"0.6835069",
"0.68015647",
"0.678917",
"0.6754920... | 0.0 | -1 |
This code was taken from active_record_helper.rb | def rp_error_messages_for(*params)
options = params.extract_options!.symbolize_keys
if object = options.delete(:object)
objects = [object].flatten
count = objects.inject(0) { |sum, obj|
sum += params.inject(0) {|s, p|
obj.errors.detect { |e|
e.include?(p.to_s)
}.blank? ? s : s + 1
}
}
# count = objects.inject(0) {|sum, object| sum + object.errors.count }
else
objects = params.collect {|object_name| instance_variable_get("@#{object_name}") }.compact
count = objects.inject(0) {|sum, object| sum + object.errors.count }
end
unless count.zero?
html = {}
[:id, :class].each do |key|
if options.include?(key)
value = options[key]
html[key] = value unless value.blank?
else
html[key] = 'errorExplanation'
end
end
options[:header_only] ||= false
name = objects.first
if name.respond_to?('property')
options[:object_name] ||= name.property.name
elsif name.respond_to?('resource_type')
options[:object_name] ||= name.resource_type.name
elsif name.respond_to?('name')
options[:object_name] ||= name.name
else
options[:object_name] ||= ''
end
unless options.include?(:header_message)
if options[:header_only]
options[:header_message] = "Errors prohibited #{options[:object_name].to_s.gsub('_', ' ')} from being saved"
else
options[:header_message] = "#{options[:object_name].to_s.gsub('_', ' ')}"
end
end
options[:message] ||= ''#There were problems with the following fields:' unless options.include?(:message)
error_messages = objects.map {|object| object.errors.full_messages.map {|msg| content_tag(:li, msg) } }
contents = ''
contents << content_tag(options[:header_tag] || :h2, options[:header_message]) unless options[:header_message].blank?
contents << content_tag(:p, options[:message]) unless options[:message].blank? or options[:header_only]
contents << content_tag(:ul, error_messages) unless options[:header_only]
content_tag(:div, contents, html)
else
''
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orm; end",
"def subscribe_sql_active_record; end",
"def private; end",
"def real_column; end",
"def single_object_db; end",
"def subscribe_sql_active_record=(_arg0); end",
"def prerecord(klass, name); end",
"def sdb_to_ruby(name, value)\n# puts 'sdb_to_ruby arg=' + name.inspect + ' - '... | [
"0.5917317",
"0.5899161",
"0.5853252",
"0.55706394",
"0.5535221",
"0.5432858",
"0.539077",
"0.53449047",
"0.53095895",
"0.5245881",
"0.52411354",
"0.52411354",
"0.52387166",
"0.52336055",
"0.52162683",
"0.51960176",
"0.5171255",
"0.5149756",
"0.5149756",
"0.51436627",
"0.5120... | 0.0 | -1 |
Handle to designage/move sortable elements | def sort_handler(force = false)
# return unless logged_in?
# return if @is_homepage and (not force)
'<img class="sort_handler" src="/images/arrow.gif" alt="" />'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sortable(pos)\n @sortable[pos]\n end",
"def update_sortable(pos, newVal)\n sort_function = @parent.sort_function(pos)\n if sort_function\n @sortable[pos] = sort_function.call(newVal)\n else\n @sortable[pos] = newVal\n end\n end",
"def __sortable__\n self\n end",
"de... | [
"0.69781756",
"0.670934",
"0.66613495",
"0.6188665",
"0.61590856",
"0.61583745",
"0.60426706",
"0.5957023",
"0.581892",
"0.57525957",
"0.5735824",
"0.56466484",
"0.5603152",
"0.5530853",
"0.54576087",
"0.5410814",
"0.53945756",
"0.53719366",
"0.53404105",
"0.5326266",
"0.5305... | 0.0 | -1 |
Return a pointer to the first form element in libcurl. | def first
@first ||= FFI::MemoryPointer.new(:pointer)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parseTarget(url)\n response = Nokogiri::HTML(RestClient.get(url))\n\n forms = response.css('form')\n puts \"there are #{forms.length} forms\"\n forms_attributes = []\n forms.each_with_index do |el, index|\n puts\n forms_attributes[index] = el.to_s.split('>')[0]\n puts \" #... | [
"0.5553469",
"0.5488442",
"0.5430206",
"0.5314752",
"0.5271995",
"0.52333486",
"0.5200609",
"0.5145032",
"0.51377267",
"0.51080287",
"0.5100265",
"0.5035936",
"0.50172025",
"0.50081843",
"0.49990615",
"0.4996669",
"0.4993031",
"0.4993031",
"0.49808604",
"0.49773577",
"0.49769... | 0.0 | -1 |
Return a pointer to the last form element in libcurl. | def last
@last ||= FFI::MemoryPointer.new(:pointer)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_form_last_action(form_name)\n get_form(form_name)[:form_last_action]\n end",
"def last_textfield\n xpath 'textfield[last()]'\n end",
"def last_for_value\n self.form_field_value.queries.last\n end",
"def last\n contents[contents.size - 1]\n end",
"def last_textfield\n js = textfie... | [
"0.6217018",
"0.59610254",
"0.58965826",
"0.57708776",
"0.5703214",
"0.5579",
"0.55638975",
"0.5538263",
"0.5533082",
"0.5450115",
"0.5422348",
"0.5418438",
"0.54183555",
"0.5414606",
"0.5413244",
"0.541307",
"0.5410266",
"0.5409679",
"0.54065907",
"0.5404854",
"0.5389307",
... | 0.51422817 | 50 |
Return if form is multipart. The form is multipart when it contains a file or multipart option is set on the form during creation. | def multipart?
return true if @multipart
query_pairs.any?{|pair| pair.respond_to?(:last) && pair.last.is_a?(Array)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multipart?\n @multipart\n end",
"def multipart?\n @multipart\n end",
"def multipart?\n false\n end",
"def multipart?\n message.multipart?\n end",
"def multipart?\n has_content_type? ? !!(main_type =~ /^multipart$/i) : false\n end",
"def multipart?\n\t tr... | [
"0.8513963",
"0.8513963",
"0.84156984",
"0.8367256",
"0.8340908",
"0.82289857",
"0.8173901",
"0.76845795",
"0.76123595",
"0.75042015",
"0.7301946",
"0.7300103",
"0.70108896",
"0.6890594",
"0.67617697",
"0.66707534",
"0.65567577",
"0.6549531",
"0.6347656",
"0.6291106",
"0.6257... | 0.6929337 | 13 |
Add form elements to libcurl. | def materialize
query_pairs.each { |pair| form_add(pair.first.to_s, pair.last) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_form_and_submit(agent, creds, url, category, tech, data)\n case category\n when 'extensions'\n puts \"uploading #{category.chop}: #{data[category.chop].to_s}\" unless $quiet\n cat_page = get_page(agent, creds, url + CONFIG, {display: category, tech_hardware: 'custom_custom'})\n frm = ca... | [
"0.60855335",
"0.60110116",
"0.5937936",
"0.5933206",
"0.5758307",
"0.57352376",
"0.57140595",
"0.5671017",
"0.5659895",
"0.56042874",
"0.5586499",
"0.5574012",
"0.55718565",
"0.5553367",
"0.5511366",
"0.5467106",
"0.5408678",
"0.54013824",
"0.53831685",
"0.5332916",
"0.53326... | 0.0 | -1 |
before_action :authorize_owner, only: [:edit, :destroy, :update] | def new
@cocktail = Cocktail.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_edit\n authorize! :edit, @opportunity\n end",
"def edit\n authorize! :update, @user\n end",
"def edit\n authorize @user_information\n end",
"def allow_edit(owner)\n return true if allow(owner)\n respond_to do |format|\n format.html { redirect_to user_path(session[:u... | [
"0.7743605",
"0.7657641",
"0.74859446",
"0.73679274",
"0.7248306",
"0.7236876",
"0.72187275",
"0.71852714",
"0.7177464",
"0.71415037",
"0.71286076",
"0.7087862",
"0.7082044",
"0.70409507",
"0.7020739",
"0.6992041",
"0.6975335",
"0.69707924",
"0.6953136",
"0.69500065",
"0.6946... | 0.0 | -1 |
GET /spaceships/1 GET /spaceships/1.json | def show
@spaceship = Spaceship.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @spaceship }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_spaceship\n @Spaceship = Spaceship.find(params[:id])\n end",
"def destroy\n @spaceship = Spaceship.find(params[:id])\n @spaceship.destroy\n\n respond_to do |format|\n format.html { redirect_to spaceships_url }\n format.json { head :no_content }\n end\n end",
"def show\n @... | [
"0.6912334",
"0.6850876",
"0.6655734",
"0.6593635",
"0.6593635",
"0.6578572",
"0.65641755",
"0.65522325",
"0.64784205",
"0.645288",
"0.6362502",
"0.6340898",
"0.6309388",
"0.624591",
"0.6204399",
"0.6168204",
"0.6147271",
"0.6136464",
"0.6070756",
"0.606848",
"0.60638136",
... | 0.749515 | 0 |
GET /spaceships/new GET /spaceships/new.json | def new
@spaceship = Spaceship.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @spaceship }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @spaceship = Spaceship.new(params[:spaceship])\n\n respond_to do |format|\n if @spaceship.save\n format.html { redirect_to @spaceship, notice: 'Spaceship was successfully created.' }\n format.json { render json: @spaceship, status: :created, location: @spaceship }\n else\... | [
"0.7296353",
"0.6984411",
"0.69628364",
"0.6823614",
"0.6733631",
"0.6665979",
"0.66434836",
"0.65606123",
"0.6524445",
"0.6505506",
"0.6435907",
"0.6389318",
"0.6389318",
"0.63241774",
"0.629617",
"0.6291355",
"0.6264541",
"0.62360275",
"0.62093776",
"0.6184651",
"0.6151153"... | 0.76457113 | 0 |
POST /spaceships POST /spaceships.json | def create
@spaceship = Spaceship.new(params[:spaceship])
respond_to do |format|
if @spaceship.save
format.html { redirect_to @spaceship, notice: 'Spaceship was successfully created.' }
format.json { render json: @spaceship, status: :created, location: @spaceship }
else
format.html { render action: "new" }
format.json { render json: @spaceship.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @space = Space.new(space_params)\n @space.user = current_user\n if @space.save\n render json: @space\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def create\n @space = Space.new(space_params)\n\n respond_to do |format|\n if @s... | [
"0.6713618",
"0.6478278",
"0.6451725",
"0.6440632",
"0.6364032",
"0.63469845",
"0.62720066",
"0.6269905",
"0.62597173",
"0.6215008",
"0.61268187",
"0.61099136",
"0.61027986",
"0.60991967",
"0.6039852",
"0.6034618",
"0.6031819",
"0.6023402",
"0.5977067",
"0.5971664",
"0.595108... | 0.7412879 | 0 |
PUT /spaceships/1 PUT /spaceships/1.json | def update
@spaceship = Spaceship.find(params[:id])
respond_to do |format|
if @spaceship.update_attributes(params[:spaceship])
format.html { redirect_to @spaceship, notice: 'Spaceship was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @spaceship.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @space.update(space_params)\n render json: @space, status: :ok\n else\n render json: @space.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @spaceship = Spaceship.find(params[:id])\n @spaceship.destroy\n\n respond_to do |format|\n format.html {... | [
"0.7006186",
"0.6673637",
"0.6661903",
"0.6658144",
"0.6597776",
"0.6574459",
"0.6551795",
"0.65341336",
"0.63493514",
"0.63277406",
"0.63232774",
"0.6322382",
"0.6322382",
"0.62951064",
"0.6262661",
"0.62561697",
"0.62507707",
"0.62293136",
"0.62293136",
"0.62293136",
"0.622... | 0.7239147 | 0 |
DELETE /spaceships/1 DELETE /spaceships/1.json | def destroy
@spaceship = Spaceship.find(params[:id])
@spaceship.destroy
respond_to do |format|
format.html { redirect_to spaceships_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to ships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.h... | [
"0.74584836",
"0.7456517",
"0.7437676",
"0.7378187",
"0.7368963",
"0.7368963",
"0.7284748",
"0.7280078",
"0.7257336",
"0.72509706",
"0.72509706",
"0.72509706",
"0.71888006",
"0.71787786",
"0.71521485",
"0.7068189",
"0.70637536",
"0.7053948",
"0.7050484",
"0.70380163",
"0.7018... | 0.815735 | 0 |
We can always render a static viewer, even if the blob is too large. | def render_error
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @dataservice_blob = Dataservice::Blob.find(params[:id])\n # leaving manual authorization in place because of the params check and the formatting error options\n is_authorized = is_admin? || (@dataservice_blob && @dataservice_blob.token == params[:token]) || current_visitor.has_role?('researcher... | [
"0.62957287",
"0.6171491",
"0.5988713",
"0.59141815",
"0.5828085",
"0.57239807",
"0.5690204",
"0.56749",
"0.56532973",
"0.56532973",
"0.56460613",
"0.5642755",
"0.5642755",
"0.5642755",
"0.5642755",
"0.5642755",
"0.5642755",
"0.564145",
"0.56070065",
"0.5602173",
"0.5598186",... | 0.0 | -1 |
Make sure the message has valid message ids for the message, and fetch them | def fetch_message_ids field
self[field] ? self[field].message_ids || [self[field].message_id] : []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_existing_message_id\n id = Message.all.first&.id\n return if id.nil?\n\n get \"/messages/#{id}\"\n assert last_response.ok?\n assert_equal 'application/vnd.api+json', last_response.headers['Content-Type']\n\n response_body = JSON.parse last_response.body\n data = response_body['da... | [
"0.63826364",
"0.6215906",
"0.6174645",
"0.6132375",
"0.60798234",
"0.6048526",
"0.5982312",
"0.59225845",
"0.588637",
"0.5834074",
"0.5827028",
"0.5820203",
"0.5777928",
"0.57758",
"0.5766871",
"0.56620264",
"0.5660341",
"0.56515366",
"0.5645467",
"0.56278944",
"0.5589139",
... | 0.6604395 | 0 |
we don't encode any nontext parts here, because json encoding of binary objects is crazytalk, and because those are likely to be big anyways. | def to_h message_id, preferred_type
parts = mime_parts(preferred_type).map do |type, fn, cid, content, size|
if type =~ /^text\//
{ :type => type, :filename => fn, :cid => cid, :content => content, :here => true }
else
{ :type => type, :filename => fn, :cid => cid, :size => content.size, :here => false }
end
end.compact
{ :from => (from ? from.to_email_address : ""),
:to => to.map(&:to_email_address),
:cc => (cc || []).map(&:to_email_address),
:bcc => (bcc || []).map(&:to_email_address),
:subject => subject,
:date => date,
:refs => refs,
:parts => parts,
:message_id => message_id,
:snippet => snippet,
:reply_to => (reply_to ? reply_to.to_email_address : ""),
:recipient_email => recipient_email,
:list_post => list_post,
:list_subscribe => list_subscribe,
:list_unsubscribe => list_unsubscribe,
:email_message_id => @msgid,
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode(obj); end",
"def encode!; end",
"def encode_chunk(chunk); end",
"def encode_string_ex; end",
"def encode_string; end",
"def encoder; end",
"def encoder; end",
"def jsonify(hash)\n deep_reduce(hash) do |k, v, h|\n if v.is_a?(String)\n if v.encoding == ::Encoding::... | [
"0.6813736",
"0.644952",
"0.64233136",
"0.6201372",
"0.6200101",
"0.61295784",
"0.61295784",
"0.61176884",
"0.6099621",
"0.6099621",
"0.6099621",
"0.6099621",
"0.6099621",
"0.6099621",
"0.6099621",
"0.6099621",
"0.6099621",
"0.6099621",
"0.6099621",
"0.6099621",
"0.6099621",
... | 0.0 | -1 |
hash the fuck out of all message ids. trust me, you want this. | def munge_msgid msgid
Digest::MD5.hexdigest msgid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n id.hash + 32 * bs_request.hash\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\r\n id.hash\r\n end",
"def hash\r\n a = 0\r\n @id.each_byte {|c| a += c.to_i}\r\n (a +... | [
"0.682959",
"0.6731084",
"0.6731084",
"0.6731084",
"0.6731084",
"0.6731084",
"0.6731084",
"0.6731084",
"0.67029834",
"0.67015386",
"0.66540813",
"0.66380715",
"0.6583516",
"0.65463895",
"0.65400827",
"0.6539493",
"0.6539493",
"0.6539493",
"0.6539493",
"0.6539493",
"0.6539493"... | 0.6138445 | 51 |
unnests all the mime stuff and returns a list of [type, filename, content] tuples. for multipart/alternative parts, will only return the subpart that matches preferred_type. if none of them, will only return the first subpart. | def decode_mime_parts part, preferred_type, level=0
if part.multipart?
if mime_type_for(part) =~ /multipart\/alternative/
target = part.body.parts.find { |p| mime_type_for(p).index(preferred_type) } || part.body.parts.first
if target # this can be nil
decode_mime_parts target, preferred_type, level + 1
else
[]
end
else # decode 'em all
part.body.parts.compact.map { |subpart| decode_mime_parts subpart, preferred_type, level + 1 }.flatten 1
end
else
type = mime_type_for part
filename = mime_filename_for part
id = mime_id_for part
content = mime_content_for part, preferred_type
[[type, filename, id, content]]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_mime_parts part, preferred_type, level=0\n if part.multipart?\n if mime_type_for(part) =~ /multipart\\/alternative/\n target = part.body.find { |p| mime_type_for(p).index(preferred_type) } || part.body.first\n if target # this can be nil\n decode_mime_parts target, preferr... | [
"0.81594896",
"0.68456435",
"0.6838694",
"0.68105495",
"0.6785661",
"0.66915774",
"0.6241558",
"0.61803854",
"0.6168737",
"0.6095913",
"0.60192",
"0.5857295",
"0.5844454",
"0.5838469",
"0.57698023",
"0.57279783",
"0.5694555",
"0.5678422",
"0.56566614",
"0.56438607",
"0.560171... | 0.81477994 | 1 |
a filename, or nil | def mime_filename_for part
cd = part.fetch_header(:content_disposition)
ct = part.fetch_header(:content_type)
## RFC 2183 (Content-Disposition) specifies that disposition-parms are
## separated by ";". So, we match everything up to " and ; (if present).
filename = if ct && ct =~ /name="?(.*?[^\\])("|;|\z)/im # find in content-type
$1
elsif cd && cd =~ /filename="?(.*?[^\\])("|;|\z)/m # find in content-disposition
$1
end
## filename could be RFC2047 encoded
filename.chomp if filename
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename(filename = nil)\n @filename = filename if filename\n @filename\n end",
"def filename\n @filename || (@options && @options[:filename])\n end",
"def filename\n @filename || (@options && @options[:filename])\n end",
"def filename\n @filename || @options[:... | [
"0.76679724",
"0.74676156",
"0.74676156",
"0.7410706",
"0.7313507",
"0.7203521",
"0.7203521",
"0.7203521",
"0.7178585",
"0.71773666",
"0.7166418",
"0.7166418",
"0.7160895",
"0.7093239",
"0.70773673",
"0.7050033",
"0.7039934",
"0.7005236",
"0.7005236",
"0.7005236",
"0.7005236"... | 0.0 | -1 |
the content of a mime part itself. if the contenttype is text/, it will be converted to utf8. otherwise, it will be left in the original encoding | def mime_content_for mime_part, preferred_type
return "" unless mime_part.body # sometimes this happens. not sure why.
content_type = mime_part.fetch_header(:content_type) || "text/plain"
source_charset = mime_part.charset || "US-ASCII"
content = mime_part.decoded
converted_content, converted_charset = if(converter = CONVERSIONS[[content_type, preferred_type]])
send converter, content, source_charset
else
[content, source_charset]
end
if content_type =~ /^text\//
Decoder.transcode "utf-8", converted_charset, converted_content
else
converted_content
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mime_content_for mime_part, preferred_type\n return \"\" unless mime_part.body # sometimes this happens. not sure why.\n\n mt = mime_type_for(mime_part) || \"text/plain\" # i guess\n content_type = if mt =~ /^(.+);/ then $1.downcase else mt end\n source_charset = if mt =~ /charset=\"?(.*?)\"?(;|$)/... | [
"0.8224312",
"0.70821804",
"0.7076037",
"0.6950319",
"0.69197065",
"0.6854977",
"0.68008924",
"0.67520815",
"0.65030843",
"0.65019614",
"0.649895",
"0.64961064",
"0.64805937",
"0.6471726",
"0.64519835",
"0.6377766",
"0.6355258",
"0.63552046",
"0.63443625",
"0.63443625",
"0.63... | 0.82974017 | 0 |
seconds... this thing can be slow | def html_to_text html, charset
## ignore charset. html2text produces output in the system charset.
#puts "; forced to decode html. running #{HTML_CONVERSION_CMD} on #{html.size}b mime part..."
content = begin
Timeout.timeout(HTML_CONVERSION_TIMEOUT) do
Heliotrope.popen3(HTML_CONVERSION_CMD) do |inn, out, err|
inn.print html
inn.close
out.read
end
end
rescue Timeout::Error
$stderr.puts "; warning: timeout when converting message from html to text"
"[html conversion failed on this command (htmlconversionfailure)]"
end
[content, SYSTEM_CHARSET]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seconds\n _nudge[2]\n end",
"def seconds() self end",
"def tv_sec() end",
"def cstime=(*) end",
"def time_sec; Time.now.sec; end",
"def tv_usec() end",
"def sec() time[2] end",
"def seconds\n\t\t@seconds\n\tend",
"def cstime(*) end",
"def seconds\n (duration + 0.4999).to_i\n end",
... | [
"0.7695408",
"0.76448673",
"0.7451672",
"0.7334487",
"0.72072446",
"0.719797",
"0.7145516",
"0.7134375",
"0.7133664",
"0.7126344",
"0.7117892",
"0.7078474",
"0.69565105",
"0.6950917",
"0.6950435",
"0.69353133",
"0.6913067",
"0.6913067",
"0.68939644",
"0.6886317",
"0.6875122",... | 0.0 | -1 |
Given a number from 0 to 999,999,999,999, spell out that number in English. Step 1 Handle the basic case of 0 through 99. If the input to the program is 22, then the output should be 'twentytwo'. Your program should complain loudly if given a number outside the blessed range. Some good test cases for this program are: 0 14 50 98 1 100 Extension If you're on a Mac, shell out to Mac OS X's say program to talk out loud. Step 2 Implement breaking a number up into chunks of thousands. So 1234567890 should yield a list like 1, 234, 567, and 890, while the far simpler 1000 should yield just 1 and 0. The program must also report any values that are out of range. Step 3 Now handle inserting the appropriate scale word between those chunks. So 1234567890 should yield '1 billion 234 million 567 thousand 890' The program must also report any values that are out of range. It's fine to stop at "trillion". Step 4 Put it all together to get nothing but plain English. 12345 should give twelve thousand three hundred fortyfive. The program must also report any values that are out of range. Extensions Use and (correctly) when spelling out the number in English: 14 becomes "fourteen". 100 becomes "one hundred". 120 becomes "one hundred and twenty". 1002 becomes "one thousand and two". 1323 becomes "one thousand three hundred and twentythree". | def spell_one_nine(num)
case num
when 1
"one"
when 2
"two"
when 3
"three"
when 4
"four"
when 5
"five"
when 6
"six"
when 7
"seven"
when 8
"eight"
when 9
"nine"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_words(number)\n negative = false\n written_out = \"\"\n dictionary = {\n 0 => \"zero\",\n 1 => \"one\",\n 2 => \"two\",\n 3 => \"three\",\n 4 => \"four\",\n 5 => \"five\",\n 6 => \"six\",\n 7 => \"seven\",\n 8 => \"eight\",\n 9 => \"nine\",\n 10 => \"ten\",\n 11 => \"e... | [
"0.78867555",
"0.7808188",
"0.7764262",
"0.7741971",
"0.76921237",
"0.7686812",
"0.76815444",
"0.76790273",
"0.7654146",
"0.7646829",
"0.76276755",
"0.76263547",
"0.7600322",
"0.7580754",
"0.7577119",
"0.75752765",
"0.751148",
"0.7472468",
"0.745444",
"0.74488336",
"0.7355169... | 0.69322854 | 63 |
Converts position to char For Ex: (8,1) => H1 | def to_char(x, y)
"#{char_mapping.key(x).upcase}#{y}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_text(single_pos)\t\n\t\t\t\t\tcase single_pos\n\t\t\t\t\t\twhen 0\n\t \t\tsingle_pos =\"A\"\n\t \t\twhen 1\n\t \t\tsingle_pos =\"B\"\n\t \t\twhen 2\n\t \t\t\tsingle_pos =\"C\"\n\t \t\twhen 3\n\t \t\tsingle_pos =\"D... | [
"0.77012813",
"0.72112554",
"0.6871412",
"0.6850559",
"0.6648862",
"0.6539978",
"0.6537295",
"0.64946914",
"0.64938617",
"0.64849645",
"0.64834166",
"0.64622027",
"0.6432442",
"0.6432234",
"0.6411009",
"0.6402583",
"0.6390403",
"0.6389513",
"0.6380329",
"0.63203806",
"0.63060... | 0.65955293 | 5 |
Gets the shortest path from source to destination using BFS algorithm | def shortest_path
initial_position_obj = { position: start_position, source: {} }
knights_path = [initial_position_obj]
while knights_path.present?
current_position = knights_path.shift
position = current_position[:position]
if position == end_position
return path_to_destination(current_position, initial_position_obj)
end
add_possible_destination(position, current_position, knights_path)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_path\n dist, previous = Hash.new(Infinity), {}\n dist[@source] = 0.0\n queue = @graph.vertex_set.dup\n\n until queue.empty?\n u = queue.min { |a,b| dist[a.name] <=> dist[b.name] }\n break if dist[u.name].infinite?\n queue.delete(u)\n\n u.each_edge do |e, v|\n... | [
"0.7995144",
"0.7745324",
"0.7636586",
"0.7586582",
"0.75549906",
"0.7545491",
"0.75307226",
"0.74935955",
"0.7445026",
"0.7368284",
"0.73522717",
"0.7333823",
"0.7222897",
"0.7208352",
"0.7200845",
"0.71549547",
"0.7150209",
"0.714395",
"0.7122513",
"0.70829666",
"0.7069968"... | 0.79216474 | 1 |
Gets all next possible unvisited destinations | def possible_destinations(position)
possible_moves = possible_moves_in_board(position)
possible_destinations = possible_moves.map do |move|
[move[0] + position[0], move[1] + position[1]]
end.uniq
possible_destinations - visited_destinations
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_paths(start)\n step = 0\n visited = []\n unvisited = [[board_node_by_location(start),step]]\n \n while !unvisited.empty?\n node = unvisited[0][0]\n step = unvisited[0][1] + 1\n \n node.neighbors.each do |x|\n if not_visited(board_node_by_location(x),visited, unvisited)\n unvi... | [
"0.64335024",
"0.62808055",
"0.6268387",
"0.62412333",
"0.6168641",
"0.6123594",
"0.59832114",
"0.59664327",
"0.5945113",
"0.5941099",
"0.59141713",
"0.5910497",
"0.5900156",
"0.58388394",
"0.58341783",
"0.5826197",
"0.5787011",
"0.5773083",
"0.5744208",
"0.57255304",
"0.5683... | 0.56812966 | 21 |
Gets next possible moves constrained to board size | def possible_moves_in_board(position)
POSSIBLE_MOVES.select do |move|
x = position[0] + move[0]
y = position[1] + move[1]
within_board?(x, y)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless on_board?(next_move)\n break unless empty_square?(next_move)\n available_moves << next_move\n end\n\n available_moves + capture_moves\n end",
"def moves\n avai... | [
"0.6923934",
"0.69164264",
"0.68595105",
"0.6798775",
"0.6798461",
"0.6728409",
"0.6715774",
"0.6693639",
"0.66842777",
"0.6676377",
"0.6672635",
"0.6667831",
"0.6663717",
"0.666013",
"0.66576385",
"0.6639141",
"0.66182566",
"0.6593605",
"0.65808606",
"0.6543156",
"0.6531702"... | 0.64069617 | 26 |
Returns the path taken to reach the destination | def path_to_destination(knights_path, inital_knight_position)
steps_taken = []
loop do
steps_taken << to_char(knights_path[:position][0], knights_path[:position][1])
if knights_path == inital_knight_position
return steps_taken.reverse.to_sentence
end
knights_path = knights_path[:source]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path(dest,path)\n if @prev[dest] != -1\n path += get_path(@prev[dest],\"\")\n end\n path += \">#{dest}\"\n end",
"def destination_path\n @destination_path ||= Pathname.new(self.destination_root)\n end",
"def given_destination\n dir\n end",
"def find_path(goal) \n \n ... | [
"0.748106",
"0.7184996",
"0.71724826",
"0.7058811",
"0.7029395",
"0.69140947",
"0.69140947",
"0.6913661",
"0.6889298",
"0.6837211",
"0.6827346",
"0.6816735",
"0.67335624",
"0.6706399",
"0.6632025",
"0.66304296",
"0.6585009",
"0.65459114",
"0.65425324",
"0.6528802",
"0.6465385... | 0.6485802 | 20 |
Saves the given knight's position and returns the board id | def save
if self.class.valid_position?(knight_position)
unique_board_id = board_id
redis_conn.set(unique_board_id, knight_position)
{ status: :success, board_id: unique_board_id }
else
{ status: :failed, message: "Invalid knight's position" }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n\t\t[@board, @player1, @player2, @player_turn, @check]\n\tend",
"def export\n # Temporarily use first database entry for all saves\n s = ChessSave.first\n s.position = @current_state[:position].join\n s.human_to_move = @current_state[:player] == :human\n s.save\n end",
"def place_knig... | [
"0.6420481",
"0.6128735",
"0.60095066",
"0.5973782",
"0.59638786",
"0.5896512",
"0.58839715",
"0.5771361",
"0.5710182",
"0.57052237",
"0.57034415",
"0.56949437",
"0.56610554",
"0.5650523",
"0.5622209",
"0.56087404",
"0.55820096",
"0.5581498",
"0.55697507",
"0.5545929",
"0.554... | 0.79746467 | 0 |
Adds all possible destinations with respect to the knight's position | def add_possible_destination(position, knights_action, knights_path)
possible_destinations = possible_destinations(position)
possible_destinations.each do |possible_destination|
add_path(possible_destination, knights_action, knights_path)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def knight_moves(start, destination)\n\t\tnode = possible_moves(Node.new(start), destination)\n\t\tpath = []\n\t\twhile node.parent != nil\n\t\t\tpath.push(node.value)\n\t\t\tnode = node.parent\n\t\tend\n\t\tpath.push(start)\n\t\tprint_path(path.reverse)\n\tend",
"def add_path(destination, knights_action, knight... | [
"0.6738935",
"0.67211807",
"0.67088896",
"0.66092366",
"0.65555704",
"0.65023845",
"0.6478805",
"0.64724344",
"0.64675397",
"0.63763046",
"0.6321274",
"0.6287201",
"0.62555367",
"0.62447125",
"0.6160926",
"0.61265546",
"0.61096984",
"0.60430247",
"0.6032911",
"0.60122496",
"0... | 0.76067793 | 0 |
Add destination to visited destinations Adds destination with respect to the action taken by knight and adds the path taken to destination to source to track. | def add_path(destination, knights_action, knights_path)
visited_destinations << destination
knights_path << { position: destination, source: knights_action }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_possible_destination(position, knights_action, knights_path)\n\n possible_destinations = possible_destinations(position)\n\n possible_destinations.each do |possible_destination|\n add_path(possible_destination, knights_action, knights_path)\n end\n end",
"def set_destination(destination)\n... | [
"0.7589915",
"0.62062234",
"0.6092163",
"0.6044265",
"0.6023083",
"0.5994683",
"0.59566385",
"0.5937222",
"0.59344935",
"0.58746743",
"0.5832598",
"0.58178014",
"0.5743225",
"0.571955",
"0.5697374",
"0.5666418",
"0.56610596",
"0.5653673",
"0.5625447",
"0.5583469",
"0.55764425... | 0.8459319 | 0 |
Checks if the given position remains within the board | def within_board?(x, y)
BOARD_SIZE.include?(x) && BOARD_SIZE.include?(y)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_board?(pos)\n pos.all? { |el| el.between?(0, @board.size - 1) }\n end",
"def position_taken?(board, position)\n int = position.to_i\n if board[int - 1] != 0.upto(8) || board[int - 1] != \" \"\n return false\n end\nend",
"def on_board?(pos)\n pos.all? {|coord| coord.between?(0, SIZE - 1)}\n ... | [
"0.7868998",
"0.78427935",
"0.7838406",
"0.7818385",
"0.7801968",
"0.7790167",
"0.7788958",
"0.7745353",
"0.7741053",
"0.7739301",
"0.7709756",
"0.77031",
"0.76981044",
"0.76784337",
"0.76782143",
"0.76752454",
"0.76629615",
"0.76542926",
"0.76477575",
"0.76452565",
"0.763618... | 0.0 | -1 |
Maps the character to number | def char_mapping
@char_mapping ||= BOARD_SIZE.each_with_object({}) do |index, hash|
hash[(96 + index).chr] = index
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replaceCharToNumber(char)\n case char\n when 'T'\n then\n char = 10\n when 'J'\n then\n char = 11\n when 'Q'\n then\n char = 12\n when 'K'\n then\n char = 13\n when 'A'\n then\n char = 14\n end\n char.to_i\nend",
"def letter_to_number(letter)\n lette... | [
"0.79000664",
"0.71542317",
"0.7078814",
"0.7056756",
"0.70373267",
"0.69364727",
"0.67737263",
"0.65925413",
"0.6562108",
"0.6543928",
"0.65069336",
"0.6470825",
"0.6466184",
"0.6453851",
"0.64459795",
"0.64024603",
"0.6368526",
"0.635451",
"0.63265824",
"0.63247395",
"0.632... | 0.6338032 | 18 |
Splits the chat to (x,y) position | def split_char(char)
return if char.nil?
x, y = char.split('')
[char_mapping[x.downcase], y.to_i]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split(position)\n end",
"def split(position)\n end",
"def separate_coordinates\n piece = @input[0..1]\n @row = input_to_row(piece[1])\n @col = input_to_col(piece[0])\n\n location = @input[2..3]\n @row_new = input_to_row(location[1])\n @col_new = input_to_col(location[0])\n end",
"def... | [
"0.6258403",
"0.6258403",
"0.6070784",
"0.58054936",
"0.5791814",
"0.5660853",
"0.560132",
"0.55725354",
"0.5551007",
"0.5542057",
"0.55148786",
"0.5495848",
"0.54716355",
"0.5466907",
"0.54618776",
"0.5441884",
"0.5380161",
"0.5374498",
"0.5364923",
"0.53582746",
"0.53505737... | 0.0 | -1 |
Instantiates a new unifiedRoleManagementPolicyExpirationRule and sets the default values. | def initialize()
super
@odata_type = "#microsoft.graph.unifiedRoleManagementPolicyExpirationRule"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(opts = {})\n @expiration = opts[:expiration]\n end",
"def expiration\n @expiration ||= 60 * 60 * 24 * 30 # 30 days\n end",
"def add_default_expiration(vm, exps)\n return exps if vm.default_expiration\n exps << Berta::Entities::Expiration.new(vm.next_expiration_id,\n ... | [
"0.5098749",
"0.5029767",
"0.49990115",
"0.49698284",
"0.49698284",
"0.48873985",
"0.48079443",
"0.47304365",
"0.47269452",
"0.47269452",
"0.47164595",
"0.47164595",
"0.47164595",
"0.47164595",
"0.46641845",
"0.46608317",
"0.46554548",
"0.46535292",
"0.46407995",
"0.4617505",
... | 0.7127701 | 0 |
The deserialization information for the current model | def get_field_deserializers()
return super.merge({
"isExpirationRequired" => lambda {|n| @is_expiration_required = n.get_boolean_value() },
"maximumDuration" => lambda {|n| @maximum_duration = n.get_duration_value() },
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end",
"def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },... | [
"0.6510734",
"0.63224316",
"0.6322254",
"0.63094735",
"0.62954384",
"0.6238735",
"0.6232461",
"0.62155676",
"0.6200175",
"0.6199403",
"0.6173917",
"0.61733985",
"0.61705345",
"0.61631054",
"0.61620396",
"0.6158031",
"0.6156071",
"0.6142402",
"0.613998",
"0.6138061",
"0.612005... | 0.0 | -1 |
Gets the isExpirationRequired property value. Indicates whether expiration is required or if it's a permanently active assignment or eligibility. | def is_expiration_required
return @is_expiration_required
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_expiration_required=(value)\n @is_expiration_required = value\n end",
"def expiration_behavior\n return @expiration_behavior\n end",
"def can_expire?\n return !!@expiry\n end",
"def expiration\n return @expiration\n ... | [
"0.77053386",
"0.6665872",
"0.6395092",
"0.61893505",
"0.61705333",
"0.6162824",
"0.614428",
"0.6097486",
"0.608558",
"0.6029967",
"0.5965881",
"0.59582055",
"0.5946574",
"0.59443855",
"0.5938723",
"0.5925991",
"0.59085464",
"0.5901934",
"0.5898379",
"0.58736587",
"0.587226",... | 0.8223862 | 0 |
Sets the isExpirationRequired property value. Indicates whether expiration is required or if it's a permanently active assignment or eligibility. | def is_expiration_required=(value)
@is_expiration_required = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_expiration_required\n return @is_expiration_required\n end",
"def expiration_behavior=(value)\n @expiration_behavior = value\n end",
"def expiration=(value)\n @expiration = value\n end",
"def is_required=(value)\n ... | [
"0.68301517",
"0.60498744",
"0.59132427",
"0.58651066",
"0.57569396",
"0.5736499",
"0.5593959",
"0.5581465",
"0.53682905",
"0.53637195",
"0.53589004",
"0.5325741",
"0.5325741",
"0.5325741",
"0.5325741",
"0.5325741",
"0.5325741",
"0.5293934",
"0.5285521",
"0.51977193",
"0.5194... | 0.8102894 | 0 |
Gets the maximumDuration property value. The maximum duration allowed for eligibility or assignment which is not permanent. Required when isExpirationRequired is true. | def maximum_duration
return @maximum_duration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximum_duration=(value)\n @maximum_duration = value\n end",
"def max_record_duration_in_seconds\n return @max_record_duration_in_seconds\n end",
"def max_record_duration_in_seconds=(value)\n @max_record_... | [
"0.8067252",
"0.74787444",
"0.70436144",
"0.67879844",
"0.6765356",
"0.6577147",
"0.641355",
"0.63824296",
"0.63730973",
"0.6370917",
"0.63244295",
"0.631829",
"0.6298791",
"0.6234084",
"0.621521",
"0.6188506",
"0.6172675",
"0.61421794",
"0.613132",
"0.6121068",
"0.6100329",
... | 0.8593823 | 0 |
Sets the maximumDuration property value. The maximum duration allowed for eligibility or assignment which is not permanent. Required when isExpirationRequired is true. | def maximum_duration=(value)
@maximum_duration = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_record_duration_in_seconds=(value)\n @max_record_duration_in_seconds = value\n end",
"def maximum_duration\n return @maximum_duration\n end",
"def set_VideoDuration(value)\n set_input(\"VideoDuration\", value)\n ... | [
"0.7354659",
"0.70358676",
"0.6625368",
"0.6619562",
"0.661018",
"0.659481",
"0.659481",
"0.659481",
"0.659481",
"0.659481",
"0.6467129",
"0.63928545",
"0.63776976",
"0.63632476",
"0.633555",
"0.6335292",
"0.6335292",
"0.6314366",
"0.628917",
"0.6260467",
"0.621436",
"0.621... | 0.86637014 | 0 |
Serializes information the current object | def serialize(writer)
raise StandardError, 'writer cannot be null' if writer.nil?
super
writer.write_boolean_value("isExpirationRequired", @is_expiration_required)
writer.write_duration_value("maximumDuration", @maximum_duration)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n end",
"def serialize(object) end",
"def serialize; end",
"def serialize; end",
"def serialize\n \n end",
"def serialize\n raise NotImplementedError\n end",
"def serialize\n raise NotImplementedError\n end",
"def dump\r\n super + to_s\r\n end",
... | [
"0.7951372",
"0.7645999",
"0.7579812",
"0.7579812",
"0.7440032",
"0.720861",
"0.720861",
"0.7207583",
"0.7016516",
"0.70007193",
"0.6992252",
"0.69838214",
"0.69723576",
"0.69666415",
"0.69666415",
"0.6942002",
"0.69417155",
"0.6933786",
"0.6913977",
"0.6891677",
"0.68810964"... | 0.0 | -1 |
'strong parameters' allow us to specify which parameters are required and which are permitted | def user_params
params.require(:user).permit(:name, :email, :password, :password_confirmation)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_params; true; end",
"def valid_params?; end",
"def valid_params_request?; end",
"def optional_parameters\n must_be_defined_in_derived_class\n end",
"def parameter_rule?; end",
"def accepted_parameters\n required_parameters + optional_parameters\n end",
"def check_param... | [
"0.74272096",
"0.74011904",
"0.7071272",
"0.6803203",
"0.6777842",
"0.67771035",
"0.6708466",
"0.66404945",
"0.6629609",
"0.6600598",
"0.6585277",
"0.6576207",
"0.6575225",
"0.65750796",
"0.65750796",
"0.65750796",
"0.65750796",
"0.65750796",
"0.65750796",
"0.65750796",
"0.65... | 0.0 | -1 |
Demote a child work to a file set. This deletes the child work. | def to_fileset
begin
parent_work = GenericWork.find(params['parentworkid'] )
child_work = GenericWork.find(params['childworkid'] )
rescue ActiveFedora::ObjectNotFoundError, Ldp::Gone, ActiveFedora::RecordInvalid
flash[:notice] = "This item no longer exists, so it can't be promoted to a child work."
redirect_to "/works/#{parent_work.id}"
return
end
if !self.class.can_demote_to_file_set?(current_user, parent_work, child_work)
flash[:notice] = "Sorry. \"#{child_work.title.first}\" can't be demoted to a file."
redirect_to "/works/#{child_work.id}"
return
end
WorkToFilesetCompletionJob.perform_later(parent_work.id, child_work_id: child_work.id)
file_set = child_work.members.first
flash[:notice] = "\"#{file_set.title.first}\" is IN PROCESS of being demoted to a file attached to \"#{parent_work.title.first}\". All metadata associated with the child work has been deleted. You can edit the file immediately if desired."
redirect_to "/concern/parent/#{parent_work.id}/file_sets/#{file_set.id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unlink_from_work\n work = file_set.parent\n # monkey patch\n work.total_file_size_subtract_file_set! file_set\n # monkey patch\n return unless work && (work.thumbnail_id == file_set.id || work.representative_id == file_set.id || work.rendering_ids.include?(file_set.... | [
"0.69785744",
"0.67087173",
"0.6657726",
"0.5990703",
"0.5758282",
"0.5725088",
"0.56670606",
"0.5634715",
"0.56048715",
"0.5602555",
"0.5579192",
"0.5541013",
"0.55216897",
"0.5521616",
"0.54938984",
"0.5480793",
"0.54645514",
"0.5448425",
"0.5426574",
"0.54222316",
"0.54123... | 0.64396185 | 3 |
Creates child work with: All the appropriate metadata copied from parent title/creator copied from file_set file_set set as member of new child_work DOES save the new child work. DOES NOT actually add it to parent_work yet. That's expensive and needs to be done in a lock. DOES NOT transfer collection membership, that's a whole different mess. | def create_intermediary_child_work(parent, file_set)
new_child_work = GenericWork.new(title: file_set.title, creator: [current_user.user_key])
new_child_work.apply_depositor_metadata(current_user.user_key)
# make original fileset a member of our new child work
self.class.add_to_parent(new_child_work, file_set, 0, make_thumbnail: true, make_representative: true)
# and set the child work's metadata based on the parent work.
# bibliographic
attrs_to_copy = parent.attributes.sort.map { |a| a[0] }
attrs_to_copy -= ['id', "title", 'lease_id', 'embargo_id', 'head', 'tail', 'access_control_id', 'thumbnail_id', 'representative_id' ]
attrs_to_copy.each do |a|
new_child_work[a] = parent[a]
end
# permissions-related
new_child_work.visibility = parent.visibility
new_child_work.embargo_release_date = parent.embargo_release_date
new_child_work.lease_expiration_date = parent.lease_expiration_date
parent_permissions = parent.permissions.map(&:to_hash)
# member HAS to be saved to set it's permission attributes, not sure why.
# extra saves make things extra slow. :(
new_child_work.save!
if parent_permissions.present?
new_child_work.permissions_attributes = parent_permissions
end
# But now everything seems to be properly saved without need for another save.
return new_child_work
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spawn attributes={}\n child = self.dup\n self.work_groups.each do |wg|\n new_wg = WorkGroup.new(:institution=>wg.institution,:project=>child)\n child.work_groups << new_wg\n wg.group_memberships.each do |gm|\n new_gm = GroupMembership.new(:person=>gm.person, :work_group=>wg)\n ... | [
"0.63733083",
"0.6279779",
"0.598384",
"0.59336245",
"0.59103876",
"0.57412577",
"0.56821907",
"0.5675552",
"0.5580366",
"0.5564886",
"0.5513622",
"0.55012125",
"0.54822636",
"0.54739124",
"0.5445093",
"0.54324025",
"0.5389517",
"0.5380987",
"0.53791934",
"0.53449917",
"0.534... | 0.86703324 | 0 |
Begin Display Custom SignIn This section is to enable registration form to be embedded in other pages | def resource_name
:user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @partner_sign_in = true\n render layout: 'sign_pages'\n end",
"def new\n #showing the registration page\n end",
"def sign_in\n end",
"def login\n layout 'sign_in'\n end",
"def sign_in\n\tend",
"def sign_in\n\n end",
"def signin\n end",
"def signup_form_javascript\n re... | [
"0.66339207",
"0.6368181",
"0.6303788",
"0.6260165",
"0.6228212",
"0.6227329",
"0.6147987",
"0.6147557",
"0.6136934",
"0.6086453",
"0.60843635",
"0.60747653",
"0.6067426",
"0.60292995",
"0.5988416",
"0.59651905",
"0.59518564",
"0.5885948",
"0.586249",
"0.5855816",
"0.583419",... | 0.0 | -1 |
rubocop:disable Metrics/PerceivedComplexity rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/BlockNesting | def update?
if record.updateable_time?
if record.subject&.personal?
if record.vip_updateable_time?
return true if user.staff.id.in? record.staff_ids
return true if user.id == record.creator_id
end
end
if record.klass_subject&.fixed == false
return true if user.staff.id.in? record.staff_ids
return true if user.id == record.creator_id
end
return true if user.role? 'STUDENT_ADMIN'
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end"... | [
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393",
"0.70014393"... | 0.0 | -1 |
Assumptions: 1. CWD is "jenkinsintegration" 2. Scenario config JSON files in "./config/scenarios/.json" 3. Node config JSON files in "./config/nodes/.json" 4. Hiera config YAML files in "./config/hieras//hiera.yaml" 5. Hiera data trees in "./config/hieras///" | def parse_scenario_file(scenario_id)
JSON.parse(File.read(File.join('config', 'scenarios', scenario_id + '.json')))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_configs(scenario_id)\n parse_node_config_files(parse_scenario_file(scenario_id))\nend",
"def hiera_configpath(hiera)\n File.join('config', 'hieras', hiera, 'hiera.yaml')\nend",
"def read_component_configuration component,platform,configuration\n hp_dir=File.join(configuration['base_dir'],'src','han... | [
"0.64268255",
"0.5865868",
"0.5843177",
"0.5788928",
"0.57699054",
"0.5763899",
"0.57149637",
"0.5664235",
"0.56347233",
"0.5603015",
"0.5576554",
"0.55589277",
"0.5555402",
"0.5537381",
"0.5522504",
"0.5498021",
"0.54587007",
"0.54587007",
"0.54543394",
"0.5453461",
"0.54435... | 0.5558348 | 12 |
Returns the list of node configs hashes in the given scenario. | def node_configs(scenario_id)
parse_node_config_files(parse_scenario_file(scenario_id))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_subhashes(node)\n l_hash = node.left ? node.left._hash : self.class.null_hash_at(node.depth + 1)\n r_hash = node.right ? node.right._hash : self.class.null_hash_at(node.depth + 1)\n [l_hash, r_hash]\n end",
"def find_scenario_paths(scenarios)\n return [] if scenarios.nil?\n scena... | [
"0.542058",
"0.5137308",
"0.5054009",
"0.5019797",
"0.5015323",
"0.5013689",
"0.49368373",
"0.49368373",
"0.49368373",
"0.4911848",
"0.48847175",
"0.48072508",
"0.47990763",
"0.4782286",
"0.47625422",
"0.47604105",
"0.47544375",
"0.47277436",
"0.47255638",
"0.4718899",
"0.471... | 0.61751086 | 0 |
Returns the environment from the node config hash, or 'production' if it is nil or empty. | def node_environment(node_config)
env = node_config['environment']
(env.nil? || env.empty?) ? 'production' : env
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_environment\n if node['ingenerator'] && node['ingenerator']['node_environment']\n node['ingenerator']['node_environment'].to_sym\n else\n :production\n end\n end",
"def environment\n if exists?(:stage)\n stage\n elsif exists?(:rails_env)\n rails_env\n ... | [
"0.7434109",
"0.729148",
"0.729148",
"0.722927",
"0.69439954",
"0.6834882",
"0.6802396",
"0.67666334",
"0.67666334",
"0.67045647",
"0.6703618",
"0.66951555",
"0.6649619",
"0.6637568",
"0.6636658",
"0.66002995",
"0.66002995",
"0.65810573",
"0.65581447",
"0.64899784",
"0.646120... | 0.83173084 | 0 |
Group the list of node configs into a hash keyed by their environments. A nil or empty environment will be interpreted as 'production'. | def group_by_environment(node_configs)
node_configs.group_by do |config|
node_environment(config)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modules_per_environment(node_configs)\n node_configs = group_by_environment(node_configs)\n modules = node_configs.map do |env, configs|\n [env, configs.map { |c| c['modules'] }.flatten.uniq]\n end\n Hash[modules]\nend",
"def environments\n environment_config.keys\n end",
"def environments\n... | [
"0.7234255",
"0.68260694",
"0.66575277",
"0.65260625",
"0.6470043",
"0.6170826",
"0.6169138",
"0.61430985",
"0.61017185",
"0.6069006",
"0.60683566",
"0.6031708",
"0.6026988",
"0.6017535",
"0.6013884",
"0.5921596",
"0.5902307",
"0.5901868",
"0.5872974",
"0.5826732",
"0.5796940... | 0.74446887 | 0 |
Returns a hash from environments to modules; removes duplicate modules. | def modules_per_environment(node_configs)
node_configs = group_by_environment(node_configs)
modules = node_configs.map do |env, configs|
[env, configs.map { |c| c['modules'] }.flatten.uniq]
end
Hash[modules]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modules_hash\n @modules\n end",
"def modules_hash\n @modules\n end",
"def modules_hash\n @modules_hash\n end",
"def unique_modules\n @unique_modules\n end",
"def global_modules\n node['rsyncd']['globals'].reduce({}) do |hash, (key, value)|\n hash[snake_to_space(key)] = v... | [
"0.68974185",
"0.68974185",
"0.67499155",
"0.63170797",
"0.62764794",
"0.61536616",
"0.60655314",
"0.6028512",
"0.60182786",
"0.5964805",
"0.59135616",
"0.58405316",
"0.57757044",
"0.573321",
"0.56737626",
"0.56425565",
"0.56408525",
"0.56319124",
"0.5620412",
"0.5587188",
"0... | 0.71670455 | 0 |
Returns the path to the local hiera.yaml file for the specified hiera. | def hiera_configpath(hiera)
File.join('config', 'hieras', hiera, 'hiera.yaml')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hiera_datadir\n # This output lets us know where Hiera is configured to look on the system\n puppet_lookup_info = run_shell('puppet lookup --explain test__simp__test').stdout.strip.lines\n puppet_config_check = run_shell('puppet agent --configprint manifest').stdout\n\n if puppet_config_check.nil? || puppe... | [
"0.6186646",
"0.603547",
"0.6025256",
"0.5864132",
"0.5863631",
"0.5824347",
"0.5793109",
"0.5759246",
"0.5739312",
"0.5705098",
"0.5667579",
"0.5639628",
"0.560354",
"0.5603295",
"0.5563946",
"0.5553217",
"0.55365145",
"0.5533156",
"0.54939014",
"0.5479283",
"0.5479283",
"... | 0.7937551 | 0 |
Returns a list of pairs of datadir filepaths for the given hiera. The pairs contain the local and target filepaths, respectively. | def hiera_datadirs(hiera)
configpath = hiera_configpath(hiera)
config = YAML.load_file(configpath)
backends = [config[:backends]].flatten
datadirs = backends.map { |be| config[be.to_sym][:datadir] }.uniq
datadirs.map do |datadir|
localpath = File.join('config', 'hieras', hiera, File.basename(datadir))
[localpath, datadir]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paths(arrs)\n arrs.inject([[]]) do |paths, arr|\n arr.map {|e| paths.map {|path| path + [e]}}.flatten(1)\n end\n end",
"def hiera_datadir\n # This output lets us know where Hiera is configured to look on the system\n puppet_lookup_info = run_shell('puppet lookup --explain test__simp__te... | [
"0.60336673",
"0.60256386",
"0.601235",
"0.5936207",
"0.58613276",
"0.5835206",
"0.5623412",
"0.5613568",
"0.5536183",
"0.5530625",
"0.55179334",
"0.54826343",
"0.5477433",
"0.54733324",
"0.54641217",
"0.54577374",
"0.5449669",
"0.54428285",
"0.54393405",
"0.54370093",
"0.543... | 0.7555087 | 0 |
GET /lists/1 GET /lists/1.xml | def show
@list = List.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @list }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end",
"def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end",
"def i... | [
"0.7345432",
"0.73375726",
"0.72963923",
"0.692",
"0.69010794",
"0.66984206",
"0.6689478",
"0.6685211",
"0.6613234",
"0.6560278",
"0.6535424",
"0.6491924",
"0.6469646",
"0.6468288",
"0.6423837",
"0.6400867",
"0.6386313",
"0.6374874",
"0.63511574",
"0.63160855",
"0.6299484",
... | 0.6892642 | 5 |
GET /lists/new GET /lists/new.xml | def new
@list = List.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @list }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @list = List.find(params[:id])\n @todolist = @list.todolists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todolist }\n end\n end",
"def new\n @mylist = Mylist.new\n\n respond_to do |format|\n format.html # new.html.erb\n ... | [
"0.70856327",
"0.7079035",
"0.7074122",
"0.7035158",
"0.7033077",
"0.7019581",
"0.70163757",
"0.70163757",
"0.70163757",
"0.6988978",
"0.6954271",
"0.6898971",
"0.68669724",
"0.68494916",
"0.6849325",
"0.6820026",
"0.68136185",
"0.67286146",
"0.67181563",
"0.67121124",
"0.670... | 0.73274845 | 0 |
POST /lists POST /lists.xml | def create
@list = List.new(params[:list])
respond_to do |format|
if @list.save
format.html { redirect_to(@list, :notice => 'List was successfully created.') }
format.xml { render :xml => @list, :status => :created, :location => @list }
@perm = Permission.new(
:add => true,
:edit => true,
:own => true,
:del => true,
:user_id => session[:user_id],
:list_id => @list.id)
@perm.save
else
format.html { render :action => "new" }
format.xml { render :xml => @list.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end",
"def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end",
"def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n ... | [
"0.7125083",
"0.7066784",
"0.6921468",
"0.6768993",
"0.6612775",
"0.65280986",
"0.65194136",
"0.6486917",
"0.6486426",
"0.64758843",
"0.64758843",
"0.6463956",
"0.6449232",
"0.64285964",
"0.6419513",
"0.6307411",
"0.6306979",
"0.62993675",
"0.6290997",
"0.6286385",
"0.6283033... | 0.60221297 | 57 |
PUT /lists/1 PUT /lists/1.xml | def update
@list = List.find(params[:id])
respond_to do |format|
if @list.update_attributes(params[:list])
format.html { redirect_to(root_url) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @list.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end",
"def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end",
"def update\n @list = current_user.lists.find(params[:id])\n ... | [
"0.7174831",
"0.7108598",
"0.67610824",
"0.6572841",
"0.65460837",
"0.6532652",
"0.6532652",
"0.6461191",
"0.64486414",
"0.64202404",
"0.6397813",
"0.6348516",
"0.6335764",
"0.6333402",
"0.63244444",
"0.6320316",
"0.6307662",
"0.6307662",
"0.6307662",
"0.6307662",
"0.6307662"... | 0.67906475 | 2 |
DELETE /lists/1 DELETE /lists/1.xml | def destroy
@list = List.find(params[:id])
@list.destroy
respond_to do |format|
format.html { redirect_to(root_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end",
"def delete(list_id)\n Iterable.request(conf, \"/lists/#{list_id}\").delete\n end",
"def delete_list(user, list)\n delete(\"/#{user}/lists/#{list}.json\")\n end",
"def delete_list(id)\n query(\... | [
"0.74714243",
"0.7290611",
"0.703505",
"0.70157504",
"0.69659823",
"0.6884975",
"0.6883083",
"0.6878157",
"0.68778455",
"0.6837181",
"0.6837181",
"0.6837181",
"0.681098",
"0.67993176",
"0.6776809",
"0.67693955",
"0.67681295",
"0.6760802",
"0.6760802",
"0.6760802",
"0.67200255... | 0.70058084 | 4 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: backend_servers, type: String name: host_id, type: String name: load_balancer_id, type: String name: owner_account, type: String | def add_backend_servers(optional={})
args = self.class.new_params
args[:query]['Action'] = 'AddBackendServers'
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? :backend_servers
args[:query]['BackendServers'] = optional[:backend_servers]
end
if optional.key? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? ... | [
"0.6474627",
"0.6289442",
"0.6230481",
"0.6017509",
"0.58854175",
"0.5771842",
"0.57512516",
"0.5707569",
"0.5659567",
"0.5629907",
"0.5601322",
"0.55060434",
"0.5479961",
"0.5479961",
"0.5479961",
"0.5479961",
"0.54543763",
"0.54415727",
"0.5439501",
"0.53967047",
"0.5386634... | 0.5156724 | 48 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: address, type: String name: client_token, type: String name: is_public_address, type: String name: load_balancer_mode, type: String name: load_balancer_name, type: String name: owner_account, type: String name: owner_id, type: Long name: resource_owner_account, type: String name: resource_owner_id, type: Long | def create_load_balancer(optional={})
args = self.class.new_params
args[:query]['Action'] = 'CreateLoadBalancer'
args[:region] = optional[:_region] if (optional.key? :_region)
if optional.key? :_method
raise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]
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? :address
args[:query]['Address'] = optional[:address]
end
if optional.key? :client_token
args[:query]['ClientToken'] = optional[:client_token]
end
if optional.key? :is_public_address
args[:query]['IsPublicAddress'] = optional[:is_public_address]
end
if optional.key? :load_balancer_mode
args[:query]['LoadBalancerMode'] = optional[:load_balancer_mode]
end
if optional.key? :load_balancer_name
args[:query]['LoadBalancerName'] = optional[:load_balancer_name]
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 create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? ... | [
"0.6802249",
"0.65976703",
"0.6059916",
"0.5987703",
"0.57154024",
"0.5691563",
"0.56653047",
"0.56263",
"0.5624155",
"0.55704135",
"0.55603266",
"0.5530433",
"0.5448158",
"0.5448158",
"0.5448158",
"0.5448158",
"0.5431011",
"0.54160184",
"0.5415401",
"0.54129857",
"0.53938115... | 0.6680468 | 1 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: backend_server_port, type: Integer name: cookie, type: String name: cookie_timeout, type: Integer name: domain, type: String name: health_check, type: String name: health_check_timeout, type: Integer name: healthy_threshold, type: Integer name: host_id, type: String name: interval, type: Integer name: listener_port, type: Integer name: listener_status, type: String name: load_balancer_id, type: String name: owner_account, type: String name: scheduler, type: String name: sticky_session, type: String name: sticky_session_type, type: String name: u_r_i, type: String name: unhealthy_threshold, type: Integer name: x_forwarded_for, type: String | def create_load_balancer_h_t_t_p_listener(optional={})
args = self.class.new_params
args[:query]['Action'] = 'CreateLoadBalancerHTTPListener'
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? :backend_server_port
args[:query]['BackendServerPort'] = optional[:backend_server_port]
end
if optional.key? :cookie
args[:query]['Cookie'] = optional[:cookie]
end
if optional.key? :cookie_timeout
args[:query]['CookieTimeout'] = optional[:cookie_timeout]
end
if optional.key? :domain
args[:query]['Domain'] = optional[:domain]
end
if optional.key? :health_check
args[:query]['HealthCheck'] = optional[:health_check]
end
if optional.key? :health_check_timeout
args[:query]['HealthCheckTimeout'] = optional[:health_check_timeout]
end
if optional.key? :healthy_threshold
args[:query]['HealthyThreshold'] = optional[:healthy_threshold]
end
if optional.key? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :interval
args[:query]['Interval'] = optional[:interval]
end
if optional.key? :listener_port
args[:query]['ListenerPort'] = optional[:listener_port]
end
if optional.key? :listener_status
args[:query]['ListenerStatus'] = optional[:listener_status]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
if optional.key? :scheduler
args[:query]['Scheduler'] = optional[:scheduler]
end
if optional.key? :sticky_session
args[:query]['StickySession'] = optional[:sticky_session]
end
if optional.key? :sticky_session_type
args[:query]['StickySessionType'] = optional[:sticky_session_type]
end
if optional.key? :u_r_i
args[:query]['URI'] = optional[:u_r_i]
end
if optional.key? :unhealthy_threshold
args[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]
end
if optional.key? :x_forwarded_for
args[:query]['XForwardedFor'] = optional[:x_forwarded_for]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_parameters; end",
"def params\n {\n \"add-header\" => nil,\n \"burst-length\" => nil,\n \"client\" => nil,\n \"close-with-reset\" => nil,\n \"debug\" => nil,\n \"failure-status\" => nil,\n \"hog\" => nil,\n \"http-version\" => nil,\n \"max-connections\"... | [
"0.607202",
"0.6055937",
"0.59630394",
"0.59630394",
"0.59630394",
"0.59630394",
"0.58797115",
"0.5841207",
"0.5841207",
"0.57641506",
"0.575487",
"0.5703929",
"0.5680632",
"0.5677272",
"0.5671812",
"0.5650069",
"0.5649988",
"0.5599758",
"0.55951846",
"0.55802613",
"0.5556202... | 0.5866774 | 7 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: backend_server_port, type: Integer name: connect_port, type: Integer name: connect_timeout, type: Integer name: health_check, type: String name: host_id, type: String name: interval, type: Integer name: listener_port, type: Integer name: listener_status, type: String name: load_balancer_id, type: String name: owner_account, type: String name: persistence_timeout, type: Integer name: scheduler, type: String | def create_load_balancer_t_c_p_listener(optional={})
args = self.class.new_params
args[:query]['Action'] = 'CreateLoadBalancerTCPListener'
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? :backend_server_port
args[:query]['BackendServerPort'] = optional[:backend_server_port]
end
if optional.key? :connect_port
args[:query]['ConnectPort'] = optional[:connect_port]
end
if optional.key? :connect_timeout
args[:query]['ConnectTimeout'] = optional[:connect_timeout]
end
if optional.key? :health_check
args[:query]['HealthCheck'] = optional[:health_check]
end
if optional.key? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :interval
args[:query]['Interval'] = optional[:interval]
end
if optional.key? :listener_port
args[:query]['ListenerPort'] = optional[:listener_port]
end
if optional.key? :listener_status
args[:query]['ListenerStatus'] = optional[:listener_status]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
if optional.key? :persistence_timeout
args[:query]['PersistenceTimeout'] = optional[:persistence_timeout]
end
if optional.key? :scheduler
args[:query]['Scheduler'] = optional[:scheduler]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer_h_t_t_p_listener(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancerHTTPListener'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'G... | [
"0.5811262",
"0.57497275",
"0.57497275",
"0.57497275",
"0.57497275",
"0.5679072",
"0.5601781",
"0.55696577",
"0.55462664",
"0.5541359",
"0.5536942",
"0.5536942",
"0.55319947",
"0.55145895",
"0.5465463",
"0.54597014",
"0.5457034",
"0.53781176",
"0.5372368",
"0.5341574",
"0.532... | 0.5726488 | 5 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: load_balancer_id, type: String name: owner_account, type: String name: owner_id, type: Long name: resource_owner_account, type: String name: resource_owner_id, type: Long | def delete_load_balancer(optional={})
args = self.class.new_params
args[:query]['Action'] = 'DeleteLoadBalancer'
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? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
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 create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? ... | [
"0.68089867",
"0.669338",
"0.66098464",
"0.62013036",
"0.6132031",
"0.59439814",
"0.5936646",
"0.5747338",
"0.5615555",
"0.55655336",
"0.54775256",
"0.54581034",
"0.5422995",
"0.5408604",
"0.54028803",
"0.5401761",
"0.53853136",
"0.5361272",
"0.5351572",
"0.53451025",
"0.5293... | 0.5686367 | 8 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: host_id, type: String name: listener_port, type: List name: load_balancer_id, type: String name: owner_account, type: String | def delete_load_balancer_listener(optional={})
args = self.class.new_params
args[:query]['Action'] = 'DeleteLoadBalancerListener'
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? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :listener_port
args[:query]['ListenerPort'] = optional[:listener_port]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? ... | [
"0.644576",
"0.6340762",
"0.61790377",
"0.61658084",
"0.61303085",
"0.5991566",
"0.58227193",
"0.58219695",
"0.5802971",
"0.5795455",
"0.5746822",
"0.57363224",
"0.5694722",
"0.5694722",
"0.5694722",
"0.5694722",
"0.5691916",
"0.5691422",
"0.56491816",
"0.5628651",
"0.5601868... | 0.51842046 | 59 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: host_id, type: String name: listener_port, type: Integer name: load_balancer_id, type: String name: owner_account, type: String | def describe_backend_servers(optional={})
args = self.class.new_params
args[:query]['Action'] = 'DescribeBackendServers'
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? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :listener_port
args[:query]['ListenerPort'] = optional[:listener_port]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? ... | [
"0.64302105",
"0.6325864",
"0.6221867",
"0.61697066",
"0.6067263",
"0.6040307",
"0.58924437",
"0.5878112",
"0.5832977",
"0.5790073",
"0.5779026",
"0.57621855",
"0.57341903",
"0.5727921",
"0.5648852",
"0.5648852",
"0.5648852",
"0.5648852",
"0.5611834",
"0.55784607",
"0.5575475... | 0.0 | -1 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: host_id, type: String name: load_balancer_id, type: String name: owner_account, type: String | def describe_load_balancer_attribute(optional={})
args = self.class.new_params
args[:query]['Action'] = 'DescribeLoadBalancerAttribute'
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? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? ... | [
"0.66677046",
"0.6535007",
"0.6466888",
"0.6211608",
"0.6028023",
"0.5981134",
"0.58650047",
"0.5834508",
"0.57195145",
"0.56340444",
"0.5594318",
"0.553328",
"0.5461805",
"0.5429633",
"0.54226696",
"0.5408994",
"0.5398023",
"0.53774786",
"0.5366003",
"0.5366003",
"0.5363954"... | 0.5432214 | 13 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: host_id, type: String name: listener_port, type: Integer name: load_balancer_id, type: String name: owner_account, type: String | def describe_load_balancer_h_t_t_p_listener_attribute(optional={})
args = self.class.new_params
args[:query]['Action'] = 'DescribeLoadBalancerHTTPListenerAttribute'
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? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :listener_port
args[:query]['ListenerPort'] = optional[:listener_port]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? ... | [
"0.64313316",
"0.6326936",
"0.62214124",
"0.61689353",
"0.60679847",
"0.6041232",
"0.5892805",
"0.5878499",
"0.58319575",
"0.57913655",
"0.57796055",
"0.57615423",
"0.5733857",
"0.5728543",
"0.5647224",
"0.5647224",
"0.5647224",
"0.5647224",
"0.5613168",
"0.55781585",
"0.5575... | 0.51493216 | 63 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: host_id, type: String name: load_balancer_id, type: String name: owner_account, type: String name: server_id, type: String | def describe_load_balancers(optional={})
args = self.class.new_params
args[:query]['Action'] = 'DescribeLoadBalancers'
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? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
if optional.key? :server_id
args[:query]['ServerId'] = optional[:server_id]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? ... | [
"0.6386994",
"0.6247801",
"0.62020737",
"0.59993243",
"0.57949907",
"0.5770757",
"0.5755485",
"0.5727139",
"0.56117886",
"0.5610129",
"0.55574346",
"0.5545361",
"0.5545361",
"0.5545361",
"0.5545361",
"0.5539851",
"0.5534327",
"0.5519035",
"0.54950017",
"0.5444844",
"0.5444844... | 0.58280563 | 4 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: host_id, type: String name: listener_port, type: Integer name: load_balancer_id, type: String name: owner_account, type: String | def describe_load_balancer_t_c_p_listener_attribute(optional={})
args = self.class.new_params
args[:query]['Action'] = 'DescribeLoadBalancerTCPListenerAttribute'
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? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :listener_port
args[:query]['ListenerPort'] = optional[:listener_port]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? ... | [
"0.64302105",
"0.6325864",
"0.6221867",
"0.61697066",
"0.6067263",
"0.6040307",
"0.58924437",
"0.5878112",
"0.5832977",
"0.5790073",
"0.5779026",
"0.57621855",
"0.57341903",
"0.5727921",
"0.5648852",
"0.5648852",
"0.5648852",
"0.5648852",
"0.5611834",
"0.55784607",
"0.5575475... | 0.5170256 | 59 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: host_id, type: String name: owner_account, type: String | def describe_regions(optional={})
args = self.class.new_params
args[:query]['Action'] = 'DescribeRegions'
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? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint_params\n params.require(:data).permit(:type, {\n attributes: [:verb, :path, response: [:code, :body, headers: {}]]\n })\n end",
"def create_method\n :http_put\n end",
"def create_method\n :http_put\n end",
"def request_parameters; end",
"def ... | [
"0.5964625",
"0.587524",
"0.587524",
"0.5734517",
"0.57123655",
"0.56801575",
"0.566042",
"0.56546396",
"0.5607281",
"0.5597859",
"0.5597859",
"0.5585274",
"0.557061",
"0.557061",
"0.557061",
"0.557061",
"0.556374",
"0.5546403",
"0.5521726",
"0.55144954",
"0.5507968",
"0.54... | 0.5258396 | 52 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: backend_servers, type: String name: host_id, type: String name: load_balancer_id, type: String name: owner_account, type: String | def remove_backend_servers(optional={})
args = self.class.new_params
args[:query]['Action'] = 'RemoveBackendServers'
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? :backend_servers
args[:query]['BackendServers'] = optional[:backend_servers]
end
if optional.key? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? ... | [
"0.6474627",
"0.6289442",
"0.6230481",
"0.6017509",
"0.58854175",
"0.5771842",
"0.57512516",
"0.5707569",
"0.5659567",
"0.5629907",
"0.5601322",
"0.55060434",
"0.5479961",
"0.5479961",
"0.5479961",
"0.5479961",
"0.54543763",
"0.54415727",
"0.5439501",
"0.53967047",
"0.5386634... | 0.0 | -1 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: cookie, type: String name: cookie_timeout, type: Integer name: domain, type: String name: health_check, type: String name: health_check_timeout, type: Integer name: healthy_threshold, type: Integer name: host_id, type: String name: interval, type: Integer name: listener_port, type: Integer name: load_balancer_id, type: String name: owner_account, type: String name: scheduler, type: String name: sticky_session, type: String name: sticky_session_type, type: String name: u_r_i, type: String name: unhealthy_threshold, type: Integer name: x_forwarded_for, type: String | def set_load_balancer_h_t_t_p_listener_attribute(optional={})
args = self.class.new_params
args[:query]['Action'] = 'SetLoadBalancerHTTPListenerAttribute'
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? :cookie
args[:query]['Cookie'] = optional[:cookie]
end
if optional.key? :cookie_timeout
args[:query]['CookieTimeout'] = optional[:cookie_timeout]
end
if optional.key? :domain
args[:query]['Domain'] = optional[:domain]
end
if optional.key? :health_check
args[:query]['HealthCheck'] = optional[:health_check]
end
if optional.key? :health_check_timeout
args[:query]['HealthCheckTimeout'] = optional[:health_check_timeout]
end
if optional.key? :healthy_threshold
args[:query]['HealthyThreshold'] = optional[:healthy_threshold]
end
if optional.key? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :interval
args[:query]['Interval'] = optional[:interval]
end
if optional.key? :listener_port
args[:query]['ListenerPort'] = optional[:listener_port]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
if optional.key? :scheduler
args[:query]['Scheduler'] = optional[:scheduler]
end
if optional.key? :sticky_session
args[:query]['StickySession'] = optional[:sticky_session]
end
if optional.key? :sticky_session_type
args[:query]['StickySessionType'] = optional[:sticky_session_type]
end
if optional.key? :u_r_i
args[:query]['URI'] = optional[:u_r_i]
end
if optional.key? :unhealthy_threshold
args[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]
end
if optional.key? :x_forwarded_for
args[:query]['XForwardedFor'] = optional[:x_forwarded_for]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_parameters; end",
"def params\n {\n \"add-header\" => nil,\n \"burst-length\" => nil,\n \"client\" => nil,\n \"close-with-reset\" => nil,\n \"debug\" => nil,\n \"failure-status\" => nil,\n \"hog\" => nil,\n \"http-version\" => nil,\n \"max-connections\"... | [
"0.60035664",
"0.59973466",
"0.5782403",
"0.5749603",
"0.5656002",
"0.56268954",
"0.56108236",
"0.5606029",
"0.5599377",
"0.5599377",
"0.5599377",
"0.5599377",
"0.55653846",
"0.55365217",
"0.5524096",
"0.5524096",
"0.5522632",
"0.5475042",
"0.5474657",
"0.5473388",
"0.5464179... | 0.52903783 | 31 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: host_id, type: String name: listener_port, type: Integer name: listener_status, type: String name: load_balancer_id, type: String name: owner_account, type: String | def set_load_balancer_listener_status(optional={})
args = self.class.new_params
args[:query]['Action'] = 'SetLoadBalancerListenerStatus'
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? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :listener_port
args[:query]['ListenerPort'] = optional[:listener_port]
end
if optional.key? :listener_status
args[:query]['ListenerStatus'] = optional[:listener_status]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer_t_c_p_listener(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancerTCPListener'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|... | [
"0.63837177",
"0.6372391",
"0.6279545",
"0.6059074",
"0.6011611",
"0.5975739",
"0.59615475",
"0.58857226",
"0.57540584",
"0.5750123",
"0.5721178",
"0.57137656",
"0.56760687",
"0.56727606",
"0.5600799",
"0.5530732",
"0.5530732",
"0.5530732",
"0.5530732",
"0.55079454",
"0.55039... | 0.6250731 | 3 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: host_id, type: String name: load_balancer_id, type: String name: load_balancer_name, type: String name: owner_account, type: String | def set_load_balancer_name(optional={})
args = self.class.new_params
args[:query]['Action'] = 'SetLoadBalancerName'
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? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :load_balancer_name
args[:query]['LoadBalancerName'] = optional[:load_balancer_name]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? ... | [
"0.6866154",
"0.6751546",
"0.66152465",
"0.6187423",
"0.6098222",
"0.6038154",
"0.5912855",
"0.5767288",
"0.56685144",
"0.56385946",
"0.56008303",
"0.5484754",
"0.54226196",
"0.5392469",
"0.53671664",
"0.5349883",
"0.5344752",
"0.5335411",
"0.5320632",
"0.5310211",
"0.5303687... | 0.6372453 | 3 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: host_id, type: String name: load_balancer_id, type: String name: load_balancer_status, type: String name: owner_account, type: String | def set_load_balancer_status(optional={})
args = self.class.new_params
args[:query]['Action'] = 'SetLoadBalancerStatus'
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? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :load_balancer_status
args[:query]['LoadBalancerStatus'] = optional[:load_balancer_status]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancer'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? ... | [
"0.6909721",
"0.6828887",
"0.67474425",
"0.6447085",
"0.63585633",
"0.620061",
"0.59820795",
"0.59377414",
"0.5841316",
"0.5826932",
"0.57243174",
"0.5650492",
"0.5558808",
"0.5551457",
"0.54907346",
"0.5480091",
"0.545946",
"0.54384315",
"0.5415502",
"0.54100215",
"0.5403800... | 0.65761095 | 3 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: connect_port, type: Integer name: connect_timeout, type: Integer name: health_check, type: String name: healthy_threshold, type: Integer, min value: 1, max value: 10 name: host_id, type: String name: interval, type: Integer name: listener_port, type: Integer name: load_balancer_id, type: String name: owner_account, type: String name: persistence_timeout, type: Integer name: scheduler, type: String name: unhealthy_threshold, type: Integer, min value: 1, max value: 10 | def set_load_balancer_t_c_p_listener_attribute(optional={})
args = self.class.new_params
args[:query]['Action'] = 'SetLoadBalancerTCPListenerAttribute'
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? :connect_port
args[:query]['ConnectPort'] = optional[:connect_port]
end
if optional.key? :connect_timeout
args[:query]['ConnectTimeout'] = optional[:connect_timeout]
end
if optional.key? :health_check
args[:query]['HealthCheck'] = optional[:health_check]
end
if optional.key? :healthy_threshold
raise ArgumentError, 'healthy_threshold must be equal or greater than 1' unless optional[:healthy_threshold] < 1
raise ArgumentError, 'healthy_threshold must be equal or less than 10' unless optional[:healthy_threshold] > 10
args[:query]['HealthyThreshold'] = optional[:healthy_threshold]
end
if optional.key? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :interval
args[:query]['Interval'] = optional[:interval]
end
if optional.key? :listener_port
args[:query]['ListenerPort'] = optional[:listener_port]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
if optional.key? :persistence_timeout
args[:query]['PersistenceTimeout'] = optional[:persistence_timeout]
end
if optional.key? :scheduler
args[:query]['Scheduler'] = optional[:scheduler]
end
if optional.key? :unhealthy_threshold
raise ArgumentError, 'unhealthy_threshold must be equal or greater than 1' unless optional[:unhealthy_threshold] < 1
raise ArgumentError, 'unhealthy_threshold must be equal or less than 10' unless optional[:unhealthy_threshold] > 10
args[:query]['UnhealthyThreshold'] = optional[:unhealthy_threshold]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def params\n {\n \"add-header\" => nil,\n \"burst-length\" => nil,\n \"client\" => nil,\n \"close-with-reset\" => nil,\n \"debug\" => nil,\n \"failure-status\" => nil,\n \"hog\" => nil,\n \"http-version\" => nil,\n \"max-connections\" => nil,\n \"max-piped-calls... | [
"0.59732234",
"0.57500786",
"0.56919616",
"0.56631744",
"0.565759",
"0.565759",
"0.565759",
"0.565759",
"0.56524473",
"0.5647434",
"0.55865693",
"0.5535142",
"0.5500358",
"0.54681146",
"0.5435296",
"0.5419128",
"0.5416722",
"0.5416722",
"0.5413054",
"0.54054886",
"0.5401759",... | 0.5206276 | 38 |
optional parameters: name: _method, type: String, optional values: GET|POST name: _region, type: String name: _scheme, type: String, optional values: http|https name: host_id, type: String name: listener_port, type: Integer name: listener_status, type: String name: load_balancer_id, type: String name: owner_account, type: String | def set_load_banancer_listener_status(optional={})
args = self.class.new_params
args[:query]['Action'] = 'SetLoadBanancerListenerStatus'
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? :host_id
args[:query]['HostId'] = optional[:host_id]
end
if optional.key? :listener_port
args[:query]['ListenerPort'] = optional[:listener_port]
end
if optional.key? :listener_status
args[:query]['ListenerStatus'] = optional[:listener_status]
end
if optional.key? :load_balancer_id
args[:query]['LoadBalancerId'] = optional[:load_balancer_id]
end
if optional.key? :owner_account
args[:query]['OwnerAccount'] = optional[:owner_account]
end
self.run(args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_load_balancer_t_c_p_listener(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateLoadBalancerTCPListener'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|... | [
"0.63837177",
"0.6372391",
"0.6250731",
"0.6059074",
"0.6011611",
"0.5975739",
"0.59615475",
"0.58857226",
"0.57540584",
"0.5750123",
"0.5721178",
"0.57137656",
"0.56760687",
"0.56727606",
"0.5600799",
"0.5530732",
"0.5530732",
"0.5530732",
"0.5530732",
"0.55079454",
"0.55039... | 0.6279545 | 2 |
before_action :check_if_admin, only: [:index] | def profile
@user = @current_user
render :show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_actions\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end",
"def any_action?\n admin?\n end",
"def check_admin\n redirect_to :root unless current_user.admin?\n ... | [
"0.7955673",
"0.787282",
"0.7815589",
"0.778126",
"0.77725923",
"0.7766669",
"0.7731227",
"0.7706988",
"0.76438016",
"0.76393396",
"0.76359767",
"0.76359767",
"0.7622286",
"0.76172316",
"0.76114625",
"0.7609318",
"0.75978595",
"0.75577706",
"0.7542272",
"0.753394",
"0.7529552... | 0.0 | -1 |
maybe later display these as a tag cloud? Font size increasing with numbe of times a word is mentioned? | def get_keywords
tweets = self.get_tweets
counts = Hash.new(0)
tweets.each do |tweet|
tweet.text.downcase.split(/\s+/).each do |word|
word.gsub!(/\p{^Alnum}/,'')
next if word.size < 1
counts[word] += 1
end
end
temp_nest_array = (counts.select{ |k, v| v.to_i > 1}).sort_by{ |k, v| -v } # sort by count (descending) on counts of more than one word
count_hash = Hash.new(0)
temp_nest_array.each do |k, v|
count_hash[k] = v
end
count_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_tag_cloud(tags)\n max, min = 30, 10 # font size of tags\n popularity = []\n tags.each{|t| (popularity << t.popularity)}\n x = ((max - min) / popularity.uniq.length)\n for i in 0...(tags.length)\n if i != 0 && tags[i - 1].popularity.to_i > tags[i].popularity.to_i\n max=max - x #... | [
"0.74840826",
"0.6707534",
"0.6511921",
"0.6246186",
"0.6234064",
"0.61204076",
"0.6075045",
"0.60658044",
"0.6060441",
"0.60526216",
"0.59866494",
"0.5980222",
"0.5972254",
"0.5965879",
"0.594402",
"0.5893685",
"0.5861589",
"0.5854775",
"0.5843645",
"0.5769496",
"0.57649386"... | 0.0 | -1 |
save any relationships that need saving, storing in the reference to the final target | def save(with_id)
@roles.each do |role|
$stderr.puts "Role: #{role.name} '#{role.needs_saving.inspect}'"
if role.needs_saving
role.role.role_user = role.user.save
role.role.role_target = with_id
role.save
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_related\n if self.links.present?\n self.links.each do | link |\n link.parent_type = :action_item\n link.parent_key = self.key\n link.save!\n end\n end\n end",
"def save(processed_map=ObjectMap.new) # use that in Reform::AR.\n processed_map[self] = true\n\n ... | [
"0.71147573",
"0.6635284",
"0.65061784",
"0.63429606",
"0.6298138",
"0.6297294",
"0.6288878",
"0.6224133",
"0.61287117",
"0.61071855",
"0.60599345",
"0.605781",
"0.6054804",
"0.6050412",
"0.5969446",
"0.5958421",
"0.5930621",
"0.58953774",
"0.58931583",
"0.58112025",
"0.57741... | 0.54842347 | 53 |
Find out what new roles need filling in, and (at the same time) which ones need saving. We need filling in if 'dont_know' is set or if an email address is given which isn't in the system. It needs saving if it needs filling in or if is has a valid email address | def needs_filling_in?
any_need_filling = false
@roles.select{|r| r.new_entry }.each do |role|
role.needs_saving = role.needs_filling_in = false
if role.dont_know
role.needs_filling_in = true
role.needs_saving = true
elsif !role.email.empty?
role.needs_saving = true
user = User.with_email(role.email)
if user
role.role.role_user = user.user_id
else
role.needs_filling_in = true
role.user.contact.con_email = role.email
end
end
any_need_filling ||= role.needs_filling_in
end
any_need_filling
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_possible_roles\n\tif User.has_role Role.ADMINISTRATOR,session[:roles]\n\t @roles=Role.all\n\t return\n\tend\n\n\t@logged_in_user_role_id = UserRoleMap.getRoleidByUserid(session[:session_user])\n\t#@roles = Role.where(:id => RoleReportTo.select(\"user_role_id\").where(:manager_role_id => @logged_in_user_r... | [
"0.57952803",
"0.56126213",
"0.5602745",
"0.5591891",
"0.55843586",
"0.5533017",
"0.5507958",
"0.54850715",
"0.54683775",
"0.54308635",
"0.5386315",
"0.5366523",
"0.5360715",
"0.5358581",
"0.53537655",
"0.5349893",
"0.532473",
"0.5322135",
"0.5317815",
"0.5315868",
"0.5315821... | 0.75029004 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.