query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102 values |
|---|---|---|---|---|---|---|
We initialize the class passing in the 3 attributes. | def initialize(name, phone_number, email)
@name = name
@phone_number = phone_number
@email = email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(args)\n @attributes = args\n end",
"def initialize(*args)\n @args = args\n assign_attributes\n end",
"def initialize(*attrs)\n set_attributes(attrs.extract_options!)\n end",
"def initialize(*attrs)\n # Sets all attributes as instance variables from the... | [
"0.7795555",
"0.77747923",
"0.76916087",
"0.76550806",
"0.7607321",
"0.75914043",
"0.75573444",
"0.7554523",
"0.7554523",
"0.7467844",
"0.74667555",
"0.74656606",
"0.7460676",
"0.744712",
"0.7444691",
"0.74433666",
"0.74408185",
"0.74408185",
"0.74408185",
"0.74408185",
"0.74... | 0.0 | -1 |
the following are the Activity Goals Calculations any changes here should also be made in activity_goals_calculator.js.coffee | def referrals_needed_per_month
5 * monthly_transaction_goal
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def points_algorithm\n\tif current_user[:input] = \"Calories\"\n\tcurrent_user[:points] = (@daily_activity['goals']['steps'] * 0.1)\n\telsif current_user[:input] = \"Distance\"\n\tcurrent_user[:points] = (@daily_activity['goals']['distance'] * 10)\n\telsif current_user[:input] = \"Steps\"\n\tcurrent_user[:points] ... | [
"0.66066605",
"0.65971065",
"0.65451396",
"0.6507256",
"0.6199064",
"0.6180355",
"0.6143281",
"0.60982186",
"0.60982186",
"0.60568535",
"0.605497",
"0.60079026",
"0.5992744",
"0.59904087",
"0.598466",
"0.5948578",
"0.5947906",
"0.59306955",
"0.5801519",
"0.5757387",
"0.575460... | 0.5264551 | 86 |
Newlinedelimited list of actions | def encode(serialized_actions = [])
serialized_actions.join("\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_actions\n\n actions = []\n\n unless self.actions.nil? or self.actions.empty?\n actions = self.actions.split(\"\\n\").collect {|entry| entry.split('-') }\n end\n return actions\n end",
"def actions!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __... | [
"0.6600519",
"0.60031545",
"0.59979725",
"0.59924996",
"0.59924996",
"0.59924996",
"0.5932228",
"0.58856696",
"0.5872141",
"0.5813266",
"0.57589763",
"0.5752623",
"0.57341725",
"0.5712437",
"0.5682996",
"0.5682996",
"0.56825763",
"0.5673276",
"0.5631639",
"0.5614074",
"0.5613... | 0.60092807 | 1 |
Apply filters to optimally format content for display on Twitter. | def filter(str)
FILTERS.each do |f|
str = f.filter(str)
end
str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_twitter(options)\n $client_stream.filter(options) do |tweet|\n if tweet.is_a?(Twitter::Tweet)\n puts tweet.text\n spam(tweet)\n end\n end\n end",
"def sanitize(body)\n # If a tweet contains a long string of non breaking letters it breaks the layout of the widget.\n # U... | [
"0.64762914",
"0.64508176",
"0.6335795",
"0.5819919",
"0.57615936",
"0.5723406",
"0.5723406",
"0.56930393",
"0.56094176",
"0.56094176",
"0.56048524",
"0.5574385",
"0.556204",
"0.556204",
"0.5558341",
"0.5557162",
"0.55535",
"0.5541055",
"0.55307114",
"0.55307114",
"0.55307114... | 0.0 | -1 |
Maximum content length before a URL, this is 140 (maximum length of a Twitter message) minus 21 (space plus 20 characters for a t.co URL) or 22 with the https protocol | def max_content_length
@@max_content_length ||= Config.web =~ /^https/ ? 118 : 119
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def too_long? content\n content.length > MaxTweetLength\n end",
"def for_web_urls\n self.fixed_length\n end",
"def length\n [default&.length, max_content_length].compact.max\n end",
"def content_length; end",
"def content_length; end",
"def content_length; end",
"def max_length\n ... | [
"0.7034747",
"0.6990235",
"0.67459667",
"0.6643421",
"0.6643421",
"0.6643421",
"0.650526",
"0.6440131",
"0.63746667",
"0.63328135",
"0.62714547",
"0.6236814",
"0.6193767",
"0.6193416",
"0.60863227",
"0.60849625",
"0.6076017",
"0.60754406",
"0.60221374",
"0.6010283",
"0.594098... | 0.7638888 | 0 |
wraper for the brand method ActiveMerchant returns master or american_express Banwire requires mastercard and amex | def get_brand(brand)
case brand
when "master"
return "mastercard"
when "american_express"
return "amex"
else
return brand
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def brand\n cc_type\n end",
"def brand\n cc_type\n end",
"def is_brand? brand\n Handset.is_brand? request.user_agent, brand\n end",
"def brand_name\n maintenance_record_hub.try(:brand) || car.try(:brand_name)\n end",
"def brand_name\n product.brand_name\n end",
"def brand_name... | [
"0.6565322",
"0.65630853",
"0.647237",
"0.6302554",
"0.6068399",
"0.59349877",
"0.59022504",
"0.58542854",
"0.5850447",
"0.5816948",
"0.58104074",
"0.57395095",
"0.57395095",
"0.5686578",
"0.56758773",
"0.5652856",
"0.5618775",
"0.5617302",
"0.5580419",
"0.54561615",
"0.54204... | 0.7343426 | 0 |
GET /farms GET /farms.json | def index
@farms = Farm.all
respond_with(@users,@farms)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def farms\n user = User.find(params[:id])\n\n @farms = []\n # Find which farms this user is authorized to access\n if (user.is_hog_owner?)\n @farms = user.owner.farms\n elsif user.is_barn_manager?\n @farms << user.owner.barn.location.farm\n elsif user.is_site_manager?\n @farms << u... | [
"0.7742577",
"0.7169997",
"0.7169997",
"0.70576215",
"0.67901725",
"0.66245574",
"0.658241",
"0.635273",
"0.6294622",
"0.62944347",
"0.62555987",
"0.62397563",
"0.6227292",
"0.6200471",
"0.6131185",
"0.60921496",
"0.60811955",
"0.6057075",
"0.60558754",
"0.6051409",
"0.604940... | 0.7302946 | 1 |
GET /farms/1 GET /farms/1.json | def show
@farm = Farm.find(params[:id])
if request.path != (farm_path(@farm) )
redirect_to @farm, status: :moved_permanently
end
respond_with(@farm)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def farms\n user = User.find(params[:id])\n\n @farms = []\n # Find which farms this user is authorized to access\n if (user.is_hog_owner?)\n @farms = user.owner.farms\n elsif user.is_barn_manager?\n @farms << user.owner.barn.location.farm\n elsif user.is_site_manager?\n @farms << u... | [
"0.70541817",
"0.6974336",
"0.6974336",
"0.6901509",
"0.6893884",
"0.6825972",
"0.6701643",
"0.6669254",
"0.66371167",
"0.6447422",
"0.6429127",
"0.64071226",
"0.62730056",
"0.62407124",
"0.6234928",
"0.6228568",
"0.62281644",
"0.620606",
"0.61874175",
"0.61850303",
"0.618488... | 0.6181077 | 21 |
GET /farms/new GET /farms/new.json | def new
@farm = Farm.new(:user_id => @user.id)
respond_with(@user,@farm)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farm }\n end\n end",
"def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @farm }\n end\n end",
... | [
"0.7700876",
"0.7658627",
"0.75480705",
"0.7426537",
"0.7354313",
"0.73320216",
"0.73320216",
"0.73320216",
"0.72737706",
"0.7213169",
"0.71769404",
"0.71762913",
"0.7174545",
"0.71429086",
"0.7031144",
"0.70288855",
"0.6980324",
"0.6979269",
"0.69719297",
"0.69646156",
"0.69... | 0.0 | -1 |
POST /farms POST /farms.json | def create
@farm = Farm.new(params[:farm])
@farm.save
respond_with(@farm)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @farm = Farm.new(farm_params)\n\n if @farm.save\n render :show, status: :created, location: api_farm_url(@farm)\n else\n render json: @farm.errors, status: :unprocessable_entity\n end\n end",
"def create\n @farm = Farm.new(params[:farm])\n\n respond_to do |format|\n ... | [
"0.6864054",
"0.66907626",
"0.66907626",
"0.65416205",
"0.6459743",
"0.6384204",
"0.6291221",
"0.6266345",
"0.62352663",
"0.6190006",
"0.61686873",
"0.61450535",
"0.61290795",
"0.61204994",
"0.61204994",
"0.611606",
"0.60479647",
"0.5997131",
"0.5930209",
"0.5914418",
"0.5814... | 0.64554 | 5 |
PUT /farms/1 PUT /farms/1.json | def update
@farm = Farm.find(params[:id])
respond_to do |format|
if @farm.update_attributes(params[:farm])
format.html { redirect_to @farm, notice: 'Farm was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @farm.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @farm.update(farm_params)\n render :show, status: :ok, location: api_farm_url(@farm)\n else\n render json: @farm.errors, status: :unprocessable_entity\n end\n end",
"def update\n @farmer = Farmer.find(params[:id])\n\n respond_to do |format|\n if @farmer.update_attri... | [
"0.6582223",
"0.62707245",
"0.61878616",
"0.60990083",
"0.607067",
"0.60659105",
"0.60659105",
"0.60402524",
"0.60367805",
"0.5959026",
"0.58987385",
"0.58987385",
"0.58757645",
"0.58727986",
"0.5758789",
"0.57448274",
"0.57407284",
"0.57397836",
"0.57330656",
"0.5732136",
"0... | 0.6400539 | 3 |
DELETE /farms/1 DELETE /farms/1.json | def destroy
@farm = Farm.find(params[:id])
@farm.destroy
respond_to do |format|
format.html { redirect_to farms_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @farm = Farm.find(params[:id])\n @farm.destroy\n\n respond_to do |format|\n format.html { redirect_to farms_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @farm.destroy\n respond_to do |format|\n format.html { redirect_to farms_url, notice: 'データを消去しま... | [
"0.74285626",
"0.7226602",
"0.722136",
"0.7202098",
"0.70863503",
"0.70715886",
"0.69521165",
"0.6886304",
"0.685428",
"0.68450624",
"0.6755933",
"0.6755328",
"0.67205185",
"0.6698712",
"0.6698712",
"0.66958845",
"0.6686744",
"0.6686744",
"0.6678107",
"0.6664311",
"0.66556114... | 0.7434962 | 2 |
This is where the logic for our index page lives | def index
# Build the ledgers if the user is logged in. Otherwise, initialize a dummy one.
if current_user
@ledger = current_user.ledgers.first
@place = Place.new
else
@ledger = Ledger.new
@place = Place.new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end"... | [
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"0.7792886",
"... | 0.0 | -1 |
def cache(path, original_filename, output_filename, data=nil) | def cache(input_path, output_path, data=nil)
path = input_path
@new_hashes[input_path] = hash(@input_directory, input_path)
if data
@data[path] = data if data
@wildcard_dependencies[path] = data[:wildcard_dependencies] if data[:wildcard_dependencies]
@dependencies[path] = data[:dependencies] if data[:dependencies]
end
FileUtils.mkdir_p(File.dirname(cached_path_for(path)))
if File.exist? File.join(@output_directory, output_path)
FileUtils.cp(File.join(@output_directory, output_path), cached_path_for(path))
else
FileUtils.cp(File.join(@input_directory, input_path), cached_path_for(input_path))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache(data); end",
"def cache(gist, file, data)\n cache_file = get_cache_file_for gist, file\n File.open(cache_file, \"w\") do |io|\n io.write data\n end\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data... | [
"0.7448695",
"0.74201995",
"0.7315937",
"0.7315937",
"0.7315937",
"0.7315937",
"0.73099744",
"0.73099744",
"0.72626126",
"0.7227641",
"0.7171443",
"0.70319706",
"0.69553924",
"0.6954398",
"0.69367135",
"0.6930686",
"0.6914109",
"0.68401515",
"0.6818943",
"0.6818943",
"0.68189... | 0.7517386 | 0 |
Yes if the file is modified. | def dependencies_changed?(path)
if dependencies = @dependencies[path]
dependencies.each do |dependency|
return true if file_changed?(dependency)
end
end
if wildcard_dependencies = @wildcard_dependencies[path]
wildcard_dependencies.each do |query, results|
o = Hammer::HTMLParser.new(:path => path, :directory => @input_directory)
return true if o.find_files(*query) != results
end
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_modified?\n modified = false\n\n if @name\n begin\n mtime = File.mtime( @name )\n\n if mtime > @last_modification_check\n modified = true\n @last_modification_check = mtime\n end\n rescue Errno::ENOENT\n # Ignore if file doe... | [
"0.800393",
"0.79374504",
"0.7707993",
"0.76921386",
"0.76868856",
"0.7617682",
"0.7617682",
"0.7596972",
"0.7565416",
"0.75458217",
"0.75378674",
"0.75231284",
"0.738882",
"0.7353235",
"0.73527396",
"0.7344089",
"0.7333359",
"0.731654",
"0.7299752",
"0.7164382",
"0.7135235",... | 0.0 | -1 |
Defines a mock method. It raises an exception if a given method name does not exist. This helps you realize quickly that your test is outdated when an interface of target class is changed in future. | def fake(method_name)
if !@methods.include?(method_name.to_sym)
raise ArgumentError, "#{@class_name} does not have a method '#{method_name}'"
end
@args_array_by_method[method_name] = args_array = []
define_singleton_method(method_name) do |*args|
args_array << args
yield(*args)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method(symbol)\n return @mock_method if symbol == @expected_symbol\n\n # The requested method is not being tested, raise if it called.\n proc do\n raise \"The method #{symbol} was unexpectedly called during the \" \\\n \"test for #{@expected_symbol}.\"\n end\n end",
"def method(symbo... | [
"0.69107914",
"0.6910658",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
"0.6910243",
... | 0.0 | -1 |
def transaction(&block) super end | def commit
@handle.commit
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transaction(&block); end",
"def transaction(&block)\n yield\n end",
"def transaction(&block)\n yield\n end",
"def transaction; end",
"def transaction; end",
"def transaction; end",
"def transaction(&block)\n block.call\n end",
"def transaction(&block)\n yield\n ... | [
"0.9166085",
"0.88309205",
"0.88309205",
"0.8813152",
"0.8813152",
"0.8813152",
"0.87166363",
"0.85941994",
"0.846339",
"0.846339",
"0.8392532",
"0.8300115",
"0.82924736",
"0.81922555",
"0.817089",
"0.8134129",
"0.8117979",
"0.8117979",
"0.8067657",
"0.8067657",
"0.7981954",
... | 0.0 | -1 |
NOTE: Shopify appears to only consider the first (eh... ~3036) characters of the filename when determining whether or not they think it's a duplicate (and should get the name mangled with a GUID), so we need to put the unique parts of the name near the beginning. | def live_name
[
transformed_part('product'),
middle_name(standalone: false), # Will have word dividers on either side
idx,
maybe_upto,
'-',
parts['sku'] =~ /editorial/ && bang? ? 'square-' : nil,
[name_base, ext_name].join
].compact.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_file_name file_name\n count = 0\n name = file_name\n current_user = User.find(self.user_id)\n while Userfile.find_all_accessible_by_user(current_user).exists?(:name => name)\n count += 1\n extname = File.extname(name)\n name = \"#{File.basename(name,extname)}-#{count}#{extnam... | [
"0.7650481",
"0.73489976",
"0.7346674",
"0.726912",
"0.71614987",
"0.7121346",
"0.70793927",
"0.70430183",
"0.7011258",
"0.69781375",
"0.69501245",
"0.69290847",
"0.6909401",
"0.6887918",
"0.6881601",
"0.68653244",
"0.6827264",
"0.6823465",
"0.6819645",
"0.67983854",
"0.67815... | 0.0 | -1 |
Take off the size, e.g. for Traveler | def transformed_sku(sku)
sku.sub(/-(s|l)$/i, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size!\n @size = nil\n self.size\n end",
"def size\n super\n end",
"def size\n super\n end",
"def set_size!(size) \n @transforms << SIZES[size]\n self \n end",
"def interpret_size(size); end",
"def size=(size)\n end",
"def default_tire_size\n raise NotImp... | [
"0.6649727",
"0.6579533",
"0.6579533",
"0.6571167",
"0.6456822",
"0.6342154",
"0.6277296",
"0.62623686",
"0.6230446",
"0.6225058",
"0.6204238",
"0.61581993",
"0.61367416",
"0.61076915",
"0.6063664",
"0.6013116",
"0.6007533",
"0.60046715",
"0.5989419",
"0.5986845",
"0.59850115... | 0.0 | -1 |
def capturemail(ville_entree)capture l'adresse email de la commune d'Avernes url=" doc = Nokogiri::HTML(open(url)) adresse = doc.css(".txtprimary")[3].text.split(" ")[2] puts adresse end capturemail | def captureurlmail #capture url des villes du 95
url2 = "http://www.annuaire-des-mairies.com/val-d-oise.html"
doc2 = Nokogiri::HTML(open(url2))
adresse2 = doc2.css('.lientxt')
noms = []
villes = []
emails = []
adresse2.each do |link|
#noms.push(url2 + (link['href'][1..-1]))
p="http://www.annuaire-des-mairies.com"
#puts link['href'][1..-1]
p+=link['href'][1..-1]
noms << p
q=link['href'][1..-1]
r=q.split('/')
s=r[2]
t=s.split('.')
ville=t[0]
villes << ville
end
noms.each do |adresse|
doc3 = Nokogiri::HTML(open(adresse))
adresse3 = doc3.css(".txt-primary")[3].text.split(" ")[2]
if ['@'].include?(adresse3) == true
emails << adresse3.to_s
else
emails << nil
end
end
Hash[villes.zip(emails)].each do |ville,email|
puts ville+" => "+email
#my_hash=Hash[villes.zip(emails)]
#return my_hash(ville_entree)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_townhall_email\n\tcity_95 = Nokogiri::HTML(open(\"https://www.annuaire-des-mairies.com/95/avernes.html\"))\n\tp city_95.css(\"/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]\").text\n#trouve l’adresse mail de la ville avernes:\n#clic droit sur le mail puis inspecter\n#puis dans l’inspecteur, cli... | [
"0.8169125",
"0.7946845",
"0.7788663",
"0.77168167",
"0.77087414",
"0.7549809",
"0.74866503",
"0.7421064",
"0.7414073",
"0.74064136",
"0.72507405",
"0.7238277",
"0.721227",
"0.71670496",
"0.7142452",
"0.7127348",
"0.7117786",
"0.7041935",
"0.6966523",
"0.69531614",
"0.6852647... | 0.78749436 | 2 |
handle 2 tensor math operations | def vector_op(vector, vector2, switch = false, safe = true, &block)
if get_rank(vector) < get_rank(vector2) # upgrade rank of A
duplicated = Array.new(vector2.size) {
vector
}
return vector_op(duplicated, vector2, switch, &block)
end
return yield(vector, vector2) unless vector.is_a?(Array)
vector.each_with_index.collect { |input, index|
next vector_op(input, vector2, switch, &block) if input.is_a?(Array) && get_rank(vector) > get_rank(vector2)
if safe && vector2.is_a?(Array)
next nil if vector2.size != 1 && index >= vector2.size
end
z = if vector2.is_a?(Array)
if index < vector2.size
vector2[index]
else
raise "incompatible tensor shapes used during op" if vector2.size != 1
vector2[0]
end
else
vector2
end
if input.is_a?(Array)
vector_op(input, z, switch, &block)
else
switch ? yield(z, input) : yield(input, z)
end
}.compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tensor_product_of_two_matrices(mat1, mat2)\n\n\tresult_rows = []\n\tmat1.values.each { |mat1_row| \n\t\tmat2.values.each { |mat2_row| \n\t\t\t\n\t\t\tresult_row = []\n\t\t\tmat1_row.each { |mat1_elem|\n\n\t\t\t\tmat2_row.each { |mat2_elem|\n\t\t\t\t\tcase [mat1_elem, mat2_elem]\n\t\t\t\t\tin [Term, Term]\n\t\t... | [
"0.60477465",
"0.5645467",
"0.55475837",
"0.54053766",
"0.54021853",
"0.53748095",
"0.5368515",
"0.53651124",
"0.5310847",
"0.53074855",
"0.5300187",
"0.52763027",
"0.52760446",
"0.52559054",
"0.5253071",
"0.5239404",
"0.5239404",
"0.5236789",
"0.5208744",
"0.51777947",
"0.51... | 0.5021209 | 37 |
general case transposition with flat arrays | def transpose_with_perm(arr, new_arr, shape, new_shape, perm)
arr_size = shape.reduce(:*)
divisors = shape.dup.drop(1).reverse.inject([1]) { |a, s|
a << s * a.last
}.reverse
multipliers = new_shape.dup.drop(1).reverse.inject([1]) { |a, s|
a << s * a.last
}.reverse
arr_size.times do |p|
ptr = p
index = []
divisors.each_with_object(index) do |div, a|
a << (ptr / div.to_f).floor
ptr = ptr % div
end
# remap based on perm
remaped = perm.map { |x| index[x] }
ptr2 = 0
multipliers.each_with_index do |m, idx|
ptr2 += remaped[idx] * m
end
new_arr[ptr2] = arr[p]
end
[new_arr, new_shape]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transpose() end",
"def my_transpose(trans_arr)\n i, j = 0, 1\n array_copy = trans_arr.dup\n (i...trans_arr.length-1).each do |index_one|\n (j...trans_arr.length).each do |index_two|\n array_copy[index_one][index_two], array_copy[index_two][index_one] =\n array_copy[index_two][inde... | [
"0.8092258",
"0.79717743",
"0.7724703",
"0.75800276",
"0.75800276",
"0.7423364",
"0.73696876",
"0.73085773",
"0.7300054",
"0.7278257",
"0.72656065",
"0.723977",
"0.72277904",
"0.7211921",
"0.71967477",
"0.7188553",
"0.7178558",
"0.7175899",
"0.7144891",
"0.7133072",
"0.706679... | 0.63133085 | 59 |
number as an arg 1 2 4 8 16 32 64 ... 2n | def power_of_two?(number)
(0..number).each do|num|
# 2**num == 16
if 2**num == number
return true
end
if 2**num > number
return false
end
end
return "problem"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numbers(n)\n\nend",
"def next_number(n)\n\t\t(n).map{|n|n+2}\n\tend",
"def getNumber _args\n \"getNumber _args;\" \n end",
"def range_number(n,t)\n\t\t(n).step(t){|n|n+2}\n\tend",
"def number=(_arg0); end",
"def parseNumber _args\n \"parseNumber _args;\" \n end",
"def slippery_numbe... | [
"0.71995646",
"0.7008653",
"0.6834752",
"0.67906225",
"0.6764885",
"0.66145533",
"0.65578246",
"0.6538081",
"0.6496248",
"0.6496248",
"0.64493865",
"0.6446884",
"0.64048046",
"0.632517",
"0.6312935",
"0.6264367",
"0.6232891",
"0.6226489",
"0.61818165",
"0.6179881",
"0.6128397... | 0.0 | -1 |
TODO: needs to check all the way up a given tree. | def no_circular_reference
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_tree(tree)\n\nend",
"def test_recursive_methods\n assert_equal 0, find_node(1).ancestors_r.size\n assert_equal 8, find_node(1).descendants_r.size\n assert_equal 4, find_node('1_1_2_1_1').ancestors_r.size\n end",
"def valid_tree?\n true\n end",
"def valid_tree?\n true\n end",
... | [
"0.7282106",
"0.6589286",
"0.6570763",
"0.6570763",
"0.6545202",
"0.6507942",
"0.649494",
"0.64915293",
"0.64816314",
"0.6435132",
"0.64148796",
"0.6394745",
"0.6384812",
"0.62271696",
"0.6218531",
"0.62144905",
"0.61863184",
"0.61497414",
"0.61021626",
"0.60977215",
"0.60747... | 0.0 | -1 |
Create L2VPN session Create L2VPN session and bind to a L2VPNService | def create_l2_vpn_session(l2_vpn_session, opts = {})
data, _status_code, _headers = create_l2_vpn_session_with_http_info(l2_vpn_session, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_l2_vpn_session_with_http_info(l2_vpn_session, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session ...'\n end\n # verify the required parameter 'l2_vpn_session' is set\n if @api... | [
"0.6675386",
"0.61380833",
"0.6061185",
"0.5906935",
"0.58896804",
"0.58732396",
"0.58028316",
"0.57887095",
"0.5749061",
"0.5645838",
"0.5626455",
"0.55933565",
"0.55907303",
"0.54721963",
"0.5393742",
"0.5384021",
"0.53733975",
"0.5359921",
"0.5348103",
"0.53226995",
"0.530... | 0.685843 | 0 |
Create L2VPN session Create L2VPN session and bind to a L2VPNService | def create_l2_vpn_session_with_http_info(l2_vpn_session, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session ...'
end
# verify the required parameter 'l2_vpn_session' is set
if @api_client.config.client_side_validation && l2_vpn_session.nil?
fail ArgumentError, "Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.create_l2_vpn_session"
end
# resource path
local_var_path = '/vpn/l2vpn/sessions'
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(l2_vpn_session)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'L2VpnSession')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementPlaneApiVpnL2VpnSessionsApi#create_l2_vpn_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_l2_vpn_session(l2_vpn_session, opts = {})\n data, _status_code, _headers = create_l2_vpn_session_with_http_info(l2_vpn_session, opts)\n data\n end",
"def create_or_patch_l2_vpn(tier_0_id, locale_service_id, l2vpn_id, l2_vpn, opts = {})\n create_or_patch_l2_vpn_with_http_info(tier_0_i... | [
"0.685843",
"0.61380833",
"0.6061185",
"0.5906935",
"0.58896804",
"0.58732396",
"0.58028316",
"0.57887095",
"0.5749061",
"0.5645838",
"0.5626455",
"0.55933565",
"0.55907303",
"0.54721963",
"0.5393742",
"0.5384021",
"0.53733975",
"0.5359921",
"0.5348103",
"0.53226995",
"0.5309... | 0.6675386 | 1 |
Delete a L2VPN session Delete a specific L2VPN session. If there are any logical switch ports attached to it, those needs to be deleted first. | def delete_l2_vpn_session(l2vpn_session_id, opts = {})
delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if ... | [
"0.6884213",
"0.6750097",
"0.6658194",
"0.65352345",
"0.63437486",
"0.6209401",
"0.6108679",
"0.60897464",
"0.60321873",
"0.60032254",
"0.59915",
"0.598154",
"0.5939608",
"0.58934855",
"0.5891",
"0.588163",
"0.5875589",
"0.58510727",
"0.5823639",
"0.5803315",
"0.57784283",
... | 0.6743412 | 2 |
Delete a L2VPN session Delete a specific L2VPN session. If there are any logical switch ports attached to it, those needs to be deleted first. | def delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session ...'
end
# verify the required parameter 'l2vpn_session_id' is set
if @api_client.config.client_side_validation && l2vpn_session_id.nil?
fail ArgumentError, "Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.delete_l2_vpn_session"
end
# resource path
local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementPlaneApiVpnL2VpnSessionsApi#delete_l2_vpn_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_session(env, sid, options); end",
"def delete_l2_vpn_session(l2vpn_session_id, opts = {})\n delete_l2_vpn_session_with_http_info(l2vpn_session_id, opts)\n nil\n end",
"def delete\n if @session\n @session.destroy\n @session = nil\n end\n end",
"def delete_session\n ... | [
"0.6753051",
"0.6744462",
"0.6662052",
"0.65379804",
"0.6346409",
"0.62133276",
"0.6111714",
"0.60931176",
"0.6034961",
"0.60064596",
"0.59941137",
"0.59852016",
"0.59428304",
"0.5897266",
"0.5892356",
"0.5884579",
"0.5878992",
"0.58543134",
"0.5823081",
"0.5802549",
"0.57815... | 0.68838084 | 0 |
Get a L2VPN session Get a specific L2VPN session | def get_l2_vpn_session(l2vpn_session_id, opts = {})
data, _status_code, _headers = get_l2_vpn_session_with_http_info(l2vpn_session_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' is set\n if @api_c... | [
"0.68863684",
"0.65346664",
"0.6142881",
"0.6033498",
"0.5987291",
"0.58496064",
"0.582263",
"0.5783638",
"0.57282025",
"0.570861",
"0.5691314",
"0.56578994",
"0.56189305",
"0.55903184",
"0.55779153",
"0.5559573",
"0.5545683",
"0.55303633",
"0.55278563",
"0.55197275",
"0.5499... | 0.67856747 | 1 |
Get a L2VPN session Get a specific L2VPN session | def get_l2_vpn_session_with_http_info(l2vpn_session_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session ...'
end
# verify the required parameter 'l2vpn_session_id' is set
if @api_client.config.client_side_validation && l2vpn_session_id.nil?
fail ArgumentError, "Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session"
end
# resource path
local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'L2VpnSession')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_l2_vpn_session(l2vpn_session_id, opts = {})\n data, _status_code, _headers = get_l2_vpn_session_with_http_info(l2vpn_session_id, opts)\n data\n end",
"def get_session2\n privileged = @@session_id_privileged rescue false\n if !privileged\n @@session_id = nil\n @@session_id_pri... | [
"0.67856747",
"0.65346664",
"0.6142881",
"0.6033498",
"0.5987291",
"0.58496064",
"0.582263",
"0.5783638",
"0.57282025",
"0.570861",
"0.5691314",
"0.56578994",
"0.56189305",
"0.55903184",
"0.55779153",
"0.5559573",
"0.5545683",
"0.55303633",
"0.55278563",
"0.55197275",
"0.5499... | 0.68863684 | 0 |
Get peer codes for the L2VpnSession Get peer codes for the L2VPN session to program the remote side of the tunnel. | def get_l2_vpn_session_peer_codes(l2vpn_session_id, opts = {})
data, _status_code, _headers = get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes ...'\n end\n # verify the required parameter 'l2vpn_session_id' i... | [
"0.71293914",
"0.5819167",
"0.5471055",
"0.5189417",
"0.51367766",
"0.5108261",
"0.5076274",
"0.5057087",
"0.5023644",
"0.4959744",
"0.49277085",
"0.49203652",
"0.48814026",
"0.4824515",
"0.48199093",
"0.47869185",
"0.4767501",
"0.4755308",
"0.47380775",
"0.47254547",
"0.4706... | 0.79052573 | 0 |
Get peer codes for the L2VpnSession Get peer codes for the L2VPN session to program the remote side of the tunnel. | def get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes ...'
end
# verify the required parameter 'l2vpn_session_id' is set
if @api_client.config.client_side_validation && l2vpn_session_id.nil?
fail ArgumentError, "Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.get_l2_vpn_session_peer_codes"
end
# resource path
local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}/peer-codes'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'L2VpnSessionPeerCodes')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementPlaneApiVpnL2VpnSessionsApi#get_l2_vpn_session_peer_codes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_l2_vpn_session_peer_codes(l2vpn_session_id, opts = {})\n data, _status_code, _headers = get_l2_vpn_session_peer_codes_with_http_info(l2vpn_session_id, opts)\n data\n end",
"def list_l2_vpn_sessions(opts = {})\n data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)\n ... | [
"0.79057103",
"0.58211654",
"0.54679704",
"0.5190082",
"0.5138232",
"0.5109675",
"0.5076664",
"0.50579065",
"0.502413",
"0.49591893",
"0.49243572",
"0.4920729",
"0.48780403",
"0.4823812",
"0.48201475",
"0.47893485",
"0.47692594",
"0.47544664",
"0.47376856",
"0.47256473",
"0.4... | 0.7128506 | 1 |
Get all L2VPN sessions Get paginated list of all L2VPN sessions | def list_l2_vpn_sessions(opts = {})
data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_l2_vpn_sessions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_... | [
"0.7177643",
"0.62780446",
"0.62716323",
"0.60475665",
"0.5932879",
"0.5919063",
"0.591813",
"0.58998376",
"0.5872089",
"0.5872089",
"0.5872089",
"0.5872089",
"0.5816827",
"0.5789972",
"0.5785835",
"0.569206",
"0.5642155",
"0.5592925",
"0.5585024",
"0.5576251",
"0.5561094",
... | 0.74568003 | 0 |
Get all L2VPN sessions Get paginated list of all L2VPN sessions | def list_l2_vpn_sessions_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions ...'
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be smaller than or equal to 1000.'
end
if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0
fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiVpnL2VpnSessionsApi.list_l2_vpn_sessions, must be greater than or equal to 0.'
end
# resource path
local_var_path = '/vpn/l2vpn/sessions'
# query parameters
query_params = {}
query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?
query_params[:'l2vpn_service_id'] = opts[:'l2vpn_service_id'] if !opts[:'l2vpn_service_id'].nil?
query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?
query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'L2VpnSessionListResult')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementPlaneApiVpnL2VpnSessionsApi#list_l2_vpn_sessions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_l2_vpn_sessions(opts = {})\n data, _status_code, _headers = list_l2_vpn_sessions_with_http_info(opts)\n data\n end",
"def index\n sessions = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/ses... | [
"0.74568003",
"0.62780446",
"0.62716323",
"0.60475665",
"0.5932879",
"0.5919063",
"0.591813",
"0.58998376",
"0.5872089",
"0.5872089",
"0.5872089",
"0.5872089",
"0.5816827",
"0.5789972",
"0.5785835",
"0.569206",
"0.5642155",
"0.5592925",
"0.5585024",
"0.5576251",
"0.5561094",
... | 0.7177643 | 1 |
Edit a L2VPN session Edit a specific L2VPN session | def update_l2_vpn_session(l2vpn_session_id, l2_vpn_session, opts = {})
data, _status_code, _headers = update_l2_vpn_session_with_http_info(l2vpn_session_id, l2_vpn_session, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_l2_vpn_session_with_http_info(l2vpn_session_id, l2_vpn_session, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session ...'\n end\n # verify the required parameter 'l2vpn_session_id' i... | [
"0.63248646",
"0.60819167",
"0.59483075",
"0.5897877",
"0.58323157",
"0.58171827",
"0.5757632",
"0.5704464",
"0.56998515",
"0.56495434",
"0.56353724",
"0.5609072",
"0.55920726",
"0.5590826",
"0.558789",
"0.5574672",
"0.55618584",
"0.55611956",
"0.54988873",
"0.5496382",
"0.54... | 0.51929176 | 66 |
Edit a L2VPN session Edit a specific L2VPN session | def update_l2_vpn_session_with_http_info(l2vpn_session_id, l2_vpn_session, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session ...'
end
# verify the required parameter 'l2vpn_session_id' is set
if @api_client.config.client_side_validation && l2vpn_session_id.nil?
fail ArgumentError, "Missing the required parameter 'l2vpn_session_id' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session"
end
# verify the required parameter 'l2_vpn_session' is set
if @api_client.config.client_side_validation && l2_vpn_session.nil?
fail ArgumentError, "Missing the required parameter 'l2_vpn_session' when calling ManagementPlaneApiVpnL2VpnSessionsApi.update_l2_vpn_session"
end
# resource path
local_var_path = '/vpn/l2vpn/sessions/{l2vpn-session-id}'.sub('{' + 'l2vpn-session-id' + '}', l2vpn_session_id.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
# form parameters
form_params = {}
# http body (model)
post_body = @api_client.object_to_http_body(l2_vpn_session)
auth_names = ['BasicAuth']
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'L2VpnSession')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ManagementPlaneApiVpnL2VpnSessionsApi#update_l2_vpn_session\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.edit(struct)\n rt = nil\n ... | [
"0.60819167",
"0.59483075",
"0.5897877",
"0.58323157",
"0.58171827",
"0.5757632",
"0.5704464",
"0.56998515",
"0.56495434",
"0.56353724",
"0.5609072",
"0.55920726",
"0.5590826",
"0.558789",
"0.5574672",
"0.55618584",
"0.55611956",
"0.54988873",
"0.5496382",
"0.5487196",
"0.548... | 0.63248646 | 0 |
output if the boolean is true, return half the given integers if false, return 0 E puts calculate_bonus(2800, true) == 1400 puts calculate_bonus(1000, false) == 0 puts calculate_bonus(50000, true) == 25000 D: coded structure A: use ternary operator to halve integer if true, or return 0 if not C: | def calculate_bonus(num, boolean)
boolean == true ? num / 2 : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_bonus(integer, bool)\n if bool\n integer / 2\n else\n 0\n end\nend",
"def calculate_bonus(int, boolean)\n boolean ? int / 2 : 0\nend",
"def calculate_bonus(integer, boolean)\n boolean == true ? integer / 2 : 0\nend",
"def calculate_bonus(integer, boolean)\n if boolean == true\n i... | [
"0.8662063",
"0.85986024",
"0.8564059",
"0.8531671",
"0.851488",
"0.8503154",
"0.8502087",
"0.85006475",
"0.8484156",
"0.8437396",
"0.83231544",
"0.82608944",
"0.8222967",
"0.8192086",
"0.8183173",
"0.81785685",
"0.817468",
"0.81733966",
"0.81329834",
"0.81027395",
"0.8067501... | 0.8451289 | 9 |
GET /mbrackets GET /mbrackets.json | def index
@mbrackets = Mbracket.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cnmrbrackets = Cnmrbracket.all\n end",
"def list_assets\n get('/video/v1/assets')\n end",
"def index\n @abuckets = @account.abuckets\n @help = \"Bucket List\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @abuckets }\n end\n e... | [
"0.61459535",
"0.5878671",
"0.57804185",
"0.5624205",
"0.5548744",
"0.5442309",
"0.5441612",
"0.54038733",
"0.5327505",
"0.5325637",
"0.5309805",
"0.5285535",
"0.52602696",
"0.5228278",
"0.52167517",
"0.5215463",
"0.52030003",
"0.5196619",
"0.51772296",
"0.51601577",
"0.51545... | 0.6294522 | 0 |
GET /mbrackets/1 GET /mbrackets/1.json | def show
@team = Team.all
@rank1 = Team.rank1
@rank2 = Team.rank2
@rank3 = Team.rank3
@rank4 = Team.rank4
@rank5 = Team.rank5
@rank6 = Team.rank6
@rank7 = Team.rank7
@rank8 = Team.rank8
@rank9 = Team.rank9
@rank10 = Team.rank10
@rank11 = Team.rank11
@rank12 = Team.rank12
@rank13 = Team.rank13
@rank14 = Team.rank14
@rank15 = Team.rank15
@rank16 = Team.rank16
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @mbrackets = Mbracket.all\n end",
"def index\n @cnmrbrackets = Cnmrbracket.all\n end",
"def list_assets\n get('/video/v1/assets')\n end",
"def index\n @abuckets = @account.abuckets\n @help = \"Bucket List\"\n respond_to do |format|\n format.html # index.html.erb\n f... | [
"0.6181096",
"0.5977827",
"0.5727121",
"0.56343037",
"0.5602006",
"0.55155116",
"0.54377556",
"0.5428718",
"0.5387181",
"0.5379383",
"0.53762144",
"0.5343459",
"0.534158",
"0.53385484",
"0.5338115",
"0.5278292",
"0.52658635",
"0.52585226",
"0.52403015",
"0.5223005",
"0.522066... | 0.0 | -1 |
POST /mbrackets POST /mbrackets.json | def create
@mbracket = Mbracket.new(mbracket_params)
respond_to do |format|
if @mbracket.save
format.html { redirect_to @mbracket, notice: 'Mbracket was successfully created.' }
format.json { render :show, status: :created, location: @mbracket }
else
format.html { render :new }
format.json { render json: @mbracket.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @abucket = @account.abuckets.build(params[:abucket])\n respond_to do |format|\n if @abucket.save\n flash[:notice] = 'Bucket was successfully assigned.'\n format.html { redirect_to(account_abuckets_path(@account)) }\n format.xml { render :xml => @abucket, :status => :cr... | [
"0.58926225",
"0.5855267",
"0.5675764",
"0.5573238",
"0.5555356",
"0.54543626",
"0.5419137",
"0.5354525",
"0.53034854",
"0.5223558",
"0.51780456",
"0.5177694",
"0.5146059",
"0.51358217",
"0.5079961",
"0.5068309",
"0.5057744",
"0.5056958",
"0.50495857",
"0.50196517",
"0.499712... | 0.59274787 | 0 |
PATCH/PUT /mbrackets/1 PATCH/PUT /mbrackets/1.json | def update
respond_to do |format|
if @mbracket.update(mbracket_params)
format.html { redirect_to @mbracket, notice: 'Mbracket was successfully updated.' }
format.json { render :show, status: :ok, location: @mbracket }
else
format.html { render :edit }
format.json { render json: @mbracket.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @abucket.update_attributes(params[:abucket])\n flash[:notice] = 'Bucket was successfully updated.'\n format.html { redirect_to(account_abuckets_path(@account)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"e... | [
"0.6146706",
"0.59289056",
"0.5795",
"0.57512766",
"0.5737652",
"0.56975603",
"0.56896573",
"0.56379503",
"0.55683506",
"0.5561941",
"0.5560071",
"0.5523778",
"0.5479658",
"0.5464934",
"0.54600555",
"0.54535997",
"0.54489356",
"0.5421928",
"0.5415702",
"0.5405829",
"0.5405829... | 0.608883 | 1 |
DELETE /mbrackets/1 DELETE /mbrackets/1.json | def destroy
@mbracket.destroy
respond_to do |format|
format.html { redirect_to mbrackets_url, notice: 'Mbracket was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cnmrbracket.destroy\n respond_to do |format|\n format.html { redirect_to cnmrbrackets_url, notice: 'Cnmrbracket was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bes_asset.destroy\n respond_to do |format|\n format.html { ... | [
"0.69888973",
"0.6659261",
"0.6627805",
"0.6627805",
"0.6627805",
"0.6627805",
"0.6627805",
"0.65069485",
"0.648206",
"0.64722663",
"0.6464805",
"0.644266",
"0.6431193",
"0.6431193",
"0.6431193",
"0.6431193",
"0.6409544",
"0.6395895",
"0.6392431",
"0.6387701",
"0.6368856",
... | 0.66546935 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_mbracket
@mbracket = Mbracket.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def mbracket_params
params.require(:mbracket).permit(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Read a save file, and attempt to initialize a game from it | def load_game
print_saves
begin
read_save
rescue IOError, SystemCallError
puts 'File not found'
load_game
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load\n file_name = ask_save_file\n save_file = File.open(file_name, 'r')\n save_file.pos = 0\n contents = unserialize(save_file.read)\n @name = contents['name']\n @guess = contents['guess']\n @word = contents['word']\n @bank = contents['bank']\n @lives = contents['lives']\n @lette... | [
"0.7642684",
"0.76054585",
"0.7590426",
"0.7520142",
"0.7355775",
"0.72137725",
"0.71496314",
"0.7041646",
"0.7003075",
"0.6940102",
"0.68225586",
"0.68003446",
"0.67826295",
"0.67689615",
"0.67403746",
"0.67222226",
"0.6719393",
"0.6710889",
"0.6656671",
"0.6475185",
"0.6466... | 0.81866574 | 0 |
Saves are serialized in JSON format. This would have been much easier in YAML(Yaml.dump(self)) | def save_game
file_name = input_save_name
begin
Dir.mkdir('saves') unless Dir.exist?('saves')
save_file = File.new(file_name, 'w')
save_file.puts generate_save
save_file.close
puts 'Game saved!'
rescue IOError
puts 'Save failed'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n YAML::dump(self)\n end",
"def generate_save\n YAML.dump(self)\n end",
"def save\n ::File.open(@file, \"w\") { |file| file << self.to_hash.to_yaml }\n end",
"def save_data\n puts \"saving data\"\n\n File.open(generate_filename(self), \"w\") do |f|\n f.write(ostruct_t... | [
"0.75708884",
"0.75315285",
"0.7015672",
"0.699909",
"0.6849924",
"0.6825399",
"0.6825399",
"0.6825399",
"0.6798712",
"0.6761611",
"0.67493725",
"0.6742367",
"0.6731286",
"0.67009515",
"0.6683374",
"0.667178",
"0.667178",
"0.6591724",
"0.6574427",
"0.6502932",
"0.6485812",
... | 0.0 | -1 |
TODO: Generate yaml of game | def generate_save
YAML.dump(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game\n {\n starting_decision: :stormy_night,\n decisions: {\n stormy_night: {\n description: 'It was a dark and stormy night. (storyline located in decision.rb)',\n option_one: {\n description: 'Go to sleep.',\n decision: :nap\n },\n option_two: {\n ... | [
"0.6945381",
"0.6874358",
"0.6593015",
"0.657946",
"0.65297467",
"0.650175",
"0.6465459",
"0.64196795",
"0.6417755",
"0.64036214",
"0.6372766",
"0.63324267",
"0.63127553",
"0.63097715",
"0.63062483",
"0.63062483",
"0.63062483",
"0.63062483",
"0.63062483",
"0.630572",
"0.63052... | 0.54805577 | 100 |
stubs blocks yield Performance Monitor This is (a stripped down version of) an actual useful concept: a function that runs a block of code and then tells you how long it took to run. | def measure (n=1)
cnt=0
elapsed_time=Time.now
n.times {
cnt+=1
yield}
elapsed_time=(Time.now-elapsed_time)/cnt
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timed_run(&block)\n time = Benchmark.measure do\n block.call\n end\n puts time\nend",
"def bench(descr)\n start = Time.now\n yield\n puts \"#{descr} : #{Time.now-start} seconds\"\nend",
"def benchmark\n start = Time.now\n yield\n p Time.now - start\nend",
"def measure_time(&block)\n start_ti... | [
"0.7542573",
"0.7482536",
"0.73488665",
"0.7310012",
"0.7307402",
"0.72471327",
"0.7212225",
"0.7210083",
"0.7194402",
"0.7180565",
"0.7180482",
"0.7177534",
"0.71647835",
"0.71335363",
"0.7118577",
"0.711352",
"0.7095569",
"0.7031781",
"0.7027405",
"0.7023289",
"0.7017483",
... | 0.62784004 | 57 |
Overwriting the sign_out redirect path method | def after_sign_out_path_for(resource_or_scope)
root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end",
"def after_sign_out_path_for(_resource_or_scope)\n '/'\n end",
"def after_sign_out_path_for(resource_or_scope); end",
"def signout_url\n {:controller => 'auth', :action => 'signout'}\n end",
"def after_sign_out_path_for(reso... | [
"0.8102037",
"0.8007481",
"0.7984188",
"0.79324496",
"0.7897868",
"0.78892565",
"0.7874593",
"0.78685254",
"0.7857867",
"0.78436327",
"0.78436327",
"0.78436327",
"0.78436327",
"0.7842701",
"0.7821579",
"0.77880424",
"0.7748489",
"0.77373666",
"0.7731692",
"0.77291566",
"0.772... | 0.0 | -1 |
Creates and initializes a new instance of the Web class. | def initialize(client)
@client = client
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @web= Web.new\n end",
"def create_web(name, template, options = {}, &blk)\n\t\t\t # create our new web\n\t\t\t new_web = Webs.create_web(@web, name, template, options)\n\t\t\t context_for_new_object(new_web, WebContext, &blk)\n\t\t\tend",
"def initialize(web3)\n @web3 = web3\n end",
... | [
"0.7012912",
"0.66679406",
"0.66447395",
"0.6522962",
"0.6464505",
"0.62941104",
"0.62031883",
"0.6153433",
"0.6145058",
"0.60960096",
"0.6031048",
"0.60147876",
"0.59465915",
"0.5945385",
"0.59400433",
"0.59072125",
"0.5900642",
"0.589394",
"0.58758444",
"0.5866958",
"0.5865... | 0.0 | -1 |
Create slicing planes which are perpendicular to the reference segment. | def slicing_planes(segmenter)
plane_normal = segmenter.segment.line[1]
segmenter.points.map { |point|
[point.clone, plane_normal.clone]
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_perpendicular\n p1dot_ = self * P1\n p2dot_ = self * P2\n p1dot_ = -p1dot_ if p1dot_ < 0\n p2dot_ = -p2dot_ if p2dot_ < 0\n p1dot_ < p2dot_ ? (self % P1) : (self % P2)\n end",
"def plane\n return nil if @vertices.length < 3\n Plane.three_po... | [
"0.60368395",
"0.59248894",
"0.57970124",
"0.547599",
"0.5413303",
"0.5211689",
"0.5192795",
"0.5153421",
"0.51324207",
"0.5099675",
"0.5024902",
"0.5005301",
"0.4974331",
"0.49632823",
"0.49546692",
"0.49196318",
"0.49046892",
"0.48149726",
"0.47870997",
"0.47808498",
"0.477... | 0.7468517 | 0 |
Creates a transformation that convert world coordinates to a local coordinate for the reference segment. | def world_to_segment_space
# TODO: Will the direction of the segment matter? Does it need to be
# sorted somehow?
@segment.transformation.inverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_transformation( transformation )\r\n # Cast Vector3d into Transformation.\r\n if transformation.is_a?( Geom::Vector3d )\r\n transformation = Geom::Transformation.new( transformation )\r\n end\r\n et = @instance.model.edit_transform\r\n local_transform = (et.inverse * trans... | [
"0.6654681",
"0.5739941",
"0.5708238",
"0.56390935",
"0.5512808",
"0.5412651",
"0.5387135",
"0.5310979",
"0.5166456",
"0.51522624",
"0.5109401",
"0.5099228",
"0.50434667",
"0.502317",
"0.50109315",
"0.4996229",
"0.49886397",
"0.49800968",
"0.49607196",
"0.49449757",
"0.493759... | 0.56818104 | 3 |
Return the full orientation of the two lines. Going counterclockwise. | def full_angle_between(vector1, vector2, normal = Z_AXIS)
direction = (vector1 * vector2) % normal
angle = vector1.angle_between(vector2)
angle = 360.degrees - angle if direction < 0.0
angle
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_angle(p1,p2)\n v1 = RBA::DPoint.new(1,0)\n v2 = p2-p1\n return vector_angle(v1,v2)\n end",
"def orientation \n @position - @prev_position\n end",
"def orientation\n p1, p2, p3 = *convex_sub_polygon\n det = (p2[0]-p1[0])*(p3[1]-p1[1]) - (p3[0]-p1[0])*(p2[1]-p1[1])\n @orient... | [
"0.62789124",
"0.62677735",
"0.6135888",
"0.59395975",
"0.5926302",
"0.5712566",
"0.5707717",
"0.57012683",
"0.56970793",
"0.5648831",
"0.5619228",
"0.5599831",
"0.5594926",
"0.55764705",
"0.55026925",
"0.5493917",
"0.54844475",
"0.5440558",
"0.5424334",
"0.54047996",
"0.5392... | 0.49792928 | 85 |
Creates a set of `Geom::Point3d` objects for an arc. | def arc(center, xaxis, normal, radius, start_angle, end_angle, num_segments = 12)
# Generate the first point.
t = Geom::Transformation.rotation(center, normal, start_angle)
points = []
points << center.offset(xaxis, radius).transform(t)
# Prepare a transformation we can repeat on the last entry in point to complete the arc.
t = Geom::Transformation.rotation(center, normal, (end_angle - start_angle) / num_segments)
1.upto(num_segments) {
points << points.last.transform(t)
}
points
rescue StandardError
p [center, xaxis, normal, radius, start_angle, end_angle, num_segments]
raise
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_outer_radius(p, outerRadius, angle)\r\n res = Geom::Point3d.new(p[0] + Math.cos(angle * Math::PI) * outerRadius, \r\n p[1] + Math.sin(angle * Math::PI) * outerRadius, \r\n 0)\r\n return res\r\nend",
"def bezier3d(p1, p2, p3, p4, n)\n\tar = []\n\tar.push... | [
"0.5745622",
"0.56563866",
"0.55909216",
"0.54083776",
"0.53112423",
"0.52581954",
"0.5243789",
"0.5230431",
"0.52199143",
"0.5217242",
"0.51904416",
"0.5160909",
"0.51120985",
"0.50925976",
"0.50517815",
"0.49432805",
"0.49287426",
"0.49136236",
"0.4857209",
"0.48492023",
"0... | 0.5582796 | 3 |
Takes a date range and breaks it into an array of ranges by month. The first and last items may be partial months (ex starting in the middle and ending at the end) and the intermediate items are always full months (1st to last of month) | def months(date_range)
results = []
results << (date_range.begin..date_range.begin.end_of_month)
current = date_range.begin.end_of_month + 1.day
while current < date_range.end.beginning_of_month
month_start = current.beginning_of_month
month_end = current.end_of_month
results << (month_start..month_end)
current = month_end + 1.day
end
results << (date_range.end.beginning_of_month..date_range.end) if current < date_range.end
results
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def month_range start_time, end_time\n start_date = start_time.month_start.to_date\n end_date = end_time.month_start.to_date\n current_date = start_date\n result = []\n while current_date <= end_date\n result << current_date.to_time\n current_date = current_date.next_month\n end\n result\nend",
"def... | [
"0.757665",
"0.73225707",
"0.7177227",
"0.70933497",
"0.7092237",
"0.7079848",
"0.69416416",
"0.68823355",
"0.6880895",
"0.6837699",
"0.682649",
"0.6821009",
"0.6760408",
"0.67402565",
"0.6560415",
"0.65319514",
"0.65215003",
"0.64339083",
"0.63829774",
"0.63628393",
"0.62705... | 0.85104007 | 0 |
Determines root node for the list | def fetch_entries(context)
@site, @page, @portal_user = context.registers[:site], context.registers[:page], context.registers[:current_portal_user]
set_defaults
page = (case @source
when 'site' then @all_pages.root.minimal_attributes(@options[:add_attributes]).first # start from home page
when 'parent' then top_page
when 'page' then @page
else
@all_pages.fullpath(@source).minimal_attributes(@options[:add_attributes]).first
end)
children = children(page)
children.delete_if { |p| !include_page?(p) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root_node\n root_nodes.first\n end",
"def root_node; end",
"def root\n return nodes.first if nodes.size == 1\n nodes.find { |node| root?(node) }\n end",
"def root_node_id\n 1\n end",
"def root\n node = self\n node = node.parent while !node.parent.nil?\n ... | [
"0.7744681",
"0.6957455",
"0.69097817",
"0.6772719",
"0.65886706",
"0.6489657",
"0.6412798",
"0.6385489",
"0.6385489",
"0.6369249",
"0.6362248",
"0.6327559",
"0.63098675",
"0.6256922",
"0.6248215",
"0.62422776",
"0.62380075",
"0.623641",
"0.6221097",
"0.6181858",
"0.6181858",... | 0.0 | -1 |
Returns a list element, a link to the page and its children | def render_entry_link(context, page, css, depth)
selected = @page == page ? " #{@options[:active_class]}" : ''
icon = @options[:icon] ? '<span></span>' : ''
title = render_title(context, page)
label = %{#{icon if @options[:icon] != 'after' }#{title}#{icon if @options[:icon] == 'after' }}
link_options = caret = ''
href = File.join('/', @site.localized_page_fullpath(page))
if render_children_for_page?(page, depth) && bootstrap?
css += ' dropdown'
link_options = %{ class="dropdown-toggle" data-toggle="dropdown"}
href = '#'
caret = %{ <b class="caret"></b>}
end
has_children_class = has_children?(page) ? @options[:has_children_class] : nil
has_active_child_class = has_active_child?(page) ? @options[:has_active_child_class] : nil
has_dropdown_class = page.depth == 1 && @source == 'site' ? @options[:has_dropdown_class] : nil
css_classes_string = ["link#{selected}", "#{css}", "#{@options[:depth_class]}-#{page.depth}", has_children_class, has_active_child_class, has_dropdown_class].compact.join(" ")
output = %{<li id="#{page.slug.to_s.dasherize}-link" class="#{css_classes_string}">}
output << %{<a href="#{href}"#{link_options}>#{label}#{caret}</a>}
output << render_entry_children(context, page, depth.succ) if (depth.succ <= @options[:depth].to_i)
output << %{</li>}
output.strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def links\n construct_html(self.items)\n end",
"def subpage_navigation(page)\n l = \"<ul>\\n\"\n page.pages.each do |page|\n l << page_navigation_helper(page)\n end\n l << \"</ul>\"\n end",
"def webSiteBuildLinkListForPages(pages, label, baseDir)\n html = \"<u... | [
"0.6466164",
"0.64638126",
"0.64476544",
"0.6368072",
"0.6246507",
"0.6240587",
"0.6231831",
"0.6226405",
"0.62156194",
"0.6214931",
"0.6163092",
"0.615328",
"0.6146338",
"0.61224645",
"0.6063149",
"0.60366535",
"0.60360116",
"0.60340476",
"0.6026651",
"0.60243785",
"0.599170... | 0.5733977 | 36 |
Recursively creates a nested unordered list for the depth specified | def render_entry_children(context, page, depth)
output = %{}
children = children(page).reject { |c| !include_page?(c) }
if children.present?
dropdown_class = @source == 'site' && page.depth == 1 ? @options[:dropdown_class] : ''
output = %{<ul id="#{@options[:id]}-#{page.slug.to_s.dasherize}" class="#{bootstrap? ? 'dropdown-menu' : dropdown_class}">}
children.each do |c, page|
css = []
css << 'first' if children.first == c
css << 'last' if children.last == c
output << render_entry_link(context, c, css.join(' '), depth)
end
output << %{</ul>}
end
output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_list_to_html(list, depth_to_traverse=1000, start_depth=0)\n depth = start_depth\n if list.is_a?(Array) && !list.empty?\n str =''\n str << '<ul>'\n depth += 1\n list.each do |value|\n unless depth > depth_to_traverse\n str << \"<li> #{value} </li> \"\n if ... | [
"0.685823",
"0.68208694",
"0.66374844",
"0.6589937",
"0.6552515",
"0.637286",
"0.63725144",
"0.63636017",
"0.63243544",
"0.60720694",
"0.60386866",
"0.5983094",
"0.59502393",
"0.59264046",
"0.5905678",
"0.590465",
"0.58891594",
"0.58663493",
"0.58127165",
"0.5779734",
"0.5768... | 0.0 | -1 |
Determines whether or not a page should be a part of the menu | def include_page?(page)
if do_not_show?(page)
false
elsif @options[:exclude]
(page.fullpath =~ @options[:exclude]).nil?
else
true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include_in_menu?\n @include_in_menu != false\n end",
"def shown_in_menu?\n false\n end",
"def sidebar_required?\n @menu_elements = []\n if @page.parent_id.present?\n @menu_elements = @page.parent.children.reject{|c| !c.in_menu?}\n end\n unless @page.children.blank?\n ... | [
"0.71867716",
"0.70993996",
"0.7079304",
"0.70061105",
"0.6975726",
"0.69751304",
"0.68361324",
"0.67792284",
"0.67428446",
"0.6645417",
"0.6640492",
"0.6631472",
"0.6627317",
"0.6617787",
"0.6616841",
"0.6612598",
"0.6600276",
"0.6518728",
"0.65031266",
"0.6467844",
"0.64554... | 0.643293 | 22 |
GET /information GET /information.json | def index
@information = Information.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @information = Information.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @information }\n end\n end",
"def show\n @information = Information.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.e... | [
"0.78929687",
"0.78379023",
"0.758303",
"0.75783414",
"0.7538838",
"0.73509043",
"0.7326645",
"0.7326645",
"0.7208983",
"0.712591",
"0.703123",
"0.70282733",
"0.7015941",
"0.6977512",
"0.68791246",
"0.68407077",
"0.6794898",
"0.67802995",
"0.67617553",
"0.67573845",
"0.673618... | 0.67366105 | 21 |
POST /information POST /information.json | def create
@information = Information.new(information_params)
respond_to do |format|
if @information.save
conn = Bunny.new(:automatically_recover => false)
conn.start
ch = conn.create_channel
q = ch.queue("user")
ch.default_exchange.publish(@information.content, :routing_key => q.name)
conn.close
format.html { redirect_to @information, notice: 'Information was successfully created.' }
format.json { render :show, status: :created, location: @information }
else
format.html { render :new }
format.json { render json: @information.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @information = Information.new(information_params)\n\n if @information.save\n render json: :ok\n else\n render json: @information.errors, status: :unprocessable_entity\n end\n end",
"def create\n @information = Information.new(params[:information])\n\n respond_to do |for... | [
"0.7813996",
"0.75670433",
"0.7522389",
"0.7512729",
"0.7138231",
"0.71197915",
"0.71197915",
"0.69440216",
"0.694048",
"0.6909741",
"0.69005674",
"0.6864512",
"0.67391384",
"0.66557485",
"0.6588165",
"0.6588165",
"0.6580225",
"0.65799195",
"0.65591663",
"0.65234953",
"0.6515... | 0.6569009 | 18 |
Use callbacks to share common setup or constraints between actions. | def set_information
@information = Information.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def information_params
params.require(:information).permit(:content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
define included attributes for thinkingsphinx indexing define_index do indexes title, :sortable => true indexes content indexes permalink, :sortable => true indexes cached_tag_list has user_id, created_at, updated_at, blog_id set_property :delta => true end Status update | def setup_to_mark_as_drafted
self.status = STATUSES[:drafted]
self.drafted_at = Time.zone.now
self.permalink ||= self.title.parameterize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_index_field(*) super end",
"def index_keywords!\n update_attribute(:_keywords, set_keywords)\n end",
"def construct_index\n end",
"def indexed\n meta(index: true)\n end",
"def index_on( field, opts={} )\n opts = Gnash.new( opts )\n design_document(true).add!... | [
"0.6742292",
"0.63079053",
"0.62691176",
"0.6195474",
"0.61248267",
"0.6117683",
"0.60501474",
"0.6040059",
"0.6006835",
"0.60011077",
"0.59949535",
"0.5987425",
"0.59833694",
"0.59769386",
"0.5947855",
"0.59453726",
"0.59413254",
"0.5932856",
"0.5920413",
"0.5898849",
"0.589... | 0.0 | -1 |
GET /sites GET /projects/:project_id/sites | def index
do_authorize_class
get_project_if_exists
do_authorize_instance(:show, @project) unless @project.nil?
respond_to do |format|
#format.html # index.html.erb
format.json do
@sites, opts = Settings.api_response.response_advanced(
api_filter_params,
list_permissions,
Site,
Site.filter_settings
)
respond_index(opts)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\n @project = Project.find(params[:project_id])\n @site = @project.sites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def show\n @project = Project.find(params[:id])\n @sites = @project.spans\n\n respond... | [
"0.69330496",
"0.6869819",
"0.67282987",
"0.66814977",
"0.6619648",
"0.6619648",
"0.6619648",
"0.6619648",
"0.6619648",
"0.6619648",
"0.6587409",
"0.65140283",
"0.6482919",
"0.6440983",
"0.64348024",
"0.63573444",
"0.6350226",
"0.6339367",
"0.632594",
"0.632594",
"0.63254887"... | 0.6307397 | 22 |
GET /sites/:id GET /projects/:project_id/sites/:id | def show
do_load_resource
get_project_if_exists
do_authorize_instance
respond_to do |format|
format.html { @site }
format.json { respond_show }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\n @project = Project.find(params[:project_id])\n @site = @project.sites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def show\n @project = Project.find(params[:id])\n @sites = @project.spans\n\n respond... | [
"0.70766526",
"0.66787434",
"0.6606796",
"0.66055626",
"0.64919317",
"0.63666683",
"0.62347466",
"0.61579514",
"0.61579514",
"0.61579514",
"0.61579514",
"0.61579514",
"0.61579514",
"0.61542255",
"0.6110491",
"0.610454",
"0.60918856",
"0.609185",
"0.6072752",
"0.6058747",
"0.6... | 0.5661572 | 94 |
GET /sites/new GET /projects/:project_id/sites/new | def new
do_new_resource
get_project_if_exists
do_set_attributes
do_authorize_instance
# initialize lat/lng to Brisbane-ish
@site.longitude = 152
@site.latitude = -27
respond_to do |format|
format.html
format.json { respond_new }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\n @project = Project.find(params[:project_id])\n @site = @project.sites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def new\n @my_sites = current_user.sites.clone\n @site = current_user.sites.build\n\n ... | [
"0.8405857",
"0.7162858",
"0.7145906",
"0.7104214",
"0.7099238",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088741",
"0.7088588",
"0.706127",
"0.70456815",
"0.702826",
"0... | 0.0 | -1 |
POST /sites POST /projects/:project_id/sites | def create
do_new_resource
do_set_attributes(site_params)
get_project_if_exists
do_authorize_instance
respond_to do |format|
if @site.save
format.html { redirect_to [@project, @site], notice: 'Site was successfully created.' }
format.json {
if @project.nil?
respond_create_success(shallow_site_path(@site))
else
respond_create_success(project_site_path(@project, @site))
end
}
else
format.html { render action: 'new' }
format.json { respond_change_fail }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\n @project = Project.find(params[:project_id])\n @site = @project.sites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end",
"def create\n @site = current_user.sites.build(params[:site])\n\n respond_to do |format|\... | [
"0.6808781",
"0.6653245",
"0.64772636",
"0.64595175",
"0.64161086",
"0.63823074",
"0.63426745",
"0.63059527",
"0.62254995",
"0.6201547",
"0.6134515",
"0.6037362",
"0.60171574",
"0.59973013",
"0.5966203",
"0.5966203",
"0.5966203",
"0.5954593",
"0.5935434",
"0.5932729",
"0.5917... | 0.6576635 | 2 |
PUT|PATCH /sites/:id PUT|PATCH /projects/:project_id/sites/:id | def update
do_load_resource
get_project_if_exists
do_authorize_instance
@original_site_name = @site.name
respond_to do |format|
if @site.update(site_params)
format.html { redirect_to [@project, @site], notice: 'Site was successfully updated.' }
format.json { respond_show }
else
format.html do
render action: 'edit'
end
format.json { respond_change_fail }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to site_path(@site), notice: 'Site was successfully updated.' }\n # format.html { redirect_to project_site_path(@site.project, @site), notice: 'Site w... | [
"0.68864995",
"0.6803217",
"0.6754956",
"0.6699364",
"0.6563257",
"0.64455116",
"0.6334341",
"0.63271093",
"0.6317401",
"0.6311834",
"0.6309317",
"0.6294351",
"0.628393",
"0.62765926",
"0.6250152",
"0.620043",
"0.61921304",
"0.61790377",
"0.61767364",
"0.6175501",
"0.61629957... | 0.67603123 | 2 |
DELETE /sites/:id DELETE /projects/:project_id/sites/:id | def destroy
do_load_resource
get_project_if_exists
do_authorize_instance
@site.destroy
add_archived_at_header(@site)
respond_to do |format|
format.html { redirect_to project_sites_url(@project) }
format.json { respond_destroy }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @site = current_user.sites.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { flash_and_redirect(\"successfully deleted\", sites_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @site = Site.find(id_from_params)\n\n respond_to do ... | [
"0.7523925",
"0.7515405",
"0.74884456",
"0.74365526",
"0.74279046",
"0.74185526",
"0.7413889",
"0.7412574",
"0.7405516",
"0.73911226",
"0.73911226",
"0.73911226",
"0.73911226",
"0.73911226",
"0.7365301",
"0.7365301",
"0.7365301",
"0.7365301",
"0.7365301",
"0.7365301",
"0.7365... | 0.73844576 | 14 |
GET|POST /sites/filter GET|POST /projects/:project_id/sites/filter | def filter
do_authorize_class
get_project_if_exists
do_authorize_instance(:show, @project) unless @project.nil?
filter_response, opts = Settings.api_response.response_advanced(
api_filter_params,
list_permissions,
Site,
Site.filter_settings
)
respond_filter(filter_response, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @projects = Project.all\n \n filter = params[:filter]\n by = params[:by]\n \n if filter == 'all' or filter == 'New Posts'\n @projects = filter_projects(filter)\n elsif filter == 'Type' or filter == 'Region' or filter == 'Budget' or filter == 'Popular'\n @projects = filter... | [
"0.6695942",
"0.65546066",
"0.6224362",
"0.62091506",
"0.61379486",
"0.61110914",
"0.60876745",
"0.6036601",
"0.6003981",
"0.59945613",
"0.59913814",
"0.59524214",
"0.59524214",
"0.5950059",
"0.59470063",
"0.58867913",
"0.5873827",
"0.5869289",
"0.58607066",
"0.58587646",
"0.... | 0.6942313 | 0 |
controller actions named :login squash this login | def resolve_canonical_id(xri)
return xri if AtLinksafe::Iname.is_inumber?(xri)
AtLinksafe::Resolver::Resolve.new(xri).canonical_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n\n end",
"def login\n\n end",
"def login\n end",
"def login\n\tend",
"def login; end",
"def... | [
"0.7731615",
"0.7731615",
"0.7731615",
"0.7731615",
"0.7731615",
"0.7731615",
"0.7731615",
"0.7731615",
"0.7731615",
"0.7687842",
"0.7687842",
"0.7687748",
"0.76120555",
"0.75719285",
"0.7388394",
"0.7367486",
"0.7343614",
"0.7322231",
"0.7310472",
"0.72134596",
"0.71361333",... | 0.0 | -1 |
Given a class, update the index. Don't duplicate this class's entries if they're already in there | def updateWith(cl)
cl.eachMethod do |m|
mname = m.name
fname = fqn(cl, m)
if @index[mname].nil?
@index[mname] = [fname]
else
@index[mname] << fname unless @index[mname].include?(fname)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reindex_class(klass, options={})\n opts = {:verbose => false}.merge(options)\n # First, delete all docs of this class\n XapianDb.database.delete_docs_of_class(klass)\n blueprint = XapianDb::DocumentBlueprint.blueprint_for(klass)\n indexer = XapianDb::Indexer.new(X... | [
"0.74796563",
"0.6981333",
"0.6598288",
"0.655213",
"0.6408979",
"0.6408979",
"0.6399122",
"0.6279504",
"0.6270902",
"0.6145742",
"0.613652",
"0.61317766",
"0.60936815",
"0.600133",
"0.59957445",
"0.5913338",
"0.5892912",
"0.5859924",
"0.5856618",
"0.5841925",
"0.57764846",
... | 0.5817954 | 20 |
This who is following the user | def followers
list = service.find_followers(user).map {|data| build_object(data)}
followers = list.map {|follower| follower.login}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def follower_username\n self.following_user.username\n end",
"def following\n return @following\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following_user?(other_user)\n following.include?(other_user)\n end",
"def... | [
"0.7837616",
"0.7482533",
"0.7300668",
"0.7283128",
"0.72566235",
"0.7223081",
"0.722218",
"0.72082865",
"0.7203265",
"0.7199945",
"0.71920174",
"0.71920174",
"0.71920174",
"0.7174599",
"0.7174599",
"0.7174599",
"0.7174599",
"0.7170681",
"0.7148585",
"0.7145278",
"0.7145278",... | 0.0 | -1 |
This is who the user follows | def followees
list = service.find_user_follows(user).map {|data| build_object(data)}
followees = list.map {|followee| followee.login}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def follower_username\n self.following_user.username\n end",
"def following\n return @following\n end",
"def who\n\t\t\t@username\n\t\tend",
"def users_messaged_by\r\n self.users_who_messaged_me\r\n end",
"def users_messaged_by\r\n self.users_who... | [
"0.8019525",
"0.7187833",
"0.7135876",
"0.6875988",
"0.6875988",
"0.6842539",
"0.6775694",
"0.6721884",
"0.66867524",
"0.6683983",
"0.66752815",
"0.6672738",
"0.6644547",
"0.66426426",
"0.6638271",
"0.6636472",
"0.6594985",
"0.65875506",
"0.65814644",
"0.6529242",
"0.6522476"... | 0.0 | -1 |
adding and removing sizes | def add_size( size )
@size << size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n @sizes ||= strip(:size)\n end",
"def remove_size(size)\n @size.delete(size)\n end",
"def interpret_size(size); end",
"def add_size (size)\n @size << size\n end",
"def update_size(width, height) \n if @vertical\n @height += height\n @width = width if width ... | [
"0.68593484",
"0.6683275",
"0.6670001",
"0.6587559",
"0.64204353",
"0.6319315",
"0.6290475",
"0.62815124",
"0.62740856",
"0.621347",
"0.6175416",
"0.61624885",
"0.6152782",
"0.6152782",
"0.6130159",
"0.6120918",
"0.6100449",
"0.60730606",
"0.60303694",
"0.60303694",
"0.595969... | 0.6572914 | 5 |
Overwriting the string method to apply to this Class/object | def to_s
return "#{@id}\t #{@description}\t #{@price}\t Sizes: #{@size.join(", ")}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string() end",
"def str; end",
"def str; end",
"def string\n @string\n end",
"def string\n @string\n end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",... | [
"0.74949",
"0.731909",
"0.731909",
"0.73020196",
"0.73020196",
"0.728641",
"0.728641",
"0.728641",
"0.728641",
"0.728641",
"0.728641",
"0.728641",
"0.728641",
"0.728641",
"0.72782105",
"0.72782105",
"0.72782105",
"0.71594965",
"0.71268743",
"0.70789886",
"0.69821966",
"0.69... | 0.0 | -1 |
include Override Objectinclude so that modules extending Module instance can define include. | def include( *modules )
super if defined?( super )
original_include( *modules )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_include(include)\n object_class.record_location self\n return include unless @document_self\n object_class.add_include include\n end",
"def add_include include\n add_to @includes, include\n\n include\n end",
"def include; end",
"def include; end",
"def include(mod)\n mod.inclu... | [
"0.77406377",
"0.76823545",
"0.76145893",
"0.76145893",
"0.75136584",
"0.748567",
"0.748567",
"0.7480797",
"0.73424315",
"0.7187626",
"0.71865445",
"0.7132548",
"0.70626134",
"0.70600283",
"0.70591635",
"0.70266175",
"0.70034164",
"0.69935614",
"0.69613117",
"0.6959581",
"0.6... | 0.782343 | 0 |
append_features Override Module.included so that modules extending Module can define append_features. | def append_features( hooked_instance )
original_append_features( hooked_instance )
super if defined?( super )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_features(mod)\n im = Rubinius::IncludedModule.new(self)\n im.attach_to mod\n end",
"def append_features(other)\n if other.__check_include(self)\n other.__include_module(self)\n end\n self\n end",
"def append_features(mod) end",
"def include(mod)\n mod.append_features(self)... | [
"0.81698424",
"0.7929921",
"0.7605099",
"0.7407746",
"0.7233596",
"0.71166867",
"0.70085",
"0.70085",
"0.6687014",
"0.65890837",
"0.6556314",
"0.65128714",
"0.65041614",
"0.6499552",
"0.648103",
"0.6465637",
"0.6458739",
"0.6426297",
"0.6415078",
"0.6394641",
"0.63808316",
... | 0.67549074 | 8 |
included Override Module.included so that modules extending Module can define included. | def included( hooked_instance )
super if defined?( super )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def included(mod); end",
"def included(a_module)\n end",
"def include(mod)\n mod.included(self)\n end",
"def included(othermod) end",
"def included_modules() end",
"def included; end",
"def included_modules; end",
"def included_modules\n end",
"def included?\n @_included\n end",
... | [
"0.774958",
"0.7700335",
"0.76510525",
"0.7555904",
"0.7514503",
"0.74625325",
"0.74324864",
"0.74024594",
"0.7292493",
"0.72560894",
"0.71499944",
"0.71231526",
"0.70918006",
"0.6882734",
"0.68352604",
"0.6823955",
"0.6736286",
"0.6736286",
"0.6706164",
"0.6706164",
"0.66816... | 0.651915 | 32 |
extend_object Override Module.extended so that modules extending Module can define extend_object. | def extend_object( hooked_instance )
original_extend_object( hooked_instance )
super if defined?( super )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend_object(obj) end",
"def representer_module_for(object, *args)\n evaluate_option(:extend, object) # TODO: pass args? do we actually have args at the time this is called (compile-time)?\n end",
"def extended(object)\n super\n\n case object\n when Class\n raise RuntimeError... | [
"0.8195318",
"0.7320905",
"0.7275163",
"0.7273842",
"0.72107977",
"0.69822526",
"0.6912915",
"0.68997276",
"0.680728",
"0.680653",
"0.6763356",
"0.6682619",
"0.6562188",
"0.6475795",
"0.64347625",
"0.63667876",
"0.6320993",
"0.6162019",
"0.6150696",
"0.6064884",
"0.60126346",... | 0.7342474 | 1 |
extended Override Module.extended so that modules extending Module can define extended. | def extended( hooked_instance )
super if defined?( super )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extended_modules; end",
"def extended(a_module)\n end",
"def extend(mod)\n @modules << mod\n super(mod)\n end",
"def extended(*) end",
"def extended( instance )\n \n super if defined?( super )\n \n configuration_modules.each { |this_member| instance.extend( this_member )... | [
"0.8267796",
"0.811399",
"0.75415605",
"0.7526507",
"0.7282426",
"0.7185247",
"0.71126276",
"0.7076048",
"0.7071892",
"0.69632757",
"0.6788207",
"0.6709228",
"0.67009974",
"0.6562005",
"0.6377122",
"0.63437635",
"0.63381594",
"0.6266463",
"0.62174517",
"0.61916184",
"0.617973... | 0.646909 | 14 |
== INVENTORY METHOD ========================================= | def bind_items_to_survivors
InventoryItem.create(context[:items_attributes].map { |item|
{ survivor_id: context.survivor.id, item_id: item[:item_id], quantity: item[:quantity] }
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop_inv(inv, size) \n\n items = Array.new;\n\n # Populate with size\n case size\n when :pocket\n @book = Item.new([\"book\", \"novel\"], \"1984\", \"An Orwellian Nightmare\")\n @pen = Item.new([\"pen\", \"biro\"], \"4-Pen\", \"A four pen with red, green, blue and bla... | [
"0.6821982",
"0.66276956",
"0.6320307",
"0.6313477",
"0.62878585",
"0.6253014",
"0.6206846",
"0.61971015",
"0.6187541",
"0.61797774",
"0.61649215",
"0.6138619",
"0.6130737",
"0.6110542",
"0.6107317",
"0.6107317",
"0.609714",
"0.60952634",
"0.6090643",
"0.6085588",
"0.6083163"... | 0.0 | -1 |
Ensure supplied GitHub usernames are real | def test_github_profile_exists
people.each do |name, info|
github_username = info.fetch("github", false)
if github_username
assert_kind_of Sawyer::Resource, octokit.user(github_username), "#{github_username} is not a real GitHub account"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def username_exists?(github_username)\n !!User.all.find_by(github_username: github_username)\n end",
"def test_username_with_invalid_examples\n person = @valid_person\n invalid_usernames = %w{rails/rocks web2.0 javscript:something ME}\n invalid_usernames.each do |username|\n person.username = u... | [
"0.64287794",
"0.6357639",
"0.6189124",
"0.61513263",
"0.6128418",
"0.59871584",
"0.5966224",
"0.59537137",
"0.59128714",
"0.5866562",
"0.5853227",
"0.5853227",
"0.5822763",
"0.5805044",
"0.5790539",
"0.57476133",
"0.57420015",
"0.5684714",
"0.56837326",
"0.5681776",
"0.56736... | 0.6685057 | 0 |
Return the next lower item in the list. | def lower_item
return nil unless in_list?
acts_as_list_class.find(:first, :conditions =>
"position = #{(send(:position).to_i + 1).to_s}"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_item\n return nil unless in_list?\n lower_items(1).first\n end",
"def move_lower\n return if self == self_and_siblings(true).last\n move_to(position_in_list + 1)\n end",
"def find_lt(list, item, &block)\r\n\t\ti = bisect_left(list, item, &block)\r\n\t\tretu... | [
"0.7830517",
"0.728753",
"0.72604984",
"0.7019275",
"0.6981675",
"0.6970054",
"0.68971944",
"0.68971944",
"0.6853704",
"0.67496645",
"0.6717482",
"0.67153007",
"0.67058164",
"0.6630305",
"0.65746784",
"0.6537143",
"0.651084",
"0.6452789",
"0.64444345",
"0.6438452",
"0.6425565... | 0.7377293 | 1 |
Swap positions with the next higher item, if one exists. | def move_higher
return unless higher_item
acts_as_list_class.transaction do
higher_item.increment_position
decrement_position
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n if higher_item.current_position != current_position\n swap_positions_with(higher_item)\n else\n higher_item.increment_position\n decrement_position\n ... | [
"0.768778",
"0.75485796",
"0.75485796",
"0.7510956",
"0.7440676",
"0.6979976",
"0.67730665",
"0.6720234",
"0.66571563",
"0.66489387",
"0.6485785",
"0.63742876",
"0.63581955",
"0.63233906",
"0.6306851",
"0.6306851",
"0.6295075",
"0.62842023",
"0.627841",
"0.6263418",
"0.626341... | 0.752773 | 3 |
Move to the bottom of the list. If the item is already in the list, the items below it have their position adjusted accordingly. | def move_to_bottom
return unless in_list?
acts_as_list_class.transaction do
decrement_positions_on_lower_items
assume_bottom_position
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position\n end",
"def move_to_bottom\n return unless in_list?\n\n decrement_positions_on_lower_items\n assume_bottom_position \n end",
"def move_to_bottom\n ... | [
"0.89545804",
"0.89390266",
"0.8729667",
"0.8696749",
"0.8179114",
"0.8084895",
"0.7987429",
"0.7786934",
"0.7624863",
"0.7589462",
"0.7485386",
"0.73781663",
"0.71489966",
"0.7095753",
"0.7079211",
"0.70756894",
"0.7026675",
"0.69410986",
"0.6854394",
"0.6850265",
"0.6785297... | 0.8816438 | 2 |
Move to the top of the list. If the item is already in the list, the items above it have their position adjusted accordingly. | def move_to_top
return unless in_list?
acts_as_list_class.transaction do
increment_positions_on_higher_items
assume_top_position
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_to_top\n return unless in_list?\n\n increment_positions_on_higher_items\n assume_top_position\n end",
"def move_to_top\n return u... | [
"0.8963604",
"0.8963604",
"0.8709419",
"0.86347026",
"0.8564782",
"0.79207796",
"0.77833104",
"0.7370714",
"0.7115456",
"0.70733476",
"0.70612925",
"0.70531374",
"0.694561",
"0.6931347",
"0.68894947",
"0.6858711",
"0.68464035",
"0.68075615",
"0.68047327",
"0.67787117",
"0.674... | 0.8769221 | 2 |
Test if this record is in a list | def in_list?
!send(:position).nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_in(token, list)\n return false unless list\n list.include?(token[1])\n end",
"def includes?(data)\n list.includes?(data)\n end",
"def in_list?\n !not_in_list?\n end",
"def in?(*list)\n for item in list\n self === item and return true\n end... | [
"0.735059",
"0.7263366",
"0.72335136",
"0.70742536",
"0.6963092",
"0.6862043",
"0.68228",
"0.6734479",
"0.66829413",
"0.66368186",
"0.64990103",
"0.64718276",
"0.6413733",
"0.6407528",
"0.63881415",
"0.63881415",
"0.63848376",
"0.63733286",
"0.63656",
"0.63544965",
"0.6267211... | 0.6452956 | 12 |
Decrease the position of this item without adjusting the rest of the list. | def decrement_position
return unless in_list?
update_attribute :position, self.send(:position).to_i - 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrement_position\n return unless in_list?\n set_list_position(current_position - 1)\n end",
"def decrement_position\n return unless in_list?\n\n # self_class_all_or_in_collection.where(:pos => my_position).\n adjust_position!(-1)\n end",
"def decrement_p... | [
"0.78441364",
"0.7756966",
"0.77155715",
"0.7483058",
"0.7363868",
"0.7135145",
"0.7029498",
"0.694255",
"0.6940081",
"0.6910789",
"0.6874631",
"0.68350005",
"0.66091406",
"0.6557186",
"0.6520704",
"0.65114504",
"0.6485874",
"0.6408452",
"0.63783157",
"0.63783157",
"0.6366913... | 0.80463296 | 0 |
Returns the bottom position number in the list. bottom_position_in_list => 2 | def bottom_position_in_list(except = nil)
item = bottom_item(except)
item ? item.send(:position) : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_position_in_list\n return nil unless in_list?\n bottom_position_in_list\n end",
"def bottom_position_in_list(except = nil)\n item = bottom_item(except)\n item ? item.send(position_column) : 0\n end",
"def bottom_position_in_list(except = nil)\n item = botto... | [
"0.81155956",
"0.8079379",
"0.80280375",
"0.7928457",
"0.7911197",
"0.69945776",
"0.6879014",
"0.67420703",
"0.67404836",
"0.6604313",
"0.65601915",
"0.65463865",
"0.65017986",
"0.6450243",
"0.6329894",
"0.6293622",
"0.6293622",
"0.6283526",
"0.62620646",
"0.6239669",
"0.6200... | 0.8109231 | 1 |
Returns the bottom item | def bottom_item(except = nil)
conditions = "#{self.class.primary_key} != #{except.id}" if except
acts_as_list_class.find(:first, :conditions => conditions, :order => "#{:position} DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottom_item\n @current = last\n\n items\n end",
"def bottom_item(except = nil)\n except ? siblings.reject{|page| page == self }.last : siblings.last\n end",
"def bottom\n return @bottom\n end",
"def bottom\n @ole.Bottom\n end",
"def bottom\n @ole.... | [
"0.8642546",
"0.80459046",
"0.7966891",
"0.7739817",
"0.7739817",
"0.76541287",
"0.751771",
"0.7361369",
"0.73133516",
"0.7283584",
"0.7187465",
"0.71776414",
"0.71752954",
"0.71603096",
"0.71485853",
"0.7103811",
"0.7102432",
"0.706414",
"0.7038563",
"0.7030219",
"0.7024166"... | 0.7234649 | 10 |
Forces item to assume the bottom position in the list. | def assume_bottom_position
update_attribute(:position, bottom_position_in_list(self).to_i + 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assume_bottom_position\n set_list_position(bottom_position_in_list(self).to_i + 1)\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).to_i + 1 \n set_my_position(pos)\n end",
"def assume_bottom_position\n pos = bottom_position_in_list(self).t... | [
"0.8895148",
"0.8751973",
"0.872385",
"0.84182245",
"0.83475506",
"0.8330359",
"0.83057916",
"0.80619425",
"0.79133695",
"0.7763853",
"0.7697672",
"0.76956654",
"0.7365909",
"0.73552006",
"0.73487",
"0.7337892",
"0.7336568",
"0.73062414",
"0.7229807",
"0.720082",
"0.69901395"... | 0.8451492 | 3 |
Forces item to assume the top position in the list. | def assume_top_position
update_attribute(:position, 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assume_top_position\n set_list_position(acts_as_list_top)\n end",
"def move_to_top\n return unless in_list?\n acts_as_list_class.transaction do\n increment_positions_on_higher_items\n assume_top_position\n end\n end",
"def move_to_top\... | [
"0.84269834",
"0.82675207",
"0.82260305",
"0.8187087",
"0.8187087",
"0.7804485",
"0.77915674",
"0.7559511",
"0.75136405",
"0.74292815",
"0.74292815",
"0.7241875",
"0.7085184",
"0.6894807",
"0.6806887",
"0.6767487",
"0.6756102",
"0.6746853",
"0.6664958",
"0.66403157",
"0.66402... | 0.74106985 | 11 |
This has the effect of moving all the lower items up one. | def decrement_positions_on_lower_items
return unless in_list?
acts_as_list_class.update_all(
"#{:position} = (#{:position} - 1)", "#{:position} > #{send(:position).to_i}"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n end",
"def move_lower\n low_item = lower_item\n return unless low_item\n\n low_item.decrement_position\n increment_position\n en... | [
"0.8017883",
"0.8017883",
"0.79280317",
"0.7623656",
"0.7591928",
"0.7574836",
"0.7452978",
"0.7427453",
"0.73179835",
"0.73155963",
"0.7238273",
"0.7236713",
"0.7190494",
"0.7190494",
"0.7165726",
"0.7165582",
"0.71362764",
"0.7101295",
"0.7091394",
"0.7091394",
"0.7044215",... | 0.7304567 | 10 |
This has the effect of moving all the higher items down one. | def increment_positions_on_higher_items
return unless in_list?
acts_as_list_class.update_all(
"#{:position} = (#{:position} + 1)", "#{:position} < #{send(:position).to_i}"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_higher\n return unless higher_item\n\n acts_as_list_class.transaction do\n higher_item.increment_position\n decrement_position\n end\n end",
"def move_higher\n high_item = higher_item\n return unless high_item\n\n high_item.inc... | [
"0.82816607",
"0.82685244",
"0.82685244",
"0.815027",
"0.794733",
"0.79036486",
"0.7872906",
"0.74482703",
"0.7392774",
"0.7359648",
"0.7359648",
"0.72972417",
"0.72765803",
"0.7203857",
"0.72002316",
"0.71914345",
"0.714911",
"0.7128582",
"0.71229905",
"0.7097113",
"0.704291... | 0.680853 | 28 |
Parse value, if necessary | def object
@object ||= case @library
when :nokogiri then parse_nokogiri(value)
when :rexml then parse_rexml(value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_value; end",
"def parse_value(value)\n if value.is_a?(String)\n if value.to_i.to_s == value\n value.to_i\n elsif value.to_f.to_s == value\n value.to_f\n elsif value.gsub(/^\\s+|\\s+$/, '') == '' || value == '(Not Specified)'\n nil\n elsif /^\\... | [
"0.8314484",
"0.722614",
"0.72228366",
"0.72040856",
"0.7171283",
"0.70247275",
"0.6937803",
"0.6806457",
"0.6776627",
"0.67737776",
"0.6739892",
"0.67258364",
"0.6588984",
"0.65740097",
"0.65112966",
"0.65027463",
"0.64995927",
"0.64725477",
"0.64668965",
"0.6441344",
"0.643... | 0.0 | -1 |
XML Equivalence. XML Literals can be compared with each other or with xsd:strings | def eql?(other)
if other.is_a?(Literal::XML)
case @library
when :nokogiri then equivalent_nokogiri(other)
when :rexml then equivalent_rexml(other)
end
elsif other.is_a?(Literal) && (other.plain? || other.datatype == RDF::XSD.string)
value == other.value
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equivalent_rexml(other)\n begin\n require 'active_support'\n require 'active_support/core_ext'\n rescue LoadError\n # string equivalence\n end\n\n if Hash.respond_to?(:from_xml)\n Hash.from_xml(\"<root>#{self}</root>\") == Hash.from_xml(\"<root>#{other}</root>\")... | [
"0.70666987",
"0.69580764",
"0.6945802",
"0.68708915",
"0.67834777",
"0.64853346",
"0.642785",
"0.63423467",
"0.6318661",
"0.6158912",
"0.6108669",
"0.5952487",
"0.58695203",
"0.5854799",
"0.58479977",
"0.58113885",
"0.58005613",
"0.5781364",
"0.5747349",
"0.5728704",
"0.5666... | 0.67453015 | 5 |
Use equivalentxml to determine equivalence | def equivalent_nokogiri(other)
if defined?(::EquivalentXml)
EquivalentXml.equivalent?(object, other.object)
else
equivalent_rexml(other)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equivalent_rexml(other)\n begin\n require 'active_support'\n require 'active_support/core_ext'\n rescue LoadError\n # string equivalence\n end\n\n if Hash.respond_to?(:from_xml)\n Hash.from_xml(\"<root>#{self}</root>\") == Hash.from_xml(\"<root>#{other}</root>\")... | [
"0.7360179",
"0.70576596",
"0.6480727",
"0.6468421",
"0.64491636",
"0.6258976",
"0.62296516",
"0.598884",
"0.5913244",
"0.5804363",
"0.57848096",
"0.5780509",
"0.5732317",
"0.5587081",
"0.5512715",
"0.54148257",
"0.5400435",
"0.53641295",
"0.5327247",
"0.5314293",
"0.52894455... | 0.733993 | 1 |
Parse the value either as a NodeSet, as results are equivalent if it is just a node | def parse_rexml(value)
REXML::Document.new("<root>#{value}</root>").root.children
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_value(nodes); end",
"def parse_set\n @current_set = Set.new\n @current_match.add_set @current_set\n end",
"def _set_value(value)\n if value.is_a? Array\n value.map do |v|\n v.is_a?(Taverna::Baclava::Node) ? v : Node.new(v)\n end\n else\n ... | [
"0.66734195",
"0.5850223",
"0.5667307",
"0.5488531",
"0.5221209",
"0.52194256",
"0.5207817",
"0.5159564",
"0.5138471",
"0.5100816",
"0.50731546",
"0.50714356",
"0.5069714",
"0.5021881",
"0.5014765",
"0.5013516",
"0.49961022",
"0.49947268",
"0.4994703",
"0.49702662",
"0.496474... | 0.4551201 | 74 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.