query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Find the edge connecting the two specified nodes, if it exists Note that our edges are undirected, so the order of the parameters `one` and `two` is not meaningful. | def find_edge(one, two)
edges.find do |e|
(e.one == one && e.two == two) || (e.two == one && e.one == two)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_edge(node_1, node_2)\n @edges[node_1][node_2] if @edges[node_1]\n end",
"def find_or_add_edge(one, two)\n edge = find_edge(one, two)\n if edge\n edge.weight += 1\n edge\n else\n edges << Edge.new(one: one, two: two, weight: 1)\n ... | [
"0.7645755",
"0.7172728",
"0.68479484",
"0.66183007",
"0.6327788",
"0.6204899",
"0.6167555",
"0.61288065",
"0.6118278",
"0.61089617",
"0.60141027",
"0.60141027",
"0.60116744",
"0.5994023",
"0.5950963",
"0.5850298",
"0.58221346",
"0.58221346",
"0.5820249",
"0.5803314",
"0.5759... | 0.8362846 | 0 |
Return the maximum edge weight in the graph | def max_edge_weight
edges.map(&:weight).max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weighted_max_score\n max_score * weight\n end",
"def maxweight(w)\n @weight = w if w>@weight\n end",
"def edge_weight(start_node, end_node)\n relationships = @adj_list[start_node]\n relationships.length.times do |r|\n relationship = relationships.read(r)\n return relationship.we... | [
"0.7142364",
"0.7119911",
"0.6974494",
"0.6931505",
"0.6800333",
"0.6675541",
"0.655177",
"0.64820033",
"0.6364242",
"0.6350356",
"0.6324943",
"0.6283164",
"0.6260426",
"0.6222856",
"0.6222856",
"0.6164321",
"0.6162874",
"0.61587054",
"0.61587054",
"0.6118615",
"0.61082864",
... | 0.92122024 | 0 |
Add nodes and edges for a given gap This function adds nodes and edges to the graph for a given size of sliding window. | def add_nodes_for_gap(gap)
analyzer = Frequency.call(
dataset: dataset,
ngrams: gap,
num_blocks: 1,
split_across: true,
progress: ->(p) { progress&.call((p.to_f / 100 * 33).to_i + 33) }
)
ngrams = analyzer.blocks[0]
ngr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increase_gap\n\n @gap = @gap + 50\n\n end",
"def increase_gap\n\n @gap = @gap + 50\n\n end",
"def create_knight_tour_graph(board_size)\n new_graph = Graph.new()\n board_size.times do |x|\n board_size.times do |y|\n new_graph.add_vertex([x,y])\n end\n end\n knight_legal_moves(new_grap... | [
"0.552551",
"0.552551",
"0.5385118",
"0.4994156",
"0.49828216",
"0.49427024",
"0.4939581",
"0.48757485",
"0.48162365",
"0.47926322",
"0.47401768",
"0.47324634",
"0.47183073",
"0.4689046",
"0.46799418",
"0.46649724",
"0.4655176",
"0.4638918",
"0.46381128",
"0.46278125",
"0.462... | 0.6652222 | 0 |
Find an edge and increment its weight, or add it if needed | def find_or_add_edge(one, two)
edge = find_edge(one, two)
if edge
edge.weight += 1
edge
else
edges << Edge.new(one: one, two: two, weight: 1)
edges.last
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hyperball_on_edge(edge)\n update_node = @counters.get_counter(edge[1])\n neighbor_node = @counters.get_counter(edge[0])\n\n update_node.merge(neighbor_node)\n end",
"def add_edge(node, weight)\n @adjacent_nodes[node.value] = { weight: weight, node: node }\n self\n end",
"def add_edge(sou... | [
"0.68839383",
"0.68835115",
"0.68623716",
"0.6738664",
"0.66191673",
"0.65683854",
"0.65471256",
"0.6526162",
"0.6449443",
"0.644654",
"0.64417714",
"0.6428381",
"0.6422983",
"0.6420932",
"0.63979197",
"0.6375651",
"0.6351983",
"0.6310793",
"0.62784505",
"0.6257984",
"0.62551... | 0.74529654 | 0 |
Returns an array of items which have a paid quantity greater than zero. That is, any items which have nonbonus components. | def candidate_items
sku_items.select {|i| i.paid_quantity > 0}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def items_no_sale\r\n sale = Array.new\r\n\r\n if(self.items.size > 0)\r\n self.items.each {|val|\r\n if (!val.is_active )\r\n sale.push(val)\r\n end\r\n }\r\n end\r\n\r\n return sale\r\n end",
"def get_products_bought\n res = []\n\n @data.p... | [
"0.6286385",
"0.61376476",
"0.61366105",
"0.60251176",
"0.58752483",
"0.5799775",
"0.5756575",
"0.57485896",
"0.57201076",
"0.57199156",
"0.5716697",
"0.5714918",
"0.56775546",
"0.565848",
"0.5619463",
"0.56134444",
"0.56097525",
"0.55814415",
"0.55751985",
"0.5562453",
"0.55... | 0.7494559 | 0 |
Checks to see if any new promotions have been applied to the order. | def new_promotions?
!new_promotions.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def existing_promotions?\n !existing_promotions.empty?\n end",
"def pending_promotions?\n !pending_promotions.empty?\n end",
"def checkout_promotions?\n !checkout_promotions.empty?\n end",
"def check_promotions\n line_items.each do |item|\n Spree::ItemAdjustments.new(item).cal... | [
"0.70721054",
"0.7056001",
"0.69980675",
"0.6493094",
"0.63931346",
"0.63828385",
"0.6347391",
"0.61738896",
"0.60555255",
"0.59602386",
"0.5910393",
"0.5874006",
"0.5748538",
"0.5730938",
"0.5692966",
"0.5688312",
"0.5688093",
"0.56499726",
"0.56438255",
"0.56414473",
"0.563... | 0.7135606 | 0 |
Checks to see if there are any promotions pending/applied to the order. | def pending_promotions?
!pending_promotions.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkout_promotions?\n !checkout_promotions.empty?\n end",
"def existing_promotions?\n !existing_promotions.empty?\n end",
"def pending_promotions\n @pending_promotions ||= []\n end",
"def related_promotions?\n !related_promotions.empty?\n end",
"def new_promotions?\n !new_pr... | [
"0.7250044",
"0.6820905",
"0.67420924",
"0.6575087",
"0.63620156",
"0.62685466",
"0.6214691",
"0.62023866",
"0.6189956",
"0.61802685",
"0.61587554",
"0.61482704",
"0.614073",
"0.61390716",
"0.61282104",
"0.61171407",
"0.6091816",
"0.60823596",
"0.6051234",
"0.6018808",
"0.600... | 0.7923248 | 0 |
Checks for any promotions that have already been applied to the order. | def existing_promotions?
!existing_promotions.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promotions\n @promotions ||= order.promotions\n end",
"def check_promotions\n line_items.each do |item|\n Spree::ItemAdjustments.new(item).calculate_promo_total\n end\n end",
"def checkout_promotions?\n !checkout_promotions.empty?\n end",
"def pending_promotions?\n ... | [
"0.66147894",
"0.6596519",
"0.65890914",
"0.65631324",
"0.6498255",
"0.634031",
"0.6302131",
"0.62207687",
"0.60311466",
"0.6003467",
"0.5800548",
"0.5784076",
"0.5779233",
"0.57785434",
"0.56835026",
"0.5454023",
"0.5436384",
"0.5376852",
"0.53672314",
"0.5353282",
"0.529693... | 0.6743173 | 0 |
An array of IDs of the promotions that have been applied, used to dump the previous promotion state to session. | def promotion_id_dump
pending_promotions.map(&:id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_promotion_ids\n @previous_promotion_ids ||= []\n end",
"def promotion_id_dump=(ids)\n @previous_promotion_ids = ids.map(&:to_i)\n end",
"def existing_promotions\n @existing_promotions ||= []\n end",
"def pending_promotions\n @pending_promotions ||= []\n end",
"def promotions\n ... | [
"0.69574535",
"0.6845519",
"0.6559235",
"0.6446942",
"0.64211804",
"0.64093024",
"0.63725805",
"0.6210528",
"0.60376173",
"0.5691419",
"0.56717986",
"0.56485",
"0.55175287",
"0.55175287",
"0.55175287",
"0.5483183",
"0.546651",
"0.54416454",
"0.54339087",
"0.54246724",
"0.5387... | 0.71284246 | 0 |
Returns the IDs of promotions that were previously applied to the order. | def previous_promotion_ids
@previous_promotion_ids ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promotions\n @promotions ||= order.promotions\n end",
"def promotion_id_dump\n pending_promotions.map(&:id)\n end",
"def existing_promotions\n @existing_promotions ||= []\n end",
"def checkout_promotions\n @checkout_promotions ||= Promotion.active.code_based\n end",
"def pending... | [
"0.70147043",
"0.60357255",
"0.60298723",
"0.5873947",
"0.57972443",
"0.5661478",
"0.56314117",
"0.55912",
"0.55706793",
"0.55138034",
"0.5462903",
"0.5376086",
"0.5363145",
"0.5344974",
"0.5310175",
"0.52990013",
"0.5268256",
"0.5255847",
"0.5232396",
"0.52301896",
"0.520399... | 0.66303337 | 1 |
Checks to see if there is a code promotion applied to the order and that it is successful. | def code_promotion_successful?
promotion_results.code_based.successful?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code_promotion_failed?\n !promo_code.blank? and promotion_results.code_based.failed?\n end",
"def test_say_if_is_discounted\n setup_new_order_with_items()\n promo = promotions(:percent_rebate)\n \n assert !@order.is_discounted?\n @order.promotion_code = promo.code\n assert @order.is_dis... | [
"0.6988479",
"0.6475755",
"0.6407527",
"0.63245493",
"0.6290344",
"0.6088696",
"0.5954468",
"0.58843946",
"0.58774066",
"0.58522063",
"0.5848439",
"0.5763855",
"0.5736762",
"0.5692154",
"0.5674695",
"0.5666807",
"0.5659416",
"0.5636786",
"0.5635909",
"0.5598773",
"0.55513275"... | 0.7242866 | 0 |
Checks to see if there is a promotion code set against this order. If it is nil, then code promotions are pending i.e. haven't been checked yet. | def code_promotion_unchecked?
promo_code.blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code_promotion_failed?\n !promo_code.blank? and promotion_results.code_based.failed?\n end",
"def code_promotion_successful?\n promotion_results.code_based.successful?\n end",
"def check_for_coupon\n coupon = self.orders.where(state: \"paused\").first.coupon\n valid_coupon = Coupon.is_valid?(... | [
"0.63372177",
"0.6250729",
"0.6246687",
"0.6083889",
"0.6052146",
"0.60324043",
"0.60162807",
"0.6010615",
"0.59483963",
"0.5901427",
"0.5697834",
"0.56523883",
"0.5642045",
"0.5545806",
"0.54634845",
"0.5440411",
"0.5435848",
"0.54229414",
"0.5417677",
"0.53852314",
"0.53498... | 0.68784934 | 0 |
Checks to see if a promotion code has been entered, promotions have been applied and that the order has failed to qualify for any code based promotions. | def code_promotion_failed?
!promo_code.blank? and promotion_results.code_based.failed?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normal_and_standalone_promo?\n # Guard clause to ensure promo code is definitely a standalone promo\n return unless promotion.stand_alone_promo(self[:promotion_id])\n if !promotions.empty? && !promotions.map(&:standalone).include?(true)\n return errors.add(:promotion_id, '..other promo exists!')\... | [
"0.66064394",
"0.6550816",
"0.6235409",
"0.6210746",
"0.6102948",
"0.6055292",
"0.6046318",
"0.58865774",
"0.5851954",
"0.5834576",
"0.5752221",
"0.5730365",
"0.57057464",
"0.5651144",
"0.56200117",
"0.56192803",
"0.55841076",
"0.55555713",
"0.5551097",
"0.55111104",
"0.55062... | 0.74688196 | 0 |
Attempts to apply promotions to this order. It'll return any promotions it successfully applies. | def apply_promotions!
raise PromotionApplyError unless pending_promotions.empty?
@promotion_results = Promotion.active.apply!(self)
apply_adjustments!
# Convert all the applied promotions into an array of decorated
# promotions.
@pending_promotions = applied_promotions.map {|p| ::Promotions::De... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promotions\n @promotions ||= order.promotions\n end",
"def calculate_promotional_adjustments\n @promotion_adjustment = 0\n\n # An assumption is made here that the promotions are ordered correctly. A global 10% discount must be applied last\n @promotions.each do |promotion|\n if promotion.tr... | [
"0.64268756",
"0.61746866",
"0.60649604",
"0.5835612",
"0.55584973",
"0.55160064",
"0.54326624",
"0.53392017",
"0.5239044",
"0.5236701",
"0.51956725",
"0.51830184",
"0.5129507",
"0.51139766",
"0.50788236",
"0.5071204",
"0.5035513",
"0.49953207",
"0.4930564",
"0.49168912",
"0.... | 0.8107721 | 0 |
create [num] SHF applications in the given state return the list of SHF applications created | def create_shf_apps_in_state(num, state, create_date: Time.current)
shf_apps = []
num.times do
shf_apps << create(:shf_application, state: state, created_at: create_date,
updated_at: create_date)
end
shf_apps
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_apps_in_states(create_date: Time.current)\n\n NUM_APPS_IN_STATE.each_pair do |state, number|\n create_shf_apps_in_state(number, state, create_date: create_date)\n end\n\n end",
"def get_recent_shf_apps(start_date, end_date)\n\n @recent_shf_apps = ShfApplication.updated_in_date_range(s... | [
"0.7199402",
"0.59144616",
"0.5414188",
"0.53837156",
"0.5303373",
"0.52989286",
"0.52305746",
"0.52006435",
"0.519886",
"0.5156555",
"0.50491333",
"0.5034245",
"0.499946",
"0.49726558",
"0.4949552",
"0.49459392",
"0.49261197",
"0.49163422",
"0.49084094",
"0.48974708",
"0.485... | 0.8624569 | 0 |
create applications in all states and set the created_at: and updated_at dates to create_date default create_date = Time.zone.now | def create_apps_in_states(create_date: Time.current)
NUM_APPS_IN_STATE.each_pair do |state, number|
create_shf_apps_in_state(number, state, create_date: create_date)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_shf_apps_in_state(num, state, create_date: Time.current)\n shf_apps = []\n\n num.times do\n shf_apps << create(:shf_application, state: state, created_at: create_date,\n updated_at: create_date)\n end\n\n shf_apps\n end",
"def apps_by_creation_date(createdat)\... | [
"0.67802423",
"0.6033695",
"0.5781957",
"0.5771342",
"0.57342434",
"0.57287693",
"0.56911033",
"0.56450516",
"0.5643362",
"0.56431955",
"0.5642254",
"0.56245863",
"0.55921745",
"0.5544943",
"0.5516274",
"0.54866517",
"0.5482571",
"0.54647434",
"0.54512715",
"0.54324293",
"0.5... | 0.7496882 | 0 |
add an uploaded file to the SHF application | def add_uploaded_file(shf_app)
shf_app.uploaded_files << create(:uploaded_file, actual_file: File.open(UPLOAD_PNG_FILE))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_file\n #TODO\n end",
"def upload\n self._create params[:upfile], params[:pictitle]\n end",
"def upload\r\n \r\n end",
"def save_file_entry\n @user.search_files.create!(file_path: uploaded_file_path.result, file_name: @file.original_filename, status: 'initialized')\n end... | [
"0.7202717",
"0.7095032",
"0.68771875",
"0.6794102",
"0.6717206",
"0.6717206",
"0.6666275",
"0.66188914",
"0.65814596",
"0.6578944",
"0.65714294",
"0.65434194",
"0.6533004",
"0.6514539",
"0.65074474",
"0.6497595",
"0.648155",
"0.6434443",
"0.6428496",
"0.6428496",
"0.64201474... | 0.8243698 | 0 |
create a member with a membership fee payment, branding fee paid return the member | def create_member_with_member_and_branding_payments_expiring(member_pay_expires = Time.zone.today + 1.year,
payment_create_date: Time.zone.now,
membership_status: :current_member)
u = create... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @member = Member.new(member_params)\n #@member.card_id = SecureRandom.uuid\n @member.magma_coins = 0\n add_abo_types_to_member(@member)\n respond_to do |format|\n if @member.save\n format.html { redirect_to current_user.present? ? @member : members_path, notice: t('flash.not... | [
"0.69762033",
"0.6961654",
"0.6950737",
"0.6841401",
"0.68327266",
"0.67581135",
"0.6729609",
"0.6715025",
"0.669848",
"0.6658047",
"0.66500276",
"0.64890933",
"0.6476469",
"0.6470372",
"0.6454703",
"0.64526945",
"0.6439926",
"0.64303267",
"0.6428765",
"0.6383507",
"0.6378504... | 0.7537223 | 0 |
create a paid up member with a given company number, make a payment with the expire date. | def create_co_and_payment(company_number, payment_exp_date, member_pay_expires: Time.zone.today + 1.year, payment_create_date: Time.zone.now)
u = create(:member_with_membership_app, company_number: company_number)
u.shf_application.update(created_at: payment_create_date, updated_at: payment_create_date)
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_member_with_member_and_branding_payments_expiring(member_pay_expires = Time.zone.today + 1.year,\n payment_create_date: Time.zone.now,\n membership_status: :current_member)\n u ... | [
"0.69060594",
"0.64355946",
"0.6358454",
"0.63414973",
"0.6306214",
"0.623397",
"0.6134724",
"0.6095739",
"0.60889095",
"0.60676795",
"0.6065046",
"0.6063734",
"0.60517734",
"0.602945",
"0.6026668",
"0.6022899",
"0.601373",
"0.6005469",
"0.59579885",
"0.5949564",
"0.5937691",... | 0.71493685 | 0 |
DELETE /event_registrations/1 DELETE /event_registrations/1.json | def destroy
@registration = Registration.find(params[:id])
@event = @registration.event
@registration.destroy
respond_to do |format|
format.html { redirect_to manage_event_path(@event), notice: 'Event registration was successfully destroyed.' }
format.json { head :no_content }
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event_registration.destroy\n respond_to do |format|\n format.html { redirect_to event_registrations_path}\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_registration.destroy\n\n respond_to do |format|\n format.html { redirect_to event_url(@eve... | [
"0.78776497",
"0.75545466",
"0.72664815",
"0.7233993",
"0.7121077",
"0.71203524",
"0.7118392",
"0.7118392",
"0.7118392",
"0.71130234",
"0.7070225",
"0.7033818",
"0.70054746",
"0.70037514",
"0.6978001",
"0.696753",
"0.6967277",
"0.6949586",
"0.6947828",
"0.6946387",
"0.6945035... | 0.77075 | 1 |
Instructions when there is missing license information, but the user has specified disableapi preventing remote license sources being used. | def no_remote_instructions(unlicensed)
puts <<-INST
There is no license defined for #{counter(unlicensed)}. You are running with the `--disable-api`
option. If you remove this option, gemterms will attempt to use RubyGems and
other sources for license information.
INST
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_license()\n return true\n end",
"def opted_out?(api_name)\n if @is_opted_out\n @logger.log(\n LogLevelEnum::INFO,\n 'API_NOT_ENABLED',\n {\n '{file}' => FILE,\n '{api}' => api_name\n }\n )\n end\n @is_opted_out\n end",
"def api_onl... | [
"0.65706086",
"0.6272512",
"0.609993",
"0.609993",
"0.609993",
"0.59620357",
"0.59411335",
"0.5854937",
"0.58096164",
"0.5787622",
"0.5754711",
"0.5726572",
"0.5716209",
"0.5688357",
"0.5678192",
"0.56603557",
"0.56530493",
"0.565202",
"0.565202",
"0.56110483",
"0.5603035",
... | 0.81446695 | 0 |
POST /birds POST /birds.json Add new bird in data Sanctuary | def create
@bird = Bird.new(bird_params)
if @bird.save
render json: @bird, status: :created
else
render json: @bird.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_bird\n bird_obj = bird_params\n continent = params['continents']\n unless continent.nil?\n continent = continent.split(',').map { |v| v.strip } if continent.is_a?(String)\n if continent.is_a?(Array) && !continent.blank?\n continent = continent[0].split... | [
"0.7714612",
"0.75363326",
"0.7342247",
"0.73273396",
"0.7292651",
"0.7231101",
"0.7071595",
"0.6567158",
"0.6535382",
"0.632883",
"0.62607706",
"0.6230511",
"0.62067455",
"0.61623937",
"0.6154507",
"0.6017123",
"0.5993737",
"0.5970231",
"0.5929623",
"0.5923371",
"0.5912476",... | 0.7564016 | 1 |
GET /birds/1 GET /birds/1.json Return specific bird provided by bird id | def bird_specification
@bird = Bird.find(params[:id])
if @bird
@bird = JSON.parse(@bird.to_json)
@bird["id"]=params[:id]
render json: @bird.except("_id"), status: :ok
else
render :nothing => true, status: :not_found
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bird\n bird = Api::V1::Bird.find(params[:id])\n render json: {\n status: 200,\n message: \"OK\",\n bird: Api::V1::BirdSerializer.new(bird) \n }\n \n end",
"def show\n @bird = Bird.find(params[:id])\n end",
"def show \n bird = Bird.find_by... | [
"0.7842902",
"0.75328666",
"0.7532793",
"0.73402125",
"0.72267026",
"0.71068805",
"0.70877093",
"0.69594675",
"0.69594675",
"0.69594675",
"0.6863208",
"0.6838396",
"0.67940015",
"0.6771479",
"0.6771479",
"0.6751278",
"0.6612028",
"0.6603761",
"0.64625204",
"0.64274997",
"0.63... | 0.7864114 | 0 |
end ======================================================================================== Problem 2: Golden Ratio Golden Ratio is ratio between consecutive Fibonacci numbers calculate the golden ratio up to specified precision validate using MiniTest unit tests module Assignment08 | def golden_ratio(precision)
x = fib(99)/fib(98).to_f
x.round(precision)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_exercise_1119\n expected_result = nil\n time_span = time_block { expected_result = calc_all_fibonacci 20 }\n verify_method :exercise_1119,\n :with => {param: 20, expect: expected_result}\n\n actual_time_span = time_block { @target.exercise_1119 20 }\n\n ... | [
"0.6329578",
"0.6120972",
"0.604802",
"0.60390025",
"0.6032825",
"0.6017206",
"0.60041684",
"0.5998652",
"0.5917522",
"0.591311",
"0.59097296",
"0.5905226",
"0.5897867",
"0.5875491",
"0.58643633",
"0.5861391",
"0.5860039",
"0.58598614",
"0.5812934",
"0.5812185",
"0.5807329",
... | 0.7249214 | 0 |
Row explanation: [ "language", prs ] Output: [ ["Ruby", 3], ... ["CSS", 1] ] | def language_prs
languages.map do |language|
[language.fetch("language").name, language.fetch("prs")]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row\n [\n \"Theme\",\n \"Question\",\n { value: \"Average Score\", alignment: :right },\n { value: \"No. Scores Submitted\", alignment: :right }\n ]\n end",
"def reformat_languages(languages)\n new_hash = {}\n java_style_array = Array.new... | [
"0.559313",
"0.5516747",
"0.5369649",
"0.53510374",
"0.5305311",
"0.52974373",
"0.5261206",
"0.5224807",
"0.51573884",
"0.5136142",
"0.51236105",
"0.5122372",
"0.51097256",
"0.508731",
"0.5048546",
"0.50386214",
"0.5018835",
"0.5017918",
"0.5006626",
"0.4990945",
"0.49556917"... | 0.6034796 | 0 |
Transforms a SQLiX embedded XML Document. Takes a valid XML document as either a string or url, including local filename, or REXML::Document. Use the seeds hash to feed the references of the initial row element. Returns the resulting XML Document as a string, or as an REXML::Document if that was given. sqlix:query elem... | def transform(xml_source, seeds={})
if xml_source.is_a?(REXML::Document)
xml_document = xml_source
else
src = fetch_xml(xml_source)
xml_document = REXML::Document.new(src)
end
queries = REXML::XPath.match(xml_document.root,'//x:query', {'x' => 'http://www.transami.net/nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_solr\n puts \"transforming #{self.filename}\"\n solr_doc = Nokogiri::XML(\"<add></add>\")\n @csv.each do |row|\n if !row.header_row?\n doc = Nokogiri::XML::Node.new(\"doc\", solr_doc)\n # row_to_solr should return an XML::Node object with children\n doc = row_to_sol... | [
"0.5513982",
"0.51492333",
"0.5118726",
"0.50949293",
"0.48850235",
"0.48745278",
"0.48360753",
"0.46812204",
"0.46770287",
"0.46688595",
"0.46593094",
"0.46211913",
"0.4581038",
"0.4566015",
"0.4557557",
"0.45343542",
"0.45343143",
"0.45018125",
"0.449809",
"0.44949844",
"0.... | 0.7102761 | 0 |
q! method, she's an odd one, takes a query and returns an array of Row objects produced but also inserts those Row objects into this Row's (self) children it is also neccessary to pass the DBConnection object the query will be run against this actually pisses me off in that the whole point of having this class | def q!(query, db)
# build bindings from references
bindings = []
if query.references
query.references.each do |reference|
bindings << @row[reference]
end
end
# query
qry = query.query.gsub(''',"'").gsub('"','"') # replace single ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drillthrough(query)\n RowSet.new @connection.create_statement.execute_query(query.to_s)\n end",
"def insert_in_database\n Fetch.new(insertion_query).array\n end",
"def node_query_mapping_insert\n # binding.pry\n branches.each do |br|\n br.nodes.each do |nd|\n nodeName ... | [
"0.63389015",
"0.6150857",
"0.56682765",
"0.5638703",
"0.5631739",
"0.5565175",
"0.554424",
"0.55289435",
"0.55239236",
"0.5510129",
"0.54968923",
"0.54849654",
"0.54802024",
"0.5435421",
"0.5407851",
"0.53947794",
"0.5382071",
"0.53806543",
"0.5377896",
"0.5330029",
"0.53206... | 0.70666033 | 0 |
this is a mesh builder which returns this Row (self) as xml | def xml
base = REXML::Element.new(@name)
if @row.class == DBI::Row # only if we have a row otherwise return an empty xml node
# prime
context = nil
rowcontext = base
# loop through each column
@row.each_with_name do |val, colpath|
context = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_xml(builder, include_dims=true)\n builder.grid do |xml|\n xml.cube\n dims_to_xml(xml) if include_dims\n xml.slices do |xml|\n xml.slice :rows => @row_count, :cols => @col_count do |xml|\n xml.data do |xml|\n ... | [
"0.67881894",
"0.64383596",
"0.6252738",
"0.6088256",
"0.60743666",
"0.6060757",
"0.59958315",
"0.5992822",
"0.59912175",
"0.59912175",
"0.59912175",
"0.5930447",
"0.5930447",
"0.59286547",
"0.5905474",
"0.58934057",
"0.5868874",
"0.58656883",
"0.5779803",
"0.5759905",
"0.575... | 0.6755729 | 1 |
watch comment user id list without `ignore` option | def watch_comment_by_user_ids
self.watch_comment_by_user_actions.where("action_option is null or action_option != ?", "ignore").pluck(:user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def watch_comment_by_user_ids\n user_ids = watch_comment_by_user_actions.where(\"action_option is null or action_option != ?\", \"ignore\").pluck(:user_id)\n user_ids += repository.watch_by_user_ids\n user_ids.uniq!\n\n user_ids - unwatch_comment_by_user_ids\n end",
"def notify_watchers(comment_id)\... | [
"0.8032371",
"0.69915086",
"0.67108715",
"0.60207844",
"0.5932253",
"0.58122885",
"0.5720991",
"0.571276",
"0.57055014",
"0.5673911",
"0.5670132",
"0.56651604",
"0.56452847",
"0.564112",
"0.56228155",
"0.5617142",
"0.551847",
"0.550706",
"0.54384184",
"0.5428817",
"0.5418359"... | 0.77821356 | 1 |
This action is called on ajax autocomplete call. It checks if user has rights to view data. URL parameters: [table] Table (collection) model name in lower case indicating table which will be searched. [id] Name of id key field that will be returned. Default is '_id' [input] Search data entered in input field. [search] ... | def autocomplete
# return '' unless session[:edit_mode] > 0 #
return render text: t('drgcms.not_authorized') unless dc_user_can(DcPermission::CAN_VIEW)
# TODO Double check if previous line works as it should.
table = params['table'].classify.constantize
id = [params['id']] || '_id'
# call method in class ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autocomplete\r\n # table parameter must be defined. If not, get it from search parameter\r\n if params['table'].nil? && params['search'].match(/\\./)\r\n name = params['search'].split('.').first\r\n params['table'] = name.underscore\r\n end\r\n if params['table'].match('_control')\r\n # it must be... | [
"0.74884635",
"0.5927023",
"0.5922668",
"0.59110004",
"0.59110004",
"0.59110004",
"0.59110004",
"0.59110004",
"0.59110004",
"0.59110004",
"0.59110004",
"0.59110004",
"0.59110004",
"0.5908016",
"0.5892678",
"0.5855081",
"0.583393",
"0.57894963",
"0.5746241",
"0.57433057",
"0.5... | 0.7519833 | 0 |
Action for restoring document data from journal document. | def restore_from_journal
# Only administrators can perform this operation
unless dc_user_has_role('admin')
return render inline: { 'msg_info' => (t ('drgcms.not_authorized')) }.to_json, formats: 'js'
end
# selected fields to hash
restore = {}
params[:select].each {|key,value| restore[key] = valu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_from_journal\r\n # Only administrators can perform this operation\r\n unless dc_user_has_role('admin')\r\n return render plain: { 'msg_info' => (t ('drgcms.not_authorized')) }.to_json\r\n end\r\n # selected fields to hash\r\n restore = {} \r\n params[:select].each { |key,value| restore[key] = ... | [
"0.7390467",
"0.63006765",
"0.62760204",
"0.62753516",
"0.61917746",
"0.6177054",
"0.61600447",
"0.615471",
"0.60448",
"0.59916365",
"0.59766567",
"0.5932643",
"0.58583075",
"0.5843801",
"0.57998765",
"0.57667685",
"0.5734534",
"0.5678913",
"0.56276613",
"0.5625284",
"0.56246... | 0.73040944 | 1 |
Paste data from clipboard into text_area and update documents in destination database. This action is called twice. First time for displaying text_area field and second time ajax call for processing data. | def paste_clipboard
# Only administrators can perform this operation
return render(text: t('drgcms.not_authorized') ) unless dc_user_has_role('admin')
result = ''
respond_to do |format|
# just open new window to same url and come back with html request
format.html { return render('paste_clipbo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paste_clipboard\r\n # Only administrators can perform this operation\r\n return render(plain: t('drgcms.not_authorized') ) unless dc_user_can(DcPermission::CAN_ADMIN,'dc_site')\r\n\r\n result = ''\r\n respond_to do |format|\r\n # just open new window to same url and come back with html request\r\n f... | [
"0.6940014",
"0.6300451",
"0.62851685",
"0.6256926",
"0.6134019",
"0.60812545",
"0.6001184",
"0.5991647",
"0.59278405",
"0.5848881",
"0.58273697",
"0.57580703",
"0.57208323",
"0.56754756",
"0.5573386",
"0.55658126",
"0.55145067",
"0.5464325",
"0.5414632",
"0.5395405",
"0.5368... | 0.69390106 | 1 |
Clears all session data related to login. | def clear_login_data
session[:edit_mode] = 0
session[:user_id] = nil
session[:user_name] = nil
session[:user_roles] = nil
cookies.delete :remember_me
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_session\n @session = @login_info = nil\n end",
"def clear_session\n\t\tsession[:email] = nil \n\t\tsession[:player_id] = nil\n\t\tsession[:admin] = nil\n\t\tsession[:login_time] = nil \n\tend",
"def clear_any_logged_in_session\n if logged_in?\n session[:user] = nil\n session[:... | [
"0.8568118",
"0.8056482",
"0.78624153",
"0.77697676",
"0.7748444",
"0.76843065",
"0.7662799",
"0.76477534",
"0.7492621",
"0.74533963",
"0.74317443",
"0.74027437",
"0.74027437",
"0.73829645",
"0.7325849",
"0.71922666",
"0.71912503",
"0.71812296",
"0.7180784",
"0.71724325",
"0.... | 0.8069562 | 1 |
Initializes various variables when a new Crawler object is instantiated | def initialize(site)
puts "Rcrawl Version #{VERSION} initializing..."
@links_to_visit = Array.new
@visited_links = Array.new
@external_links = Array.new
@raw_html = Hash.new
@rules = RobotRules.new('Rcrawl')
@user_agent = "Rcrawl/#{VERSION} (http://rubyforge.org/projects/rcrawl/)"
@sites = Hash.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(title, url) # from first scrape data initialize == Lifecycle method in Ruby\n @title = title\n @url = url\n @@all << self if @@all.none?(self)\n end",
"def initialize (params = {})\t\t\n\t\t@verbose=params.fetch(:verbose, false)\n\t\t@http_timeout=params.fetch(:http_timeout, 5000)\n\t\t@... | [
"0.7178817",
"0.71490777",
"0.709987",
"0.6904131",
"0.67465186",
"0.66765857",
"0.6645099",
"0.6625878",
"0.656214",
"0.653998",
"0.65359765",
"0.65270984",
"0.6518336",
"0.65163743",
"0.65112466",
"0.6502881",
"0.64959514",
"0.6487032",
"0.6482146",
"0.64784795",
"0.6458494... | 0.72382843 | 0 |
HTML processing module for raw HTML storage | def process_html(document)
# Add link and raw HTML to a hash as key/value
# for later storage in database
unless @raw_html.has_value?(document)
print "."
@raw_html[@document.base_uri.to_s] = document
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_parser; end",
"def html_markup_html(text); end",
"def html_markup_textile(text); end",
"def preprocess!\n input_html\n nil\n end",
"def content_from(html, url)\n \n def extract_pre_from(html)\n regex = /<pre.*?>.*?<\\/pre>/m\n pre_list = html.scan regex\n html.gsu... | [
"0.72275674",
"0.7037976",
"0.6898776",
"0.6856065",
"0.6822643",
"0.67134655",
"0.67065716",
"0.66989154",
"0.66362983",
"0.6617293",
"0.66110164",
"0.65809214",
"0.65735453",
"0.6573088",
"0.65580565",
"0.65563947",
"0.65555423",
"0.65246415",
"0.65094733",
"0.6453285",
"0.... | 0.7170976 | 1 |
Returns last_name, first_name or just first_name if no last_name exists | def full_name_last_first
return self.first_name unless (self.last_name.length > 0)
return (self.last_name + ", " + self.first_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_full_name\n [first_name, last_name].select(&:present?).join(' ')\n end",
"def full_name_first_last\n return self.first_name unless (self.last_name.length > 0)\n return (self.first_name + \" \" + self.last_name)\n end",
"def full_name\n if first_name.blank?\n last_name\n else\n ... | [
"0.82630426",
"0.8230351",
"0.8187526",
"0.8098964",
"0.80962664",
"0.794671",
"0.79358965",
"0.79339486",
"0.7903188",
"0.7893612",
"0.7880249",
"0.7859064",
"0.7847392",
"0.7846149",
"0.7835837",
"0.7759763",
"0.77378917",
"0.77253187",
"0.7711071",
"0.7708167",
"0.7700223"... | 0.8495747 | 0 |
"Sand", "Water", "Fish", and "Sun" appear without overlapping (regardless of the case). Examples sum_of_a_beach("WAtErSlIde") ==> 1 sum_of_a_beach("GolDeNSanDyWateRyBeaChSuNN") ==> 3 sum_of_a_beach("gOfIshsunesunFiSh") ==> 4 sum_of_a_beach("cItYTowNcARShoW") ==> 0 | def sum_of_a_beach (beach)
(beach.scan(/sand|water|fish|sun/i) || []).length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_jewels_in_stones(j, s)\n hash_table = {}\n (0..s.length-1).each do |i|\n if hash_table.include? s[i]\n hash_table[s[i]] = hash_table[s[i]] + 1\n else\n hash_table[s[i]] = 1\n end\n end\n\n count = 0\n (0..j.length-1).each do |i|\n if hash_table.include? (j[i])\n if hash_tabl... | [
"0.60254127",
"0.6016107",
"0.59957707",
"0.5989535",
"0.5769685",
"0.57247835",
"0.5718512",
"0.57029873",
"0.57012963",
"0.56898737",
"0.5672843",
"0.565716",
"0.5641401",
"0.5635661",
"0.55931747",
"0.5568826",
"0.55572534",
"0.55544806",
"0.5545501",
"0.5528204",
"0.55245... | 0.6820596 | 0 |
2.Get all windmill id for a given wind Form. | def getmill
formid = Windmill.where(windformid: params[:id])
if formid.present?
render json: formid.as_json(only:[:no])
else
render json: {massage: 'Windform not found'}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getform\n\tgetform = Windmill.where(no: params[:no])\n\tif getform.present?\n render json: getform.as_json(only: [:windformid])\n\telse\n\t\trender json: {massage: 'No windfrom available in this id'}\n\tend\nend",
"def form_ids\n forms.collect{|f| f.id}.sort\n end",
"def form_ids\n forms.collect... | [
"0.6425715",
"0.6211666",
"0.62067705",
"0.60876197",
"0.57503605",
"0.55311996",
"0.54089653",
"0.537362",
"0.53451985",
"0.5297192",
"0.5282358",
"0.52794325",
"0.5251241",
"0.52483505",
"0.52100426",
"0.5203082",
"0.51838595",
"0.5178811",
"0.51776016",
"0.51733357",
"0.51... | 0.65941966 | 0 |
4.Get a wind form for a given wind mill id | def getform
getform = Windmill.where(no: params[:no])
if getform.present?
render json: getform.as_json(only: [:windformid])
else
render json: {massage: 'No windfrom available in this id'}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getmill\n\tformid = Windmill.where(windformid: params[:id])\n\tif formid.present?\n render json: formid.as_json(only:[:no])\n\telse\n\t\trender json: {massage: 'Windform not found'}\n\tend\nend",
"def form\n\tform = Windmill.all\n\t#form = Windmill.where(windformid: params[:id])\n\t#if form.present?\n... | [
"0.70188755",
"0.69844186",
"0.6163385",
"0.6037567",
"0.59459174",
"0.59080905",
"0.58822536",
"0.58781534",
"0.56679285",
"0.56117207",
"0.5533566",
"0.54399055",
"0.5417854",
"0.5362818",
"0.53531736",
"0.533231",
"0.5286203",
"0.5242859",
"0.5233617",
"0.52308726",
"0.523... | 0.727166 | 0 |
executes easy_install command with the passed arguments | def ezy_install(*args)
easy_install *args
rescue NoMethodError => e
if pathname = which('easy_install')
self.class.commands :easy_install => pathname
easy_install *args
else
raise e
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dist_install_s( *args )\n if args.last.is_a?( Hash )\n args = args.dup\n opts = args.pop\n else\n opts = {}\n end\n\n args = dist_map_packages( args )\n\n if opts[ :succeed ]\n \"yum install -q -y #{args.join ' '} || true\"\n else\n \"yum install -q -y #{args.join ' '... | [
"0.68979686",
"0.67946815",
"0.6308114",
"0.6296184",
"0.62498754",
"0.62241715",
"0.6200244",
"0.61983836",
"0.61692244",
"0.6168601",
"0.6148906",
"0.61445975",
"0.6132253",
"0.61254644",
"0.61213946",
"0.60783046",
"0.60333896",
"0.6031039",
"0.6027059",
"0.5995982",
"0.59... | 0.76981574 | 0 |
DELETE /albums/1 DELETE /albums/1.json | def destroy
@album = @user.albums.find(params[:id])
@album.destroy
respond_to do |format|
format.html { redirect_to albums_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @album.destroy\n render json: @album\n end",
"def destroy\n @album = Album.find(params[:id])\n @album.destroy\n\n respond_to do |format|\n format.html { redirect_to albums_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @album = Album.find(params[:id... | [
"0.79129416",
"0.7841086",
"0.77922285",
"0.77922285",
"0.77922285",
"0.77922285",
"0.77922285",
"0.7786131",
"0.77811533",
"0.7776723",
"0.7772079",
"0.77639914",
"0.77639914",
"0.77639914",
"0.7685881",
"0.7641379",
"0.7640984",
"0.76020396",
"0.7557685",
"0.75472915",
"0.7... | 0.8011329 | 0 |
Returns absolute and movingaverage values of time to repair ()complete unplanned cards) since supplied time. | def time_to_repair(since_time, unit: :second)
total_repair_time = 0
total_repairs = 0
ttr = { point_values: {}, moving_averages: {} }
# Unplanned cards created after since_time, in order of creation.
cards.where('cards.created_at > ?', since_time).where('cards.label = ?', Card::LABEL_UNPLANNED).ord... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def at_time(time)\n resource = @initial\n\n puts \"[START] initial: #{initial}\" if COPIOUS_DEBUGGING\n puts \"[START] time: #{time}\" if COPIOUS_DEBUGGING\n\n if intervals_at_time(@harvesters, time).size > 1\n generate_pairs(intervals_at_time(@harvesters, time)).each_with_index do |pair, index|\n... | [
"0.5869817",
"0.58603567",
"0.56355774",
"0.5614027",
"0.5604639",
"0.5559245",
"0.55308306",
"0.54630786",
"0.5405201",
"0.5365227",
"0.5290069",
"0.5286041",
"0.52774304",
"0.52488804",
"0.5222357",
"0.5212122",
"0.5208633",
"0.5184622",
"0.5179051",
"0.51691294",
"0.516448... | 0.6589963 | 0 |
Returns absolute and movingaverage values of time between failures (creation of unplanned card and completion of last unplanned card) since supplied time. | def time_between_failures(since_time, unit: :second)
total_uptime = 0
total_failures = 0
tbf = { point_values: {}, moving_averages: {} }
# Unplanned cards created after since_time, in order of creation.
unplanned_cards = cards.where('cards.created_at > ?', since_time).where('cards.label = ?', Card:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_to_repair(since_time, unit: :second)\n total_repair_time = 0\n total_repairs = 0\n ttr = { point_values: {}, moving_averages: {} }\n\n # Unplanned cards created after since_time, in order of creation.\n cards.where('cards.created_at > ?', since_time).where('cards.label = ?', Card::LABEL_UNP... | [
"0.59466237",
"0.5944881",
"0.5944881",
"0.5897146",
"0.57786214",
"0.55632937",
"0.5487752",
"0.5487752",
"0.5437157",
"0.540516",
"0.5381568",
"0.53214526",
"0.52549005",
"0.5250814",
"0.5245481",
"0.5217097",
"0.5204357",
"0.5204357",
"0.51853985",
"0.5181975",
"0.5174489"... | 0.664568 | 0 |
Returns hash containing timestamp and details from ServerLog and Card | def logs_and_cards_with_timestamp(since_time)
required_logs = server_logs.where('server_logs.created_at > ?', since_time).order('server_logs.created_at DESC')
required_cards = cards.where('cards.created_at > ?', since_time).order('cards.created_at DESC')
formatted_logs_info = required_logs.inject({}) do |s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash(ts)\n sig = [\n Rackspace::Email::Api.configuration.user_key,\n Rackspace::Email::Api.configuration.user_agent,\n ts,\n Rackspace::Email::Api.configuration.api_key\n ].join('')\n\n Base64.encode64(Digest::SHA1.digest(sig))\n end... | [
"0.6000593",
"0.5935062",
"0.5913583",
"0.58834237",
"0.5822245",
"0.58120126",
"0.578311",
"0.56563985",
"0.56487066",
"0.5637914",
"0.5631631",
"0.55961853",
"0.5559007",
"0.55397695",
"0.55334884",
"0.5509347",
"0.5508729",
"0.548707",
"0.5477845",
"0.5406288",
"0.5386556"... | 0.639813 | 0 |
parse the command line arguments example 'c 23 f text.csv' = :count = 23 and :path = text.csv | def parse_arguments
OptionParser.new do |parser|
# parser.banner = "Usage: init.rb -c <integer>"
parser.on("-c", "--count COUNT", Integer, "Specify number of uuid's to generate") do |c|
@options[:count] = c
end
parser.on("-f", "--file FILE", "Specify path to save csv file example -f ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_args()\n opts = GetoptLong.new(\n ['--host', GetoptLong::OPTIONAL_ARGUMENT],\n ['--port', GetoptLong::OPTIONAL_ARGUMENT],\n ['--columns', GetoptLong::OPTIONAL_ARGUMENT],\n ['--index', GetoptLong::REQUIRED_ARGUMENT],\n ['--type', GetoptLong::REQUIRED_ARGUMENT]\n )\n\n opts.each do |opt, ... | [
"0.6028493",
"0.5696837",
"0.5345504",
"0.5277444",
"0.5276807",
"0.5252528",
"0.5217761",
"0.5186166",
"0.51670563",
"0.5155809",
"0.51500833",
"0.5144254",
"0.5134379",
"0.51314235",
"0.51246405",
"0.5122422",
"0.51139",
"0.5082428",
"0.50822866",
"0.5046602",
"0.5024367",
... | 0.6839619 | 0 |
Converts account to a Struct::Account and sets it. | def account=(account)
@account = account ? Struct::Account.new(account) : account
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account=(val)\n @account = val\n @base.accountRef = val.ref\n end",
"def account=(value)\n @account = value\n end",
"def account= val\n @account = val\n self.source_account = val.address\n end",
"def set_account\n @account = current_user.ac... | [
"0.7619571",
"0.7449623",
"0.7309978",
"0.7229922",
"0.7229922",
"0.69726574",
"0.6969836",
"0.69493276",
"0.6892448",
"0.68204236",
"0.67833364",
"0.6741396",
"0.6741261",
"0.67404133",
"0.6725098",
"0.6725098",
"0.6725098",
"0.6725098",
"0.6725098",
"0.6725098",
"0.6725098"... | 0.84498876 | 0 |
Converts user to a Struct::User and sets it. | def user=(user)
@user = user ? Struct::User.new(user) : user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user\n @user = User.find(user_id)\n end",
"def user=(user)\n check_user(user)\n set_user(user)\n # returns user\n end",
"def user=(value)\n @user = value\n end",
"def user=(value)\n @user = value\n end",
"def user=(usr)\n... | [
"0.7312901",
"0.72290397",
"0.72104454",
"0.72104454",
"0.71981764",
"0.71824837",
"0.71824837",
"0.70357496",
"0.7028903",
"0.70286804",
"0.69824094",
"0.6982281",
"0.6982281",
"0.6965168",
"0.69562954",
"0.6934402",
"0.6932778",
"0.6912967",
"0.6912967",
"0.6911703",
"0.690... | 0.82027197 | 0 |
This sets the mode so OpenSSL knows to encrypt or decrypt, etc. | def initialize_cipher_for(mode)
@cipher.send mode
@cipher.key = @config['key']
@cipher.iv = @config['iv']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mode\n attributes.fetch(:mode) do\n Ably::Util::Crypto::DEFAULTS.fetch(:mode)\n end.downcase\n end",
"def _setup(action)\n @cipher ||= OpenSSL::Cipher.new(@options[:cipher]) \n # Toggles encryption mode\n @cipher.send(action)\n @cipher.padding = @options[:paddi... | [
"0.6709338",
"0.65460825",
"0.6397773",
"0.635467",
"0.61822665",
"0.61617327",
"0.61496496",
"0.6148367",
"0.60943794",
"0.60300434",
"0.59287816",
"0.57963926",
"0.57963926",
"0.57930976",
"0.57873386",
"0.5780654",
"0.57656914",
"0.57390237",
"0.57379",
"0.5712116",
"0.570... | 0.7027253 | 0 |
def set_defaults self.badge ||= " end we can call the concern here | def set_defaults
self.badge ||= Placeholder.image_generator(height: '150', width: '150')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults\n self.badge ||= Placeholder.image_generator(height: '250', width: '250') \n end",
"def defaults!\n @badge_enabled = true\n @badge_position = 'top-left'\n @page_size = 25\n @webpacker_enabled = true\n end",
"def set_default_values_skill\n self.badge ||= P... | [
"0.7531255",
"0.7097636",
"0.6680987",
"0.6666321",
"0.6666321",
"0.6666321",
"0.6666321",
"0.6666321",
"0.6666321",
"0.66328174",
"0.6608102",
"0.6608102",
"0.6511401",
"0.65053445",
"0.64164084",
"0.6379893",
"0.62925607",
"0.62925607",
"0.628346",
"0.628346",
"0.62681466",... | 0.75497967 | 0 |
Agrega enlaces de notas | def enlaces_notas resumen
mensaje = ""
notas = resumen.notas.order "updated_at DESC"
if notas.count > 0
notas.each_with_index do |nota,i|
mensaje += link_nota nota
mensaje += "-" if i < resumen.notas.count-1
end
end
return mensaje
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comisiones_asignadas\n asunto.comisiones if asunto\n end",
"def notificaciones\n end",
"def solicitudes_atrasadas\n end",
"def incluir_inicial\n ['casoid', 'fecha', 'ubicaciones', 'presponsables',\n 'tipificacion', 'victimas', 'memo']\n end",
"def guarda_nombres_c... | [
"0.6699505",
"0.65446395",
"0.60493153",
"0.5985316",
"0.5908733",
"0.57849526",
"0.57509387",
"0.57341427",
"0.57105327",
"0.5666349",
"0.5615516",
"0.5561488",
"0.5508755",
"0.5471767",
"0.5462504",
"0.5449848",
"0.5427775",
"0.54254746",
"0.54253733",
"0.5424888",
"0.54212... | 0.74527264 | 0 |
Trigger auto approve update rescue task Author: Aniket Date: 06/07/2018 Reviewed By: | def trigger_auto_approve_update_rescue_task(user_extended_details_id)
BgJob.enqueue(
AutoApproveUpdateJob,
{
client_id: @client_id,
reprocess: 1,
user_extended_details_id: user_extended_details_id
}
)
Rails.logger.info("---- enqueue_job AutoApprove... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_approve!\n update_attribute(:approved_at,DateTime.now)\n update_attribute(:approved_by, User.APPLICATION)\n write_key!\n end",
"def auto_approve\n if !self.auto_approved && self.approval_status.nil?\n UserMailer.auto_approved_email(self).deliver\n self.auto_approved = true\n ... | [
"0.7300589",
"0.6860544",
"0.66208094",
"0.6579514",
"0.6537604",
"0.64907944",
"0.6414515",
"0.6392691",
"0.63433105",
"0.63322794",
"0.63170993",
"0.6307723",
"0.6301542",
"0.62309974",
"0.62107265",
"0.61708796",
"0.61656624",
"0.6159551",
"0.6159291",
"0.61283183",
"0.611... | 0.73774314 | 0 |
Check if the function param is defined as an output for the action in the ddl | def contains_output?(output)
@ddl[:output].keys.include?(output)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_params\n raise 'No output defined. Please use --output option.' if @outputs.empty?\n end",
"def output? ; !!@output ; end",
"def done?\n !@output_id.nil?\n end",
"def arguments_valid?\n ret = false\n ret = true unless (@options.action == nil)\n end",
"def action_argume... | [
"0.612776",
"0.6070327",
"0.597946",
"0.5908288",
"0.5878903",
"0.58391726",
"0.5827675",
"0.5748225",
"0.56671315",
"0.5663992",
"0.562403",
"0.5589231",
"0.5547613",
"0.5543209",
"0.55371636",
"0.55096775",
"0.5495103",
"0.5474193",
"0.5468145",
"0.54485077",
"0.5446196",
... | 0.6811118 | 0 |
Similar to `case`, except it uses a `ResultPatternMatch` instead. | def result_case(target, destructure: false, &fn)
Qo::PatternMatchers::ResultPatternMatch
.new(destructure: destructure, &fn)
.call(target)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def case!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n type = CASE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 144:8: 'case'\n match( \"case\" )\n\n \n @state.type = t... | [
"0.662114",
"0.6491278",
"0.63860977",
"0.63575363",
"0.6344473",
"0.62308085",
"0.62308085",
"0.6076645",
"0.6054541",
"0.6054541",
"0.6037954",
"0.60247666",
"0.5977843",
"0.5956351",
"0.59129816",
"0.58484346",
"0.5824745",
"0.58157057",
"0.5803418",
"0.58016825",
"0.57896... | 0.7665825 | 0 |
Creates a new type of pattern matcher from a set of branches | def create_pattern_match(branches:)
Qo::PatternMatchers::PatternMatch.create(branches: branches)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_matcher(options, whitelist_option, blacklist_option); end",
"def match(*args)\n if args.first.is_a?(Qo::Matchers::GuardBlockMatcher)\n Qo::Matchers::PatternMatch.new(*args)\n else\n match_target, *qo_matchers = args\n Qo::Matchers::PatternMatch.new(*qo_matchers).call(matc... | [
"0.6051287",
"0.5499758",
"0.54571134",
"0.5445732",
"0.53744024",
"0.5301951",
"0.52606374",
"0.51869124",
"0.5180006",
"0.5111025",
"0.5105657",
"0.5097023",
"0.505593",
"0.5021175",
"0.5005874",
"0.49785346",
"0.49457228",
"0.49292594",
"0.49196014",
"0.490118",
"0.4895908... | 0.7791935 | 0 |
GET /refunds GET /refunds.json | def index
respond_to do |format|
format.html # index.html.erb
format.json { render json: @refunds }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refunds\n RefundRepository.new(api).all(token)\n end",
"def refund(tid, refund)\n begin\n #creating url\n url = \"#{@security.environment}/transactions/#{tid}/refunds\"\n\n # make the request.\n json_response = Rede::CommonRequest... | [
"0.774411",
"0.7166731",
"0.71120745",
"0.71120745",
"0.6953939",
"0.67905384",
"0.6724481",
"0.6713539",
"0.6691451",
"0.66871655",
"0.66508275",
"0.661992",
"0.661992",
"0.6613698",
"0.66089576",
"0.65944284",
"0.65873724",
"0.6585264",
"0.65592146",
"0.65592146",
"0.647270... | 0.7228496 | 1 |
GET /refunds/1 GET /refunds/1.json | def show
@refund = Refund.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @refund }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refunds\n RefundRepository.new(api).all(token)\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refunds }\n end\n end",
"def refund(tid, refund)\n begin\n #creating url\n url = \"#{@s... | [
"0.7301627",
"0.71893334",
"0.71390665",
"0.71280944",
"0.7020472",
"0.7020472",
"0.6979931",
"0.695762",
"0.6921594",
"0.6905886",
"0.6871424",
"0.68568027",
"0.6736404",
"0.6691081",
"0.66664696",
"0.66564816",
"0.66289157",
"0.66115683",
"0.6606588",
"0.65953076",
"0.65933... | 0.749443 | 1 |
GET /refunds/new GET /refunds/new.json | def new
@refund = Refund.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @refund }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @refund = Refund.new(params[:refund])\n\n respond_to do |format|\n if @refund.save\n format.html { redirect_to @refund, notice: 'Refund was successfully created.' }\n format.json { render json: @refund, status: :created, location: @refund }\n else\n format.html { r... | [
"0.7760759",
"0.7684975",
"0.74572015",
"0.744348",
"0.6885683",
"0.6806962",
"0.6689645",
"0.66887814",
"0.6637615",
"0.65879345",
"0.6569617",
"0.6530977",
"0.65274894",
"0.65274894",
"0.65236926",
"0.6481491",
"0.64791125",
"0.64791125",
"0.6474597",
"0.6473745",
"0.646988... | 0.847749 | 1 |
PUT /refunds/1 PUT /refunds/1.json | def update
@refund = Refund.find(params[:id])
respond_to do |format|
if @refund.update_attributes(params[:refund])
format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @refund = Refund.find(params[:id])\n\n respond_to do |format|\n if @refund.update_attributes(params[:refund])\n format.html { redirect_to @refund, notice: 'Refund was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\"... | [
"0.75930625",
"0.7290829",
"0.70791286",
"0.70637393",
"0.6838148",
"0.68328863",
"0.68274236",
"0.6785931",
"0.6768365",
"0.6754151",
"0.6727216",
"0.6710479",
"0.66524756",
"0.662985",
"0.65941256",
"0.65941256",
"0.6587663",
"0.6534057",
"0.65168035",
"0.65012044",
"0.6469... | 0.75599337 | 1 |
DELETE /refunds/1 DELETE /refunds/1.json | def destroy
@refund = Refund.find(params[:id])
@refund.destroy
respond_to do |format|
format.html { redirect_to refunds_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @refund = Refund.find(params[:id])\n @refund.destroy\n\n respond_to do |format|\n format.html { redirect_to refunds_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @refund_request = RefundRequest.find(params[:id])\n @refund_request.destroy\n\n respond_t... | [
"0.81669515",
"0.79900545",
"0.7478539",
"0.7146553",
"0.6928762",
"0.6753174",
"0.6579645",
"0.65783507",
"0.65673065",
"0.65597016",
"0.65315986",
"0.65289164",
"0.64688873",
"0.646832",
"0.6432849",
"0.640182",
"0.6395198",
"0.6395198",
"0.6393717",
"0.63912356",
"0.638374... | 0.8130104 | 1 |
This will only work for switching languages | def switch_language
language = locale('Español', 'English')
go_to language
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def language; end",
"def language; end",
"def language; end",
"def language; end",
"def lang(orig); end",
"def lang; end",
"def lang; end",
"def lang; end",
"def lang; end",
"def language_server; end",
"def verificar_locale\n \n end",
"def select_language\n I18n.backend.send(:init_tran... | [
"0.75204027",
"0.75204027",
"0.75204027",
"0.75204027",
"0.74501675",
"0.73938185",
"0.73938185",
"0.73938185",
"0.73938185",
"0.7377426",
"0.72867656",
"0.72524875",
"0.7218356",
"0.7210764",
"0.7185844",
"0.710356",
"0.7046074",
"0.70344025",
"0.70297027",
"0.70297027",
"0.... | 0.76059306 | 0 |
set up the session context information, so that it gets logged with the job log lines also set up a unique tmpdir, which will get removed at the end of the job. | def configure_for_job(job)
previous_tmpdir = ENV.fetch("TMPDIR", nil)
self.class.running_job(job) do
dir = Dir.mktmpdir("job-#{job.id}-#{name.gsub(/[^\w.]/, ".")}-")
begin
ENV["TMPDIR"] = dir
yield
ensure
FileUtils.remove_entry(dir, true)
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n @current_session = new_session\n end",
"def prepare\n FileUtils.rm_rf(@tempdirs, secure: true) if @tempdirs\n @tempdirs = []\n @base_options = nil\n @mode_options = nil\n @user_recipients = nil\n @user_keys = nil\n @system_identifiers = nil\n ... | [
"0.6003464",
"0.5945935",
"0.5819618",
"0.5753736",
"0.569681",
"0.5682621",
"0.5508562",
"0.5484854",
"0.5477067",
"0.5477067",
"0.5443726",
"0.5436414",
"0.5398018",
"0.5394001",
"0.5382443",
"0.5358069",
"0.5342104",
"0.5337471",
"0.53160423",
"0.5294716",
"0.52557176",
... | 0.63703877 | 0 |
Private: Used by insert to add new node in specified position. | def insert_at(data, position)
node, head, tail = set_insert_vars(data, position)
# before: head -> position
# after: head -> node -> position
head.tail = node
node.tail = position
position.head = node
node.head = head
@size += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(node, position)\n node_before_position = index(position-1)\n node_at_position = index(position)\n node_before_position.next = node\n node.next = node_at_position\n @size += 1\n node\n # returns inserted node\n end",
"def insert(position, surname)\n new_node = Node.new(surname)... | [
"0.7950374",
"0.7509472",
"0.7481829",
"0.74788064",
"0.7257622",
"0.72214186",
"0.71629435",
"0.714674",
"0.71291023",
"0.7113394",
"0.70786136",
"0.70153815",
"0.6981719",
"0.6958616",
"0.6956231",
"0.6948699",
"0.6945686",
"0.69395214",
"0.6927987",
"0.6927987",
"0.6920860... | 0.7567862 | 1 |
Determine if there is a chapter after the current page | def next_chapter_path
return false unless current_page.is_a? Book::Chapter
current_page.next_chapter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_chapter?()\n end",
"def whole_chapter?\n starting_bibleverse.verse.zero?\n end",
"def end_of_chapter\n end",
"def whole_book?\n starting_bibleverse.chapter.zero?\n end",
"def chapters?\n !chapters.empty?\n end",
"def last_page?; ! @doc.has_key? 'next' end",
"def last?\n ev... | [
"0.72224975",
"0.70645046",
"0.697479",
"0.65666264",
"0.6426701",
"0.63711345",
"0.63204855",
"0.6284475",
"0.6268844",
"0.62505114",
"0.6212323",
"0.6190456",
"0.615414",
"0.6149218",
"0.6134336",
"0.6120063",
"0.60991955",
"0.6035204",
"0.6030053",
"0.6027291",
"0.6017554"... | 0.7099606 | 1 |
Atomically decrement integer value with key This is just syntactic sugar for calling increment with a negative value. This method also accepts negative amounts. | def decrement(key, amount = 1, options = {})
increment(key, -amount, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decr(key, value = 1)\n mon_synchronize do\n perform [\"decr\", key, value], proc: T_INT\n end\n end",
"def decr(key, value = 1)\n mon_synchronize do\n perform [\"decr\", key, value], :proc => T_INT\n end\n end",
"def decrby(key, decrement); end",
"def decrby(key, decrement); end"... | [
"0.7871098",
"0.786161",
"0.78296614",
"0.78296614",
"0.7819166",
"0.7782856",
"0.77813274",
"0.77317894",
"0.7664426",
"0.7406838",
"0.73124725",
"0.72700393",
"0.71659833",
"0.71587723",
"0.712504",
"0.7062982",
"0.70442504",
"0.70044357",
"0.69277936",
"0.69277936",
"0.692... | 0.8487073 | 0 |
display ingredients created or updated after the specified date. | def updated_after
update_selector { @ingredients = policy_scope(Ingredient.updated_after(@date)).order(:name) }
render :index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @recipe = Recipe.all.order(\"created_at DESC\")\nend",
"def index\n @recipe = Recipe.all.order(\"created_at DESC\")\n end",
"def list_date(date)\n if date\n date = date.beginning_of_day\n if @list_date != date\n return content_tag(:h2, date.strftime(\"%m/%d/%Y\"))\n ... | [
"0.5571825",
"0.5557989",
"0.548803",
"0.5378808",
"0.53154016",
"0.53023547",
"0.528683",
"0.5278025",
"0.52607936",
"0.5249847",
"0.52494836",
"0.52359885",
"0.52355886",
"0.5233625",
"0.5232739",
"0.5232502",
"0.522944",
"0.5224436",
"0.5214373",
"0.52037644",
"0.51993275"... | 0.66590506 | 0 |
Creates a new label. | def create_label(project, name, color, options = {})
post("/projects/#{url_encode project}/labels", body: options.merge(name: name, color: color))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_label(node)\n if node.attributes['id'] and @labels[node.attributes['id']]\n label = @labels[node.attributes['id']]\n else\n label = @factory.new_label\n @labels[node.attributes['id']] = label\n end\n \n # Read all defined data fields\n ... | [
"0.75013953",
"0.71534044",
"0.7140698",
"0.7057874",
"0.7035276",
"0.6994237",
"0.69415545",
"0.6875589",
"0.68751764",
"0.68545467",
"0.6725328",
"0.672352",
"0.6695129",
"0.66658825",
"0.6658846",
"0.66065925",
"0.6557896",
"0.65385735",
"0.64709044",
"0.6469384",
"0.64668... | 0.7503175 | 0 |
Subscribes the user to a label to receive notifications | def subscribe_to_label(project, name)
post("/projects/#{url_encode project}/labels/#{url_encode name}/subscribe")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe!\n # TODO: Implement\n end",
"def subscribe_to_group_label(group, name)\n post(\"/groups/#{url_encode group}/labels/#{url_encode name}/subscribe\")\n end",
"def subscribe\n \nend",
"def subscribe\n @bot.get_updates(fail_silently: true) do |message|\n parser = InputParser.ne... | [
"0.63506544",
"0.62950766",
"0.601759",
"0.60003644",
"0.5977762",
"0.59768397",
"0.5948324",
"0.5934377",
"0.5934377",
"0.5893909",
"0.58407027",
"0.5835649",
"0.57620066",
"0.574103",
"0.5732175",
"0.5712805",
"0.56882906",
"0.56356305",
"0.5599611",
"0.5559095",
"0.555835"... | 0.6934015 | 0 |
GET /translated_lines GET /translated_lines.json | def index
@translated_lines = TranslatedLine.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_translated_line\n @translated_line = TranslatedLine.find(params[:id])\n end",
"def create\n @translated_line = TranslatedLine.new(translated_line_params)\n\n respond_to do |format|\n if @translated_line.save\n @translated_lines = TranslatedLine.where(translation_code: @translate... | [
"0.6548335",
"0.6476807",
"0.63034403",
"0.60311884",
"0.60255754",
"0.59237367",
"0.589768",
"0.5782095",
"0.5773349",
"0.5766864",
"0.57553756",
"0.5752632",
"0.5752632",
"0.56929684",
"0.561968",
"0.5565931",
"0.55541885",
"0.5552106",
"0.55155766",
"0.5509043",
"0.5501729... | 0.79125476 | 0 |
POST /translated_lines POST /translated_lines.json | def create
@translated_line = TranslatedLine.new(translated_line_params)
respond_to do |format|
if @translated_line.save
@translated_lines = TranslatedLine.where(translation_code: @translated_line.translation_code)
format.html { redirect_to @translated_line, notice: 'Translated line was s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translated_line_params\n params.require(:translated_line).permit(:translation_code, :description)\n end",
"def index\n @translated_lines = TranslatedLine.all\n end",
"def create\n @textline = Textline.new(textline_params)\n\n respond_to do |format|\n if @textline.save\n format... | [
"0.6830107",
"0.6629822",
"0.6466715",
"0.6433577",
"0.64027274",
"0.6105049",
"0.6046207",
"0.603598",
"0.59943044",
"0.5929162",
"0.5917073",
"0.5837867",
"0.5811325",
"0.57427025",
"0.5715672",
"0.5670065",
"0.5664622",
"0.561393",
"0.5608419",
"0.55941063",
"0.5585981",
... | 0.73388076 | 0 |
PATCH/PUT /translated_lines/1 PATCH/PUT /translated_lines/1.json | def update
respond_to do |format|
if @translated_line.update(translated_line_params)
format.html { redirect_to @translated_line, notice: 'Translated line was successfully updated.' }
format.json { render :show, status: :ok, location: @translated_line }
else
format.html { render :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @line = Line.find(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(line_params)\n format.html { redirect_to new_line_path, notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render verb: \"edit\"... | [
"0.6875655",
"0.6616695",
"0.66020405",
"0.66011876",
"0.65923893",
"0.65765464",
"0.64645976",
"0.6454072",
"0.6415003",
"0.6323658",
"0.63188964",
"0.63166213",
"0.6307501",
"0.63050836",
"0.63040924",
"0.6275271",
"0.62743974",
"0.6273326",
"0.6273326",
"0.6273326",
"0.627... | 0.76529455 | 0 |
DELETE /translated_lines/1 DELETE /translated_lines/1.json | def destroy
@translated_line.destroy
respond_to do |format|
format.html { redirect_to translated_lines_url, notice: 'Translated line was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to new_line_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line = Line.find_by_no(params[:id])\n @line.destroy\n\n respond_to do |format|\n ... | [
"0.70516783",
"0.70286965",
"0.70273167",
"0.6995233",
"0.69291437",
"0.68406737",
"0.67733943",
"0.67655706",
"0.6751633",
"0.67370576",
"0.67370576",
"0.67360646",
"0.67339957",
"0.67239946",
"0.6706351",
"0.66943514",
"0.66928524",
"0.6684665",
"0.6684665",
"0.6684665",
"0... | 0.7962743 | 0 |
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: ... | {
"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 ... | {
"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 |
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 |
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 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 |
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 |
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 |
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 |
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 { ... | {
"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 |
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 i... | 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 |
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.
... | {
"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 no... | {
"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 |
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 |
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 |
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 = ... | {
"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 n... | {
"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 |
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 ... | 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)
... | {
"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 |
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} ... | {
"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 |
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.