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 |
|---|---|---|---|---|---|---|
Wheter this user is a super admin. Short for has_permission(:is_super_admin) | def is_super_admin?
((!user_group_id.nil?) && has_permission(:is_super_admin))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_super_admin?\n user_type == 'super_admin'\n end",
"def is_super_admin?\n self.is_admin?\n end",
"def is_super_admin?\n if admin_type == 1\n return true\n else\n return false\n end\n end",
"def is_superadmin\n user = UserAdmin.find_by_user_id(current_user.id)\n if user... | [
"0.8697247",
"0.8686085",
"0.8585433",
"0.8503495",
"0.8499921",
"0.8472378",
"0.83544934",
"0.8305156",
"0.82714045",
"0.8228453",
"0.8224789",
"0.8162704",
"0.8150583",
"0.8124374",
"0.80108666",
"0.7961289",
"0.79499114",
"0.79121536",
"0.7907736",
"0.78979313",
"0.7895682... | 0.8830652 | 0 |
Print the version of iTunes | def show_version
puts "iTunes version: #{@iTunes.version}"
@logger.info "iTunes version: #{@iTunes.version}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_version()\n (version,packager,name) = get_version()\n puts name+\" v. \"+version+\" \"+packager\n exit\nend",
"def print_version\n puts VERSION\n \n exit\n end",
"def show_version\n puts format('JRubyArt version %s', JRubyArt::VERSION)\n end",
"def print_version_info()\... | [
"0.65963435",
"0.6577111",
"0.65505254",
"0.65398264",
"0.6528015",
"0.64972866",
"0.6479126",
"0.6469703",
"0.64344853",
"0.628872",
"0.6227733",
"0.6093266",
"0.60480416",
"0.6046116",
"0.5966573",
"0.59488386",
"0.59069866",
"0.58627456",
"0.58528763",
"0.58112365",
"0.578... | 0.8646498 | 0 |
Get a list of all possible iTunes sources | def sources
@iTunes.sources.each do |source|
@sources << source
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sources\n @sources.names\n end",
"def get_sources\n @page.all(input_elements[:sources_list])\n end",
"def sources\n []\n end",
"def sources\n @sources ||= []\n end",
"def sources\n @sources ||= AVAILABLE_SOURCES.each_with_object({}) do |source_class, list|\n ... | [
"0.6552776",
"0.6322853",
"0.6287629",
"0.6234077",
"0.6230914",
"0.6189557",
"0.61244214",
"0.60867286",
"0.59995264",
"0.59594893",
"0.59584624",
"0.5896845",
"0.585722",
"0.58501995",
"0.58476985",
"0.5754696",
"0.5724293",
"0.57051915",
"0.5647997",
"0.5635674",
"0.561590... | 0.83333707 | 0 |
Find a playlist by its name | def find_playlist_by_name name
@playlists.each do |playlist|
return playlist.index if name == playlist.name
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_playlist\n @playlist = Playlist.find(params[:id])\n end",
"def item_find\n find(playlist_url(@response.old_index))\n end",
"def find_by_name(name)\r\n @internal_list.find {|album| album.name == name}\r\n end",
"def find_playlists_for_song(song_name)\n track_array = s... | [
"0.69710803",
"0.6940758",
"0.68536437",
"0.67400104",
"0.647235",
"0.643509",
"0.6434064",
"0.6405076",
"0.6315739",
"0.6255049",
"0.6187526",
"0.6138805",
"0.6124344",
"0.6102551",
"0.60900825",
"0.60815686",
"0.60704964",
"0.60665536",
"0.60312784",
"0.60115546",
"0.600960... | 0.7819258 | 0 |
Return the number of dead tracks | def count_dead_tracks
@dead_track_list.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def track_count\n return @tracks.length\n end",
"def track_count\n self.tracks.count\n end",
"def num_of_tracks\n\t\t@tracks.count\t \n\tend",
"def incomplete_count\n incomplete.count\n end",
"def number_of_tracklists\n tracklists.size\n end",
"def track_count\n @ole.TrackCount... | [
"0.7729222",
"0.7510872",
"0.74920726",
"0.6840377",
"0.6794566",
"0.6771973",
"0.6727374",
"0.6718701",
"0.6544453",
"0.6544453",
"0.64508843",
"0.64395803",
"0.6374396",
"0.63047314",
"0.6283432",
"0.6241958",
"0.6239872",
"0.62331903",
"0.62202245",
"0.6212775",
"0.6198936... | 0.90659004 | 0 |
Remove tracks from the track_list from the iTunes database | def rem_dead_tracks playlist
begin
playlist.fileTracks.each do |track|
#puts "#{track.index}: #{track.location}"
next unless track.location == nil
puts "Deleting dead track: #{track.artist} - #{track.album} - #{track.name}"
@logger.info "Deleting dead track: #{track.artist} - #{tra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_tracks(tracks)\n\n tracks.each do |track|\n self.tracks.destroy(track) # remove association\n end\n\n tracks\n end",
"def remove_track_from_tracklist(playlist_id=1439475515)\n \t url = \"playlist/#{playlist_id}/tracks\"\n request_data = {:params=>{'access... | [
"0.73032564",
"0.69318926",
"0.6711813",
"0.66769016",
"0.6638574",
"0.66019875",
"0.6216058",
"0.613805",
"0.6134288",
"0.605465",
"0.6035624",
"0.600622",
"0.59619135",
"0.59495777",
"0.5910261",
"0.58891296",
"0.5883125",
"0.585527",
"0.58225507",
"0.58147",
"0.57582915",
... | 0.6958975 | 1 |
Gem Dependency API methods Declare a dependency on a gem. Ignores every option except :group. | def gem( name, *requirements, **options )
if options[:group] == :development ||
options[:groups]&.include?( :development ) ||
self.current_groups.include?( :development )
requirements.push( :development )
end
dependency = Gem::Dependency.new( name, *requirements )
self.dependencies.add( dependency )... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem(name, *reqs)\n if dep = @dependency_names[name]\n dep.requirement.concat reqs\n else\n dep = Gem::Dependency.new name, *reqs\n @dependency_names[name] = dep\n @dependencies << dep\n end\n end",
"def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n ... | [
"0.6867321",
"0.6728805",
"0.6728805",
"0.6662304",
"0.6561729",
"0.6559748",
"0.6436301",
"0.639025",
"0.6329641",
"0.6286518",
"0.62733144",
"0.6232861",
"0.62017846",
"0.61180526",
"0.6117555",
"0.6104101",
"0.6091112",
"0.6083656",
"0.6057914",
"0.6037483",
"0.59764814",
... | 0.7401856 | 0 |
Public: Callback to filter backtrace lines. One use for this is to make additional [PROJECT_ROOT] or [GEM_ROOT] substitutions, which are used by Honeybadger when grouping errors and displaying application traces. block A block which can be used to modify the Backtrace lines sent to Honeybadger. The block expects one ar... | def backtrace_filter(&block)
Agent.backtrace_filter(&block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(backtrace); end",
"def filter(backtrace); end",
"def filter_backtrace(backtrace)\n ## remove backtraces that match any pattern in IGNORE_CALLERS\n trace = backtrace.reject{|b| IGNORE_CALLERS.any?{|i| i=~b}}\n ## remove `:in ...` portion of backtraces\n trace = trace.map do |bt| \... | [
"0.7130077",
"0.7130077",
"0.7024147",
"0.69362855",
"0.68944085",
"0.6633929",
"0.65367573",
"0.6326931",
"0.632211",
"0.6288927",
"0.61718094",
"0.6166607",
"0.6138041",
"0.6028372",
"0.57720876",
"0.5744469",
"0.5744032",
"0.5703542",
"0.55516654",
"0.55077255",
"0.5500343... | 0.7388833 | 0 |
Populate the prejoined fact table. | def populate(options={})
populate_prejoined_fact_table(options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_prejoined_fact_table(options={})\r\n fact_columns_string = columns.collect {|c|\r\n \"#{table_name}.\" + c.name unless excluded_foreign_key_names.include?(c.name)\r\n }.compact.join(\",\\n\") \r\n \r\n prejoined_columns = []\r\n \r\n tables_and_joins = \"#{table_n... | [
"0.84082294",
"0.74827445",
"0.6295784",
"0.58048487",
"0.55817306",
"0.5358085",
"0.5300262",
"0.5279212",
"0.5266691",
"0.5205254",
"0.51967645",
"0.5195885",
"0.5181098",
"0.5102876",
"0.5089507",
"0.50233686",
"0.5011442",
"0.50093275",
"0.49745193",
"0.49037144",
"0.4902... | 0.80255306 | 1 |
Get foreign key names that are excluded. | def excluded_foreign_key_names
excluded_dimension_relations = prejoined_fields.keys.collect {|k| dimension_relationships[k]}
excluded_dimension_relations.collect {|r| r.foreign_key}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foreign_key_fields\n keys = []\n database_field_names.each do |param|\n if self.send(param).is_a? ForeignKey\n keys << param\n end\n end\n keys\n end",
"def non_foreign_key_fields\n self.database_field_names - self.foreign_key_fields\n end",
"def foreign_keys\n vals = [... | [
"0.6926847",
"0.6741855",
"0.67373955",
"0.65991753",
"0.64413625",
"0.63550436",
"0.62120456",
"0.61069524",
"0.60865986",
"0.60457295",
"0.6005258",
"0.5979622",
"0.59685093",
"0.59685093",
"0.5932059",
"0.59176356",
"0.59096026",
"0.59076685",
"0.58819073",
"0.5847478",
"0... | 0.863032 | 0 |
Construct the prejoined fact table. | def create_prejoined_fact_table(options={})
connection.transaction {
drop_prejoin_fact_table
connection.create_table(prejoined_table_name, :id => false) do |t|
# get all columns except the foreign_key columns for prejoined dimensions
columns.each do |c|
t.co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_prejoined_fact_table(options={})\r\n fact_columns_string = columns.collect {|c|\r\n \"#{table_name}.\" + c.name unless excluded_foreign_key_names.include?(c.name)\r\n }.compact.join(\",\\n\") \r\n \r\n prejoined_columns = []\r\n \r\n tables_and_joins = \"#{table_n... | [
"0.81337154",
"0.6465175",
"0.6194726",
"0.60960203",
"0.53838074",
"0.53418994",
"0.53412735",
"0.52600896",
"0.52530104",
"0.52224874",
"0.5216368",
"0.51703537",
"0.5150687",
"0.5143182",
"0.51354873",
"0.51294726",
"0.5122486",
"0.5099326",
"0.5083423",
"0.50702107",
"0.5... | 0.80051035 | 1 |
Populate the prejoined fact table. | def populate_prejoined_fact_table(options={})
fact_columns_string = columns.collect {|c|
"#{table_name}." + c.name unless excluded_foreign_key_names.include?(c.name)
}.compact.join(",\n")
prejoined_columns = []
tables_and_joins = "#{table_name}"
prej... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate(options={})\r\n populate_prejoined_fact_table(options)\r\n end",
"def create_prejoined_fact_table(options={})\r\n connection.transaction {\r\n drop_prejoin_fact_table\r\n\r\n connection.create_table(prejoined_table_name, :id => false) do |t|\r\n # get all columns ... | [
"0.80255306",
"0.74827445",
"0.6295784",
"0.58048487",
"0.55817306",
"0.5358085",
"0.5300262",
"0.5279212",
"0.5266691",
"0.5205254",
"0.51967645",
"0.5195885",
"0.5181098",
"0.5102876",
"0.5089507",
"0.50233686",
"0.5011442",
"0.50093275",
"0.49745193",
"0.49037144",
"0.4902... | 0.84082294 | 0 |
this page allows you to add food items to a participant | def edit
@food_item = @participant.food_items.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_food(food)\n food_meals.create(food_id: food.id)\n end",
"def update\n @food_item = @restaurant.food_items.find_by(name: params[:new_food_item])\n if @food_item.nil?\n # here we are taking user input and inserting it into the flash, thus the flash needs to be sanitized before displayed\n ... | [
"0.6631024",
"0.6522788",
"0.6497612",
"0.64098877",
"0.6310791",
"0.6310409",
"0.6297878",
"0.6289299",
"0.6271286",
"0.6214466",
"0.61955434",
"0.61719424",
"0.6122305",
"0.6105413",
"0.60910183",
"0.6056701",
"0.6052904",
"0.6041875",
"0.6040316",
"0.6033282",
"0.6021365",... | 0.6902602 | 0 |
Exports data to a CSV formatted file, using columns directly from a table table_name: name of the table exporting. Column names are pulled from it. data_array: an array of hashes (link from a find) | def csv_export_rawtable(table_name, data_array, options = {})
column_definitions = []
eval("#{table_name}.content_columns").each do |column|
column_definitions << [column.name, column.name]
end
csv_export(column_definitions, data_array, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_data(array, name = \"data\")\n CSV.open(\"public/data/\" + name + \"_\" + Time.now.strftime(\"%m_%d_%Y_%H:%M:%S\") + \".csv\", \"w\") do |csv|\n csv << array\n end\n end",
"def export_data(array, name = \"data\")\n CSV.open(\"public/data/\" + name + \"_\" + Time.now.strftime(\"%m_%d_%Y_... | [
"0.73341936",
"0.73341936",
"0.69036597",
"0.65343547",
"0.65272987",
"0.6493118",
"0.6469194",
"0.632637",
"0.62658876",
"0.623132",
"0.62234145",
"0.62212783",
"0.62028",
"0.6189768",
"0.618202",
"0.60957974",
"0.60957974",
"0.6062983",
"0.6034636",
"0.6026678",
"0.6009424"... | 0.8191336 | 0 |
Completes the transfer by creating inventory entries corresponding to the changes made to the source and destination inventories by the transfer items. | def complete!
now = Time.current
transaction do
transfer_items.each do |item|
source.present? && source.destock!(item, now, self)
destination.present? && destination.restock!(item, now, self)
end
update completed_at: now
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete_transactions!\n pending_transactions.each do |transaction|\n ActiveRecord::Base.transaction do\n transaction.entries.create!(amount: transaction.amount, entry_type: 'D', transaction: transaction, account: Account.mimo_assets)\n transaction.entries.create!(amount: transaction.amou... | [
"0.6582895",
"0.63096386",
"0.5977841",
"0.5905514",
"0.58127666",
"0.5804521",
"0.5718544",
"0.56545705",
"0.55839056",
"0.55536807",
"0.5511493",
"0.5504977",
"0.5487107",
"0.5475895",
"0.5421679",
"0.5414727",
"0.5402404",
"0.5346618",
"0.52448153",
"0.52358997",
"0.521074... | 0.70786023 | 0 |
Transfer is considered feasible only if all its items can be transferred, given current stock levels. Immediately returns true if the source is nil denoting an external source or if the source uses a stock gateway, which will not be queried. | def feasible?
return true if source.nil? || source.enable_gateway?
transfer_items.each do |item|
return false unless item.feasible?
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feasible?\n return true if amount < 0 || source.nil? || !product.tracked_stock? || source.enable_gateway?\n inventory_item = source_item\n inventory_item.present? && inventory_item.available >= amount\n end",
"def can_buy_ship?(other)\n return false unless @credits >= (other.price - @start_ship.... | [
"0.69510263",
"0.60551435",
"0.5973509",
"0.59410405",
"0.58941346",
"0.5849367",
"0.5816457",
"0.5791938",
"0.56999266",
"0.5693581",
"0.56742793",
"0.56690663",
"0.56568885",
"0.5652399",
"0.56424236",
"0.5602203",
"0.55789673",
"0.5552804",
"0.5547144",
"0.55413353",
"0.55... | 0.73438925 | 0 |
Loads the given order items into the transfer. To keep track of inventory during the load, matching inventory items are preloaded and updated by each load_item! call. | def load!(order_items)
transaction do
products = order_items.map(&:product)
stock = source.inventory_items.for(products)
order_items.each do |order_item|
load_item!(order_item, stock)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load!\n transfer = find_or_create_transfer\n transfer.load!(order.items_waiting)\n end",
"def load_item_from_stock(order_item, stock_items)\n amount = order_item.waiting\n stock_items.each do |item|\n all = item.available\n next if all <= 0\n\n if amount <= all\n # This inv... | [
"0.7143785",
"0.65659773",
"0.6305985",
"0.60799503",
"0.60450166",
"0.59311044",
"0.5776516",
"0.57490283",
"0.5734592",
"0.56506526",
"0.55872136",
"0.55603206",
"0.5530761",
"0.5525726",
"0.55232835",
"0.5515011",
"0.5450952",
"0.5434968",
"0.5424652",
"0.54147923",
"0.539... | 0.85636306 | 0 |
Creates a new transfer item based on given order item, specifying the product, lot code, and amount, if not overridden by arguments. | def create_item_from(order_item, lot_code = nil, expires_at = nil, amount = nil)
transfer_items.create!(
order_item: order_item,
product: order_item.product,
lot_code: lot_code || order_item.lot_code,
expires_at: expires_at,
amount: amount || order_item.waiting
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_order(order_item, qty, order)\r\n if order_item == \"latte\"\r\n item = Item.new(\"latte\", $latte_cost, $latte_price)\r\n elsif order_item == \"tea\"\r\n item = Item.new(\"tea\", $tea_cost, $tea_price)\r\n elsif order_item == \"scones\"\r\n item = Item.new(\"scones\", $scones... | [
"0.6691924",
"0.6266502",
"0.62314475",
"0.6195867",
"0.61193067",
"0.6056103",
"0.6008871",
"0.5976084",
"0.5946891",
"0.5939792",
"0.59351736",
"0.59328204",
"0.59294873",
"0.58686465",
"0.5860523",
"0.58581656",
"0.5846601",
"0.5842059",
"0.5814926",
"0.5803405",
"0.578219... | 0.8461544 | 0 |
Duplicates given existing transfer items into this transfer, useful for creating return transfers. | def duplicate_items_from(items)
transaction do
items.each do |item|
transfer_items << item.dup
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_duplicate(attrs)\n # Note that the duplication is *ONLY* the cart items and no attributes from\n # the originating cart are retained\n cloned = Cart.new(attrs)\n\n # Nor are the cart items fully cloned. Only the fabric variant is\n # retained (and associated denormalized columns)\n car... | [
"0.605014",
"0.60479575",
"0.5778689",
"0.57436013",
"0.55729043",
"0.5521336",
"0.55010784",
"0.5485309",
"0.54599166",
"0.5440926",
"0.54229176",
"0.5409679",
"0.538437",
"0.5382901",
"0.53795326",
"0.53790027",
"0.53771126",
"0.5372685",
"0.5371709",
"0.5361232",
"0.535303... | 0.82348144 | 0 |
Loads a single order item from given stock into the transfer as one or more transfer items. Updates the stock accordingly. Attempts several strategies until one returns true to denote the item has been loaded or the item is left (partially) unloaded. | def load_item!(order_item, stock)
if !order_item.product.tracked_stock? || source.enable_gateway?
load_item_from_infinite_stock(order_item) && return
end
stock_items = stock.select { |item| item.product == order_item.product }
return false if stock_items.none?
if order_item.lot_code.present?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_item_from_stock(order_item, stock_items)\n amount = order_item.waiting\n stock_items.each do |item|\n all = item.available\n next if all <= 0\n\n if amount <= all\n # This inventory item satisfies the amount, we're done.\n item.reserved += amount\n return create_i... | [
"0.74615616",
"0.70915425",
"0.69880384",
"0.6798755",
"0.59630257",
"0.5661048",
"0.5522546",
"0.544738",
"0.5381362",
"0.5239705",
"0.5188291",
"0.5172124",
"0.51267564",
"0.5115782",
"0.5044405",
"0.4995173",
"0.4985708",
"0.4950463",
"0.4935117",
"0.48869804",
"0.4881234"... | 0.78892595 | 0 |
Loading from infinite stock always succeeds. Order number is used as lot code for the transfer item. | def load_item_from_infinite_stock(order_item)
create_item_from(order_item, order_item.order.number)
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_item!(order_item, stock)\n if !order_item.product.tracked_stock? || source.enable_gateway?\n load_item_from_infinite_stock(order_item) && return\n end\n stock_items = stock.select { |item| item.product == order_item.product }\n return false if stock_items.none?\n\n if order_item.lot_co... | [
"0.7569398",
"0.7144613",
"0.67937493",
"0.67354023",
"0.65367925",
"0.6056922",
"0.5861945",
"0.5587089",
"0.54921794",
"0.54418737",
"0.5432402",
"0.5432042",
"0.53774035",
"0.5306669",
"0.52873474",
"0.5270145",
"0.5215932",
"0.52012783",
"0.51901776",
"0.51871717",
"0.518... | 0.7764891 | 0 |
Loading an item by lot code selects an inventory item by code, and only loads the item if a match is found. | def load_item_by_lot_code(order_item, stock_items)
item = stock_items.find { |item| order_item.lot_code == item.code }
# If the order item has a serial number, try lot code part only.
if item.nil? && order_item.lot_code['-']
lot_code_part = order_item.lot_code.split('-').first
item = stock_item... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_item\n source.item_by_product_and_code(product, lot_code)\n end",
"def find_by_code(code)\n record = fetch(code)\n return unless record\n\n Models::InventoryItem.new(**record.merge(code: code,\n discount: @discounts_rep.find_by_c... | [
"0.65136737",
"0.6332236",
"0.6300958",
"0.61952794",
"0.6193434",
"0.5958836",
"0.5933638",
"0.5852383",
"0.5797833",
"0.5743802",
"0.5683368",
"0.56575394",
"0.565443",
"0.56279033",
"0.5621907",
"0.5619759",
"0.5562339",
"0.5548164",
"0.55050683",
"0.54750896",
"0.545956",... | 0.80378413 | 0 |
A function to read schedule .txt | def read_schedule2(fname)
ents=[]
File.open(fname,'r') do |f|
f.each_line do |line|
line.chomp!
a1,a2,a3,a4 = line.split(/\s*==\s*/)
hash={}
hash["1"] = a1
hash["2"] = a2
hash["3"] = a3
hash["4"] = a4
ents.pu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_schedule\n schedule = {}\n File.open(SCHEDULE_FILE, 'r') do |f|\n f.each_line do |line|\n m = /^(\\d+)\\s+(\\S+)/.match(line)\n next if m.nil?\n week = m[1]\n server = m[2]\n schedule[server] = week.to_i\n end\n end\n\n schedul... | [
"0.7165557",
"0.6616428",
"0.6464286",
"0.6092501",
"0.60570586",
"0.60412633",
"0.6032724",
"0.6025103",
"0.60056823",
"0.59381217",
"0.58323586",
"0.58003163",
"0.57709646",
"0.5670735",
"0.5614807",
"0.56066287",
"0.56003714",
"0.5568436",
"0.55491984",
"0.55422306",
"0.54... | 0.672207 | 1 |
A function to read time table | def read_time_table(fname)
ents=[]
File.open(fname,'r') do |f|
f.each_line do |line|
line.chomp!
a1,a2,a3,a4,a5 = line.split(/\s*==\s*/)
hash={}
hash["1"] = a1 # id
hash["2"] = a2 # start time
hash["3"] = a3 # end time
h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_time fn=nil\n time = read_single_line(fn)\n if time.size == 2 # vector of two integers\n time.map { |t| t.to_i }\n else # single number\n single = time.first\n single =~ float_re ? single.to_f : single.to_i\n [single, nil]\n end\n end",... | [
"0.62877005",
"0.59484184",
"0.588952",
"0.5858403",
"0.5856105",
"0.5802663",
"0.5800128",
"0.5799782",
"0.5752518",
"0.5727681",
"0.5693217",
"0.5658559",
"0.5654533",
"0.5636147",
"0.56288266",
"0.5618865",
"0.55988264",
"0.55954945",
"0.5577572",
"0.55742943",
"0.5570156"... | 0.70969385 | 0 |
GET /my_exams GET /my_exams.json | def index
@my_exams = MyExam.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @my_exams }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @exams = Exam.all\n end",
"def index\n @course = Course.find(params[:course_id])\n @exams = @course.exams \n end",
"def index\n\n\t\t@resource =\tUser.find_by_authentication_token(params[:auth_token])\n\t\t# byebug\n\t\treturn invalid_user unless @resource\n\t\t@exams = Exam.all\n\t\t... | [
"0.69597405",
"0.6736313",
"0.643277",
"0.63711256",
"0.6279522",
"0.62561756",
"0.62325245",
"0.60618776",
"0.6056022",
"0.60445017",
"0.5982109",
"0.59747404",
"0.5951909",
"0.59491444",
"0.5907248",
"0.5858777",
"0.5805613",
"0.57967013",
"0.5796345",
"0.5753043",
"0.57529... | 0.74871546 | 0 |
GET /my_exams/new GET /my_exams/new.json | def new
@my_exam = MyExam.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @my_exam }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @exam = Exam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam }\n end\n end",
"def new\n @sentence = Sentence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sentence }\n end\n... | [
"0.7593478",
"0.71986675",
"0.7113014",
"0.70557946",
"0.70039195",
"0.69941354",
"0.69941354",
"0.69941354",
"0.69941354",
"0.6951249",
"0.6947157",
"0.69334483",
"0.69263786",
"0.691952",
"0.6895242",
"0.68790585",
"0.68790585",
"0.6874897",
"0.6874568",
"0.6839693",
"0.683... | 0.7325477 | 1 |
DELETE /my_exams/1 DELETE /my_exams/1.json | def destroy
@my_exam = MyExam.find(params[:id])
@my_exam.destroy
respond_to do |format|
format.html { redirect_to my_exams_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n f... | [
"0.73418057",
"0.71732163",
"0.70905197",
"0.692606",
"0.691144",
"0.6909299",
"0.6881308",
"0.6849361",
"0.6839646",
"0.6839646",
"0.6839646",
"0.68239444",
"0.67956245",
"0.67746824",
"0.675569",
"0.6749452",
"0.67456764",
"0.67290425",
"0.66978794",
"0.66743493",
"0.665517... | 0.7298862 | 1 |
GET /checklocations/1 GET /checklocations/1.json | def show
@checklocation = Checklocation.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @checklocation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locations\n get('locations')\n end",
"def get_location\n as_json(get_results('/locations.json'))\n end",
"def index\n locations = Location.all\n render json: locations\n end",
"def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1... | [
"0.67741096",
"0.6695241",
"0.65326035",
"0.6521637",
"0.63815725",
"0.6380121",
"0.6329414",
"0.6285283",
"0.62847316",
"0.62704057",
"0.6257463",
"0.6232984",
"0.6215145",
"0.61881995",
"0.6181893",
"0.6178184",
"0.61647683",
"0.6142148",
"0.6132089",
"0.6120561",
"0.609616... | 0.70227426 | 0 |
GET /checklocations/new GET /checklocations/new.json | def new
@checklocation = Checklocation.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @checklocation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @loc = current_user.locs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loc }\n end\n end",
"def new\n @location_have_location = LocationHaveLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json ... | [
"0.7326898",
"0.7140238",
"0.71116495",
"0.71116495",
"0.71116495",
"0.71116495",
"0.71116495",
"0.7072644",
"0.7057065",
"0.70568",
"0.70568",
"0.70374763",
"0.69907475",
"0.69710684",
"0.696086",
"0.6918263",
"0.6904993",
"0.6895286",
"0.68744946",
"0.6860864",
"0.6849603",... | 0.7804917 | 0 |
POST /checklocations POST /checklocations.json | def create
@checklocation = Checklocation.new(params[:checklocation])
respond_to do |format|
if @checklocation.save
format.html { redirect_to @checklocation, notice: 'Checklocation was successfully created.' }
format.json { render json: @checklocation, status: :created, location: @checklo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @location = Location.new(location_params)\n authorize @location\n if @location.save\n check_active_locations\n ok_status\n else\n error_status\n end\n end",
"def create\n @location_have_location = LocationHaveLocation.new(params[:location_have_location])\n\n resp... | [
"0.61141616",
"0.58627456",
"0.5854386",
"0.58495474",
"0.5847235",
"0.5788752",
"0.57777876",
"0.5777498",
"0.57715297",
"0.57215303",
"0.56990874",
"0.5698953",
"0.56949586",
"0.5674815",
"0.565803",
"0.56263936",
"0.56254256",
"0.56242496",
"0.5610269",
"0.5572539",
"0.557... | 0.6602425 | 0 |
PUT /checklocations/1 PUT /checklocations/1.json | def update
@checklocation = Checklocation.find(params[:id])
respond_to do |format|
if @checklocation.update_attributes(params[:checklocation])
format.html { redirect_to @checklocation, notice: 'Checklocation was successfully updated.' }
format.json { head :no_content }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_location(params)\n @client.put(\"#{path}/location\", nil, params, \"Content-Type\" => \"application/json\")\n end",
"def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end",
"def create\n @checklocation = Checklocation.new(params[:checklocation])\n\n resp... | [
"0.648955",
"0.6414245",
"0.6151873",
"0.6077711",
"0.6064187",
"0.5968042",
"0.5915312",
"0.5865967",
"0.58075815",
"0.57981247",
"0.57776487",
"0.57734776",
"0.5769888",
"0.5757061",
"0.5748443",
"0.5743139",
"0.5731062",
"0.57206774",
"0.5700789",
"0.5700789",
"0.5700243",... | 0.67213523 | 0 |
DELETE /checklocations/1 DELETE /checklocations/1.json | def destroy
@checklocation = Checklocation.find(params[:id])
@checklocation.destroy
respond_to do |format|
format.html { redirect_to checklocations_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Location.delete(params[\"id\"])\n end",
"def destroy\n @record = Location.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n #@items_location = ItemsLocation.find(params[:id])\n #@items... | [
"0.69042605",
"0.67305315",
"0.6674951",
"0.66638136",
"0.6660653",
"0.66491914",
"0.66388047",
"0.6622575",
"0.6600498",
"0.65997493",
"0.65913284",
"0.6581632",
"0.6563891",
"0.6561262",
"0.6554776",
"0.6554426",
"0.6549019",
"0.6548426",
"0.6548426",
"0.65432316",
"0.65348... | 0.75030154 | 0 |
Construct a SQL literal. This is useful for sql that is too complex for Arel. | def sql_literal(value)
Arel::Nodes::SqlLiteral.new(value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sql(string)\n ::Arel::Nodes::SqlLiteral.new(string)\n end",
"def sql_literal(ds)\n ds.literal(sql_expr)\n end",
"def sql_literal(object)\n object.literal(to_s)\n end",
"def sql_literal(*)\n @dataset.sql\n end",
"def literal_string_append(sql, v)\n sql << \"'\"... | [
"0.7736763",
"0.76860034",
"0.7586923",
"0.73519284",
"0.72554016",
"0.7220023",
"0.72013044",
"0.7135038",
"0.708184",
"0.6977372",
"0.6962823",
"0.68229246",
"0.67857265",
"0.67269695",
"0.6726387",
"0.67204005",
"0.6716745",
"0.6714795",
"0.67112356",
"0.66904217",
"0.6679... | 0.8052894 | 0 |
Construct a SQL quoted string. This is used for fragments of SQL. | def sql_quoted(value)
Arel::Nodes.build_quoted(value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string\n @sql_string = \"SELECT #{@select} FROM #{@from}#{@join} WHERE #{@where};\"\n end",
"def quoted_identifier_append(sql, c)\n sql << '`%s`' % c\n end",
"def escaped_sql\n sql % binds.reduce({}) { |a, (col, val)|\n a[col.to_sym] = if val.is_a? Array\n ... | [
"0.7503615",
"0.7257309",
"0.71583223",
"0.70563316",
"0.7047856",
"0.7003093",
"0.7003093",
"0.69992816",
"0.6699972",
"0.6696728",
"0.6689568",
"0.6659244",
"0.6655971",
"0.662139",
"0.65766203",
"0.6499731",
"0.6451111",
"0.6422716",
"0.6410513",
"0.6401725",
"0.6389198",
... | 0.73625314 | 1 |
returns booleaan value duetoday or not | def due_today?
@due_date == Date.today
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def due_today?\n @date == Date.today.to_s\n end",
"def due_today?\n due_date == Date.due_today\n end",
"def due_later?\n @due_date > Date.today\n end",
"def overdue\n @date > Date.today\n end",
"def overdue?\n @due_date < Date.today\n end",
"def overdue?\n due < Date.current\n end... | [
"0.78485334",
"0.78431356",
"0.7580038",
"0.7518905",
"0.7500144",
"0.7436945",
"0.7378778",
"0.725885",
"0.7258464",
"0.72386867",
"0.7127824",
"0.70372593",
"0.69187444",
"0.6889206",
"0.6868523",
"0.6867858",
"0.6867445",
"0.68260235",
"0.6823145",
"0.6823145",
"0.6813691"... | 0.7860707 | 0 |
it will push the todo in the todolist | def add(todo)
@todos.push(todo)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_todo\n puts\n desc = description('Todo description (required):')\n return if desc.nil?\n due = due_date\n priority = item_priority\n @list.add('todo',desc, { due: due, priority: priority})\n puts\n end",
"def add_item_to_list(item)\n @to_do_item.push(item)\n end",
"def add(tod... | [
"0.7107332",
"0.7011871",
"0.685573",
"0.6837604",
"0.6781269",
"0.67708915",
"0.6696298",
"0.6645877",
"0.6641652",
"0.66268045",
"0.66237235",
"0.6609636",
"0.6584491",
"0.65521884",
"0.6505387",
"0.6469069",
"0.64397347",
"0.6439244",
"0.6432675",
"0.63712054",
"0.63649863... | 0.74936455 | 0 |
it will return the todolist of overdue | def overdue
TodosList.new(@todos.filter { |todo| todo.overdue? })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_tasks_overdue\n self.find_all {|e| (e.completed.nil? or !e.completed) and e.complete_by < Time.zone.now }\n end",
"def due_later\n TodosList.new(@todos.filter { |todo| todo.due_later? })\n end",
"def dueToday\n dueTodayList = \"\"\n @toDoListArray.each do |e|\n if !e.status && e.d... | [
"0.7387114",
"0.7348554",
"0.72605664",
"0.7171583",
"0.7082553",
"0.707628",
"0.7039311",
"0.6990257",
"0.6685462",
"0.6665459",
"0.6647593",
"0.6630727",
"0.65986794",
"0.6557406",
"0.6529509",
"0.6522506",
"0.6505251",
"0.64968306",
"0.6437389",
"0.6434519",
"0.64197487",
... | 0.83248234 | 0 |
it will return the todolist of duetoday | def due_today
TodosList.new(@todos.filter { |todo| todo.due_today? })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dueToday\n dueTodayList = \"\"\n @toDoListArray.each do |e|\n if !e.status && e.dueDate == Date.today\n dueTodayList = dueTodayList + e.printItem + \" \"\n end\n end\n dueTodayList\n end",
"def due_later\n TodosList.new(@todos.filter { |todo| todo.due_later? })\n end",
"de... | [
"0.83781195",
"0.80639076",
"0.80233085",
"0.7953399",
"0.7519282",
"0.7334585",
"0.7211269",
"0.7080071",
"0.7056554",
"0.70332956",
"0.7003077",
"0.6950114",
"0.6912658",
"0.6840903",
"0.6753067",
"0.6731556",
"0.66811657",
"0.6605121",
"0.6572694",
"0.6509702",
"0.65023226... | 0.8575246 | 0 |
it will return the todolist of duelater | def due_later
TodosList.new(@todos.filter { |todo| todo.due_later? })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def due_date_task_list\n @due_date_task_list\n end",
"def dueToday\n dueTodayList = \"\"\n @toDoListArray.each do |e|\n if !e.status && e.dueDate == Date.today\n dueTodayList = dueTodayList + e.printItem + \" \"\n end\n end\n dueTodayList\n end",
"def due_today\n TodosList.... | [
"0.76600075",
"0.7425",
"0.7318131",
"0.6905841",
"0.6836603",
"0.6794105",
"0.67571825",
"0.66352",
"0.6619828",
"0.6590634",
"0.6586511",
"0.65522486",
"0.65361786",
"0.65172076",
"0.6468035",
"0.6465515",
"0.63964725",
"0.6368936",
"0.6341448",
"0.63335764",
"0.63125783",
... | 0.8177851 | 0 |
GET /join_user_to_assistants GET /join_user_to_assistants.json | def index
@join_user_to_assistants = JoinUserToAssistant.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_join_user_to_assistant\n @join_user_to_assistant = JoinUserToAssistant.find(params[:id])\n end",
"def create\n @join_user_to_assistant = JoinUserToAssistant.new(join_user_to_assistant_params)\n\n respond_to do |format|\n if @join_user_to_assistant.save\n format.html { redirect_t... | [
"0.6488062",
"0.61186546",
"0.59869283",
"0.59228635",
"0.5900942",
"0.56274027",
"0.5619459",
"0.55861795",
"0.5528946",
"0.5519544",
"0.54990375",
"0.5449441",
"0.54196227",
"0.5401511",
"0.53953344",
"0.5351622",
"0.5315177",
"0.5307044",
"0.5305458",
"0.5287998",
"0.52729... | 0.7344257 | 0 |
POST /join_user_to_assistants POST /join_user_to_assistants.json | def create
@join_user_to_assistant = JoinUserToAssistant.new(join_user_to_assistant_params)
respond_to do |format|
if @join_user_to_assistant.save
format.html { redirect_to @join_user_to_assistant, notice: 'Join user to assistant was successfully created.' }
format.json { render :show, st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_join_user_to_assistant\n @join_user_to_assistant = JoinUserToAssistant.find(params[:id])\n end",
"def index\n @join_user_to_assistants = JoinUserToAssistant.all\n end",
"def join_user_to_assistant_params\n params.require(:join_user_to_assistant).permit(:cpfk_user_id, :cpfk_assistant_id... | [
"0.6666518",
"0.66353935",
"0.64586884",
"0.6028437",
"0.5963533",
"0.5916752",
"0.57810825",
"0.5778081",
"0.57468504",
"0.56878847",
"0.5668315",
"0.5657118",
"0.56373066",
"0.5594424",
"0.55942625",
"0.5583349",
"0.5573002",
"0.55658644",
"0.5560405",
"0.555374",
"0.553897... | 0.6986184 | 0 |
PATCH/PUT /join_user_to_assistants/1 PATCH/PUT /join_user_to_assistants/1.json | def update
respond_to do |format|
if @join_user_to_assistant.update(join_user_to_assistant_params)
format.html { redirect_to @join_user_to_assistant, notice: 'Join user to assistant was successfully updated.' }
format.json { render :show, status: :ok, location: @join_user_to_assistant }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_join_user_to_assistant\n @join_user_to_assistant = JoinUserToAssistant.find(params[:id])\n end",
"def update\n user = User.where(:invite_token => params[:id], :status => \"invitee\").first\n role = user.roles.first\n if current_user\n role.user_id = current_user.id\n role.join_... | [
"0.64857167",
"0.59643155",
"0.59431946",
"0.5797829",
"0.5788901",
"0.5696062",
"0.5667351",
"0.563272",
"0.55762",
"0.5535458",
"0.5522331",
"0.55185026",
"0.5503112",
"0.550089",
"0.5489815",
"0.54843533",
"0.5478842",
"0.54710406",
"0.5464877",
"0.5463294",
"0.5452236",
... | 0.6742016 | 0 |
DELETE /join_user_to_assistants/1 DELETE /join_user_to_assistants/1.json | def destroy
@join_user_to_assistant.destroy
respond_to do |format|
format.html { redirect_to join_user_to_assistants_url, notice: 'Join user to assistant was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @assist = Assist.find(params[:id])\n @assist.destroy\n\n respond_to do |format|\n format.html { redirect_to assists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @guidances_user.destroy\n respond_to do |format|\n format.html { redirect_to gu... | [
"0.66305023",
"0.65866286",
"0.65855944",
"0.6518632",
"0.64724064",
"0.64334816",
"0.64238405",
"0.6421914",
"0.6395352",
"0.6389911",
"0.6377326",
"0.63713765",
"0.6355604",
"0.6353042",
"0.6338573",
"0.6330434",
"0.63176066",
"0.6313337",
"0.63094944",
"0.63054067",
"0.629... | 0.7291304 | 0 |
Save serialized attribute to cache. If serializer method or serialization block is not given, Ultracache tries to serialize the object by serializeing hash returned by its `as_json` method. | def save_cache(obj)
value = if @serializer_method
serializer.serialize(obj.send(@serializer_method))
elsif @serializing_block
serializer.serialize(@serializing_block.call(obj))
else
serializer.serialize(obj.as_json)
end
storage.set(key(obj), value)
value
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_serialize(key, serializer: ActiveModel::ArraySerializer, json_opts: {}, &block)\n cache(key) { serialize(serializer: serializer, json_opts: json_opts, &block) }\n end",
"def write\n hash = attributes_hash\n write_value(serializer_class.dump(hash))\n @_cache = hash # set... | [
"0.72712463",
"0.7095984",
"0.69161844",
"0.5956073",
"0.5825795",
"0.5731434",
"0.56962436",
"0.56694424",
"0.55922",
"0.5510292",
"0.54900897",
"0.5483556",
"0.5483556",
"0.54575866",
"0.5448683",
"0.540787",
"0.54075634",
"0.5387215",
"0.5352197",
"0.5343216",
"0.53388435"... | 0.77806485 | 0 |
Destroys cache from storage | def destroy_cache(obj)
storage.del(key(obj))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_clear\n @store.delete\n end",
"def destroy\n delete!(get, phase: :destroyed) if get && !cache.uploaded?(get)\n end",
"def cache_clear\n @store.clear\n end",
"def cache_clear\n @dataset.delete\n end",
"def cache_clear\n @dataset.delete\n ... | [
"0.77374905",
"0.7639924",
"0.7367089",
"0.7342189",
"0.7342189",
"0.7297336",
"0.7297336",
"0.72606885",
"0.72606885",
"0.7221525",
"0.7219844",
"0.7205838",
"0.7205838",
"0.72021604",
"0.719867",
"0.71892095",
"0.71892095",
"0.7174867",
"0.71665406",
"0.71665174",
"0.716614... | 0.82391334 | 0 |
Updates value of existing cache. Its behavior is same with that of `save_cache`. | def update_cache(obj)
save_cache(obj)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def set_cache(value); end",
"def set_cache(value); end",
"def set_cache\n cache_key = self.class.cache_key(self.key)\n Rails.cache.write(cache_key, self.actual_value)\n end",
"def update_cache(type, id, dat... | [
"0.7836948",
"0.75574094",
"0.75574094",
"0.7305472",
"0.7301359",
"0.7301359",
"0.7288954",
"0.7223188",
"0.71811163",
"0.717196",
"0.7152517",
"0.7129033",
"0.7072834",
"0.70043796",
"0.69305825",
"0.68115866",
"0.6740709",
"0.6729932",
"0.6726854",
"0.67143255",
"0.6713984... | 0.7672664 | 1 |
Adds a where condition that requires column to contain key Example: User.hstore_has_key(:properties, "favorite_color") | def hstore_has_key(column, key)
where("#{connection.quote_column_name(column)} ? :key", :key => key)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hstore_has_any_keys(column, *keys)\n where(\"#{connection.quote_column_name(column)} ?| ARRAY[:keys]\", :keys => keys.flatten)\n end",
"def hstore_has_all_keys(column, *keys)\n where(\"#{connection.quote_column_name(column)} ?& ARRAY[:keys]\", :keys => keys.flatten)\n end",
"def se... | [
"0.7161256",
"0.7025353",
"0.63294756",
"0.62365425",
"0.617708",
"0.61253405",
"0.6086603",
"0.6018537",
"0.5920791",
"0.5895221",
"0.58656144",
"0.5843804",
"0.5765473",
"0.57418346",
"0.5711226",
"0.56885314",
"0.5677917",
"0.5673337",
"0.5644449",
"0.5629177",
"0.56104684... | 0.8315779 | 0 |
Adds a where condition that requires column to contain all keys. Example: User.hstore_has_all_keys(:properties, "favorite_color", "favorite_song") User.hstore_has_all_keys(:properties, ["favorite_color", "favorite_song"]) | def hstore_has_all_keys(column, *keys)
where("#{connection.quote_column_name(column)} ?& ARRAY[:keys]", :keys => keys.flatten)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hstore_has_any_keys(column, *keys)\n where(\"#{connection.quote_column_name(column)} ?| ARRAY[:keys]\", :keys => keys.flatten)\n end",
"def all?(*keys)\n keys.flatten!\n if keys.any?\n # Check only the specified keys\n valid = true\n keys.each do |key|\n un... | [
"0.7869474",
"0.6374922",
"0.63405627",
"0.6193158",
"0.5560081",
"0.55010927",
"0.5499895",
"0.5454974",
"0.54354656",
"0.54081637",
"0.533416",
"0.5332656",
"0.5309972",
"0.5287408",
"0.5281288",
"0.52629673",
"0.5260552",
"0.52523375",
"0.52488273",
"0.52488273",
"0.524520... | 0.85074276 | 0 |
Adds a where condition that requires column to contain any keys. Example: User.hstore_has_any_keys(:properties, "favorite_color", "favorite_song") User.hstore_has_any_keys(:properties, ["favorite_color", "favorite_song"]) | def hstore_has_any_keys(column, *keys)
where("#{connection.quote_column_name(column)} ?| ARRAY[:keys]", :keys => keys.flatten)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hstore_has_all_keys(column, *keys)\n where(\"#{connection.quote_column_name(column)} ?& ARRAY[:keys]\", :keys => keys.flatten)\n end",
"def hstore_has_key(column, key)\n where(\"#{connection.quote_column_name(column)} ? :key\", :key => key) \n end",
"def includes!(*keys)\n key... | [
"0.82035935",
"0.6901664",
"0.58999807",
"0.5833533",
"0.57246804",
"0.56622756",
"0.56490844",
"0.5628387",
"0.56015944",
"0.55385166",
"0.55337644",
"0.55140793",
"0.55062175",
"0.55020326",
"0.5426738",
"0.5420755",
"0.54157066",
"0.54004425",
"0.5396012",
"0.5326123",
"0.... | 0.8535087 | 0 |
GET /step_types/1 GET /step_types/1.json | def show
@step_type = StepType.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @step_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @step_type = StepType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step_type }\n end\n end",
"def create\n @step_type = StepType.new(params[:step_type])\n\n respond_to do |format|\n if @step_type.save\n format.html { red... | [
"0.6964311",
"0.6590116",
"0.6362077",
"0.6362077",
"0.6362077",
"0.634966",
"0.6285838",
"0.6202415",
"0.61591583",
"0.61391413",
"0.61174864",
"0.597262",
"0.596985",
"0.58601964",
"0.5823646",
"0.58206195",
"0.5760642",
"0.57427734",
"0.57333934",
"0.57313234",
"0.5725373"... | 0.7449065 | 0 |
GET /step_types/new GET /step_types/new.json | def new
@step_type = StepType.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @step_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @step_type = StepType.new(params[:step_type])\n\n respond_to do |format|\n if @step_type.save\n format.html { redirect_to @step_type, notice: 'Step type was successfully created.' }\n format.json { render json: @step_type, status: :created, location: @step_type }\n else\n... | [
"0.76615024",
"0.7597696",
"0.74612314",
"0.7019332",
"0.70115805",
"0.69151366",
"0.68753594",
"0.6815718",
"0.6806939",
"0.6787319",
"0.6787308",
"0.67831624",
"0.6751571",
"0.66968924",
"0.66862106",
"0.6644399",
"0.66320115",
"0.6618037",
"0.6597929",
"0.6593064",
"0.6590... | 0.8258794 | 0 |
POST /step_types POST /step_types.json | def create
@step_type = StepType.new(params[:step_type])
respond_to do |format|
if @step_type.save
format.html { redirect_to @step_type, notice: 'Step type was successfully created.' }
format.json { render json: @step_type, status: :created, location: @step_type }
else
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @step_type = StepType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step_type }\n end\n end",
"def create\n\n step_attributes = step_params\n fields_attributes = step_attributes.delete(\"fields\")\n\n @step = Step.new(step_attribu... | [
"0.6301478",
"0.6165463",
"0.61133933",
"0.60096407",
"0.59759814",
"0.5933946",
"0.5898706",
"0.582284",
"0.5800694",
"0.57337314",
"0.57299453",
"0.57114893",
"0.57070243",
"0.5701471",
"0.5695857",
"0.5693313",
"0.5657367",
"0.5655584",
"0.5653112",
"0.55918777",
"0.558468... | 0.72749895 | 0 |
PUT /step_types/1 PUT /step_types/1.json | def update
@step_type = StepType.find(params[:id])
respond_to do |format|
if @step_type.update_attributes(params[:step_type])
format.html { redirect_to @step_type, notice: 'Step type was successfully updated.' }
format.json { head :no_content }
else
format.html { render acti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @step_type = StepType.new(params[:step_type])\n\n respond_to do |format|\n if @step_type.save\n format.html { redirect_to @step_type, notice: 'Step type was successfully created.' }\n format.json { render json: @step_type, status: :created, location: @step_type }\n else\n... | [
"0.6641828",
"0.64360684",
"0.6363463",
"0.63611674",
"0.63611674",
"0.63441116",
"0.6302788",
"0.62916106",
"0.6289646",
"0.62329584",
"0.6131726",
"0.61298335",
"0.6120811",
"0.6112716",
"0.6078138",
"0.6056743",
"0.60472655",
"0.6023685",
"0.5924834",
"0.5923892",
"0.59079... | 0.7451496 | 0 |
DELETE /step_types/1 DELETE /step_types/1.json | def destroy
@step_type = StepType.find(params[:id])
@step_type.destroy
respond_to do |format|
format.html { redirect_to step_types_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @step = Step.find(params[:id])\n @step.status = \"deleted\"\n @step.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end",
"def destroy\n @step = Step.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.html ... | [
"0.7551166",
"0.73224986",
"0.7266624",
"0.722744",
"0.70581967",
"0.70506763",
"0.70506763",
"0.70506763",
"0.70506763",
"0.6985755",
"0.69536024",
"0.6950195",
"0.69379926",
"0.6921468",
"0.69162726",
"0.68899816",
"0.6863857",
"0.6846205",
"0.68428344",
"0.6841495",
"0.683... | 0.81487787 | 0 |
added namespaces to make root element compliant with Intuit's expectation | def post_save xml, options={:mapping=>:_default}
# using REXML's element namespace method doesn't seem to set the namespace correctly...?
xml.root.add_attributes("xmlns"=>"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1")
xml.root.add_namespace "xsi", "http://www.w3.org/2001/XMLSchema-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/... | [
"0.5956942",
"0.58077854",
"0.57177633",
"0.55588984",
"0.5534406",
"0.55242664",
"0.55207837",
"0.55207837",
"0.551308",
"0.5478807",
"0.5478807",
"0.5478807",
"0.5478807",
"0.54777044",
"0.54416996",
"0.54332113",
"0.5431981",
"0.5431981",
"0.5431981",
"0.5431981",
"0.54319... | 0.6010139 | 0 |
Produces a random hipster paragraph. | def paragraph(sentence_count: 3, supplemental: false, random_sentences_to_add: 3)
sentences(number: resolve(sentence_count) + rand(random_sentences_to_add.to_i).to_i, supplemental: supplemental).join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_p\n \"<p>#{texter.random_paragraph}</p>\"\n end",
"def random_h( level = 1 )\n \"<h#{level}>#{texter.random_title}</h#{level}>\"\n end",
"def paragraph(\n word_count: rand(DEFAULT_WORD_COUNT_RANGE),\n sentence_count: rand(DEFAULT_SENTENCE_COUNT_RANGE),\n fillers: dictionnary.f... | [
"0.8400888",
"0.6910858",
"0.68437576",
"0.6598232",
"0.6574919",
"0.6535877",
"0.65357983",
"0.6521251",
"0.65000004",
"0.6478271",
"0.6383488",
"0.63128096",
"0.62859225",
"0.6263237",
"0.62630796",
"0.6235404",
"0.6212816",
"0.61507505",
"0.61499673",
"0.6144582",
"0.60971... | 0.73073816 | 1 |
Produces a random hipster paragraph by characters. | def paragraph_by_chars(characters: 256, supplemental: false)
paragraph = paragraph(sentence_count: 3, supplemental: supplemental)
paragraph += " #{paragraph(sentence_count: 3, supplemental: supplemental)}" while paragraph.length < characters
"#{paragraph[0...characters - 1]}."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_p\n \"<p>#{texter.random_paragraph}</p>\"\n end",
"def reproduce(p)\n copy = @chars.map do |c|\n if rand < p\n (c.ord + (rand <=> 0.5)).clamp(A, Z).chr\n else\n c\n end\n end\n self.class.new(copy)\n end",
"def rand_char\n @chars.sample\n end",
"d... | [
"0.7406626",
"0.6741285",
"0.66714346",
"0.6659473",
"0.65968525",
"0.6595556",
"0.65332294",
"0.65306276",
"0.6473004",
"0.646723",
"0.64242655",
"0.64209163",
"0.6366262",
"0.63505095",
"0.6313722",
"0.6274928",
"0.62504464",
"0.6241987",
"0.62392205",
"0.6238755",
"0.62331... | 0.7069037 | 1 |
Toggle the visibility of the element, hide it if it's shown, show it if it's hidden. | def toggle
if style![:display] == :none
show
else
hide
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle\n if visible?\n hide\n\n else\n show\n\n end\n end",
"def toggle\n style[:hidden] = !style[:hidden]\n update_visibility\n end",
"def link_to_visibility_toggle(options = {})\r\n options[:of] ||= '$(this.parentNode).next()'\r\n options[:... | [
"0.8281702",
"0.7527834",
"0.6910811",
"0.6806435",
"0.67665976",
"0.65891856",
"0.64851594",
"0.6400037",
"0.63962513",
"0.63899195",
"0.63899195",
"0.6312003",
"0.6310687",
"0.6251728",
"0.6216467",
"0.6182969",
"0.6141018",
"0.61338073",
"0.6065034",
"0.6044346",
"0.604434... | 0.75500757 | 1 |
returns all of the sales that match the given prod id | def sales
FarMar::Sale.all.find_all {|instance| instance.product_id == id}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sales\n FarMar::Sale.all.find_all { |sale| sale.product_id == id }\n end",
"def sales\n FarMar::Sale.all.select { |sale| sale.product_info == product_id }\n end",
"def sales(assoc_product_id)\n assoc_sales = []\n FarMar::Sale.all.each do |sale|\n if sale.product_id.to_i == assoc_prod... | [
"0.81774527",
"0.80818695",
"0.7974159",
"0.79155743",
"0.7756965",
"0.7746877",
"0.763679",
"0.75372213",
"0.7447362",
"0.7313201",
"0.728974",
"0.71746176",
"0.715492",
"0.7005977",
"0.6799464",
"0.65683895",
"0.6558777",
"0.6558777",
"0.6541912",
"0.6534897",
"0.6332224",
... | 0.8307875 | 0 |
Init the status bar | def init_status_bar(menu)
status_bar = NSStatusBar.systemStatusBar
status_item = status_bar.statusItemWithLength(NSVariableStatusItemLength)
status_item.setMenu menu
status_item.setTitle "虾米同步状态"
@status_item = status_item
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_status_bar\n status_bar.show_message(tr(\"Ready\"))\n end",
"def status=(status)\n @statusbar.configure(:text => status)\n end",
"def initStatusBar(menu)\n status_bar = NSStatusBar.systemStatusBar\n status_item = status_bar.statusItemWithLength(NSVariableStatusItemLength)\n ... | [
"0.76012444",
"0.7158105",
"0.70395267",
"0.67654264",
"0.65527374",
"0.65359634",
"0.6156544",
"0.60428095",
"0.6009266",
"0.59643936",
"0.59157556",
"0.5882142",
"0.58810174",
"0.5876234",
"0.5828364",
"0.5814335",
"0.5801912",
"0.57615966",
"0.574682",
"0.57330674",
"0.569... | 0.75574315 | 1 |
POST to set username/station_id and redirect to SAML login | def login_creds
session_login["username"] = params.permit(:username)[:username]&.strip if allow_assert_username?
session_login["station_id"] = params.permit(:station_id)[:station_id]&.strip
redirect_to url_for_sso_host("/auth/samlva")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n redirect_to user_saml_omniauth_authorize_path\n end",
"def saml_request\n session_token = authenticate\n uri = URI.parse(idp_login_url)\n req = Net::HTTP::Post.new(uri.request_uri)\n req.set_form_data({'onetimetoken' => session_token})\n req\n end",
"def lo... | [
"0.61834264",
"0.61506456",
"0.6061828",
"0.6061385",
"0.60161567",
"0.5889821",
"0.58387",
"0.5836966",
"0.58241606",
"0.579736",
"0.579406",
"0.5779315",
"0.57770455",
"0.57770455",
"0.57743305",
"0.5772102",
"0.57502043",
"0.5718001",
"0.57034796",
"0.56947595",
"0.5693255... | 0.7953103 | 0 |
Packages needed to manage the server remotely and install applications. | def install_management
# Needed to play with the configuration database.
package 'debconf'
package 'debconf-utils'
# Keys for Debian packages.
package 'debian-archive-keyring'
# Fetch files via HTTP.
package 'curl'
package 'wget'
package 'dpkg-dev' # Builds packages from source.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_packages\n return(interpreter.package_manager.install <<-HERE)\n # Core\n mysql-server\n mysql-client\n\n # Tools\n libcompress-zlib-perl\n mytop\n dbishell\n\n # Ruby drivers\n libmysql-ruby\n libdbd-mysql-ruby\n HERE\n end",
"def install_pack... | [
"0.6951988",
"0.68111384",
"0.66349185",
"0.654118",
"0.6489752",
"0.6479016",
"0.6442254",
"0.6332588",
"0.62906885",
"0.62463474",
"0.6232697",
"0.6225306",
"0.6220263",
"0.6220263",
"0.62169737",
"0.62168646",
"0.6214205",
"0.6179236",
"0.6166253",
"0.61521494",
"0.6141875... | 0.72432524 | 0 |
Packages for all the database servers we could need. | def install_databases
package 'sqlite3'
package 'libsqlite3-dev'
package 'mysql-client'
package 'mysql-server'
package 'libmysql-dev', 'libmysqlclient-dev', /^libmysqlclient\d*-dev$/
package 'postgresql-client'
package 'libpq-dev'
# TODO: NoSQL stores.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def databases\n get '_all_dbs'\n end",
"def getDefaultDatabases\n if !$remoteDatabasesLoaded\n info \"Loading remote databases...\"\n\n $remoteDatabases = []\n\n failures = false\n\n if !loadDatabase \"boostslair\",\n \"https://boostslair.com/rubysetupsystem/database.json... | [
"0.6284662",
"0.6213865",
"0.59914136",
"0.59774816",
"0.59756696",
"0.5966052",
"0.5951221",
"0.59317786",
"0.5915743",
"0.59096557",
"0.5894013",
"0.58845866",
"0.58566016",
"0.5824274",
"0.5820387",
"0.58146137",
"0.5798659",
"0.57856566",
"0.57759154",
"0.5773085",
"0.571... | 0.7171739 | 0 |
GET /iscrivitis or /iscrivitis.json | def index
@iscrivitis = Iscriviti.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.se... | [
"0.61515707",
"0.6122329",
"0.60009104",
"0.5902783",
"0.5871682",
"0.58489805",
"0.5822327",
"0.57769346",
"0.57099545",
"0.57078904",
"0.5697192",
"0.56830317",
"0.5671696",
"0.5655413",
"0.5649607",
"0.56369156",
"0.5636174",
"0.56354713",
"0.5631355",
"0.56257206",
"0.557... | 0.6637823 | 0 |
POST /iscrivitis or /iscrivitis.json | def create
@iscriviti = Iscriviti.new(iscriviti_params)
respond_to do |format|
if @iscriviti.save
format.html { redirect_to @iscriviti, notice: "Iscriviti was successfully created." }
format.json { render :show, status: :created, location: @iscriviti }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_iscriviti\n @iscriviti = Iscriviti.find(params[:id])\n end",
"def create\n @sitio = Sitio.new(params[:sitio])\n\n respond_to do |format|\n if @sitio.save\n format.html { redirect_to @sitio, notice: 'Sitio was successfully created.' }\n format.json { render json: @sitio, s... | [
"0.57280403",
"0.5706759",
"0.5686425",
"0.5535601",
"0.54374707",
"0.54359233",
"0.54340297",
"0.53830504",
"0.53777784",
"0.53757894",
"0.5375012",
"0.53551674",
"0.5333358",
"0.5301576",
"0.5300641",
"0.52725965",
"0.52421117",
"0.5219475",
"0.5218221",
"0.5211693",
"0.520... | 0.6242526 | 0 |
PATCH/PUT /iscrivitis/1 or /iscrivitis/1.json | def update
respond_to do |format|
if @iscriviti.update(iscriviti_params)
format.html { redirect_to @iscriviti, notice: "Iscriviti was successfully updated." }
format.json { render :show, status: :ok, location: @iscriviti }
else
format.html { render :edit, status: :unprocessable_e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to @sitio, notice: 'Sitio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.6431485",
"0.6386374",
"0.63147074",
"0.62288374",
"0.6184213",
"0.6166263",
"0.6165514",
"0.6150753",
"0.6149236",
"0.61397356",
"0.6139202",
"0.61200666",
"0.6116254",
"0.6075206",
"0.6072485",
"0.6060625",
"0.60406625",
"0.60406625",
"0.6029343",
"0.6028532",
"0.6026345... | 0.6833927 | 0 |
DELETE /iscrivitis/1 or /iscrivitis/1.json | def destroy
@iscriviti.destroy
respond_to do |format|
format.html { redirect_to iscrivitis_url, notice: "Iscriviti was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orchio_delete\n response = client.send_request :delete, inst_args\n orchio_status response, 204\n end",
"def destroy\n @sitio = Sitio.find(params[:id])\n @sitio.destroy\n\n respond_to do |format|\n format.html { redirect_to sitios_url }\n format.json { head :no_content }\n ... | [
"0.68710345",
"0.6820844",
"0.6790766",
"0.67739004",
"0.6685559",
"0.6675904",
"0.66610116",
"0.6652753",
"0.66288584",
"0.66110116",
"0.6593122",
"0.6590212",
"0.6590212",
"0.6590212",
"0.6590212",
"0.6574984",
"0.6570485",
"0.65531176",
"0.6551056",
"0.6550214",
"0.6519221... | 0.6906022 | 0 |
Called directly on a keyed object, immediately dials and calls the keys specified as arguments. Returns the value found, or nil. A default cannot be specified. | def call(*lookup)
return KeyDialler.new(self, *lookup).call
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](key)\n\t\t\treturn dial!(key)\n\t\tend",
"def fetch(key, *default)\n result =\n if key?(key)\n self[key]\n elsif block_given?\n yield(self)\n end\n unless result\n raise KeyError, \"key not found \\\"#{key}\\\"\" if default.empty?\n result = d... | [
"0.6563564",
"0.6069963",
"0.60127074",
"0.5862249",
"0.5816683",
"0.5807284",
"0.5804853",
"0.58005685",
"0.57713604",
"0.57636106",
"0.5716827",
"0.56627834",
"0.56602174",
"0.5644939",
"0.564138",
"0.5632986",
"0.5627002",
"0.56203556",
"0.56124604",
"0.5580998",
"0.554427... | 0.6198736 | 1 |
Encode the assertion into a request, including the signature. | def encode_and_sign_to_http_request(request, signing_secret)
authorization_info_b64 = Base64.strict_encode64(as_json)
request.headers[ASSERTION_HEADER_NAME] = authorization_info_b64
signature = OpenSSL::HMAC.digest("SHA256", signing_secret, authorization_info_b64)
request.headers[SIGNATU... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n signed = (signed_at || Time.now).to_i.to_s\n\texpires = expires_at.to_i.to_s\n\tsignature = \"#{public_key}#{expires}#{signed}#{action}\"\n\ttoken = OpenSSL::HMAC.hexdigest DIGEST, secret, signature\n\tencoded_token = Base64.encode64(token)\n\tencoded_token.gsub! /\\n/, ''\n\tparams = [ encoded_t... | [
"0.6378693",
"0.6176774",
"0.6154882",
"0.61512655",
"0.6141733",
"0.60254514",
"0.5974324",
"0.5967479",
"0.5966809",
"0.58887297",
"0.58778286",
"0.58418393",
"0.5764388",
"0.57166386",
"0.57083136",
"0.57083136",
"0.57022184",
"0.5700408",
"0.5681346",
"0.5674436",
"0.5643... | 0.74113965 | 0 |
tests the urlinfo method | def test_urlinfo
puts 'testing url info'
urlinfo = Topsy::Base.urlinfo("http://www.aycron.com")
assert urlinfo.class == Topsy::UrlInfo, "Class of urlinfo method doesn't return UrlInfo"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_match_info\n return @url_match_info\n end",
"def url_info(url)\n response = handle_response(self.class.get(\"/urlinfo.json\", :query => {:url => url}))\n Topsy::UrlInfo.new(response)\n end",
"def get_url_info\n # test this url, it it is valid SReality url\n ... | [
"0.66013134",
"0.65040106",
"0.6437108",
"0.6315921",
"0.6281823",
"0.61463976",
"0.6061934",
"0.60583526",
"0.5996423",
"0.5996423",
"0.59619117",
"0.5923301",
"0.5910185",
"0.5900284",
"0.5900284",
"0.58526355",
"0.58487105",
"0.5830209",
"0.5827681",
"0.5817748",
"0.581765... | 0.7669538 | 0 |
This is a tad meh. We basically need to meta program our test methods as we'll want individual meths for each check so we get this easy to read in jenkins, but since we only know which lister to use once the program runs we'll have to extend ourselves lazily via class_eval which allows us to edit the class from within ... | def define_tests
@ours.each do |pkg|
their = @theirs.find { |x| x.name == pkg.name }
class_eval do
define_method("test_#{pkg.name}_#{pkg.version}") do
PackageVersionCheck.new(ours: pkg, theirs: their).run
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_tests\n Apt.update if Process.uid.zero? # update if root\n @lister.packages.each do |pkg|\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(pkg).run\n end\n end\n end\n end",
... | [
"0.79935706",
"0.6560548",
"0.6069621",
"0.59919196",
"0.5881773",
"0.5833435",
"0.57638437",
"0.5743722",
"0.57084703",
"0.5570949",
"0.5548126",
"0.5516116",
"0.5516116",
"0.5495896",
"0.54355466",
"0.54307795",
"0.54260075",
"0.54138124",
"0.5409251",
"0.53974664",
"0.5383... | 0.7360373 | 1 |
Builds a Heading of +level+ | def build_heading level
heading = RDoc::Markup::Heading.new level, text
skip :NEWLINE
heading
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_heading level\n type, text, = get\n\n text = case type\n when :TEXT then\n skip :NEWLINE\n text\n else\n unget\n ''\n end\n\n RDoc::Markup::Heading.new level, text\n end",
"def build_heading level\n heading = sup... | [
"0.8417932",
"0.7992036",
"0.766331",
"0.72736394",
"0.7115193",
"0.7091424",
"0.70675504",
"0.68406266",
"0.6820763",
"0.67263156",
"0.6411727",
"0.64061326",
"0.6369527",
"0.6271758",
"0.6270927",
"0.6246594",
"0.62451506",
"0.61768943",
"0.61630785",
"0.61508495",
"0.61322... | 0.8584473 | 0 |
Builds a List flush to +margin+ | def build_list margin
p :list_start => margin if @debug
list = RDoc::Markup::List.new
until @tokens.empty? do
type, data, column, = get
case type
when :BULLET, :LABEL, :LALPHA, :NOTE, :NUMBER, :UALPHA then
list_type = type
if column < margin then
unget
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_list margin\n p :list_start => margin if @debug\n\n list = RDoc::Markup::List.new\n label = nil\n\n until @tokens.empty? do\n type, data, column, = get\n\n case type\n when *LIST_TOKENS then\n if column < margin || (list.type && list.type != type) then\n unget\n... | [
"0.7264258",
"0.6973062",
"0.6146951",
"0.6004018",
"0.5907188",
"0.5867355",
"0.5827932",
"0.5822188",
"0.5780602",
"0.5739241",
"0.56009376",
"0.5592616",
"0.5541733",
"0.5504484",
"0.54857427",
"0.54697794",
"0.5468899",
"0.54651374",
"0.5457361",
"0.5425007",
"0.5424739",... | 0.74732697 | 0 |
Builds a ListItem that is flush to +indent+ with type +item_type+ | def build_list_item indent, item_type = nil
p :list_item_start => [indent, item_type] if @debug
list_item = RDoc::Markup::ListItem.new item_type
until @tokens.empty? do
type, data, column = get
if column < indent and
not type == :NEWLINE and
(type != :INDENT or data < indent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_list_item_start list_item\n type = @list_type.last\n\n case type\n when :NOTE, :LABEL then\n bullets = Array(list_item.label).map do |label|\n attributes(label).strip\n end.join \"\\n\"\n\n bullets << \"\\n:\"\n\n @prefix = ' ' * @indent\n @indent += 4\n @pr... | [
"0.6534294",
"0.64756286",
"0.63982606",
"0.6332178",
"0.6300186",
"0.6280757",
"0.62803835",
"0.6182565",
"0.61383456",
"0.6061238",
"0.6061238",
"0.60265017",
"0.6007495",
"0.59631926",
"0.58516514",
"0.5837462",
"0.57548285",
"0.57481664",
"0.57481664",
"0.56823754",
"0.56... | 0.81515324 | 0 |
Builds a Paragraph that is flush to +margin+ | def build_paragraph margin
p :paragraph_start => margin if @debug
paragraph = RDoc::Markup::Paragraph.new
until @tokens.empty? do
type, data, column, = get
case type
when :INDENT then
next if data == margin and peek_token[0] == :TEXT
unget
break
when :TEXT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_paragraph margin\n p :paragraph_start => margin if @debug\n\n paragraph = RDoc::Markup::Paragraph.new\n\n until @tokens.empty? do\n type, data, column, = get\n\n if type == :TEXT and column == margin then\n paragraph << data\n\n break if peek_token.first == :BREAK\n\n ... | [
"0.828294",
"0.7077012",
"0.6331948",
"0.6310281",
"0.63017106",
"0.62282985",
"0.6197009",
"0.6139939",
"0.61095005",
"0.60806936",
"0.6039721",
"0.60332686",
"0.5999385",
"0.59649974",
"0.5960489",
"0.59318346",
"0.5919193",
"0.5900154",
"0.5900154",
"0.5900154",
"0.5884583... | 0.8040784 | 1 |
Builds a Verbatim that is flush to +margin+ | def build_verbatim margin
p :verbatim_begin => margin if @debug
verbatim = RDoc::Markup::Verbatim.new
until @tokens.empty? do
type, data, column, = get
case type
when :INDENT then
if margin >= data then
unget
break
end
indent = data - margin
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_verbatim margin\n p :verbatim_begin => margin if @debug\n verbatim = RDoc::Markup::Verbatim.new\n\n min_indent = nil\n generate_leading_spaces = true\n line = ''.dup\n\n until @tokens.empty? do\n type, data, column, = get\n\n if type == :NEWLINE then\n line << data\n ... | [
"0.78023046",
"0.71912265",
"0.61379147",
"0.61276263",
"0.58679205",
"0.57041734",
"0.5671685",
"0.5600203",
"0.5551709",
"0.5530641",
"0.55081743",
"0.5490407",
"0.5484892",
"0.5384266",
"0.5378512",
"0.53358114",
"0.5310175",
"0.52667063",
"0.5237795",
"0.52332526",
"0.522... | 0.7935075 | 0 |
Skips a token of +token_type+, optionally raising an error. | def skip token_type, error = true
type, data, = get
return unless type # end of stream
return @current_token if token_type == type
unget
raise ParseError, "expected #{token_type} got #{@current_token.inspect}" if
error
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip token_type, error = true\n type, = get\n return unless type # end of stream\n return @current_token if token_type == type\n unget\n raise ParseError, \"expected #{token_type} got #{@current_token.inspect}\" if error\n end",
"def skip_token(nocov_token = T.unsafe(nil)); end",
"def consu... | [
"0.8023859",
"0.57336855",
"0.5639974",
"0.55563164",
"0.546961",
"0.5462235",
"0.53580624",
"0.51876",
"0.5172979",
"0.5165891",
"0.51409113",
"0.5130443",
"0.5073701",
"0.5073701",
"0.5043363",
"0.50416476",
"0.50350356",
"0.49987578",
"0.49729186",
"0.49450994",
"0.4929742... | 0.7890535 | 1 |
Calculates the column and line of the current token based on +offset+. | def token_pos offset
[offset - @line_pos, @line]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_pos(byte_offset) # :nodoc:\n [byte_offset - @line_pos, @line]\n end",
"def offset_on_line(offset)\n end",
"def pos_on_line(offset)\n end",
"def line_for_offset(offset)\n end",
"def get_line_and_column_from_chunk(offset)\n if offset.zero?\n return [@chunk_line, @chunk_column]\n e... | [
"0.7708019",
"0.75606894",
"0.750005",
"0.7395713",
"0.7213591",
"0.71804374",
"0.71804374",
"0.7128925",
"0.6958157",
"0.6950198",
"0.688341",
"0.68291587",
"0.68017244",
"0.67835814",
"0.6753973",
"0.6700305",
"0.6678214",
"0.65833074",
"0.6564007",
"0.6564007",
"0.65455973... | 0.82562107 | 0 |
:callseq: ratio obj > new_obj Performs a symbolic power between a symbolic rational and `obj`, returning a new symbolic object if the operation creates a new tree branch, or a symbolic number if `obj` is a SymDesc::Number. Simplification is automatic. If b is not a symbolic object, a conversion is attempted | def **(b)
b = b.symdescfy
case b
when Infinity
b
when Int
return Ratio.new(@numerator ** b.value, @denominator ** b.value)
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def /(object)\n #multiplica numerador con numerador y denominador con denominador\n Fraccion.new(@numerador*object.denominador,@denominador*object.numerador)\n end",
"def test_Rational_InstanceMethods_to_r\n\t\tassert_equal(Rational(\"2\"), Rational(\"4/2\").to_r)\n\tend",
"def coerce(other)\n... | [
"0.5513748",
"0.5395761",
"0.5352221",
"0.52719855",
"0.5176099",
"0.5094608",
"0.5078279",
"0.505973",
"0.50355375",
"0.49988765",
"0.49968788",
"0.4973092",
"0.49586266",
"0.4952022",
"0.49476475",
"0.493178",
"0.49262136",
"0.49208266",
"0.49112248",
"0.49032268",
"0.48592... | 0.55113226 | 1 |
:callseq: ratio == obj > true or false Returns true only if the `obj` is a SymDesc::Ratio or a Float or a Rational and it represents the same numeric value | def ==(b)
case b
when Rational, Ratio
(@numerator == b.numerator) &&
(@denominator == b.denominator)
when Float
self == b.symdescfy
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eql? r\n if r.is_a? Ratio\n return (self[0] == r[0] && self[1] == r[1])\n elsif r.is_a? Fixnum\n return (self.to_f == r)\n else\n raise TypeError.new(\"Tried to compare a #{r.class} to an HD::Ratio\")\n end\n end",
"def ==(rational)\n end",
"def =~(obj)\n r... | [
"0.6922043",
"0.63706243",
"0.6257363",
"0.6167372",
"0.6077013",
"0.5956101",
"0.58988214",
"0.5849982",
"0.582913",
"0.5806711",
"0.58051425",
"0.5799605",
"0.5765875",
"0.57607144",
"0.56601644",
"0.565542",
"0.565542",
"0.56261075",
"0.5595477",
"0.55935556",
"0.5589719",... | 0.6561627 | 1 |
:callseq: to_s > string to_s(str_io) > str_io If no argument is provided, it returns a string representation of the fraction. If a StringIO object is passed, the string representation is appended to the buffer and the buffer is returned. | def to_s(io = nil)
if io
__io_append(io, @numerator, DIV_ID, @denominator)
else
return "#{@numerator}/#{@denominator}"
end
io
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rational_to_s\n assert_respond_to(@rat1, :to_s)\n assert_nothing_raised{ @rat1.to_s }\n assert_kind_of(String, @rat1.to_s)\n assert_equal(\"3/4\", @rat1.to_s)\n assert_equal(\"3/4\", @rat7.to_s)\n end",
"def to_s\n return \"#{fraction.to_s}\"\n end",
"def mixed_fract... | [
"0.62411296",
"0.6067417",
"0.6048017",
"0.56619906",
"0.5567879",
"0.5535255",
"0.55082595",
"0.5502486",
"0.54220146",
"0.533182",
"0.533182",
"0.522742",
"0.5187833",
"0.5176933",
"0.5155773",
"0.5132985",
"0.51256114",
"0.50557464",
"0.5048989",
"0.50249916",
"0.50249916"... | 0.71509975 | 0 |
Get the normalized value for the key. If localization is in play the current locale will be appended to the key in MongoDB dot notation. FIXME (Did). This version DOES NOT USE ::I18n.locale directly. See the localized.rb file for more explanation. | def normalized_key(name, serializer)
# serializer && serializer.localized? ? "#{name}.#{::I18n.locale}" : name
serializer&.localized? ? "#{name}.#{::Mongoid::Fields::I18n.locale}" : name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalized_key(name, serializer)\n serializer && serializer.localized? ? \"#{name}.#{::I18n.locale}\" : name\n end",
"def lookup(locale, key, scope = [], separator = nil)\n return unless key\n keys = I18n.send(:normalize_translation_keys, locale, key, scope)\n @moneta[keys.join('.')]\n end"... | [
"0.72772455",
"0.65642506",
"0.62767637",
"0.6186129",
"0.60458326",
"0.6041448",
"0.6041448",
"0.6026203",
"0.6001171",
"0.5980327",
"0.5969849",
"0.59576917",
"0.59545887",
"0.58488494",
"0.5821653",
"0.58135754",
"0.5752824",
"0.57344896",
"0.5678363",
"0.5650589",
"0.5646... | 0.7464962 | 0 |
compile all TeX files in dir | def compile(dir)
savedir = Dir.pwd
Dir.chdir(dir)
# 中間ファイル削除
clean
# 個別ファイルコンパイル
Dir::glob("*.pdf").each do |file|
next if "nzmath_doc" == file[0...-4]
tex_compile(file[0...-4])
end
header_footer = ["header_overview.tex", "header_basic_util.tex", "header_class.tex",
"header_function.tex",... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tex_compile(file)\r\n\tprint File.basename(Dir.pwd) + '/' + file\r\n\t`platex -kanji=\"sjis\" #{file}.tex`\r\n\tprint \".\"\r\n\t`#{$bibtex} #{file}`\r\n\tprint \".\"\r\n\r\n\t# some system needs three times compiles.\r\n\t3.times do\r\n\t\t`platex -kanji=\"sjis\" #{file}.tex`\r\n\t\tprint \".\"\r\n\tend\r\n\r... | [
"0.6738461",
"0.6415091",
"0.6218515",
"0.6178845",
"0.6080331",
"0.5979561",
"0.5928755",
"0.5855256",
"0.5852079",
"0.5778334",
"0.57682055",
"0.5739974",
"0.56925184",
"0.56823117",
"0.5682132",
"0.5673344",
"0.5659808",
"0.5652723",
"0.56107134",
"0.557006",
"0.5547858",
... | 0.7556378 | 0 |
This method create all the join table given by the filter and the saving associated with each | def create_join_table_gas(filter, all_savings)
filter.each_with_index do |contract, index|
JoinTableGasSimulationContract.create(gas_simulation: self, gas_contract: contract, savings: all_savings[index])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table_joins(klass)\n if join_tables = klass.ann(:self, :join_tables)\n for info in join_tables\n begin\n # UGGLY hack!\n key_type = klass.ann(:oid, :sql).split(\" \").first\n create_join_table_sql(info, key_type).each do |sql|\n exec(sql, false)\n ... | [
"0.6556048",
"0.6534441",
"0.6457511",
"0.6235183",
"0.6114938",
"0.6044283",
"0.5942229",
"0.5807729",
"0.58055997",
"0.5781895",
"0.57558334",
"0.5721014",
"0.571776",
"0.5715381",
"0.5669762",
"0.566083",
"0.5571541",
"0.55399054",
"0.55355793",
"0.55269796",
"0.5503767",
... | 0.65796465 | 0 |
Determines whether or not any transition states exist given a beginning state and input symbol pair. | def has_transition?(state, symbol)
return false unless @transitions.include? state
@transitions[state].has_key? symbol
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accepts_zero_characters(start_state, end_state)\n marked_states = Set.new\n state_stack = [start_state]\n while !state_stack.empty?\n state = state_stack.pop\n next if marked_states.include? state.id\n marked_states.add(state.id)\n return true if state.id == end_state.id\n sta... | [
"0.6617021",
"0.65058094",
"0.6217322",
"0.62026346",
"0.60841686",
"0.60547996",
"0.59882087",
"0.5873334",
"0.58653444",
"0.58478713",
"0.5809739",
"0.57889265",
"0.5787568",
"0.5771664",
"0.5749269",
"0.5711251",
"0.56665385",
"0.56665385",
"0.5664258",
"0.5635463",
"0.562... | 0.7356532 | 0 |
Determines if a given state is an accept state. | def accept_state?(state)
@accept.include? state
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_accept_state?(state)\n @accept.include? state.to_s\n end",
"def accepted?\n state == 'accepted'\n end",
"def can_accept?\n !accepted? && !rejected? && !withdrawn?\n end",
"def accepting?\n\treturn self.type == \"Accepting\"\n end",
"def accepted?\n return (self.status == ... | [
"0.88380766",
"0.79399586",
"0.68606234",
"0.67599756",
"0.65416485",
"0.64303",
"0.63275045",
"0.6324492",
"0.63241726",
"0.6242839",
"0.6232949",
"0.621452",
"0.621452",
"0.6202336",
"0.61447644",
"0.60632914",
"0.60215425",
"0.5997094",
"0.5952792",
"0.59490377",
"0.593947... | 0.87743056 | 1 |
Pass on certain authorize_params to the Slack authorization GET request. See | def authorize_params
super.tap do |params|
%w(scope team redirect_uri).each do |v|
if !request.params[v].to_s.empty?
params[v.to_sym] = request.params[v]
end
end
log(:debug, "Authorize_params #{params.to_h}")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_request\n if basic_auth.values.all?\n [:basic_auth, @username, @password]\n else\n [:desk_oauth, oauth]\n end\n end",
"def authorize\n params[:access_token] ||= params[:oauth_token]\n super\n end",
"def authorize_params\n super.tap do |params|\n ... | [
"0.7459845",
"0.71612453",
"0.71542764",
"0.715173",
"0.70455563",
"0.6966972",
"0.680541",
"0.67030513",
"0.67030513",
"0.6687164",
"0.6647343",
"0.656474",
"0.64518327",
"0.6423493",
"0.64209443",
"0.6316849",
"0.6271404",
"0.6212525",
"0.62081057",
"0.61979944",
"0.6179658... | 0.7246134 | 1 |
Preload additional api calls with a pool of threads. | def preload_data_with_threads(num_threads)
return unless num_threads > 0
preload_methods = active_methods.concat(options[:additional_data].keys)
log :info, "Preloading (#{preload_methods.size}) data requests using (#{num_threads}) threads."
work_q = Queue.new
preload_methods.each... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_apis_asynchronously \n threads = []\n threads << Thread.new { @resp1 = RestClient.get 'https://reqres.in/api/unknown' }\n threads << Thread.new { @resp2 = RestClient.get 'https://reqres.in/api/products' }\n threads.each { |thr| thr.join } \n end",
"de... | [
"0.6453118",
"0.6229834",
"0.6211408",
"0.5797853",
"0.5561706",
"0.5507962",
"0.55022454",
"0.54906505",
"0.5468577",
"0.54551",
"0.54029375",
"0.53926635",
"0.53891283",
"0.53809327",
"0.5373321",
"0.53664947",
"0.5329434",
"0.5303737",
"0.53003293",
"0.5297891",
"0.5297891... | 0.72898734 | 0 |
Define methods for addional data from :additional_data option | def define_additional_data
hash = options[:additional_data]
if !hash.to_h.empty?
hash.each do |k,v|
define_singleton_method(k) do
instance_variable_get(:"@#{k}") ||
instance_variable_set(:"@#{k}", v.respond_to?(:call) ? v.call(env) : v)
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_extended_data(type, data); end",
"def additional_data=(value)\n @additional_data = value\n end",
"def additional_data=(value)\n @additional_data = valu... | [
"0.7356935",
"0.72789276",
"0.72592163",
"0.7225805",
"0.7225805",
"0.7225805",
"0.7225805",
"0.7225805",
"0.7225805",
"0.7225805",
"0.7225805",
"0.7172823",
"0.7172823",
"0.71564835",
"0.71564835",
"0.7143333",
"0.7143333",
"0.7143333",
"0.7129505",
"0.7129505",
"0.7129505",... | 0.7723744 | 0 |
Is this a workspace app token? | def is_app_token?
auth['token_type'].to_s == 'app'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_app_token?\n case\n when params['token_type'] == 'app' || token.to_s[/^xoxa/]\n true\n when token.to_s[/^xoxp/]\n false\n else\n nil\n end\n end",
"def token_is_for_master?\n token_account['name'] == 'mas... | [
"0.771789",
"0.7274672",
"0.72172874",
"0.71566266",
"0.7029004",
"0.6997016",
"0.6992928",
"0.6986241",
"0.69260824",
"0.6862502",
"0.6833186",
"0.68061197",
"0.68061197",
"0.6802385",
"0.6777616",
"0.67638683",
"0.6733154",
"0.6713921",
"0.67084825",
"0.66970694",
"0.668565... | 0.80090237 | 0 |
Scopes come from at least 3 different places now. The classic :scope field (string) New workshop token :scopes field (hash) Separate call to apps.permissions.users.list (array) This returns hash of workspace scopes, with classic & new identity scopes in :identity. Lists of scopes are in array form. | def all_scopes
@all_scopes ||=
{'identity' => (auth['scope'] || apps_permissions_users_list[user_id].to_h['scopes'].to_a.join(',')).to_s.split(',')}
.merge(auth['scopes'].to_h)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_scopes(_user_id=nil)\n debug{\"_user_id: #{_user_id}, @all_scopes: #{@all_scopes}\"}\n if _user_id && !@all_scopes.to_h.has_key?('identity') || @all_scopes.nil?\n @all_scopes = (\n scopes = case\n when params['scope']\n {'classic' =>... | [
"0.6774902",
"0.67735314",
"0.67023057",
"0.66939336",
"0.66305935",
"0.64769953",
"0.64670205",
"0.6418563",
"0.6394966",
"0.6382104",
"0.6324182",
"0.63023543",
"0.6266658",
"0.6254284",
"0.6243248",
"0.6169198",
"0.6147463",
"0.60793805",
"0.6078875",
"0.6004791",
"0.59846... | 0.74947 | 0 |
Determine if given scopes exist in current authorization. Scopes is hash where key == scope type val == array or string of individual scopes. | def has_scope?(**scopes_hash)
scopes_hash.detect do |section, scopes|
test_scopes = case
when scopes.is_a?(String); scopes.split(',')
when scopes.is_a?(Array); scopes
else raise "Scope must be a string or array"
end
test_scopes.detect do |scope|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_any_scope?(*scopes)\n return true if scopes.empty?\n Array(scopes.flatten).any?{ |scope| self.scopes.include?(scope) }\n end",
"def has_scope?(*scopes)\n return true if scopes.empty?\n Array(scopes.flatten).none?{ |scope| !self.scopes.include?(scope) }\n end",
"def acceptable?(scopes)\n ... | [
"0.7910931",
"0.7870426",
"0.76238036",
"0.75419444",
"0.7368402",
"0.7138306",
"0.7138306",
"0.7121337",
"0.70674014",
"0.6865917",
"0.6765733",
"0.6726917",
"0.6719299",
"0.662583",
"0.6595154",
"0.6591353",
"0.6482237",
"0.6383847",
"0.62659955",
"0.62583",
"0.61807144",
... | 0.8136706 | 0 |
GET /reqcargos GET /reqcargos.json | def index
@reqcargos = Reqcargo.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def list_tenants_for_circle(args = {}) \n get(\"/tenantcircles.json/tenants\", args)\nend",
"def request(args = {})\n response = @client.get(args[:url],\n argument_hash(args[:args] || {},\n ... | [
"0.6043053",
"0.596949",
"0.58654505",
"0.5772901",
"0.5599491",
"0.5525767",
"0.54969394",
"0.5478865",
"0.54684436",
"0.5465827",
"0.5415466",
"0.5407471",
"0.54027385",
"0.5386744",
"0.5374827",
"0.5365918",
"0.53389347",
"0.53317386",
"0.53213364",
"0.53172064",
"0.531038... | 0.65913725 | 0 |
POST /reqcargos POST /reqcargos.json | def create
@reqcargo = Reqcargo.new(reqcargo_params)
respond_to do |format|
if @reqcargo.save
format.html { redirect_to @reqcargo, notice: 'Reqcargo was successfully created.' }
format.json { render :show, status: :created, location: @reqcargo }
else
format.html { render :ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reqcargo_params\n params.require(:reqcargo).permit(:cargo_id, :nomrequis, :lactivo)\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def do_coaps_posted_03\n # get the Base64 of the incoming signed request\n body = IO.read(\"spec/files/vr_00-D0-E5-... | [
"0.5948494",
"0.58488387",
"0.5842652",
"0.5673049",
"0.5657613",
"0.5448429",
"0.544024",
"0.5406381",
"0.53049535",
"0.5302718",
"0.52997845",
"0.52974343",
"0.5248637",
"0.52108425",
"0.5198508",
"0.5189851",
"0.51875246",
"0.51829207",
"0.51804996",
"0.51787615",
"0.51628... | 0.63217616 | 0 |
DELETE /reqcargos/1 DELETE /reqcargos/1.json | def destroy
@reqcargo.destroy
respond_to do |format|
format.html { redirect_to reqcargos_url, notice: 'Reqcargo was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def delete\n request(:delete)\n end",
"def delete path\n ... | [
"0.72877944",
"0.70265955",
"0.6978186",
"0.695261",
"0.692509",
"0.6921337",
"0.6902557",
"0.68772715",
"0.68576765",
"0.6856065",
"0.68432945",
"0.68214524",
"0.67697966",
"0.676899",
"0.67601794",
"0.67601794",
"0.6754053",
"0.6733256",
"0.6717482",
"0.6716133",
"0.6712523... | 0.71188056 | 1 |
Initializes a new AttributeGroupData instance with the specified name and an empty set of rows. +name+:: The name of the attribute group whose data is being represented. | def initialize(name)
@name = name
@rows = Array.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(name)\n @name = name\n @groups = Levels::KeyValues.new\n end",
"def initialize(name)\n @name = name.to_s\n @attributes = {}\n @criteria = []\n end",
"def initialize(name)\n raise BadDataException, \"No name present\" if name.empty?\n @name = name\n e... | [
"0.6130959",
"0.59542716",
"0.5819765",
"0.58026236",
"0.56381595",
"0.5405932",
"0.5394563",
"0.5389596",
"0.53759176",
"0.53447115",
"0.52595925",
"0.5246296",
"0.52027625",
"0.50712967",
"0.5062148",
"0.50427884",
"0.5036842",
"0.5033747",
"0.5016151",
"0.50087273",
"0.495... | 0.6525518 | 0 |
Returns a tabular string representation of the attribute group's data. If +column_names+ is non+nil+, only returns data for the columns specified; otherwise returns data for all columns. +column_names+:: An array of columsn to display data for. +format+:: The format to output data in. Must be either :text or :html. If ... | def to_table(column_names=nil, format="text")
require 'tabular'
stringio = StringIO.new;
$stderr.puts "Request for #{@name} data returned #{@rows.length} #{@rows.length != 1 ? "rows" : "row"}."
if rows.length > 0
# If no column names were specified, use all the columns in the first row (in alpha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize_attributes(format, *columns)\n if format.is_a?(Symbol)\n unless format = REGISTERED_FORMATS[format]\n raise(Error, \"Unsupported serialization format: #{format} (valid formats: #{REGISTERED_FORMATS.keys.map(&:inspect).join})\")\n end\n end\n ... | [
"0.53699476",
"0.5357202",
"0.5232327",
"0.51930964",
"0.5192452",
"0.51601917",
"0.51322305",
"0.5056988",
"0.5056476",
"0.50357574",
"0.4994563",
"0.49546322",
"0.49168053",
"0.49091384",
"0.49007094",
"0.4882268",
"0.4877234",
"0.4877234",
"0.4839324",
"0.47806492",
"0.477... | 0.6304722 | 0 |
Gets the specified attribute group's data from the agent/service_point specified and returns a new AttributeGroupData object which contains that data. +agent_address+:: The address of the machine on which the agent resides. +service_point+:: The service point of the agent from which to collect the data. +username+:: Th... | def get_attribute_group_data(agent_address, service_point, username, password, attribute_group, subnodes, port=1920)
require 'net/http'
uri = URI("http://#{agent_address}:#{port}///#{service_point}/#{service_point}")
body = "<REPORT><SQLTABLE NULLATTROUTPUT=\"Y\"><TABLENAME>#{attribute_group}</TABLENAME><SUBNODE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_args(args)\n require 'ostruct'\n require 'optparse'\n\n parser = OptionParser.new\n options = OpenStruct.new\n\n options.output = STDOUT\n options.format = :text\n options.columns = nil\n options.subnodes = [ ]\n\n parser.banner = \"Usage: #{$0} [options] agent_address service_point username pas... | [
"0.48148233",
"0.4416741",
"0.42515406",
"0.42063287",
"0.41547632",
"0.4098359",
"0.40892184",
"0.4080662",
"0.40591976",
"0.40394482",
"0.39851138",
"0.39571363",
"0.39442456",
"0.3898882",
"0.3848071",
"0.3843621",
"0.3828492",
"0.38222227",
"0.38091433",
"0.3783533",
"0.3... | 0.7813658 | 0 |
Parses the specified arguments (presumably ARGV), returning the agent address, service point, username, password, and attribute group that were specified on the command line, in addition a list of columns and subnodes in an OpenStruct object. +args+:: The arguments to parse. These presumably came from the commandline. | def parse_args(args)
require 'ostruct'
require 'optparse'
parser = OptionParser.new
options = OpenStruct.new
options.output = STDOUT
options.format = :text
options.columns = nil
options.subnodes = [ ]
parser.banner = "Usage: #{$0} [options] agent_address service_point username password attribute_gr... | {
"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.6412463",
"0.6116028",
"0.60383564",
"0.5975493",
"0.59547824",
"0.58309287",
"0.571015",
"0.56809366",
"0.56716585",
"0.5657897",
"0.5644503",
"0.56317717",
"0.5618292",
"0.5602395",
"0.5582551",
"0.55758756",
"0.5542489",
"0.55292755",
"0.552834",
"0.55140316",
"0.551362... | 0.86728346 | 0 |
POST /produtividades POST /produtividades.xml | def create
@produtividade = Produtividade.new(params[:produtividade])
respond_to do |format|
if @produtividade.save
format.html { redirect_to(@produtividade, :notice => 'Produtividade was successfully created.') }
format.xml { render :xml => @produtividade, :status => :created, :location... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @produto = Produto.new(params[:produto])\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to(@produto, :notice => 'Produto was successfully created.') }\n format.xml { render :xml => @produto, :status => :created, :location => @produto }\n else\n ... | [
"0.63159233",
"0.63159233",
"0.6264138",
"0.6236292",
"0.614043",
"0.61105925",
"0.60872656",
"0.6045021",
"0.6014807",
"0.59685445",
"0.5956502",
"0.5954889",
"0.59487337",
"0.59463733",
"0.5938046",
"0.59338456",
"0.5927313",
"0.5926482",
"0.5918086",
"0.5918086",
"0.591808... | 0.65412855 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.