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 |
|---|---|---|---|---|---|---|
Accepts string, open file, or Nokogirilike document | def initialize(doc)
@doc = self.class.convert_document(doc)
initialize_plural_accessors
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse string_or_io, url = nil, encoding = nil, options = 2145, &block\n\n options = Nokogiri::XML::ParseOptions.new(options) if Fixnum === options\n # Give the options to the user\n yield options if block_given?\n\n if string_or_io.respond_to?(:read)\n url ||= string_or_io.... | [
"0.70236146",
"0.6404384",
"0.6389245",
"0.63688844",
"0.6271912",
"0.62354547",
"0.61656916",
"0.6160522",
"0.614113",
"0.6116489",
"0.6099931",
"0.6029202",
"0.598535",
"0.5953023",
"0.5912202",
"0.58901453",
"0.5889393",
"0.5872943",
"0.5833449",
"0.5815549",
"0.58037096",... | 0.0 | -1 |
Let it do its thing! | def parse
self.class.rules.each do |target, (selector, delegate, plural)|
if plural
@doc.search(selector).each do |node|
send(target) << parse_result(node, delegate)
end
else
send("#{target}=", parse_result(@doc.at(selector), delegate))
end
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run() end",
"def proceed!; end",
"def proceed!; end",
"def pass; end",
"def pass; end",
"def run(_); end",
"def run(_); end",
"def bye;... | [
"0.72099423",
"0.72099423",
"0.72099423",
"0.72099423",
"0.72099423",
"0.72099423",
"0.72099423",
"0.72099423",
"0.72099423",
"0.7123658",
"0.7021279",
"0.7021279",
"0.6980207",
"0.6980207",
"0.6968317",
"0.6968317",
"0.6956241",
"0.69099116",
"0.69099116",
"0.68457794",
"0.6... | 0.0 | -1 |
`delegate` is optional, but should respond to `call` or `parse` | def parse_result(node, delegate)
if delegate
delegate.respond_to?(:call) ? delegate.call(node) : delegate.parse(node)
elsif node.respond_to? :inner_text
node.inner_text
else
node.to_s
end unless node.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __delegate__\n @delegate\n end",
"def delegate=(delegate)\n @delegate = delegate\n end",
"def delegate_method; end",
"def initialize(delegate)\n @delegate = delegate\n end",
"def initialize(delegate_)\n @delegate = delegate_\n end",
"def parse_result(node, delegate... | [
"0.6828055",
"0.6789126",
"0.66544104",
"0.6569289",
"0.65179515",
"0.6517736",
"0.641044",
"0.6385248",
"0.6252018",
"0.6172458",
"0.59729815",
"0.5947766",
"0.58498734",
"0.5829118",
"0.580686",
"0.5716394",
"0.57095426",
"0.57074755",
"0.5639398",
"0.5634523",
"0.56198245"... | 0.57613504 | 15 |
end of response for a single document return | def successful?
@successful #make it true if everything saved successfully
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_document; end",
"def end_document; end",
"def on_end_document\n end",
"def end_accepting\n @res\n end",
"def out\n return @response.finish\n end",
"def end_accepting\n @res.compact\n end",
"def endnote\n @response, @documents = fetch(Array(params[:id]))\n ... | [
"0.6550154",
"0.6550154",
"0.6512437",
"0.6307545",
"0.62537724",
"0.62127906",
"0.6177872",
"0.61542743",
"0.6128613",
"0.61256117",
"0.59980816",
"0.5950337",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.59366083",
"0.... | 0.0 | -1 |
returns an array of the urls | def scrape
google_url = create_google_url
google_data = Scrubyt::Extractor.define do
fetch google_url
link_title "//a[@class='l']", :write_text => true do
link_url
end
end
google_data.to_hash.map {|r| r[:link_url]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urls\n @urls ||= extract_urls('url')\n end",
"def urls\n each_url.to_set\n end",
"def urls\n @@urls\n end",
"def to_a\n urls.map(&:url)\n end",
"def urls\n info.map(&:value).select { |u| u.match %r{\\Ahttps?://} }\n end",
"def urls\n (url.split(\",\") re... | [
"0.837424",
"0.8303746",
"0.79931843",
"0.7971105",
"0.7857528",
"0.78189784",
"0.77553326",
"0.7719101",
"0.7710806",
"0.7699058",
"0.7680764",
"0.7582099",
"0.75077194",
"0.7385622",
"0.73797053",
"0.73646885",
"0.73225015",
"0.72969615",
"0.72809684",
"0.72731274",
"0.7240... | 0.0 | -1 |
Return the appropriate route helper method. | def route_helper(ctrlr, action = nil, base: false)
ctr = ctrlr.to_s.underscore
ctr = ctr.split('/').map(&:singularize).join('_') if ctr.include?('/')
ctr = ctr.split('.').map(&:singularize).join('_') if ctr.include?('.')
act = action&.to_sym
act = base_action(act) if act && base
if ctr.end_with?('_url', '_path')
Log.warn("#{__method__}: #{ctrlr}: ignoring action #{act}") if act
ctr
elsif ctr == 'home'
act ? :"#{act}_path" : :main_path
else
case act
when :index, nil then :"#{ctr}_index_path"
when :show then :"#{ctr}_path"
else :"#{act}_#{ctr}_path"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_name; end",
"def route_name; end",
"def custom_routes; end",
"def route\n #TODO\n end",
"def define_resource_named_route_helper_method(method)\n self.class.send :module_eval, <<-end_eval, __FILE__, __LINE__\n def #{method}(*args)\n send \"#{method}_for_\\#{name_pref... | [
"0.6828002",
"0.6828002",
"0.6789869",
"0.66599756",
"0.6634689",
"0.6624757",
"0.6534332",
"0.6511451",
"0.65020466",
"0.65001595",
"0.6464726",
"0.64443564",
"0.6430015",
"0.63938534",
"0.63820976",
"0.63737893",
"0.63737893",
"0.6366693",
"0.6341816",
"0.6294904",
"0.62457... | 0.66056275 | 6 |
after_action :verify_authorized GET /mxa_date_history/.json | def date_history
# byebug
@date_history = MxAssessment.select(:meeting_date).distinct.joins(:patient)
.where(patients: {facility: session[:facility]})
.where(patients: {site: mx_assessment_params[:site]})
.order(meeting_date: :desc)
# byebug
# Need to convert the ActiveRecord Relation to an array
# Oracle doesn't present meeting_date as a formatted string
# Need to format meeting_date (can't do that in the @meeting_date relation)
# Can do it in an array
@date_history.to_a.map! {|meeting| meeting.meeting_date.strftime('%F')}
# @date_history.to_a.map! do |meeting|
# unless meeting.meeting_date.blank?
# meeting.meeting_date.strftime('%F')
# # meeting.meeting_date.strftime('%m/%d/%Y')
# end
# end
respond_to do |format|
format.json {render json: @date_history}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def history\n command = AccountHistory.call(@current_user)\n if command.success?\n @history = command.result\n render 'history.json.jbuilder', status: :ok\n else\n render json: {error: command.errors}, status: :bad_request\n end\n end",
"def fetch_history\... | [
"0.6291958",
"0.6020541",
"0.595228",
"0.59460473",
"0.59315926",
"0.59167576",
"0.5862205",
"0.5737237",
"0.5718228",
"0.5671029",
"0.5650537",
"0.56387687",
"0.56368124",
"0.5621231",
"0.5591315",
"0.55881345",
"0.5580779",
"0.55762136",
"0.55762136",
"0.5571356",
"0.554666... | 0.5615621 | 14 |
GET /mx_assessments GET /mx_assessments.json | def index
@mx_assessments = MxAssessment.all
authorize MxAssessment
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @skill_assessments = SkillAssessment.all\n end",
"def index\n @assessments = Assessment.all\n end",
"def index\n @assessments = Assessment.all\n end",
"def index\n @assessments = @location.assessments\n\n respond_to do |format|\n format.html # index.html.erb\n ... | [
"0.7234074",
"0.7187159",
"0.7187159",
"0.6977998",
"0.6959771",
"0.6768774",
"0.65989125",
"0.64246756",
"0.6417867",
"0.6417867",
"0.63915986",
"0.63785046",
"0.6277545",
"0.6273252",
"0.62647027",
"0.62633705",
"0.6233844",
"0.6231452",
"0.6217758",
"0.61547345",
"0.614283... | 0.68061316 | 5 |
GET /mx_assessments/1 GET /mx_assessments/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @skill_assessments = SkillAssessment.all\n end",
"def index\n @assessments = Assessment.all\n end",
"def index\n @assessments = Assessment.all\n end",
"def index\n @assessments = @location.assessments\n\n respond_to do |format|\n format.html # index.html.erb\n ... | [
"0.71665937",
"0.71493727",
"0.71493727",
"0.6896379",
"0.6874451",
"0.6737587",
"0.6736547",
"0.67287564",
"0.6728345",
"0.658677",
"0.6525294",
"0.648196",
"0.64300686",
"0.63860124",
"0.63679343",
"0.63441086",
"0.63441086",
"0.63422674",
"0.62719035",
"0.6270778",
"0.6252... | 0.0 | -1 |
POST /mx_assessments POST /mx_assessments.json | def create
@mx_assessment = MxAssessment.new(mx_assessment_params)
# byebug
respond_to do |format|
if @mx_assessment.save
# format.html { redirect_to @mx_assessment, notice: 'Mx assessment was successfully created.' }
# format.json { render action: 'show', status: :created, location: @mx_assessment }
format.json {head :no_content}
else
# format.html { render action: 'new' }
format.json { render json: @mx_assessment.errors.full_messages, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\n @assessment = Assessment.new(assessment_params)\n respond_to do |format|\n if @assessment.save\n format.html { redirect_to @assessment, notice: 'YASASSSS.' }\n format.json { render :show, status: :created, location: @assessment }\n else\n format.html { render :ne... | [
"0.654014",
"0.65046763",
"0.6496168",
"0.64294016",
"0.64194286",
"0.64194286",
"0.64124846",
"0.63261026",
"0.63075066",
"0.630401",
"0.62905586",
"0.62109745",
"0.62109745",
"0.6176865",
"0.6148356",
"0.6141864",
"0.61344635",
"0.60541433",
"0.60263157",
"0.6018596",
"0.60... | 0.6864484 | 0 |
PATCH/PUT /mx_assessments/1 PATCH/PUT /mx_assessments/1.json | def update
respond_to do |format|
if @mx_assessment.update(mx_assessment_params)
format.html { redirect_to @mx_assessment, notice: 'Mx assessment was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @mx_assessment.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @assessment = Assessment.find(params[:id])\n\n respond_to do |format|\n if @assessment.update_attributes(params[:assessment])\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.jso... | [
"0.6719616",
"0.6617438",
"0.6617438",
"0.65201426",
"0.6473369",
"0.6460596",
"0.6320895",
"0.63081264",
"0.6291418",
"0.62753546",
"0.62753546",
"0.6273983",
"0.62729067",
"0.6255384",
"0.6230215",
"0.6220069",
"0.62059736",
"0.61603636",
"0.61448586",
"0.613961",
"0.612679... | 0.7248259 | 0 |
DELETE /mx_assessments/1 DELETE /mx_assessments/1.json | def destroy
@mx_assessment.destroy
respond_to do |format|
format.html { redirect_to mx_assessments_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @assessment = Assessment.find(params[:id])\n @assessment.destroy\n \n respond_to do |format|\n format.html { redirect_to(assessments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @calculated_data_assessment = CalculatedDataAssessment.find(params[:id])\n... | [
"0.7253281",
"0.7213956",
"0.72096723",
"0.72096723",
"0.72096723",
"0.7161355",
"0.7115042",
"0.71034145",
"0.7083008",
"0.70772076",
"0.7067445",
"0.7062281",
"0.70368093",
"0.70368093",
"0.6972591",
"0.69507694",
"0.693111",
"0.69080406",
"0.6896912",
"0.6860689",
"0.68587... | 0.7893751 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_mx_assessment
@mx_assessment = MxAssessment.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def mx_assessment_params
# params[:mx_assessment]
params.require(:mx_assessment).permit(:danger_yn, :drugs_last_changed,
:drugs_not_why, :drugs_change_why, :psychsoc_last_changed,
:psychsoc_not_why, :psychsoc_change_why, :meeting_date, :patient_id,
:pre_date_yesno, :pre_date_no_why, :pre_date, :updated_by,
:site, :new_date, :date_history)
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 |
Adds a new plane to the game by adding it to list of planes | def add_plane()
planes << Plane.new(
gen_location,
0,
width,
height,
gen_speed(),
true
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_plane(plane)\n @planes << plane\n end",
"def add_section_plane(plane)\n end",
"def add new_planet\n @planets << new_planet\n end",
"def add_planet(planet_to_add)\n @planets << planet_to_add\n end",
"def has_plane(plane)\n @planes.include?(plane)\n end",
"def add_planet(planet... | [
"0.86730474",
"0.70779675",
"0.665445",
"0.6471242",
"0.6463104",
"0.6445174",
"0.6429574",
"0.6427971",
"0.6399423",
"0.63953304",
"0.63953304",
"0.63953304",
"0.63953304",
"0.6339624",
"0.6339624",
"0.6339624",
"0.6339624",
"0.6339624",
"0.63251245",
"0.63251245",
"0.632512... | 0.8479238 | 1 |
Generates a random speed for a plane | def gen_speed
rand + 15.0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_turn deg\n rand(deg) - (deg/2)\n end",
"def change_speed\n @statistics[:speed_changes] += 1\n # pick a coordination to change speed for\n @changed_coord = @coordinations.rand\n @previous_speed = @current_speed[@changed_coord]\n @current_speed[@changed_coord] = @previous_speed + SPEE... | [
"0.6065477",
"0.6058937",
"0.59434384",
"0.59357816",
"0.58834004",
"0.5849826",
"0.5834848",
"0.5790825",
"0.57825524",
"0.5653183",
"0.56463933",
"0.55252355",
"0.5501923",
"0.54777956",
"0.5468474",
"0.54295284",
"0.54108036",
"0.5394586",
"0.538887",
"0.5371247",
"0.53655... | 0.72153455 | 0 |
Checks to see if you can place a plane so that this x coordinate does not collide horizontally with any plane | def can_place(position)
planes.none? do |plane|
plane.wings.in_horizontal_range(BoundingBox.new(position, position + width, 0, 0))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_on_plane?(plane)\n plane.substitute(self) == 0\n end",
"def validation(x, y)\n if(x >= plane[0].length || x < 0)\n puts \"invalid start or end point on across direction\"\n return false\n end\n if(y >= plane.length || y < 0)\n puts \"invalid start or end point on down direction... | [
"0.70268404",
"0.6974505",
"0.68442583",
"0.66286796",
"0.66286796",
"0.662766",
"0.66256654",
"0.66153944",
"0.66153944",
"0.6595292",
"0.6530098",
"0.6432006",
"0.6413732",
"0.6376075",
"0.6351212",
"0.63475037",
"0.63427645",
"0.63180256",
"0.6294594",
"0.62927276",
"0.628... | 0.7207581 | 0 |
Generates a valid x position in a horizontal range that is not occupied by a current plane | def gen_location
while true do
position = rand(Avoid::SCREEN_W - height)
return position if can_place(position)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_x\n grid_width = @window.current_map.width\n half_x = WIDTH / 2 - GRID / 2\n @x = [[@player.x - half_x, 0].max, grid_width * GRID - WIDTH].min\n end",
"def min_x\n @pos.x\n end",
"def offset_x_position(offset)\n offset = offset % 32\n return if offset <= 0\n \n change ... | [
"0.65302503",
"0.6438389",
"0.617358",
"0.61369115",
"0.60945225",
"0.6033597",
"0.60318613",
"0.602145",
"0.5991849",
"0.59504527",
"0.5944953",
"0.59413266",
"0.5935162",
"0.5935162",
"0.5918214",
"0.5910962",
"0.5910678",
"0.5910678",
"0.58813125",
"0.58670485",
"0.5847589... | 0.0 | -1 |
Slow default method to parse timestamps | def convert_timestamp(value, capture_definition)
DateTime.parse(value).strftime('%Y%m%d%H%M%S').to_i unless value.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_timestamps\n super\n @updated = updated.to_i if updated.is_a? String\n @updated = Time.at(updated) if updated\n end",
"def timestamp_parse(_timestamp)\n _undefined\n end",
"def parse_timestamps\n self.keys.each do |key|\n self[key].map! do |timestamp| \n tim... | [
"0.7502079",
"0.742153",
"0.72573483",
"0.70370096",
"0.6761853",
"0.6658598",
"0.6471365",
"0.64357877",
"0.6415363",
"0.6398729",
"0.6227673",
"0.6217726",
"0.607338",
"0.60728997",
"0.6045323",
"0.6025335",
"0.59877765",
"0.5899995",
"0.5894549",
"0.58751416",
"0.58545876"... | 0.5542741 | 58 |
Initializes a new Request object. It will apply the the provided FileFormat module to this instance. | def initialize(file_format)
@lines = []
@attributes = {}
register_file_format(file_format)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize request\n @request = request\n loader = Loader.new\n @files = request.proto_file.map do |fd|\n loader.load_file fd, request.file_to_generate.include?(fd.name)\n end\n @services = @files.flat_map(&:services)\n @messages = @files.flat_ma... | [
"0.653213",
"0.64824104",
"0.64722526",
"0.6420625",
"0.63006014",
"0.6044487",
"0.60231537",
"0.60041815",
"0.6000828",
"0.59933305",
"0.59850824",
"0.5964369",
"0.592677",
"0.59205765",
"0.5905416",
"0.5888999",
"0.5816779",
"0.58095914",
"0.5792755",
"0.5728092",
"0.571404... | 0.60909516 | 5 |
Adds another line to the request. The line should be provides as a hash of the fields parsed from the line. | def add_parsed_line (parsed_line)
value_hash = parsed_line[:line_definition].convert_captured_values(parsed_line[:captures], self)
value_hash[:line_type] = parsed_line[:line_definition].name
value_hash[:lineno] = parsed_line[:lineno]
add_line_hash(value_hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_line(line)\n @lines << line\n line\n end",
"def add_line(line)\n @entries << line\n end",
"def add_line(line)\n\t\t@lines << line\n\tend",
"def add(context, line)\n\t\t\t@lines << @line.new(context, line)\n\t\tend",
"def append_line(line)\n @entries.last.line <... | [
"0.7293698",
"0.72569835",
"0.7010378",
"0.6998087",
"0.69378567",
"0.65400636",
"0.65014666",
"0.6469612",
"0.64541084",
"0.6437858",
"0.6375269",
"0.6327599",
"0.62233853",
"0.6197437",
"0.61816984",
"0.6145997",
"0.6134345",
"0.6134159",
"0.61280876",
"0.61050147",
"0.6056... | 0.7030503 | 2 |
Checks whether the given line type was parsed from the log file for this request | def has_line_type?(line_type)
return true if @lines.length == 1 && @lines[0][:line_type] == line_type.to_sym
@lines.detect { |l| l[:line_type] == line_type.to_sym }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_line?(line)\n end",
"def parse_line(line)\n catch :line_parsed do\n UNDERSTOOD_ROWS.each do |record_type|\n if line.start_with?(record_type)\n send \"parse_#{record_type.downcase}_line\", line.chomp\n throw :line_parsed\n ... | [
"0.6875566",
"0.6819655",
"0.6388828",
"0.6379881",
"0.6297805",
"0.6271115",
"0.6238997",
"0.6210488",
"0.62095916",
"0.6170423",
"0.61668384",
"0.6092322",
"0.60567945",
"0.60485834",
"0.60405564",
"0.6032809",
"0.60096717",
"0.5962498",
"0.59406424",
"0.59359866",
"0.59309... | 0.78390855 | 0 |
Returns the value that was captured for the "field" of this request. This function will return the first value that was captured if the field was captured in multiple lines | def first(field)
@attributes[field]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_field_value(value)\r\n value\r\n end",
"def capture_value(line)\n value = line.dup\n [@cell_mapping['capture']].flatten.each do |pattern|\n if matchdata = value.to_s.match(pattern)\n value = matchdata[1]\n else\n value = nil\n end\n ... | [
"0.63388157",
"0.63243747",
"0.6122165",
"0.6010617",
"0.5935572",
"0.5683793",
"0.56731313",
"0.56578517",
"0.56104916",
"0.5606676",
"0.55306125",
"0.55060524",
"0.5485236",
"0.5479053",
"0.5476118",
"0.54255545",
"0.54047143",
"0.54030895",
"0.5377338",
"0.5360969",
"0.535... | 0.5145488 | 34 |
Returns an array of all the "field" values that were captured for this request | def every(field)
@lines.inject([]) { |result, fields| result << fields[field] if fields.has_key?(field); result }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_fields\n @fields.values\n end",
"def fields\n raw['fields']\n end",
"def all_fields\n fields.values\n end",
"def values\n fields.map { |f| f.value }\n end",
"def fields\n []\n end",
"def fields\n @fields.keys\n end",
"def fields\n @fields.key... | [
"0.7208588",
"0.7194795",
"0.7139729",
"0.7124164",
"0.70785457",
"0.7053813",
"0.7053813",
"0.69502896",
"0.6927054",
"0.69231707",
"0.69231707",
"0.68249375",
"0.6796875",
"0.67787254",
"0.6765378",
"0.67451906",
"0.6731101",
"0.67275864",
"0.67081785",
"0.667635",
"0.66674... | 0.0 | -1 |
Returns true if this request does not yet contain any parsed lines. This should only occur during parsing. An empty request should never be sent to the aggregators | def empty?
@lines.length == 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty()\n @requests.empty?\n end",
"def empty?\n @line_items.empty?\n end",
"def empty?\n line_items.length == 0\n end",
"def empty?\n @source_lines.empty?\n end",
"def empty?\n line.empty?\n end",
"def buffer_empty?\n @line_no.zero? || @p... | [
"0.7498818",
"0.69157696",
"0.68651533",
"0.67668355",
"0.6691595",
"0.6544075",
"0.65219074",
"0.64844424",
"0.6444782",
"0.6407104",
"0.6389373",
"0.63448536",
"0.6321745",
"0.6304365",
"0.6221054",
"0.6199897",
"0.6190072",
"0.61874676",
"0.61542505",
"0.61519974",
"0.6115... | 0.6955177 | 1 |
Checks whether this request is completed. A completed request contains both a parsed header line and a parsed footer line. Not that calling this function in single line mode will always return false. | def completed?
header_found, footer_found = false, false
@lines.each do |line|
line_def = file_format.line_definitions[line[:line_type]]
header_found = true if line_def.header
footer_found = true if line_def.footer
end
header_found && footer_found
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def done_request_line?\n [:headers, :body_identity, :body_chunked, :body_chunked_tail, :done].include?(@state)\n end",
"def completed?\n\t\t\treturn request_status == REQUEST_STATUS['completed']\n\t\tend",
"def finished?\n\t\t\t\t@finished && @body.length >= @headers['CONTENT_LENGTH']\n\t\t\tend",
"d... | [
"0.7583645",
"0.7405685",
"0.7369098",
"0.7331768",
"0.718461",
"0.68619204",
"0.67938167",
"0.67938167",
"0.67217165",
"0.6713927",
"0.67137545",
"0.6632473",
"0.66208047",
"0.66208047",
"0.6591405",
"0.6553439",
"0.6548661",
"0.6536518",
"0.65295464",
"0.65285605",
"0.65165... | 0.7873064 | 0 |
This function is called before a Requests is yielded. | def validate
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before\n poller.before_request { |stats| yield(stats) }\n end",
"def before_request(&block)\n @before_request = block if block\n @before_request || proc { |a| a }\n end",
"def before_request\n end",
"def before_queue(urls)\n # stub\n end",
"def before(&block)\n ... | [
"0.7552005",
"0.6526417",
"0.6260017",
"0.6249787",
"0.62194806",
"0.5947611",
"0.59454757",
"0.59316033",
"0.59105045",
"0.58970404",
"0.58942175",
"0.5886568",
"0.5847973",
"0.5847973",
"0.58447766",
"0.5841522",
"0.58263516",
"0.582436",
"0.5821998",
"0.58150476",
"0.57908... | 0.0 | -1 |
Returns the first timestamp encountered in a request. | def timestamp
first(:timestamp)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_timestamp\n request_time.strftime(\"%Y%m%dT%H%M%SZ\")\n end",
"def get_request_timestamp\n\t\treturn @transport.get_path(\"meta\",\"datetime\")\n\tend",
"def request_timestamp\n auth_info[\"date\"] || \"\"\n end",
"def request_time\n @request_time ||= Time.now.utc\n ... | [
"0.7072777",
"0.6811562",
"0.6744703",
"0.65663624",
"0.62786555",
"0.62054044",
"0.6166322",
"0.6142026",
"0.61248314",
"0.61132866",
"0.60757315",
"0.60757315",
"0.60719293",
"0.60616124",
"0.6020519",
"0.6011151",
"0.601103",
"0.60090405",
"0.6008894",
"0.6004444",
"0.5979... | 0.7083804 | 0 |
Creates a client for the backlog.jp XMLRPC API | def new(space, username, password)
@base = Backlogjp::Base.new(space, username, password)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xmlrpc_client\n @xmlrpc_client ||= XMLRPC::Client.new2(\"https://api.webfaction.com/\", nil, 5)\n end",
"def _client\n @client ||= XMLRPC::Client.new(@uri.host, @uri.path, @uri.port, nil, nil, nil, nil, @uri.port == 443, @timeout)\n end",
"def create_client!\n Chef::ApiClient::... | [
"0.7462144",
"0.6633916",
"0.6228647",
"0.6228523",
"0.61985",
"0.6182229",
"0.6090183",
"0.60566425",
"0.5897246",
"0.58641696",
"0.5862251",
"0.58438987",
"0.57994854",
"0.57649505",
"0.57649505",
"0.5760801",
"0.5751104",
"0.573898",
"0.5724729",
"0.55873513",
"0.5577965",... | 0.0 | -1 |
get 5 random queries, across the given object types | def get_random_quick_queries(types)
allTypes = types.collect {|type| type.get_quick_queries}.flatten
prng = Random.new
random_qq = allTypes.sort {|item1, item2| prng.rand(-1 .. 1) }.slice(0, 5)
random_qq.collect {|qq| render_quick_query(qq)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomise\n @random_articles = Article.limit(5).order(\"RANDOM()\")\n @random_users = User.limit(5).order(\"RANDOM()\")\n @random_diarys = Diary.limit(5).order(\"RANDOM()\")\n @random_groups = Group.limit(5).order(\"RANDOM()\")\n end",
"def random_query\n # Use a fake query\n # TODO: better ra... | [
"0.6367781",
"0.618718",
"0.60722196",
"0.60241425",
"0.5811108",
"0.58072484",
"0.5799148",
"0.5714554",
"0.55627275",
"0.549999",
"0.5492699",
"0.5452822",
"0.5447545",
"0.54319924",
"0.5385281",
"0.5382581",
"0.53622556",
"0.5306837",
"0.52943057",
"0.52907974",
"0.5277666... | 0.7528349 | 0 |
runs the following 2 methods and returns their value | def virus_effects
predicted_deaths
speed_of_spread
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calls; end",
"def calls; end",
"def two_method(x,y,z)\n\t\tx + y + z\nend",
"def method_and_value; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def call() end",
"def secon... | [
"0.67209035",
"0.67209035",
"0.65410423",
"0.64683217",
"0.63401043",
"0.63401043",
"0.63401043",
"0.63401043",
"0.63401043",
"0.63401043",
"0.63401043",
"0.63401043",
"0.62614053",
"0.62250125",
"0.61975706",
"0.61823815",
"0.6171286",
"0.61435926",
"0.61435926",
"0.61424434",... | 0.0 | -1 |
GET /bags or /bags.json | def index
@bags = Bag.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n get('tags')\n end",
"def index\n tags = Tag.all\n render json: tags, status: :ok\n end",
"def index\n @tags = Tag.order('name')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tags }\n end\n end",
"def index\n @hastags = Has... | [
"0.63053185",
"0.6177401",
"0.61300296",
"0.610373",
"0.6095084",
"0.60931844",
"0.59739834",
"0.596978",
"0.59689313",
"0.59642494",
"0.5946389",
"0.59460473",
"0.5932101",
"0.59275085",
"0.58966583",
"0.58965844",
"0.5892065",
"0.58845395",
"0.5884357",
"0.5875273",
"0.5856... | 0.6613092 | 0 |
GET /bags/1 or /bags/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bags = Bag.all\n end",
"def index\n tags = Tag.all\n render json: tags, status: :ok\n end",
"def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end",
"def index\n @brags = Brag.all\n\n respo... | [
"0.63323045",
"0.5891597",
"0.58796716",
"0.5815884",
"0.57915324",
"0.5790761",
"0.5789947",
"0.5762983",
"0.574759",
"0.5707848",
"0.5707356",
"0.5702348",
"0.5657731",
"0.565458",
"0.56509966",
"0.56311566",
"0.5617011",
"0.5615453",
"0.5602909",
"0.5602243",
"0.55983514",... | 0.0 | -1 |
POST /bags or /bags.json | def create
#if user is not logged in, store all the attributes under its own session cookies.
if current_user.nil?
p = Product.find(session[:tmp_cart_pid])
pv_id = p.product_variants.find_by(size: params[:size], color: params[:color]).id
session[:tmp_cart_vid] = pv_id
session[:tmp_quantity] = bag_params[:quantity]
redirect_to signin_path
else
bag_params1 = bag_params
pr = Product.find(bag_params1[:product_id])
bag_params1[:product_variant_id] = pr.product_variants.find_by(size: params[:size], color: params[:color]).id
@bag = Bag.new(bag_params1)
respond_to do |format|
if @bag.save
#Add popularity when successfully added to cart
product = Product.find(bag_params1[:product_id])
product.popularity += 1
product.save
format.html { redirect_to pr, notice: "Item added to cart!" }
format.json { render :show, status: :created, location: pr }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @bag.errors, status: :unprocessable_entity }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag!(params = {})\n self.post params, edge: :tags\n end",
"def create\n params[:tag_names].split(',').each do |name|\n @tag = Tag.find_or_create_by_name name.strip\n @tagging = Tagging.new(params[:tagging])\n @tagging.tag = @tag\n @tags_saved = @tagging.save\n end\n \... | [
"0.6810579",
"0.5950155",
"0.59243083",
"0.5796079",
"0.57092917",
"0.5705225",
"0.5701296",
"0.56931865",
"0.56667936",
"0.56315726",
"0.562981",
"0.5626319",
"0.56239784",
"0.5600851",
"0.5597046",
"0.5584708",
"0.555226",
"0.5521655",
"0.5519388",
"0.5472271",
"0.54682374"... | 0.0 | -1 |
PATCH/PUT /bags/1 or /bags/1.json | def update
respond_to do |format|
if @bag.update(bag_params)
format.html { redirect_to @bag, notice: "Bag was successfully updated." }
format.json { render :show, status: :ok, location: @bag }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @bag.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n bod... | [
"0.61274207",
"0.6017179",
"0.59048915",
"0.5899882",
"0.58843267",
"0.5847221",
"0.58233",
"0.5808703",
"0.5754309",
"0.5722494",
"0.5717098",
"0.570668",
"0.57023704",
"0.5686537",
"0.5686192",
"0.56398284",
"0.5601541",
"0.5575022",
"0.5536931",
"0.55300653",
"0.5521425",
... | 0.60528153 | 1 |
DELETE /bags/1 or /bags/1.json | def destroy
@bag.destroy
respond_to do |format|
format.html { redirect_to bags_url, notice: "Bag was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @sugar_bag = SugarBag.find(params[:id])\n @sugar_bag.destroy\n\n respond_to do |format|\n format.html { redirect_to sugar_bags_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n\n client.delete(\"/tags/#{gid}\") && true\n end",
"def destroy\n... | [
"0.6856207",
"0.66041327",
"0.6498331",
"0.63567746",
"0.6343161",
"0.62770903",
"0.6260935",
"0.6246118",
"0.62445426",
"0.6229056",
"0.6189771",
"0.6187286",
"0.6186752",
"0.6114031",
"0.6108551",
"0.6102239",
"0.60974306",
"0.60656595",
"0.6064457",
"0.60632217",
"0.606081... | 0.6671587 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_bag
@bag = Bag.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def bag_params
params.require(:bag).permit(:user_id, :quantity, :product_id, :product_variant_id, :purchased)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Set the `sinatra.commonlogger` variable to `true` in the Rack environment before passing the request to lowwer middlewares and the app. This ensures that any `::Rack::CommonLogger` instances (as well as all `::Sinatra::CommonLogger` instances) in the same middleware stack will become silent and not log anything. This is required, so that a single request is not logged multiple times even in the face of the default Rack middleware stack. | def on_request(env)
env['sinatra.commonlogger'] = true
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log(env, *args)\n unless env['sinatra.commonlogger'.freeze] &&\n env['rackstash.logger'.freeze].is_a?(::Rackstash::Logger)\n super\n end\n end",
"def global_request_logging\n http_request_header_keys = request.headers.env.keys.select { |header_name| header_name.ma... | [
"0.71634567",
"0.64025956",
"0.62781805",
"0.625233",
"0.6141523",
"0.6118943",
"0.60816574",
"0.60214525",
"0.5861565",
"0.5838742",
"0.5827042",
"0.55783504",
"0.55778646",
"0.5565248",
"0.55591977",
"0.55004793",
"0.5494461",
"0.54341733",
"0.5421853",
"0.5365102",
"0.5357... | 0.8096271 | 0 |
Count the number of passing cars on the road. full description: | def solution(a)
cars_going_east = [0]
a.each do |direction|
next_counter = direction.zero? ? cars_going_east.last + 1 : cars_going_east.last
cars_going_east << next_counter
end
passings = 0
a.each_with_index do |direction, index|
passings += cars_going_east[index] if direction == 1
end
return -1 if passings > 1000000000
passings
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def car_count\n self.cars.length\n end",
"def trip_count()\n self.trips().length()\n end",
"def get_wheel_count \n \t Car_wheel #Return number of wheels\n end",
"def show_cars_count\n puts \"cars count: #{cars.size}\"\n end",
"def number_of_rides(drivers)\n driver... | [
"0.6860512",
"0.67320716",
"0.6729416",
"0.66576576",
"0.6645416",
"0.6618986",
"0.6618986",
"0.6618986",
"0.66113347",
"0.65965235",
"0.658764",
"0.6580772",
"0.6579321",
"0.6579321",
"0.6559062",
"0.65560126",
"0.65517515",
"0.65498126",
"0.65323883",
"0.6523612",
"0.651751... | 0.0 | -1 |
Get details for a template property type Permissions Needed: ANY | def get_template_property_type(type, opts = {})
data, _status_code, _headers = get_template_property_type_with_http_info(type, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_template\n {}.tap do |access_properties|\n ACCESS_FIELDS.filter { |field, _cocina_field| changed?(field) }.each do |field, cocina_field|\n val = public_send(field)\n access_properties[cocina_field] = val.is_a?(String) ? val.presence : val # allow boolean false\n end\n end\n... | [
"0.6134419",
"0.6087035",
"0.59920925",
"0.59625494",
"0.58938503",
"0.57929164",
"0.5756724",
"0.5756724",
"0.57075584",
"0.5689722",
"0.56670845",
"0.5659848",
"0.5657019",
"0.5616952",
"0.5610074",
"0.5523179",
"0.55164677",
"0.5485348",
"0.5463742",
"0.5445267",
"0.543666... | 0.0 | -1 |
Get details for a template property type Permissions Needed: ANY | def get_template_property_type_with_http_info(type, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: TemplatesPropertiesApi.get_template_property_type ..."
end
# verify the required parameter 'type' is set
if @api_client.config.client_side_validation && type.nil?
fail ArgumentError, "Missing the required parameter 'type' when calling TemplatesPropertiesApi.get_template_property_type"
end
# resource path
local_var_path = "/templates/properties/{type}".sub('{' + 'type' + '}', type.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'PropertyFieldListResource')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TemplatesPropertiesApi#get_template_property_type\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_template\n {}.tap do |access_properties|\n ACCESS_FIELDS.filter { |field, _cocina_field| changed?(field) }.each do |field, cocina_field|\n val = public_send(field)\n access_properties[cocina_field] = val.is_a?(String) ? val.presence : val # allow boolean false\n end\n end\n... | [
"0.61345625",
"0.6087644",
"0.5993657",
"0.59618616",
"0.58932936",
"0.5791299",
"0.57545334",
"0.57545334",
"0.57087237",
"0.56903917",
"0.5666722",
"0.56589675",
"0.56586355",
"0.56090534",
"0.55225",
"0.55185336",
"0.54879344",
"0.5463464",
"0.54444635",
"0.5435505",
"0.54... | 0.5619775 | 13 |
List template property types Permissions Needed: ANY | def get_template_property_types(opts = {})
data, _status_code, _headers = get_template_property_types_with_http_info(opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permissions\n attribute_prop(5)\n end",
"def index\n @allowed = false\n if check_permissions?(session[:user_type], \"create_property\")\n @allowed = true\n end\n @properties = Property.all\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types... | [
"0.63806385",
"0.6314879",
"0.61872756",
"0.61871046",
"0.6075059",
"0.6075059",
"0.60598046",
"0.6046966",
"0.5999109",
"0.59609485",
"0.58689505",
"0.58689505",
"0.5822305",
"0.58110833",
"0.5792158",
"0.5781621",
"0.5779864",
"0.5779864",
"0.57597864",
"0.57571006",
"0.573... | 0.0 | -1 |
List template property types Permissions Needed: ANY | def get_template_property_types_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: TemplatesPropertiesApi.get_template_property_types ..."
end
# resource path
local_var_path = "/templates/properties"
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Array<PropertyFieldListResource>')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: TemplatesPropertiesApi#get_template_property_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permissions\n attribute_prop(5)\n end",
"def index\n @allowed = false\n if check_permissions?(session[:user_type], \"create_property\")\n @allowed = true\n end\n @properties = Property.all\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types... | [
"0.63806385",
"0.6314879",
"0.61872756",
"0.61871046",
"0.6075059",
"0.6075059",
"0.60598046",
"0.6046966",
"0.5999109",
"0.59609485",
"0.58689505",
"0.58689505",
"0.5822305",
"0.58110833",
"0.5792158",
"0.5781621",
"0.5779864",
"0.5779864",
"0.57597864",
"0.57571006",
"0.573... | 0.53458464 | 77 |
Partially order the fixed nodes in a graph, so that each has a sequence number which can be compared. If one node must come before another then it will have a lower sequence number. | def partially_order(graph)
# Create a work list of the fixed nodes.
to_sequence = graph.all_nodes.select(&:fixed?)
# Keep going until the work list is empty.
until to_sequence.empty?
node = to_sequence.shift
# We're only interested in the control inputs to the node.
control_input_nodes = node.inputs.control_edges.from_nodes
# Nodes with no control input (such as start but possibly others) have sequence number zero.
if control_input_nodes.empty?
node.props[:sequence] = 0
next
end
# If all control inputs have been given a sequence, we can give this
# node as at least one greater than all of those.
if control_input_nodes.all? { |i| i.props[:sequence] }
node.props[:sequence] = control_input_nodes.map { |i| i.props[:sequence] }.max + 1
next
end
# If all the control inputs haven't been given a sequence number yet
# then put it back on the work list and come back to it later.
to_sequence.push node
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sorted_with_order\n # Identify groups of nodes that can be executed concurrently\n groups = tsort_each.slice_when { |a, b| parents(a) != parents(b) }\n\n # Assign order to each node\n i = 0\n groups.flat_map do |group|\n group_with_order = group.product([i])\n i += group.... | [
"0.6771997",
"0.63471776",
"0.62937516",
"0.6250659",
"0.6204097",
"0.61987805",
"0.61019766",
"0.608197",
"0.60374594",
"0.60350305",
"0.5919402",
"0.5908654",
"0.5883148",
"0.5829877",
"0.5822465",
"0.5822389",
"0.5819141",
"0.58055353",
"0.5771118",
"0.5761089",
"0.5752894... | 0.7988911 | 0 |
Globally schedule a graph, meaning to anchor all floating nodes to a fixed node. All fixed nodes are part of a basic block, so globally scheduling also puts all floating nodes into a basic block. | def global_schedule(graph)
# Create a work list of the floating nodes.
to_schedule = graph.all_nodes.select {|n| n.floating? && n.op != :immediate }
# Keep going until the work list is empty.
until to_schedule.empty?
node = to_schedule.shift
# Are we ready to schedule this node?
if ready_to_schedule?(node)
# Find candidates to anchor this node to.
candidates = schedule_candidates(graph, node)
# If there aren't any then we're stuck!
raise 'stuck' if candidates.empty?
# Sort the candidates and take the first one to get the best.
best_candidate = sort_candidates(candidates).first
# Add a global schedule edge.
node.output_to :global_schedule, best_candidate
else
# If we aren't ready to schedule this node, try it again later.
to_schedule.push node
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_schedule(graph)\n # Find all basic blocks and locally schedule them.\n\n graph.all_nodes.each do |node|\n if node.begins_block?\n locally_schedule_block node\n end\n end\n end",
"def locally_schedule_block(first_node)\n # Find all the nodes in this basic bl... | [
"0.70818436",
"0.63025105",
"0.5565143",
"0.54924834",
"0.5266468",
"0.5252445",
"0.5182981",
"0.51793593",
"0.51322055",
"0.5088472",
"0.5044987",
"0.5033813",
"0.49748293",
"0.49304396",
"0.4913319",
"0.489849",
"0.48961222",
"0.48843426",
"0.48836952",
"0.48811868",
"0.486... | 0.7916239 | 0 |
A node is ready to be globally scheduled if all outputs have themselves been globally scheduled. | def ready_to_schedule?(node)
# Ready to globally schedule
node.outputs.to_nodes.all? do |i|
globally_scheduled?(i)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def globally_scheduled?(node)\n node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:global_schedule)\n end",
"def locally_scheduled?(node)\n node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:local_schedule)\n end",
"def all_nodes_ready?\n ... | [
"0.77894527",
"0.6978141",
"0.58806896",
"0.57745874",
"0.56384164",
"0.5615665",
"0.55965364",
"0.5573211",
"0.55081576",
"0.54975164",
"0.5481254",
"0.5472935",
"0.5431965",
"0.54217064",
"0.54217064",
"0.54217064",
"0.5386987",
"0.53845656",
"0.5379257",
"0.53709334",
"0.5... | 0.8257271 | 0 |
A node is globally scheduled if it was fixed anyway or we've scheduled it. | def globally_scheduled?(node)
node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:global_schedule)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ready_to_schedule?(node)\n # Ready to globally schedule\n\n node.outputs.to_nodes.all? do |i|\n globally_scheduled?(i)\n end\n end",
"def locally_scheduled?(node)\n node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:local_schedule)\n end",
"def sche... | [
"0.7542531",
"0.75391006",
"0.6578071",
"0.65023583",
"0.59982514",
"0.59718174",
"0.59263",
"0.5889321",
"0.58093995",
"0.5792013",
"0.57559276",
"0.57559276",
"0.5634934",
"0.56066346",
"0.5554238",
"0.5544156",
"0.55417806",
"0.5528694",
"0.55213404",
"0.54560167",
"0.5432... | 0.81634796 | 0 |
Find all possible nodes we could anchor a floating node to to globally schedule it. | def schedule_candidates(graph, node)
if node.outputs.size == 1
# If a node has just one output then that's the only candidate.
[node.outputs.to_nodes.first]
else
# Otherwise, consider all the nodes in the graph (yes this is
# quadratic).
graph.all_nodes.select do |candidate|
# The start node is never a candidate because we're going to schedule
# before the candidate, and we can't schedule before the start node.
if ![:start, :immediate].include?(candidate.op)
# We only consider globally scheduled nodes as candidates.
if globally_scheduled?(candidate)
# Is there a control-flow path from all the inputs of the node to this candidate?
from_all_inputs = node.inputs.from_nodes.all? { |i| !globally_scheduled?(i) || path_from_to(i, candidate) }
# Is there a control-flow path from this candidate to all the outputs of this node?
to_all_outputs = node.outputs.to_nodes.all? { |o| !globally_scheduled?(o) || path_from_to(candidate, o) }
# Both conditions need to be true for this candidate to be valid.
from_all_inputs && to_all_outputs
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reachable_nodes\n recursive_set(@start) { |n| n.out }\n end",
"def closest_nodes_to_all(nodes, nodes_from, max_dist = nil)\n closest = []\n nodes_from.each do |node_from|\n closest += closest_nodes(nodes, node_from, max_dist)[0..5]\n end\n closest.uniq\n end",
"def find_reaching_nodes... | [
"0.62472486",
"0.60868007",
"0.60609263",
"0.6042057",
"0.57117707",
"0.57117707",
"0.5709668",
"0.5686278",
"0.5682115",
"0.56498814",
"0.5639523",
"0.56213754",
"0.5605665",
"0.56020916",
"0.5588554",
"0.5572593",
"0.5543723",
"0.5513672",
"0.5493493",
"0.54800934",
"0.5467... | 0.5382475 | 27 |
Sort a list of candidates in decreasing sequence number. | def sort_candidates(candidates)
candidates.sort_by { |candidate|
anchor = fixed_anchor(candidate)
sequence = anchor.props[:sequence]
raise unless sequence
sequence
}.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_list!(list)\n list.sort! do |a,b|\n a, b = a.sort_data, b.sort_data\n i = 0\n i += 1 while a[i] == b[i] && (a[i+1] || b[i+1])\n if a[i] && b[i]\n a[i] <=> b[i]\n else\n a[i] ? 1 : -1\n end\n end\n list\n end",
"def stable_sort... | [
"0.63810384",
"0.63610184",
"0.61656666",
"0.59829026",
"0.5834581",
"0.58151984",
"0.580408",
"0.57987636",
"0.57987636",
"0.57936",
"0.57772225",
"0.5768863",
"0.57473415",
"0.5743058",
"0.57212025",
"0.570653",
"0.5697831",
"0.56953245",
"0.5693282",
"0.56864303",
"0.56860... | 0.8058321 | 0 |
Is there a controlflow path that we can follow from one node to another. | def path_from_to(a, b)
# Work with the fixed anchors of the nodes because that's where the
# control flow is fixed to.
a = fixed_anchor(a)
b = fixed_anchor(b)
# We're going to do a depth-first search starting with the first node
# and we're going to see if we can find the second node. We keep a stack
# of nodes that we need to visit, and a set of nodes that we've already
# visited so that we don't visit nodes more than once. We pop a node
# off the stack, return if it was the node we were looking for, or move
# on if we've already visited it, if not we push the outputs of the node
# to visit next.
worklist = [a]
considered = Set.new
until worklist.empty?
node = worklist.pop
return true if node == b
if considered.add?(node)
worklist.push *node.outputs.control_edges.to_nodes
end
end
# We traversed the whole graph accessible from the first node and didn't
# find the second one.
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_path_to?(node)\n @visited.include?(node)\n end",
"def has_path_to?(end_node)\n @visited.include?(end_node)\n end",
"def completed_path?\n path.size == nodes.size - 1\n end",
"def has_path_to(node)\n\t\t@visited.include?(node)\n\tend",
"def path?(p)\n p.each_cons(2){|x|\n unl... | [
"0.6935976",
"0.6874116",
"0.6861251",
"0.68266964",
"0.6503092",
"0.64903134",
"0.6484965",
"0.6484778",
"0.6423619",
"0.6417184",
"0.6413125",
"0.6314484",
"0.6259633",
"0.62373054",
"0.6230786",
"0.622532",
"0.61801267",
"0.6174962",
"0.6143622",
"0.6028556",
"0.60270894",... | 0.66143453 | 4 |
Give the node that a node is attached to in the global schedule. | def fixed_anchor(node)
raise unless globally_scheduled?(node)
if node.fixed?
# A fixed node is anchored to itself.
node
else
# Otherwise we anchored using an output to another node.
anchor = node.outputs.with_output_name(:global_schedule).to_nodes.first
raise unless anchor
fixed_anchor(anchor)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node\n publish[:node]\n end",
"def node=(node)\n publish[:node] = node\n end",
"def local_node\n @local_node ||= DPN::Workers.nodes.node(to_node)\n end",
"def set_pm_node\n @pm_node = Pm::Node.find(params[:id])\n end",
"def get_node(node)\n\t\t\t@nodes[node]\n\t\tend",
... | [
"0.6418489",
"0.6389499",
"0.6234405",
"0.60527945",
"0.6022411",
"0.5969809",
"0.5917216",
"0.58878255",
"0.5863086",
"0.5842805",
"0.583392",
"0.5805671",
"0.57895976",
"0.57895976",
"0.57631314",
"0.5758204",
"0.5728833",
"0.57215697",
"0.57195073",
"0.569772",
"0.56909937... | 0.57828677 | 14 |
Locally schedule a graph, which means within each basic block decide a single order to run the nodes, which no ambiguity left. | def local_schedule(graph)
# Find all basic blocks and locally schedule them.
graph.all_nodes.each do |node|
if node.begins_block?
locally_schedule_block node
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def global_schedule(graph)\n # Create a work list of the floating nodes.\n\n to_schedule = graph.all_nodes.select {|n| n.floating? && n.op != :immediate }\n\n # Keep going until the work list is empty.\n\n until to_schedule.empty?\n node = to_schedule.shift\n\n # Are we ready to s... | [
"0.6652021",
"0.58744603",
"0.5705704",
"0.5672693",
"0.55824625",
"0.5418472",
"0.5282473",
"0.526016",
"0.5256413",
"0.524882",
"0.5218984",
"0.52164775",
"0.51534736",
"0.50778574",
"0.50678074",
"0.5027008",
"0.50128585",
"0.49651617",
"0.49647626",
"0.49570063",
"0.49377... | 0.73488915 | 0 |
Locally schedule within each basic block. | def locally_schedule_block(first_node)
# Find all the nodes in this basic block.
in_block = Set.new(nodes_in_block(first_node))
# Back up a second... our first node could be a fixed node, which
# actually has input values. Such as a branch with a condition.
# The nodes involved in that condition actually need to come first.
first_node = first_in_block(first_node, in_block)
# Create a work list of nodes to schedule and a set of nodes
# already scheduled.
to_schedule = in_block.to_a
scheduled = Set.new
# The first node in the basic block is already scheduled first.
to_schedule.delete first_node
scheduled.add first_node
# The tail is the last node we scheduled.
tail = first_node
until to_schedule.empty?
node = to_schedule.shift
# We are ready to locally schedule if all inputs that are in this
# block have themselves already been scheduled.
if node.inputs.from_nodes.all? { |i| !in_block.include?(i) || scheduled.include?(i) }
# Add a local schedule edge from the previous last node to this one,
# which then becomes the last node.
raise if tail.inputs.from_nodes.include? node
tail.output_to :local_schedule, node
tail = node
scheduled.add node
else
to_schedule.push node
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule\n # implemented by subclass\n end",
"def schedule(&blk)\n @reactor.next_tick(blk)\n end",
"def local_schedule(graph)\n # Find all basic blocks and locally schedule them.\n\n graph.all_nodes.each do |node|\n if node.begins_block?\n locally_schedule_bloc... | [
"0.6341952",
"0.63037956",
"0.6245337",
"0.6236898",
"0.6190105",
"0.60779387",
"0.6077296",
"0.6060238",
"0.60593796",
"0.6051279",
"0.6051279",
"0.60431254",
"0.60101354",
"0.5986354",
"0.59528625",
"0.59313506",
"0.5929625",
"0.59140587",
"0.5877349",
"0.5876079",
"0.58760... | 0.5590462 | 30 |
We've got a problem with our IR design here. We expect some fixed control flow node to be the start of the basic block. In the case of at least some branches, they can have input that needs to run first, but our system just isn't designed for anything except a control flow node to need to run first. This fixup method walks back from the fixed node to see if actually there is an input that needs to run first. Not a great solution. | def first_in_block(first, nodes)
first.inputs.from_nodes.each do |n|
if nodes.include?(n)
return first_in_block(n, nodes)
end
end
first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix\n assembled_address = $config[:base_address]\n instructions.each do |instr|\n instr.fix(assembled_address)\n assembled_address += instr.size\n end\n end",
"def cleanup_insn_nodes\n nodes.dup.each do |node|\n next unless node.is_a?(InsnNode)\n\n case node... | [
"0.54165345",
"0.5269058",
"0.5166568",
"0.51402485",
"0.50974125",
"0.50485486",
"0.5019855",
"0.4994094",
"0.49908936",
"0.49681368",
"0.49582392",
"0.4958214",
"0.49570262",
"0.49471688",
"0.4946688",
"0.4914956",
"0.48796713",
"0.4878304",
"0.48496935",
"0.483608",
"0.479... | 0.45434842 | 85 |
Find all the nodes in a basic block, given the first node. | def nodes_in_block(first_node)
# We're going to do a depth-first search of the graph from the first
# node, following control flow edges out, and global schedule edges in,
# and stopping when we find a node that ends a basic block such as a
# branch.
worklist = [first_node]
block = Set.new
until worklist.empty?
node = worklist.pop
if block.add?(node)
# We need to visit nodes that are anchored to this one.
node.inputs.edges.each do |i|
if i.input_name == :global_schedule
worklist.push i.from
end
end
# If this node isn't a branch, and it's either the first node or it
# isn't a merge, visit the nodes that follow it in control flow.
if node.op != :branch && (node == first_node || node.op != :merge)
node.outputs.edges.each do |o|
if o.control?
if !(node.op == :start && o.to.op == :finish)
worklist.push o.to
end
end
end
end
end
end
block.to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_in_block(first, nodes)\n first.inputs.from_nodes.each do |n|\n if nodes.include?(n)\n return first_in_block(n, nodes)\n end\n end\n first\n end",
"def find_nodes\n puts '1st pass: find nodes'\n find :nodes\n self\n end",
"def nodes_breadthfir... | [
"0.6709291",
"0.6666401",
"0.6242137",
"0.60401005",
"0.6026713",
"0.6015269",
"0.60145676",
"0.59886914",
"0.59748894",
"0.59748894",
"0.5884524",
"0.58118886",
"0.58118886",
"0.57877636",
"0.57521826",
"0.57321405",
"0.5704309",
"0.57033086",
"0.5685873",
"0.56380695",
"0.5... | 0.69855666 | 0 |
A node is locally scheduled if it's fixed or we have locally scheduled it. | def locally_scheduled?(node)
node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:local_schedule)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def globally_scheduled?(node)\n node.fixed? || node.op == :immediate || node.outputs.output_names.include?(:global_schedule)\n end",
"def ready_to_schedule?(node)\n # Ready to globally schedule\n\n node.outputs.to_nodes.all? do |i|\n globally_scheduled?(i)\n end\n end",
"def sc... | [
"0.7720234",
"0.7297023",
"0.6649845",
"0.6274704",
"0.6190029",
"0.61287236",
"0.61020935",
"0.590382",
"0.589468",
"0.5834543",
"0.5804419",
"0.5800366",
"0.57706374",
"0.5762994",
"0.569952",
"0.56203103",
"0.55885994",
"0.5582333",
"0.5563899",
"0.55336",
"0.55336",
"0.... | 0.8236161 | 0 |
Linearize a graph into a single linear sequence of operations with jumps and branches. | def linearize(graph)
# The basic blocks.
blocks = []
# Details of the basic block that contain the finish operation which
# won't be added to the list of basic blocks until the end.
first_node_last_block = nil
last_block = nil
# Two maps that help us map between nodes and the names of the blocks
# that they go into, and the merge instruction indicies and the blocks
# they're coming from.
first_node_to_block_index = {}
merge_index_to_first_node = {}
# Look at each node that begins a basic block.
basic_block_starters = graph.all_nodes.select { |n| n.begins_block? }
last_basic_block_starter = basic_block_starters.select { |s| nodes_in_block(s).any? { |n| n.op == :finish } }.first
basic_block_starters.delete last_basic_block_starter
basic_block_starters.push last_basic_block_starter
basic_block_starters.each do |node|
original_first_node = node
first_node = first_in_block(original_first_node, nodes_in_block(original_first_node))
# We're going to create an array of operations for this basic
# block.
block = []
next_to_last_control = nil
# Follow the local sequence.
node = first_node
begin
# We don't want to include operations that are just there to form
# branches or anchor points in the graph such as start and merge.
unless [:start, :merge].include?(node.op)
op = node.op
# We rename finish to return to match the switch from the
# declarative style of the graph to the imperative style
# of the list of operations.
op = :return if op == :finish
# The instruction begins with the operation.
insn = [op]
# Then any constant values or similar.
[:line, :n, :value].each do |p|
insn.push node.props[p] if node.props.has_key?(p)
end
# Then any input registers.
node.inputs.with_input_name(:value).from_nodes.each do |input_values|
insn.push input_values.props[:register]
end
# Phi instructions need pairs of source registers with the blocks they came from.
if node.op == :phi
node.inputs.edges.each do |input|
if input.input_name =~ /^value\((.+)\)$/
n = $1.to_i
insn.push n
insn.push input.from.props[:register]
end
end
# Elide phi instructions if register allocation has run correctly and values are
# already in the correct registers.
insn = nil if insn.drop(2).select.with_index{ |_,i| i.even? }.uniq.size == 1
end
# Send instructions and lowered equivalents need the arguments.
if [:send, :call_managed, :int64_add, :int64_sub, :int64_imul, :int64_and, :int64_shift_left, :int64_shift_right].include?(node.op)
insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]
if node.op == :send
insn.push node.props[:name]
elsif node.op == :call_managed
insn.push node.inputs.with_input_name(:name).from_node.props[:register]
end
node.props[:argc].times do |n|
arg = node.inputs.with_input_name(:"arg(#{n})").from_node
if arg.op == :immediate
insn.push arg.props[:value]
else
insn.push arg.props[:register]
end
end
end
# Then the target register if the instruction has one.
insn.push node.props[:register] if insn && (node.produces_value? || node.op == :move)
# If it's a branch then the target basic blocks and the test.
if node.op == :branch
insn.push node.inputs.with_input_name(:condition).from_node.props[:register]
[:true, :false].each do |branch|
target = node.outputs.with_output_name(branch).to_node
raise unless target
insn.push target
end
if node.props[:test]
insn.push node.props[:test]
end
end
# Send instructions and lowered managed calls need the list of live registers.
if [:send, :call_managed].include?(node.op)
insn.push node.props[:live_registers]
end
# Guards are like branches, but only have one side.
if node.op == :guard
insn.push node.inputs.with_input_name(:condition).from_node.props[:register]
if node.props[:test]
insn.push node.props[:test]
end
end
# Kind instructions need the kind.
if node.op == :kind_is?
insn.push node.props[:kind]
end
# Frame states need the instructions, the ip, and to know where values are for
# the receiver, the arguments, and the stack.
if node.op == :deopt_map
insn.push node.props[:insns]
insn.push node.props[:ip]
insn.push node.inputs.with_input_name(:receiver).from_node.props[:register]
insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('arg(') }.map { |e|
/arg\((\d+)\)/ =~ e.input_name.to_s
[$1.to_i, e.from.props[:register]]
}.sort_by { |pair| pair.first }.map { |pair| pair.last }
insn.push node.inputs.edges.select { |e| e.input_name.to_s.start_with?('stack(') }.map { |e|
/stack\((\d+)\)/ =~ e.input_name.to_s
[$1.to_i, e.from.props[:register]]
}.sort_by { |pair| pair.first }.map { |pair| pair.last }
end
# Add the instruction to the block.
block.push insn if insn
end
next_to_last_control = node if node.has_control_output?
# Follow the local schedule edge to the next node.
node = node.outputs.with_output_name(:local_schedule).to_nodes.first
end while node && node.op != :merge
# Empty blocks cause problems elsewhere - it's easier to just have a nop
# in them. Really, we should remove empty blocks by modifying the
# instruction that jumps here to jump to wherever this leads to.
if block.empty?
block.push [:nop]
end
# If the last node is a merge, we need to remember which merge index this is.
if node && node.op == :merge
next_to_last_control.outputs.with_output_name(:control).edges.first.input_name =~ /^control\((.+)\)$/
n = $1.to_i
merge_index_to_first_node[n] = first_node
end
# Add a jump instruction if this block was going to just flow into the next
# - we'll remove it later if the block followed it anyway and we can just
# fallthrough.
unless [:return, :branch].include?(block.last.first)
begin
block.push [:jump, next_to_last_control.outputs.with_output_name(:control).to_node]
rescue
block.push [:jump, :broken]
end
end
first_node_to_block_index[original_first_node] = blocks.size
first_node_to_block_index[first_node] = blocks.size
blocks.push block
end
# Record the number that this basic block has and then add it to the list of basic blocks.
first_node_to_block_index[first_node_last_block] = blocks.size
# Go back through the basic blocks and update some references that were to things that
# hadn't been decided yet.
blocks.each do |block|
block.each do |insn|
insn.map! do |e|
# If part of an instruction references a basic block, turn that into the index of
# the basic block instead.
if e.is_a?(IR::Node)
:"block#{first_node_to_block_index[e]}"
else
e
end
end
end
end
# Go back through the basic blocks and change how the branch instructions out of them
# work.
blocks.each_with_index do |block, n|
next_block = :"block#{n + 1}"
last = block.last
if last == [:jump, next_block]
# A jump that just goes to the next block can be removed and left to fall through.
block.pop
elsif last.first == :branch && last[3] == next_block
# A branch where the else goes to the next block can branch only when true.
block.pop
block.push [:branch_if, last[1], last[2], *last.drop(4)]
elsif last.first == :branch && last[2] == next_block
# A branch where the if goes to the next block can branch only unless true.
block.pop
test = last.drop(4)
block.push [:branch_unless, last[1], last[3], *test]
elsif last.first == :branch
# A branch that doesn't go to the next block at all can be a branch if true
# and then fallthrough to a new jump instruction.
block.pop
block.push [:branch_if, last[1], last[2], *last.drop(4)]
block.push [:jump, last[3]]
end
end
blocks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sequence_nodes(graph)\n # Note that this algorithm is very wasteful! It allocates two sides of a branch\n # the same sequence numbers. This means that to the linear scan values on both\n # sides of the branch and internal to those branches appear to be live at the\n # same time and they won... | [
"0.52156484",
"0.5168368",
"0.51504165",
"0.49801686",
"0.49400368",
"0.48782519",
"0.48777598",
"0.48631516",
"0.48461762",
"0.48178646",
"0.47682714",
"0.47647086",
"0.4758322",
"0.4757274",
"0.47395635",
"0.47346252",
"0.47234565",
"0.46919",
"0.4686709",
"0.4685276",
"0.4... | 0.687203 | 0 |
GET /offers GET /offers.json | def index
@offers = Offer.where(customer: current_user.customer)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def get_offers\n unless get_connection_object.headers.has_key?(\"X-Auth-Token\")\n raise \"Please authenticate() to see your offers\"\n end\n get('offer')\n end",
"def index\n @offers = Offer.all\n\n respond... | [
"0.8171875",
"0.7944721",
"0.79157716",
"0.79029083",
"0.7764754",
"0.76819086",
"0.7671478",
"0.7586528",
"0.7481807",
"0.7481807",
"0.7466798",
"0.74593174",
"0.7443136",
"0.73937756",
"0.73937756",
"0.73937756",
"0.73937756",
"0.7368404",
"0.73248607",
"0.7323364",
"0.7278... | 0.6431345 | 62 |
GET /offers/1 GET /offers/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def index\n @offers = Offer.all\n respond_to do |format|\n form... | [
"0.7893452",
"0.7734393",
"0.76324385",
"0.7481251",
"0.7394545",
"0.7394545",
"0.73184246",
"0.7309764",
"0.72893107",
"0.72650313",
"0.7260039",
"0.72340804",
"0.7228739",
"0.72237456",
"0.71911067",
"0.71911067",
"0.71911067",
"0.71911067",
"0.71791774",
"0.7166139",
"0.70... | 0.0 | -1 |
POST /offers POST /offers.json | def create
@offer = Offer.new(offer_params)
@offer.customer_id = current_user.customer_id
redirect_to @offer, notice: 'Offer was successfully created.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end",
"def create\n @offer = Offer.new(offers_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render jsonapi: @offer, status: :created }\n else\n format.jsona... | [
"0.77869576",
"0.7748448",
"0.7657578",
"0.74718577",
"0.73447186",
"0.7245436",
"0.7179201",
"0.7179201",
"0.7135144",
"0.71086293",
"0.71079504",
"0.709092",
"0.70722723",
"0.70427686",
"0.69463056",
"0.6876874",
"0.6863741",
"0.6815877",
"0.6815877",
"0.6815877",
"0.679527... | 0.59388435 | 100 |
PATCH/PUT /offers/1 PATCH/PUT /offers/1.json | def update
if @offer.update(offer_params)
redirect_to @offer, notice: 'Offer was successfully updated.'
else
render :edit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = Offer.f... | [
"0.74339384",
"0.7110587",
"0.7080391",
"0.7080391",
"0.6979401",
"0.69471204",
"0.69373626",
"0.6936734",
"0.6856799",
"0.6839258",
"0.68097216",
"0.68097216",
"0.6719154",
"0.669173",
"0.6616138",
"0.66114545",
"0.6611033",
"0.6597479",
"0.6562729",
"0.6559597",
"0.6522435"... | 0.62453574 | 36 |
DELETE /offers/1 DELETE /offers/1.json | def destroy
@offer.destroy
respond_to do |format|
redirect_to offers_url, notice: 'Offer was successfully destroyed.'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end",
"def destroy\n @offer = Offer.find(params[:id])\n checkaccount... | [
"0.78265435",
"0.78265435",
"0.77179426",
"0.7585767",
"0.7585767",
"0.753747",
"0.753747",
"0.7530682",
"0.7455453",
"0.74433076",
"0.74234",
"0.73523116",
"0.73467505",
"0.73374295",
"0.7332255",
"0.7332255",
"0.7332255",
"0.7332255",
"0.7321798",
"0.7311942",
"0.7264411",
... | 0.69947404 | 33 |
Use callbacks to share common setup or constraints between actions. | def set_offer
@offer = Offer.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 offer_params
params.require(:offer).permit(:name, :description, :reward_description, :reward_factor, :redemption_value, :active, :image_url, :published, :expires)
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.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
limit is not within the scope of the method fib | def fib(limit, first_num, second_num) # made limit an argument to be passed in
while first_num + second_num < limit
sum = first_num + second_num
first_num = second_num
second_num = sum
end
sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fib(limit)\n\tfib = 0\n\tprev = 1\n\tcurrent = 1\n\twhile current < limit\n\t\tif (prev + current).even? && (current + prev) < limit\n\t\t\tfib += (prev + current)\n\t\tend\n\n\t\told_current = current\n\t\tcurrent = prev + current\n\t\tprev = old_current\n\tend\n\tfib\nend",
"def fibs(limit, n=2)\n\t@a ||= ... | [
"0.7764187",
"0.77455133",
"0.75802004",
"0.75529206",
"0.75474316",
"0.74438614",
"0.7432258",
"0.7429745",
"0.7416253",
"0.7401014",
"0.7365452",
"0.7315744",
"0.730413",
"0.730413",
"0.7265812",
"0.7246173",
"0.7226784",
"0.7207308",
"0.7207308",
"0.7207308",
"0.7207308",
... | 0.7435566 | 6 |
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize | def call(container, context)
if spec.respond_to?(:to_proc) && !spec.is_a?(Symbol)
spec.to_proc
elsif spec.respond_to?(:call)
spec
elsif spec.nil?
context.method(name)
elsif container[spec]
with(container[spec]).call(container, context)
else
raise InvalidPlugError, name
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def offences_by; end",
"def strategy; end",
"def used?; end",
"def custo... | [
"0.76538837",
"0.62887454",
"0.62282014",
"0.62282014",
"0.61805004",
"0.6156519",
"0.6156519",
"0.6156519",
"0.6156519",
"0.612837",
"0.59572196",
"0.5944528",
"0.5892693",
"0.5819787",
"0.5819787",
"0.5808322",
"0.5808322",
"0.58052987",
"0.5795088",
"0.57326925",
"0.568785... | 0.0 | -1 |
N is an integer within the range [0..100,000]; the elements of A are all distinct; each element of array A is an integer within the range [1..(N + 1)]. | def solution(a)
((1..a.size + 1).to_a - a).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partition(n)\n subset_size = (@array.size.to_f / n).ceil\n (0...n).collect {|i| @array[i * subset_size, subset_size]}\n end",
"def solution(n)\n array = Array.new\n (1..n).each do\n array.push(0)\n end\n while (array.length >= 16)\n (1..16).each do\n array.pop\n end \n end\n array... | [
"0.6170042",
"0.6133191",
"0.6103782",
"0.6086202",
"0.60320264",
"0.5967556",
"0.5954287",
"0.5933797",
"0.59126025",
"0.59023273",
"0.58910584",
"0.5838661",
"0.5821795",
"0.5805914",
"0.5803847",
"0.57865995",
"0.5783589",
"0.5783436",
"0.5776862",
"0.57762074",
"0.5768330... | 0.0 | -1 |
Returns true if resource or collection exists. Example: vortex.exists?(" | def exists?(uri)
uri = URI.parse(uri) if uri.is_a? String
begin
self.propfind(uri.path)
rescue Net::HTTPServerException => e
return false if(e.to_s =~ /404/)
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exist?\n @resource.exist?\n end",
"def exists?\n @exists\n end",
"def exists?\n !@not_found\n end",
"def exists?\n !@exists.nil? && @exists\n end",
"def exists?\n !@exists.nil? && @exists\n end",
"def exists?\n @exists == true\n end",
... | [
"0.81929517",
"0.7711331",
"0.770568",
"0.7675827",
"0.7675827",
"0.76745874",
"0.76381975",
"0.76381975",
"0.76381975",
"0.7522061",
"0.7505184",
"0.7498501",
"0.7493516",
"0.74874175",
"0.7480204",
"0.7425897",
"0.7419037",
"0.7412122",
"0.73974633",
"0.73892134",
"0.737298... | 0.0 | -1 |
Writes a document a document to the web. Same as publish, except that if document type is StructuredArticle publishDate | def write(object)
if(object.is_a? HtmlArticle or object.is_a? HtmlEvent or object.is_a? StructuredArticle or object.is_a? Vortex::Person)
uri = @uri.merge(object.url)
# puts "DEBUG: uri = " + uri.to_s
self.put_string(uri, object.content)
# puts "DEBUG: object.properties: #{uri}\n#{object.properties.gsub("><",">\n<")}\n-----\n"
self.proppatch(uri, object.properties)
return uri.to_s
else
warn "Unknown vortex resource: " + object.class.to_s
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish_document(document)\n schema = config.get(:schema)\n paths = config.get(:paths)\n file = \"#{paths[:output]}/#{schema[:name].downcase}\"\n puts \"\\n>> #{file}\"\n # puts document\n File.write(\"#{file}.rb\", document)\n end",
"def write_to(doc);end",
"def save doc\n if doc['... | [
"0.750352",
"0.68032277",
"0.6658165",
"0.64120036",
"0.6408126",
"0.6327213",
"0.6285273",
"0.623843",
"0.61735594",
"0.609951",
"0.6096324",
"0.609122",
"0.6090767",
"0.6064074",
"0.6038858",
"0.603182",
"0.60215497",
"0.6020778",
"0.6020778",
"0.6020778",
"0.6020778",
"0... | 0.0 | -1 |
Publish a document object to the web. If content is a StructuredArticle stored as json, and publisDate is note set, then publishDate will be set to current time. Publishes a object by performing a PUT request to object.url with object.content and then performing a PROPPATCH request to object.url with object.properties Example: vortex = Vortex::Connection.new(" article = Vortex::StructuredArticle(:title=>"My title") vortex.publish(article) | def publish(object)
write(object)
uri = @uri.merge(object.url)
if(object.is_a? StructuredArticle) then
if(object.publishDate == nil)then
time = Time.now.httpdate.to_s
prop = '<v:publish-date xmlns:v="vrtx">' + time + '</v:publish-date>'
self.proppatch(uri, prop)
end
end
return uri.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish!\r\n publish\r\n save!\r\n end",
"def publish!\n publish\n save\n end",
"def publish\n public_content.delete if public_content\n PublicContent.create!(\n content: self,\n topic:,\n text:,\n otu:\n )\n end",
"def publish_impl(publish_ta... | [
"0.71453977",
"0.7045975",
"0.7017596",
"0.6807467",
"0.6760118",
"0.6760118",
"0.6760118",
"0.6748706",
"0.67122275",
"0.66668534",
"0.66657275",
"0.666556",
"0.6642465",
"0.65153235",
"0.6425978",
"0.6425434",
"0.6381326",
"0.6377038",
"0.63627976",
"0.63621724",
"0.6349824... | 0.7683737 | 0 |
Creates collections Example: connection = Connection.new(' collecion = ArticleListingCollection.new(:url => '/url') connection.create(collection) | def create(object)
if(object.is_a? Collection)
uri = @uri.merge(object.url)
self.mkdir(uri)
self.proppatch(uri, object.properties)
return uri.to_s
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_collections\n @client[URLS_COLLECTION].create\n @client[DOCUMENTS_COLLECTION].create\n\n nil\n end",
"def create_collections\n self.collections.each do |c|\n self.add_collection(c)\n end\n end",
"def create_collection(client, collection_name)\n client[collection_name... | [
"0.8263633",
"0.7974147",
"0.74858946",
"0.70476377",
"0.7022508",
"0.7022508",
"0.69382787",
"0.6932999",
"0.6920648",
"0.6895061",
"0.6889256",
"0.6884643",
"0.6868855",
"0.68587774",
"0.6837959",
"0.6834537",
"0.6825461",
"0.6812891",
"0.67772347",
"0.6742718",
"0.6672638"... | 0.0 | -1 |
Create path create all folders in the given path if they do not exist. Default is articlelisting folder and the foldername used as title. Example: create_path('/folders/to/be/created/') create_path('/folders/to/be/created/', :type => "eventlisting", :title => "Testing") | def create_path(dest_path, *args)
title = nil
if(args.size > 0)then
type = args[0][:type]
title = args[0][:title]
end
if(not(type))then
type = "article-listing"
end
destination_path = "/"
dest_path.split("/").each do |folder|
if(folder != "")then
folder = folder.downcase
destination_path = destination_path + folder + "/"
if( not(exists?(destination_path)) )then
mkdir(destination_path)
proppatch(destination_path,'<v:collection-type xmlns:v="vrtx">' + type + '</v:collection-type>')
if(title)then
proppatch(destination_path,'<v:userTitle xmlns:v="vrtx">' + title.to_s + '</v:userTitle>')
end
end
end
end
return destination_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreatePath(path)\n #puts \"Creating path #{path}\"\n dirsToCreate = []\n currentPath = path\n while(!currentPath.exist?)\n\t#puts \"Need to create path #{currentPath}\"\n\tdirsToCreate.push(currentPath.AbsolutePath())\n\tcurrentPath = currentPath.Up()\n end\n dirsToCreate.reverse(... | [
"0.7562714",
"0.74080586",
"0.74074733",
"0.74074733",
"0.73084944",
"0.72921425",
"0.7221092",
"0.7201068",
"0.7070131",
"0.70429796",
"0.7016707",
"0.6875615",
"0.68651265",
"0.6803575",
"0.678743",
"0.6734393",
"0.67006356",
"0.6680061",
"0.66497284",
"0.6634607",
"0.66258... | 0.6938284 | 11 |
Returns current working directory on vortex/webdav server as string. | def cwd
return cd("").to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dir\n @working_directory\n end",
"def pwd\r\n ndev.rpc.command(\"show cli directory\").text.strip\r\n end",
"def workspace_folder\n @pwd\n end",
"def current_directory\n File.expand_path @current_directory\n end",
"def working_directory\n @options[:working_directory]\n ... | [
"0.7138188",
"0.68991274",
"0.6828789",
"0.6804457",
"0.6770572",
"0.6711622",
"0.6696754",
"0.66654766",
"0.6646018",
"0.6644067",
"0.66334367",
"0.66313285",
"0.6585613",
"0.65604436",
"0.65427303",
"0.6518838",
"0.6505358",
"0.64944625",
"0.6485838",
"0.6464636",
"0.645956... | 0.6785824 | 4 |
Create a new article of type htmlarticle: plain html file with introduction stored as a webdav property. | def initialize(options={})
options.each{|k,v|send("#{k}=",v)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_article_content(article_id, data)\n create_content(Voog::API::Contents::ParentKind::Article, article_id, data)\n end",
"def html_file\n new_or_existing_file 'hello.html', 'text/html', 1.megabyte\n end",
"def create!\n new_file = \"#{next_number}-#{strip_title}.md\"\n @path ... | [
"0.61438954",
"0.61188227",
"0.6017308",
"0.5986638",
"0.58510935",
"0.5845582",
"0.5822948",
"0.5802643",
"0.57804376",
"0.56814253",
"0.5671804",
"0.5663171",
"0.5656578",
"0.56535244",
"0.56494075",
"0.5631068",
"0.56215477",
"0.5618898",
"0.5594392",
"0.5587019",
"0.55714... | 0.0 | -1 |
Create a new article of type htmlarticle: plain html file with introduction stored as a webdav property. | def initialize(options={})
options.each{|k,v|send("#{k}=",v)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_article_content(article_id, data)\n create_content(Voog::API::Contents::ParentKind::Article, article_id, data)\n end",
"def html_file\n new_or_existing_file 'hello.html', 'text/html', 1.megabyte\n end",
"def create!\n new_file = \"#{next_number}-#{strip_title}.md\"\n @path ... | [
"0.61457694",
"0.6118787",
"0.60177785",
"0.5986372",
"0.5852359",
"0.5848839",
"0.58251137",
"0.5803525",
"0.5782668",
"0.5684459",
"0.56733954",
"0.56634355",
"0.5658143",
"0.5653994",
"0.5652204",
"0.56326747",
"0.5624557",
"0.5617976",
"0.5595722",
"0.5589551",
"0.5570983... | 0.0 | -1 |
TODO: Samme kode som i article... Bruk arv! | def content
content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ' +
'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' +
'<html xmlns="http://www.w3.org/1999/xhtml"><head><title>' + title + '</title>' +
' <link href="http://www.uio.no/profil/kupu/kupucontentstyles.css" type="text/css" rel="stylesheet"/>' +
'</head><body>'
if(body)
content += body
end
content += '</body></html>'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def articles\n\n end",
"def title\n article.title\n end",
"def interpret(i)\n article = Article.new\n article.title = !i.title.nil? ? i.title : 'n/a'\n article.source = @source\n article.pub_date = !i.pubDate.nil? ? i.pubDate : nil\n\n name = !i.source.nil? ? i.source.content : 'n/a'\n a... | [
"0.67581767",
"0.6578359",
"0.64982694",
"0.6421189",
"0.63319725",
"0.6311412",
"0.6307622",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
"0.61894596",
... | 0.0 | -1 |
Create an article Options: :title => "Title" mandatory | def initialize(options={})
options.each{|k,v|send("#{k}=",v)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @article = Article.new\n @article.title = params[:title]\n @article.description = params[:description]\n @article.save\n redirect_to article_path(@article)\n end",
"def create(title, content, options={})\n form_data = {'action' => 'edit', 'title' => title, ... | [
"0.6681014",
"0.662412",
"0.6427653",
"0.6411581",
"0.63047343",
"0.6303501",
"0.6295897",
"0.628313",
"0.6281996",
"0.62731016",
"0.626823",
"0.6265143",
"0.6265143",
"0.6265143",
"0.6265143",
"0.6265143",
"0.6263436",
"0.62480336",
"0.62203306",
"0.6214488",
"0.6212951",
... | 0.0 | -1 |
Utilities Convert norwegian date to Time object with a forgiven regexp TODO: Move this somewhere. Examples: t = norwegian_date('1.1.2010') t = norwegian_date('22.01.2010') t = norwegian_date('22.01.2010 12:15') t = norwegian_date('22.01.2010 12:15:20') | def norwegian_date(date)
if /\A\s*
(\d\d?).(\d\d?).(-?\d+)
\s?
(\d\d?)?:?(\d\d?)?:?(\d\d?)?
\s*\z/ix =~ date
year = $3.to_i
mon = $2.to_i
day = $1.to_i
hour = $4.to_i
min = $5.to_i
sec = $6.to_i
# puts "Debug: #{year} #{mon} #{day} #{hour}:#{min}:#{sec}"
usec = 0
usec = $7.to_f * 1000000 if $7
if $8
zone = $8
year, mon, day, hour, min, sec =
apply_offset(year, mon, day, hour, min, sec, zone_offset(zone))
Time.utc(year, mon, day, hour, min, sec, usec)
else
Time.local(year, mon, day, hour, min, sec, usec)
end
else
raise ArgumentError.new("invalid date: #{date.inspect}")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_time(tt)\n tt = tt.force_encoding('utf-8')\n MONTHS.map{|k,v|\n tt.gsub!(/ #{k}/i, \" #{v.downcase}\")\n }\n case tt\n when /Demain.*/\n t = Time.parse(tt)+60*60*24\n else\n t = Time.parse(tt)\n end\n return t\nend",
"def localize_time_of_day(time)\n if time.nil?\n retu... | [
"0.5951585",
"0.5889467",
"0.58410645",
"0.57982683",
"0.5765599",
"0.57129186",
"0.5571597",
"0.55484813",
"0.5530741",
"0.55292076",
"0.55292076",
"0.5505673",
"0.5407936",
"0.5393655",
"0.53103215",
"0.52918607",
"0.52897197",
"0.528925",
"0.52817166",
"0.5250026",
"0.5245... | 0.69752795 | 0 |
Renders the HTML of the content area. Override this when subclassing. | def render
"<div id=\"#{self.area_type}_#{self.id}\">#{self.html}</div>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content\n super\n @renderer = @widget.content\n div :id => 'doc3' do\n if @renderer.render? :header\n div :id => 'hd' do\n if @renderer.render? :top_line\n render_top_line\n end\n if @renderer.render? :title\n h1 @page_ti... | [
"0.7233795",
"0.7211744",
"0.67436135",
"0.6694986",
"0.66359633",
"0.6602076",
"0.651752",
"0.651752",
"0.651752",
"0.644749",
"0.64197665",
"0.6363826",
"0.6309588",
"0.62979513",
"0.62979513",
"0.6270325",
"0.625531",
"0.6246514",
"0.6240853",
"0.6235164",
"0.62193274",
... | 0.6499691 | 10 |
A convenience for querying by class name. | def set_area_type
self.area_type = self.class.to_s.underscore
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_class_named name\n return self if full_name == name\n return self if @name == name\n\n @classes.values.find do |klass|\n next if klass == self\n klass.find_class_named name\n end\n end",
"def find_class_named name\n @classes_hash[name]\n end",
"def class_by_name name\n # ... | [
"0.7398551",
"0.73979735",
"0.7224652",
"0.69953656",
"0.6864424",
"0.68186224",
"0.67606074",
"0.67433846",
"0.6677455",
"0.6677455",
"0.66496605",
"0.6623482",
"0.6602346",
"0.6549006",
"0.65239614",
"0.65157294",
"0.64798725",
"0.6367363",
"0.6359032",
"0.6351046",
"0.6342... | 0.0 | -1 |
Admin users can customize the prompt that is shown next to the checkbox that a committee member clicks to say whether or not they will participate for a given quarter. If the admins leave this value blank, then we return a default value of "I can participate for". | def active_action_text
read_attribute(:active_action_text).blank? ? "I can participate for" : read_attribute(:active_action_text)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quarterName\n qtrName = \"\"\n case self.enclaveQuarter\n when 1\n qtrName = \"First\"\n when 2\n qtrName = \"Second\"\n when 3\n qtrName = \"Third\"\n when 4\n qtrName = \"Fourth\"\n end\n qtrName\n end",
"def name () to_s unless quarter.blank? ... | [
"0.62311745",
"0.5909223",
"0.58993685",
"0.58993685",
"0.5886626",
"0.5855012",
"0.58474773",
"0.57334346",
"0.5718033",
"0.57133615",
"0.5678494",
"0.55566883",
"0.55566883",
"0.552581",
"0.55080014",
"0.5471089",
"0.5458149",
"0.545644",
"0.54558915",
"0.5436759",
"0.54351... | 0.0 | -1 |
When changing the response_reset_date, we must go through and update the status_cache for all members of the committee. | def update_member_status_caches!
if response_reset_date_changed?
members.find_in_batches do |member_group|
member_group.each {|member| member.update_status_cache! }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_lifetime_date\n response_reset_date || CommitteeMember::DEFAULT_RESPONSE_LIFETIME.ago\n end",
"def create_reset_digest\n update_attribute(:reset_sent_at, Time.zone.now)\n update_attribute(:reset_token, TokenGenerator.new_token)\n end",
"def update_task_completion_status_caches!\n ret... | [
"0.5993426",
"0.5752831",
"0.5661639",
"0.5633851",
"0.5619514",
"0.5545357",
"0.5545073",
"0.5531888",
"0.55239874",
"0.55159336",
"0.55092955",
"0.5499759",
"0.5486579",
"0.54748523",
"0.5471356",
"0.5462431",
"0.5450764",
"0.5449242",
"0.54428774",
"0.5428965",
"0.5428867"... | 0.77870595 | 0 |
If this Committee has the response_reset_date set, return that. Otherwise, calculate this based on the DEFAULT_LIFETIME_RESPONSE. | def response_lifetime_date
response_reset_date || CommitteeMember::DEFAULT_RESPONSE_LIFETIME.ago
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago # date helpers\n\tend",
"def password_reset_not_expired?\n self.reset_sent_at > 2.hours.ago\n end",
"def password_reset_expired?\n \treset_sent_at < 2.hours.ago\n \tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\t\t\n\t... | [
"0.59531075",
"0.5941943",
"0.59131",
"0.59000325",
"0.5871361",
"0.5870025",
"0.58453834",
"0.5808049",
"0.5792284",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57903206",
"0.57785374",
"0.5749551",
"0.57... | 0.81713873 | 0 |
GET /success_cases GET /success_cases.xml | def index
@success_cases = SuccessCase.all.paginate(:page => params[:page], :per_page => 10)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @success_cases }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cases = Case.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cases }\n end\n end",
"def show\n @success_case = SuccessCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { rend... | [
"0.69023097",
"0.68591547",
"0.6672036",
"0.6409081",
"0.6260781",
"0.6158841",
"0.6017537",
"0.59043026",
"0.5888606",
"0.58763474",
"0.5809218",
"0.58088917",
"0.58007836",
"0.5791762",
"0.57827497",
"0.5757698",
"0.5744602",
"0.5732726",
"0.5732242",
"0.56842464",
"0.56647... | 0.70646626 | 0 |
GET /success_cases/1 GET /success_cases/1.xml | def show
@success_case = SuccessCase.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @success_case }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @success_cases = SuccessCase.all.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @success_cases }\n end\n end",
"def index\n @cases = Case.all\n\n respond_to do |format|\n format.... | [
"0.6960763",
"0.68474066",
"0.66321915",
"0.6408574",
"0.6388847",
"0.6146108",
"0.614035",
"0.61117876",
"0.6077934",
"0.6006697",
"0.59975284",
"0.5864014",
"0.58488",
"0.57850105",
"0.5768482",
"0.57328653",
"0.57265514",
"0.570103",
"0.5697091",
"0.56942356",
"0.5686374",... | 0.69731224 | 0 |
GET /success_cases/new GET /success_cases/new.xml | def new
@success_case = SuccessCase.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @success_case }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @test_case = TestCase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_case }\n end\n end",
"def new\n @testcase = Testcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tes... | [
"0.7379976",
"0.7356432",
"0.7132841",
"0.7100511",
"0.70228857",
"0.70228857",
"0.70228857",
"0.6960621",
"0.68580955",
"0.68580955",
"0.68580955",
"0.68343794",
"0.67580044",
"0.67448777",
"0.67371255",
"0.6714657",
"0.6698058",
"0.6698058",
"0.669793",
"0.66870165",
"0.668... | 0.79590297 | 0 |
POST /success_cases POST /success_cases.xml | def create
@success_case = SuccessCase.new(params[:success_case])
respond_to do |format|
if @success_case.save
format.html { redirect_to(@success_case, :notice => 'Success case was successfully created.') }
format.xml { render :xml => @success_case, :status => :created, :location => @success_case }
else
format.html { render :action => "new" }
format.xml { render :xml => @success_case.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @test_case = TestCase.new(params[:test_case])\n\n respond_to do |format|\n if @test_case.save\n format.html { redirect_to(@test_case, :notice => 'TestCase was successfully created.') }\n format.xml { render :xml => @test_case, :status => :created, :location => @test_case }\n ... | [
"0.6223572",
"0.6124578",
"0.6041465",
"0.59874254",
"0.58132744",
"0.5776564",
"0.57702976",
"0.57531375",
"0.5610341",
"0.5606711",
"0.5603246",
"0.5596353",
"0.55935186",
"0.5586568",
"0.55494636",
"0.55362743",
"0.54992384",
"0.5491635",
"0.54849863",
"0.5481841",
"0.5481... | 0.6777465 | 0 |
PUT /success_cases/1 PUT /success_cases/1.xml | def update
@success_case = SuccessCase.find(params[:id])
respond_to do |format|
if @success_case.update_attributes(params[:success_case])
format.html { redirect_to(@success_case, :notice => 'Success case was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @success_case.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @test_case = TestCase.find(params[:id])\n\n respond_to do |format|\n if @test_case.update_attributes(params[:test_case])\n format.html { redirect_to(@test_case, :notice => 'TestCase was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { ren... | [
"0.64020705",
"0.63010824",
"0.6277032",
"0.61977327",
"0.6163166",
"0.60461843",
"0.60460335",
"0.5972965",
"0.5959552",
"0.58750653",
"0.5868366",
"0.5858697",
"0.58387727",
"0.5832719",
"0.58182806",
"0.5773983",
"0.57547796",
"0.57533574",
"0.5734928",
"0.5732424",
"0.571... | 0.67778033 | 0 |
DELETE /success_cases/1 DELETE /success_cases/1.xml | def destroy
@success_case = SuccessCase.find(params[:id])
@success_case.destroy
respond_to do |format|
format.html { redirect_to(success_cases_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @test_case = TestCase.find(params[:id])\n @test_case.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_cases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_case = current_user.test_cases.find(params[:id])\n @test_case.logical_dele... | [
"0.7005719",
"0.6901507",
"0.68910986",
"0.6741006",
"0.66881853",
"0.65945673",
"0.65445304",
"0.6529602",
"0.6526828",
"0.6489677",
"0.6485505",
"0.64402807",
"0.63797367",
"0.6323074",
"0.63193613",
"0.6314524",
"0.6300124",
"0.62943196",
"0.62943196",
"0.62943196",
"0.628... | 0.7248163 | 0 |
GET /book_pages GET /book_pages.json | def index
@book_pages = @book.book_pages
respond_to do |format|
format.html # index.html.erb
format.json { render json: @book_pages }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_page }\n end\n end",
"def index\r\n @books = Book.paginate(:page => params[:page], :per_page => 30)\r\n\r\n respond_to do |format|\r\n ... | [
"0.7726357",
"0.7343921",
"0.72196895",
"0.7119161",
"0.710017",
"0.70552915",
"0.70552915",
"0.70552915",
"0.70552915",
"0.70552915",
"0.70552915",
"0.70552915",
"0.6990951",
"0.69235164",
"0.68995583",
"0.6894337",
"0.68879795",
"0.6860878",
"0.6841784",
"0.6833286",
"0.674... | 0.8323856 | 0 |
GET /book_pages/1 GET /book_pages/1.json | def show
@book_page = @book.book_pages.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @book_page }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end",
"def show\n @page = @chapter.pages.find_by_number(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ... | [
"0.80614024",
"0.70933026",
"0.7073454",
"0.6975017",
"0.6960861",
"0.6908995",
"0.6851252",
"0.6851252",
"0.6851252",
"0.6851252",
"0.6851252",
"0.6851252",
"0.6851252",
"0.68386227",
"0.6830326",
"0.68099904",
"0.6799294",
"0.6797875",
"0.676943",
"0.67532647",
"0.6724757",... | 0.7899805 | 1 |
GET /book_pages/new GET /book_pages/new.json | def new
@book_page = @book.book_pages.build
respond_to do |format|
format.html # new.html.erb
format.json { render json: @book_page }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @page = current_site.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end... | [
"0.78558946",
"0.777031",
"0.777031",
"0.777031",
"0.777031",
"0.777031",
"0.77518016",
"0.7743865",
"0.7743865",
"0.7714941",
"0.7714616",
"0.77012134",
"0.76933473",
"0.7639035",
"0.7639035",
"0.7639035",
"0.7639035",
"0.7639035",
"0.7639035",
"0.7639035",
"0.7639035",
"0... | 0.8079944 | 0 |
POST /book_pages POST /book_pages.json | def create
@book_page = @book.book_pages.build(params[:book_page])
respond_to do |format|
if @book_page.save
format.html { redirect_to book_series_collection_book_book_pages_url(@book_series, @collection, @book),
notice: 'Book page was successfully created.' }
format.json { render json: @book_page, status: :created, location: @book_page }
else
format.html { render action: "new" }
format.json { render json: @book_page.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @book_page = @book.book_pages.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book_page }\n end\n end",
"def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { r... | [
"0.717884",
"0.6961408",
"0.6532633",
"0.6449121",
"0.63141894",
"0.62800825",
"0.62715197",
"0.6227736",
"0.6213138",
"0.6167685",
"0.6164547",
"0.6153755",
"0.6140232",
"0.6140142",
"0.61047333",
"0.61047333",
"0.61047333",
"0.61047333",
"0.61047333",
"0.61047333",
"0.60986... | 0.7337405 | 0 |
PUT /book_pages/1 PUT /book_pages/1.json | def update
@book_page = @book.book_pages.find(params[:id])
respond_to do |format|
if @book_page.update_attributes(params[:book_page])
format.html { redirect_to book_series_collection_book_book_page_url(@book_series, @collection, @book, @book_page), notice: 'Book page was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @book_page.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if page_params[:body]\n @page.versions << Version.new(body: page_params[:body], title: page_params[:title]).save\n page_params.delete :body\n end\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to controller: \"pages\", action: \"show\", ... | [
"0.6517577",
"0.6477979",
"0.64186496",
"0.63226795",
"0.6307765",
"0.62953144",
"0.6287904",
"0.62863904",
"0.62825817",
"0.62793595",
"0.6258501",
"0.62165517",
"0.6196754",
"0.61891025",
"0.61538744",
"0.61494046",
"0.61468184",
"0.6140256",
"0.61393017",
"0.6130775",
"0.6... | 0.7505768 | 0 |
DELETE /book_pages/1 DELETE /book_pages/1.json | def destroy
@book_page = @book.book_pages.find(params[:id])
@book_page.destroy
respond_to do |format|
format.html { redirect_to book_series_collection_book_book_pages_url(@book_series, @collection, @book) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @api_book.destroy\n\n head :no_content\n end",
"def destroy\n @book.destroy\n head :no_content\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_con... | [
"0.7497998",
"0.7271345",
"0.7245735",
"0.7223038",
"0.7223038",
"0.7223038",
"0.7223038",
"0.7223038",
"0.7223038",
"0.7223038",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"0.7179205",
"... | 0.76314765 | 0 |
get_book: converts the book_id given by the routing to | def get_book
@book_series = BookSeries.find(params[:book_series_id])
@book_series_1 = BookSeries.first
@collection = @book_series.collections.find(params[:collection_id])
@book = @collection.books.find(params[:book_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_book\n @book = Book.find(params[:book_id])\n end",
"def get_book\n @book = Book.where(id: params[:book_id]).first\n end",
"def get_book( book_id )\n response = if book_id.to_s.length >= 10\n Amazon::Ecs.item_lookup( book_id, :id_type => 'ISBN', :search_index => 'Books', :re... | [
"0.76608276",
"0.76537764",
"0.7085379",
"0.70534086",
"0.70118964",
"0.70098287",
"0.6801759",
"0.67968833",
"0.6724013",
"0.6697518",
"0.66624",
"0.66175157",
"0.66023767",
"0.6516869",
"0.64862424",
"0.643488",
"0.643488",
"0.643488",
"0.643488",
"0.643488",
"0.643488",
... | 0.6441945 | 16 |
Use callbacks to share common setup or constraints between actions. | def set_material_management
@material_management = MaterialManagement.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 |
GET /posts GET /posts.xml | def index
@posts = Post.paginate(:all, :page => params[:page], :per_page => 20, :order => "posts.created_on desc, comments.created_on", :include => [ :comments, :user ])
@title = "rawdod"
# @hotness = Post.find(:all, :order => "commented_on desc", :limit => 8, :conditions => ["commented_on is NOT NULL"])
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @posts.to_xml }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => ... | [
"0.73163414",
"0.72102565",
"0.72102565",
"0.70133805",
"0.69922805",
"0.69905823",
"0.6946224",
"0.68449396",
"0.6825624",
"0.68239427",
"0.67839086",
"0.67474705",
"0.6744808",
"0.67014694",
"0.66831535",
"0.66570085",
"0.66536814",
"0.6641173",
"0.6569632",
"0.6569632",
"0... | 0.0 | -1 |
GET /posts/1 GET /posts/1.xml | def show
@post = Post.find(params[:id])
@title = @post.title
respond_to do |format|
format.html # show.rhtml
format.xml { render :xml => @post.to_xml }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => ... | [
"0.72230846",
"0.7073397",
"0.7073397",
"0.6978713",
"0.69539315",
"0.69031423",
"0.6797454",
"0.67764527",
"0.67728055",
"0.6706541",
"0.67029274",
"0.66985327",
"0.6677388",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0.66654295",
"0... | 0.6329106 | 93 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.