query stringlengths 7 9.5k | document stringlengths 10 1.07M | negatives listlengths 19 19 | metadata dict |
|---|---|---|---|
Change equals to handle computed branch_path | def eql?(obj)
super(obj) && (obj.branch_path_context == branch_path_context)
end | [
"def getBranchPath( branch )\n path = \"#{$rootPath}/#{branch['path']}\"\n child?($rootPath, path) # security check\n path\nend",
"def branch_key(branch_name)\n return @branch_key_override.call(self, branch_name) if (branch_name && @branch_key_override)\n\n # replace any equals and subsequent text wi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Redefine add_associated_object from Sequel associations.rb Add option join_class to return added object with many_to_many relations | def add_associated_object(opts, o, *args)
klass = opts.associated_class
if o.is_a?(Hash) && opts[:join_class].nil?
o = klass.new(o)
elsif o.is_a?(Integer) || o.is_a?(String) || o.is_a?(Array)
o = klass.with_pk!(o)
elsif !o.is_a?(klass)
raise(Se... | [
"def make_add_associated_object(opts, o)\n klass = opts.associated_class\n\n case o\n when Hash\n klass.new(o)\n when Integer, String, Array\n klass.with_pk!(o)\n when klass\n o\n else \n raise(Sequel::Error, \"associa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Define lesson plan component for the check whether the component is defined. | def component
current_component_host[:course_lesson_plan_component]
end | [
"def check_course_switch; end",
"def component!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 40 )\n\n\n\n type = COMPONENT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the total duration of all sessions contained within. | def duration
@sessions.map(&:duration).reduce(&:+)
end | [
"def ux_session_duration(session)\n return formatTime( session.duration)\n end",
"def total_duration\n self.inject(0) do |accum,trip|\n accum += trip.duration\n accum\n end\n end",
"def time_online\n seconds = 0\n users.select(:id, :time_online).each do |user|\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show the last privacy policy | def last_policy
@last_policy = Privacypolicy.where(:online => true).order(:publication_time).last
if @last_policy.nil?
flash[:danger] = "Le site n'a actuellement aucune politique de confidentalité."
redirect_to root_path
else
redirect_to @last_policy
end
end | [
"def new\n last_policy = Privacypolicy.where(:online => true).order(:publication_time).last\n Privacypolicy.create(:publication_time => DateTime.now, :online => false, :description => \" - À écrire - \", :content => (!last_policy.nil? ? last_policy.content : \" - À écrire - \"))\n redirect_to privacypolici... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a privacy policy (automatic from the last one) | def new
last_policy = Privacypolicy.where(:online => true).order(:publication_time).last
Privacypolicy.create(:publication_time => DateTime.now, :online => false, :description => " - À écrire - ", :content => (!last_policy.nil? ? last_policy.content : " - À écrire - "))
redirect_to privacypolicies_path
en... | [
"def create\n @privacy_policy = PrivacyPolicy.new(privacy_policy_params)\n\n respond_to do |format|\n if @privacy_policy.save\n format.html { redirect_to @privacy_policy, notice: 'Privacy policy was successfully created.' }\n format.json { render :show, status: :created, location: @privacy_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update a privacy policy or its description (send the form) | def update
if @privacypolicy.update_attributes(params.require(:privacypolicy).permit(:description, :content))
flash[:success] = "Modification enregistrée."
redirect_to privacypolicies_path
else
if params[:privacypolicy][:description].nil?
render 'edit'
else
render 'edit_d... | [
"def update\n respond_to do |format|\n if @privacy_policy.update(privacy_policy_params)\n format.html { redirect_to @privacy_policy, notice: 'Privacy policy was successfully updated.' }\n format.json { render :show, status: :ok, location: @privacy_policy }\n else\n format.html { re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Delete a privacy policy | def destroy
@privacypolicy.destroy
flash[:success] = "Politique de confidentialité supprimée."
redirect_to privacypolicies_path
end | [
"def destroy\n @privacy_policy = PrivacyPolicy.find(params[:id])\n @privacy_policy.destroy\n\n respond_to do |format|\n format.html { redirect_to privacy_policies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pages_privacy_policy = Pages::PrivacyPolicy.find(param... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Put a privacy policy online | def put_online
@privacypolicy.online = true
@privacypolicy.publication_time = DateTime.now
@privacypolicy.save
User.all.each do |u|
u.last_policy_read = false
u.save
end
redirect_to @privacypolicy
end | [
"def add_privacy\n if self.published?\n self.update_attributes(:privacy => \"public\")\n end\n end",
"def save_privacy_waiver\n _set_setting('waiver', true)\n end",
"def set_policy\n end",
"def putPolicy\n\n end",
"def new\n last_policy = Privacypolicy.where(:online => true).order... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET METHODS Get the privacy policy | def get_policy
@privacypolicy = Privacypolicy.find_by_id(params[:id])
return if check_nil_object(@privacypolicy)
end | [
"def privacy\n\n end",
"def privacy\n end",
"def privacy\n @api_v1_pages = Api::V1::Page.where('title = \"privacy\"').first\n\n render json: @api_v1_pages\n end",
"def index\n @privacy_policies = PrivacyPolicy.all\n end",
"def get_privacy_notice\n return self.public == true ? \"Public\" : \"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the privacy policy (v2) | def get_policy2
@privacypolicy = Privacypolicy.find_by_id(params[:privacypolicy_id])
return if check_nil_object(@privacypolicy)
end | [
"def get_policy\n @privacypolicy = Privacypolicy.find_by_id(params[:id])\n return if check_nil_object(@privacypolicy)\n end",
"def privacy_profile\n return @privacy_profile\n end",
"def policy\n Organization.get_typed_organization(organization).get_policy\n end",
"def get_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
CHECK METHODS Check that the privacy policy is offline | def is_offline
return if check_online_object(@privacypolicy)
end | [
"def is_online\n return if check_offline_object(@privacypolicy)\n end",
"def verify_permissions\n user.has_permission? :offline_access\n rescue \n @errors = $!\n false\n end",
"def check_offline_object(object)\n if !object.online\n render 'errors/access_refused' and return true\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check that the privacy policy is online | def is_online
return if check_offline_object(@privacypolicy)
end | [
"def is_offline\n return if check_online_object(@privacypolicy)\n end",
"def is_privacy_policy?\n if !get_option( 'wp_page_for_privacy_policy' ).blank? && is_page?( get_option( 'wp_page_for_privacy_policy' ) )\n true\n else\n false\n end\n end",
"def private?\n (@restriction != nil &&... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets metrics before returning next host | def next
next_host.tap do |_|
set_metrics!
end
end | [
"def init_metrics\n @metric_names.each do |metric|\n @metrics[metric.to_s] = 0\n end\n\n host_ids = @doc.xpath('//HOSTS/ID').map { |node| node.content }\n host_ids.each do |id|\n host = @hosts[id.to_sym]\n\n @metric_names.each do |metric|\n @metrics[metric.to_sym] ||= 0\n ho... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the next available host. Returns a Gitlab::Database::LoadBalancing::Host instance, or nil if no hosts were available. | def next_host
@mutex.synchronize do
break if @hosts.empty?
started_at = @index
loop do
host = @hosts[@index]
@index = (@index + 1) % @hosts.length
break host if host.online?
# Return nil once we have cycled through... | [
"def try_next_host\n DECISION_TRY_NEXT_HOST\n end",
"def next_ip\n return nil if (host = next_host).nil?\n host[:address]\n end",
"def next_host\n return jobs_running.size < maxjobs if runopts(:type) != 'ssh'\n\n allk = (0..nodelist.size - 1).to_a\n busyk = jobs_running.map { |k| k[:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get farthest coordinates out from a convex curve. | def find_farthest_points(vertices_hash)
@positive_x = center.x + radius
@positive_y = center.y + radius
# In case the convexity is pointing down the negative direction of the x or y axis.
@negative_x = center.x - radius
@negative_y = center.y - radius
end | [
"def lowest_point_on_hull\n lastPointOnHull = Clue.new(:long => 0, :lat => -Float::MAX )\n clues.find(:all, :conditions => {:on_path => true}).each do |clue|\n if (clue.on_path && (clue.y > lastPointOnHull.y))\n lastPointOnHull = clue\n end \n end\n return lastPointOnHull\n end",
"d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /movement_proof_details GET /movement_proof_details.json | def index
@movement_proof_details = MovementProofDetail.all
end | [
"def create\n @movement_proof_detail = MovementProofDetail.new(movement_proof_detail_params)\n\n respond_to do |format|\n if @movement_proof_detail.save\n format.html {redirect_to @movement_proof_detail, notice: 'Movement proof detail was successfully created.'}\n format.json {render :show,... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /movement_proof_details POST /movement_proof_details.json | def create
@movement_proof_detail = MovementProofDetail.new(movement_proof_detail_params)
respond_to do |format|
if @movement_proof_detail.save
format.html {redirect_to @movement_proof_detail, notice: 'Movement proof detail was successfully created.'}
format.json {render :show, status: :c... | [
"def create\n @movement_proof = MovementProof.new(movement_proof_params)\n respond_to do |format|\n if @movement_proof.save\n format.html {redirect_to @movement_proof, notice: 'Movement proof was successfully created.'}\n format.json {render :show, status: :created, location: @movement_proo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /movement_proof_details/1 PATCH/PUT /movement_proof_details/1.json | def update
respond_to do |format|
if @movement_proof_detail.update(movement_proof_detail_params)
format.html {redirect_to @movement_proof_detail, notice: 'Movement proof detail was successfully updated.'}
format.json {render :show, status: :ok, location: @movement_proof_detail}
else
... | [
"def update\n respond_to do |format|\n if @movement_proof.update(movement_proof_params)\n format.html {redirect_to @movement_proof, notice: 'Movement proof was successfully updated.'}\n format.json {render :show, status: :ok, location: @movement_proof}\n else\n format.html {render ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /movement_proof_details/1 DELETE /movement_proof_details/1.json | def destroy
@movement_proof_detail.destroy
respond_to do |format|
format.html {redirect_to movement_proof_details_url, notice: 'Movement proof detail was successfully destroyed.'}
format.json {head :no_content}
end
end | [
"def destroy\n @movement_proof.destroy\n respond_to do |format|\n format.html {redirect_to movement_proofs_url }\n format.json {head :no_content}\n format.js { render :layout => false }\n end\n end",
"def destroy\n @detail_movement.destroy\n respond_to do |format|\n format.html... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /client_users/1 DELETE /client_users/1.json | def destroy
@client_user.destroy
respond_to do |format|
format.html { redirect_to client_users_url, notice: 'Client user was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @client_user = ClientUser.find(params[:id])\n @client_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_users_url) }\n format.xml { head :ok }\n end\n end",
"def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /dtc_staffs GET /dtc_staffs.json | def index
@dtc_staffs = DtcStaff.all
end | [
"def index\n @staffs = Staff.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @staffs }\n end\n end",
"def index\n @daw_staffs = DawStaff.all\n end",
"def index\n @service_staffs = ServiceStaff.all\n end",
"def index\n @staffs = Staff.al... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /dtc_staffs/1 DELETE /dtc_staffs/1.json | def destroy
@dtc_staff.destroy
respond_to do |format|
format.html { redirect_to dtc_staffs_url }
format.json { head :no_content }
end
end | [
"def destroy\n @staff = Staff.find(params[:id])\n @staff.destroy\n\n respond_to do |format|\n format.html { redirect_to staffs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @admin_staff = Admin::Staff.find(params[:id])\n @admin_staff.destroy\n\n respond_to do |forma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Runs a script on target server, and stores the (stripped) STDOUT into settings. Usage: server.capture_value "salted password", script("convert_salted_password", "PASSWORD" => settings.bosh.password), :settings => "bosh.salted_password" Would store the returned STDOUT into settings[:bosh][:salted_password] | def capture_value(description, script, options)
@commands << RemoteScriptCommand.new(
"capture value", description, script,
"captures value of #{description}", "captured value of #{description}", options)
end | [
"def run_script(command, script, options={})\n ssh_username = options[:ssh_username] || default_ssh_username\n run_as_root = options[:run_as_root]\n settings = options[:settings]\n settings_key = options[:save_output_to_settings_key]\n\n remote_path = remote_tmp_script_path(command)\n upload_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The nested builder object. | def nested_builder(attributes, options)
Nested::One.new(self, attributes, options)
end | [
"def builder\n @builder ||= Builder.new(self)\n end",
"def builder\n @builder || self.builder!\n end",
"def builder\n ::JSON::SchemaDsl::Builder.define_builder(self)\n end",
"def nested_builder(attributes, options)\n relation.nested_builder(self, attributes, options)... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns all files declaring the object in the form of an Array of Arrays containing the location of their declaration. | def files
return [] unless meta?
filename = meta['path'] + '/' + meta['filename']
[
Inch::Utils::CodeLocation.new('', filename, meta['lineno'])
]
end | [
"def filepaths\n object.object_files.map(&:relative_path)\n end",
"def all_object_files\n digital_objects.map(&:object_files).flatten\n end",
"def files()\n\t\t\t\tlist = []\n\t\t\t\tdir = Dir.new( path() )\n\t\t\t\t\n\t\t\t\tdir.each do |f|\n\t\t\t\t\tnext if File.directory?( path() + \"/\" + f )\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns boolean of comparison true only if key == 'other' | def is_other?
key == 'other'
end | [
"def ==(other)\n return false unless self.class == other.class\n return self.key == other.key\n end",
"def filter_key?(key); end",
"def eql?(other)\n return false unless self.class == other.class\n self.key_attributes == other.key_attributes\n end",
"def ==(x)\n if x.key.dat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Uploads a file from the local system to iTunes U. | def upload_file(file_path, itunes_location)
# url = URI.parse(self.upload_url_for_location(itunes_location))
# req = Net::HTTP::Post::Multipart.new(url.path, {"file" => UploadIO.new(file_path, "image/jpeg")})
# res = Net::HTTP.start(url.host, url.port) do |http|
# http.request(req)
# end... | [
"def upload_media_file( wikipath, filename, raw )\n p filename\n headers = {\n 'Content-Type' => 'application/octet-stream',\n 'X-File-Name' => filename\n }\n url = upload_url( wikipath, filename )\n p url\n wait_second\n pp @agent.post( url, raw, headers )\n sa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retrieves and parses iTunesU usage logs. Options: +:from+:: Specifies the date to retrieve logs from. Defaults to +Date.today+ +:to+:: (optional) Specifies the ending date of a date range: (:from)..(:to). +:parse+:: Controls whether logs are parsed or returned raw. Example: connection.get_logs Retrieves and parses logs... | def get_logs(opt={})
opt[:from] ||= Date.today
#opt[:to] ||= Date.today - 1
opt[:parse] = opt[:parse].nil? ? true : opt[:parse]
#raise ":from date must preceed :to date." if opt[:to] && opt[:to] < opt[:from]
uri_str = "#{API_URL}/GetDailyReportLogs/#{options[:site]}?#{self.ge... | [
"def get_logs(opts = {})\n @transporter.read(:GET, '/1/logs', {}, opts)\n end",
"def get_all_logs(date_range_start, date_range_end, search = '', log_level = '',\n logger_assembly = '', user_id = 0, message_group_id = 0,\n include_traces = nil, org_unit_id = 0, bookmark ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
walk through garden to find 'W' | def walk_through
count = 0
for i in 0..@n-1
for j in 0..@m-1
if @garden[i][j] == 'W'
@garden[i][j] = 'C'
count += 1
check_around(i,j)
end
end
end
puts count
end | [
"def wedge\n dinucleotide_lookup(@@WEDGE)\n end",
"def scan_for_w(token); end",
"def walks\n Walk.all.select {|walk_instance| walk_instance.dog_walker == self}\n end",
"def warner\n Dynamic[:warner]\n end",
"def walk\n return false if (@captives > 0 and captives_close and warrior.feel(get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Creates a role within the given client. it will be visible in tokens given by this client during authentication, as it is already in scope. | def create_role(client:, **data)
create_object(type: 'Role', root: url_for(client), data: data)
end | [
"def create_role(auth, server_id, name, color, hoist, mentionable, permissions, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_roles,\n server_id,\n :post,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/roles\",\n { color: color, name: name, hoist... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Computes the Keccak256 hash of the given data. | def keccak256(data)
Digest::SHA3.new(256).digest(data)
end | [
"def sha256 key, data\n OpenSSL::HMAC.digest('sha256', key, data)\n rescue RuntimeError\n require 'hmac-sha2'\n HMAC::SHA256.digest(key, data)\n end",
"def sha256(data)\n Digest::SHA256.hexdigest(data)\n end",
"def hex_and_hash(data)\n Digest::SHA256.hexdigest(data)\n end",
"def hexdige... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the address corresponding to the given public key. | def public_key_to_address(public_key_bin)
Secp256k1::Util.bin_to_hex(keccak256(public_key_bin[1..-1])[-20..-1])
end | [
"def accounts_get_public_key address\n params = { :address => address }\n public_key = @client.query_get \"accounts/getPublicKey\", params\n end",
"def public_key_to_address(public_key_bin)\n Secp256k1::Util.bin_to_hex(keccak256(public_key_bin[1..-1])[-20..-1])\n end",
"def address(network: nil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Produce a signature with legacy v values. | def sign_legacy(private_key)
ctx = Secp256k1::Context.new
signature, recovery_id = ctx.sign_recoverable(private_key, hash).compact
result = signature.bytes
result = result.append(27 + recovery_id)
result.pack('c*')
end | [
"def signed_version=(_arg0); end",
"def sign_legacy(private_key)\n ctx = Secp256k1::Context.new\n signature, recovery_id = ctx.sign_recoverable(private_key, hash).compact\n result = signature.bytes\n result = result.append(27 + recovery_id)\n result.pack('c*')\n end",
"def update_sig... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the keccak256 hash of the message. Applies the expected prefix for personal messages signed with Ethereum keys. | def hash
keccak256(prefixed_message)
end | [
"def hash\n keccak256(prefixed_message)\n end",
"def message_hash(message, prefix: Bitcoin.chain_params.message_magic)\n Bitcoin.double_sha256(Bitcoin.pack_var_string(prefix) << Bitcoin.pack_var_string(message))\n end",
"def keccak256(data)\n Digest::SHA3.new(256).digest(data)\nend",
"def min... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Recover public key for this recoverable signature. | def recover_public_key(message)
ctx = Secp256k1::Context.new
recovery_id = Chains.to_recovery_id(@v, @chain_id)
recoverable_signature = ctx.recoverable_signature_from_compact(@signature, recovery_id)
public_key_bin = recoverable_signature.recover_public_key(message.hash).uncompressed
public_key_to_... | [
"def recover_public_key(message)\n ctx = Secp256k1::Context.new\n recovery_id = Chains.to_recovery_id(@v, @chain_id)\n\n recoverable_signature = ctx.recoverable_signature_from_compact(@signature, recovery_id)\n public_key_bin = recoverable_signature.recover_public_key(message.hash).uncompressed\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /routed_generics/1 DELETE /routed_generics/1.json | def destroy
@routed_generic.destroy
respond_to do |format|
format.html { redirect_to routed_generics_url, notice: 'Combination dose was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @dis_routed_generic.destroy\n respond_to do |format|\n format.html { redirect_to dis_routed_generics_url, notice: 'Dis routed generic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @generic.destroy\n respond_to do |format|\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /creditos/1 DELETE /creditos/1.json | def destroy
@credito = Credito.find(params[:id])
@credito.destroy
respond_to do |format|
format.html { redirect_to creditos_url }
format.json { head :no_content }
end
end | [
"def destroy\n @credit = Credit.find(params[:id])\n @credit.destroy\n \n respond_to do |format|\n format.html { redirect_to credits_url }\n format.json { head :ok }\n end\nend",
"def destroy\n @credit = Credit.find(params[:id])\n @credit.destroy\n\n respond_to do |format|\n format.html { ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the Gravatar for the given pod. | def gravatar_for(pod)
gravatar_id = Digest::MD5::hexdigest(pod.description.downcase)
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}"
image_tag(gravatar_url, alt: user.id, class: "gravatar")
end | [
"def gravatar_profile\n if self.use_gravatar\n \"http://gravatar.com/#{gravatar_id}\"\n end\n end",
"def gravatar\n anchor_title = \"#{source.username} GitHub Profile\"\n github_url = GitHub.profile_page(source.username)\n gravatar_url = Gravatar.url(source.gravatar_id)\n\n h.link_to(githu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Stages +obj+ in the collection of persisted objects for this class. This method does not commit, so the object will not be committed until client code calls Maglevcommit_transaction. | def stage(obj)
Maglev::PERSISTENT_ROOT[self][obj.__id__] = obj
end | [
"def put(obj)\n obj.updated_at = DateTime.now if field_declared?(:updated_at,obj.class)\n DataStore.write_yaml(obj)\n @@store.resources[obj.model].each do |o|\n o[1] = obj if o[0] == obj.id\n end\n true\n end",
"def perform(object_states)\n ActiveRecord::Base.transaction do\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Is this boot image a recovery image, or booted into recovery mode by the device firmware? | def is_recovery?()
# Check in /etc/boot/config for `is_recovery`, it's assumed to be set, and
# true, for recovery builds.
Configuration["is_recovery"] or firmware_wants_recovery?
end | [
"def reboot_requested?\n reboot_info.size > 0\n end",
"def is_rebooting?()\n reboot_detect_script = VagrantWindows.load_script('reboot_detect.ps1')\n @machine.communicate.execute(reboot_detect_script, :error_check => false) != 0\n end",
"def booted?\n !!@booted\n end",
"def re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Is the normal boot flow interrupted by a key input? | def boot_interrupted?()
Evdev.keys_held(KEYS)
end | [
"def trap_key; end",
"def waitForKeyPress\n print \"Press any key to continue\"\n got = STDIN.getch\n # Extra space to overwrite in case next output is short\n print \" \\r\"\n \n # Cancel on CTRL-C\n if got == \"\\x03\"\n puts \"Got interrupt key, quitting\"\n exit 1\n end\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
(re)generate connections for all members of an organisation | def generate_all_connections!
organisation_level_connections = []
self.has_members.each do |member_uri|
member = Person.find(member_uri)
organisation_level_connections << member.get_connections!
end
organisation_level_connections.flatten
end | [
"def write_connections(connections)\n\n # write the connections on this Person\n Person.write_connections_on(self, connections)\n\n connections.each do |conn|\n other_person = Person.find(conn)\n Person.write_connections_on(other_person, self.uri.to_s)\n Organisation.write_link(self.member_o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get all orgs in a country and return their uri and label | def all_organisations_in_country(country)
sparql = "
SELECT DISTINCT ?uri ?label
WHERE
{
VALUES ?country { \"#{country}\" }
GRAPH <http://data.artsapi.com/graph/organisations> {
?uri <http://data.artsapi.com/def/arts/locationCountry> ?country .
?uri <http://w... | [
"def country\n query = create_query(\n :Location, :regexp_search, regexp: \"#{params[:country]}$\"\n )\n show_selected_locations(query, link_all_sorts: true)\n end",
"def find_all\n rsp = @fotolia.remote_call('getCountries', @fotolia.language.id)\n\n rsp.collect{|c| Fotolia::Country.new(c... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get all orgs in a city and return their uri and label | def all_organisations_in_city(city)
sparql = "
SELECT DISTINCT ?uri ?label
WHERE
{
VALUES ?city { \"#{city}\" }
GRAPH <http://data.artsapi.com/graph/organisations> {
?uri <http://data.artsapi.com/def/arts/locationCity> ?city .
?uri <http://www.w3.org/2000/01/... | [
"def all_cities_by_artist\n all_galleries_by_artist.map do |gallery|\n gallery.city\n end\n end",
"def cities(parameters = {})\n query(:cities, parameters)['geonames']\n end",
"def cities\n self.class.get(\"/v1/cities\")\n end",
"def print_org_by_city(city)\n response = RestClient.get\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get all orgs in a sector and return their uri and label expects a uri as input | def all_organisations_in_sector(sector)
sparql = "
SELECT DISTINCT ?uri ?label
WHERE
{
VALUES ?sector { <#{sector}> }
GRAPH <http://data.artsapi.com/graph/organisations> {
?uri <http://data.artsapi.com/def/arts/sector> ?sector .
?uri <http://www.w3.org/2000/0... | [
"def location\n location = gcmd.locations? ? gcmd.locations : []\n\n polar = {\"Location_Category\" => \"GEOGRAPHIC REGION\", \"Location_Type\" => \"POLAR\"}\n arctic = {\"Location_Category\" => \"GEOGRAPHIC REGION\", \"Location_Type\" => \"ARCTIC\"}\n\n (placenames||[]).each do | p |\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the default value for the attribute +attr+. If no default value has been set, +nil+ is returned. | def default_value(attr)
@defaults ||= {}
@defaults[attr.to_sym]
end | [
"def getDefaultValue\n\t\t\t\n\t\t\t\t\treturn @defaultValue\n\t\t\t\n\t\t\t\tend",
"def get_attr(at, default=nil)\n if @data.nil?\n return default\n end\n \n return @data[at] || default\n end",
"def _attribute_default(attribute_name)\n default = self.class.attributes[attribut... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enumerates all known enumeration members. | def each
@enumvalues ||= {}
@enumvalues.each_value { |enumvalue| yield enumvalue }
end | [
"def reflect_on_all_enumerations\n _enumerations\n end",
"def enums(&block)\n values = get_enums\n if block\n values.each do |v|\n yield v\n end\n else\n values\n end\n end",
"def enums\n inject_block(:name, :value)\n end",
"def all_values\n _acts_as_e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds a new enumeration member to the current enumeration. The generated member is accessible using the constant +name+. If +value+ is +nil+, it is set to the highest integer value in use \+ 1. | def enum(name, value = nil, attributes = {})
@enumvalues ||= {}
value ||= (@enumvalues.values.max || -1) + 1
enumvalue = allocate
const_set(name, enumvalue)
@enumvalues[value] = enumvalue
_setup_enumvalue(name, value, enumvalue, attributes)
end | [
"def add_member(name)\n @members[name] = 0.0\n end",
"def add_value(name, value)\n\t\tend",
"def add_enum_value(type_name, value, options = {})\n before, after = options.values_at(:before, :after)\n sql = +\"ALTER TYPE #{quote_table_name(type_name)} ADD VALUE '#{value}'\"\n\n if before ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /code_snippets POST /code_snippets.json | def create
@code_snippet = @language.code_snippets.new(code_snippet_params)
respond_to do |format|
if @code_snippet.save
format.html { redirect_to [@language,@code_snippet], notice: 'Code snippet was successfully created.' }
format.json { render :show, status: :created, location: @code_sn... | [
"def create\n @code_snippet = CodeSnippet.new(code_snippet_params)\n\n respond_to do |format|\n if @code_snippet.save\n format.html { redirect_to @code_snippet, notice: 'Code snippet was successfully created.' }\n format.json { render :show, status: :created, location: @code_snippet }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
array The Array that will be filtered. filter The Integer/String that will be used as filter. Examples filter([5,1,34,5,74], 5) => [5,5] Returns the absolute number of input. | def filter(array, filter)
i = 0
output = []
while i < array.length
if array[i] == filter
output << array[i]
end
i += 1
end
return output
end | [
"def filter(filter)\n merged_filter = merge_filter_with_prefilter(filter)\n return create_filtered_object_array(@parent, @array_rel_path, @array_length_property_name, merged_filter)\n end",
"def subtract(arr, filter)\n\n a = arr.length - 1\n f = filter.length - 1\n \n while a >= 0\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if the model accepts this strategy as token authenticatable. | def token_authenticatable?
mapping.to.http_authenticatable?(:token_options)
end | [
"def valid_for_token_auth?\n token_authenticatable? && auth_token.present? && with_authentication_hash(:token_auth, token_auth_hash)\n end",
"def user_token_authenticable?\n # This ensures the token can be used only for JSON requests:\n return false unless request.format.json?\n return false ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if this is strategy is valid for token authentication by: Validating if the model allows http token authentication; If the http auth token exists; If all authentication keys are present; | def valid_for_token_auth?
token_authenticatable? && auth_token.present? && with_authentication_hash(:token_auth, token_auth_hash)
end | [
"def valid_for_http_auth?\n http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)\n end",
"def is_token_valid\n # entry point\n url = \"#{@client.app_info[:launcher_server]}#{API_VERSION}/auth\"\n\n # api call\n uri = URI(url)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Replace references (like `!123` for merge requests) in text with links to the referenced object's details page. text String text to replace references in. pattern Reference pattern to match against. link_text Original content of the link being replaced. Returns a String with references replaced with links. All links ha... | def object_link_filter(text, pattern, link_text: nil)
references_in(text, pattern) do |match, id, project_ref, matches|
project = project_from_ref(project_ref)
if project && object = find_object(project, id)
title = object_link_title(object)
klass = reference_class(o... | [
"def object_link_filter(text, pattern, link_content: nil, link_reference: false)\n references_in(text, pattern) do |match, id, project_ref, namespace_ref, matches|\n parent_path = if parent_type == :group\n reference_cache.full_group_path(namespace_ref)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
names and ids of employees related to current customer through ratings | def related_employees
ratings.employees
end | [
"def customer_related_employees\n if customer\n customer.related_employees\n else\n Rating.employees\n end\n end",
"def related_customers\n ratings.customers\n end",
"def index\n @employee_reviewers = EmployeeReviewer.all\n end",
"def getFullNameEmployees\n\n @employ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Output a metatag for use in your site header. The key you supply is looked up in the configuration under 'meta_data'. You can override it on a peritem basis. Usage: This will output: | def meta_tag(key)
value = @item[key] || @config[:meta_data][key]
if key == :author && value[0] == "@" && author_full_name = item[:author_full_name]
value = %Q{#{author_full_name} (#{value})}
end
return '<meta name="%s" content="%s">' % [key, value] if value
end | [
"def meta_tag(key)\n value = @item[key] || @site.config[:meta_data][key]\n '<meta name=\"%s\" content=\"%s\">' % [h(key), h(value)] if value\nend",
"def meta_tag(key)\n value = @item[key] || @config[:site][key]\n '<meta name=\"%s\" content=\"%s\">' % [h(key), h(value)] if value\nend",
"def meta_key\n @... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the supportsDeviceLicensing property value. Whether the program supports the device licensing type. | def supports_device_licensing
return @supports_device_licensing
end | [
"def supports_device_licensing=(value)\n @supports_device_licensing = value\n end",
"def supports_user_licensing\n return @supports_user_licensing\n end",
"def use_device_licensing\n return @use_device_licensing\n end",
"def support... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the supportsDeviceLicensing property value. Whether the program supports the device licensing type. | def supports_device_licensing=(value)
@supports_device_licensing = value
end | [
"def use_device_licensing=(value)\n @use_device_licensing = value\n end",
"def supports_user_licensing=(value)\n @supports_user_licensing = value\n end",
"def supports_device_licensing\n return @supports_device_licensing\n end",
"de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the supportsUserLicensing property value. Whether the program supports the user licensing type. | def supports_user_licensing
return @supports_user_licensing
end | [
"def supports_user_licensing=(value)\n @supports_user_licensing = value\n end",
"def supports_device_licensing\n return @supports_device_licensing\n end",
"def supports_device_licensing=(value)\n @supports_device_licensing = value\n e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the supportsUserLicensing property value. Whether the program supports the user licensing type. | def supports_user_licensing=(value)
@supports_user_licensing = value
end | [
"def supports_user_licensing\n return @supports_user_licensing\n end",
"def supports_device_licensing=(value)\n @supports_device_licensing = value\n end",
"def use_device_licensing=(value)\n @use_device_licensing = value\n end",
"de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if the database is healthy enough to allow the migration to be performed. class_name The name of the background migration that we might want to run. | def healthy_database?
return true unless Gitlab::Database.postgresql?
!Postgresql::ReplicationSlot.lag_too_great?
end | [
"def healthy?\n check()[\"healthy\"]\n end",
"def check_database_health\n begin\n db_healthy = ActiveRecord::Migrator.current_version != 0\n status = 200\n rescue StandardError => e\n Rails.logger.error \"Database error: #{e}\"\n db_healthy = false\n status = 503\n end\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an array of Rule instances which match the action and subject This does not take into consideration any hash conditions or block statements | def relevant_rules(action, subject)
return [] unless @rules
relevant = possible_relevant_rules(subject).select do |rule|
rule.expanded_actions = expand_actions(rule.actions)
rule.relevant? action, subject
end
relevant.reverse!.uniq!
optimize_order! relevant
... | [
"def relevant_rules(action, subject)\n rules.reverse.select do |rule|\n rule.expanded_actions = expand_actions(rule.actions)\n rule.relevant? action, subject\n end\n end",
"def relevant_rules(action, subject, context = nil)\n rules.reverse.select do |rule|\n rule.expande... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Optimizes the order of the rules, so that rules with the :all subject are evaluated first. | def optimize_order!(rules)
first_can_in_group = -1
rules.each_with_index do |rule, i|
(first_can_in_group = -1) && next unless rule.base_behavior
(first_can_in_group = i) && next if first_can_in_group == -1
next unless rule.subjects == [:all]
rules[i] = rules[fir... | [
"def process_rules(state)\n raise(\"No rules have been loaded into engine %s\" % self) if empty?\n\n rules_by_priority do |rule|\n state.mutable = !rule.concurrent?\n result = rule.process_state(state)\n state.mutable = true\n\n state.store_result(result) if result\n end\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the string representation of RDS::DBInstance | def to_s
"RDS DBInstance: #{@dbi_name}"
end | [
"def get_rds_details(options = {})\n stack_resources = resources(options)\n rds_resource_ids = get_resource_ids(stack_resources, \"AWS::RDS::DBInstance\")\n rds = Fog::AWS::RDS.new(:aws_access_key_id => @access_key_id, :aws_secret_access_key => @secret_access_key, :region => @region)\n rds_detai... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Contains the master username for the DB instance | def master_username
@dbi.master_username
end | [
"def master_username\n data[:master_username]\n end",
"def master_username\n @cluster.master_username\n end",
"def master_user\n @master_user ||= user_configuration_from_key('master_solr', 'user')\n end",
"def master_hostname\n @master_hostname ||= (user_configur... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Specifies the connection endpoint DNS address of the DB instance | def endpoint
@dbi.endpoint.address
end | [
"def calculate_dbhost\n owncloud_cookbook_config['dbhost'] =\n [\n owncloud_cookbook_config['dbhost'], owncloud_cookbook_config['dbport']\n ].join(':')\n end",
"def host\n @config.db_hostname\n end",
"def addr\n \"#{host}:#{port}\"\n end",
"def sql_database_manag... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Specifies the port that the database engine is listening on | def listening_port
@dbi.endpoint.port
end | [
"def set_port port\n @port = port\n end",
"def port(port)\n @config.port = port\n end",
"def port\n @port || 5432\n end",
"def port=(port)\n set_default :port, port\n end",
"def port\n @port ||= default_port\n end",
"def port(port, host=nil)\n host ||= default_hos... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Specifies the number of days for which automatic DB snapshots are retained | def backup_retention_period
@dbi.backup_retention_period
end | [
"def automated_snapshot_retention_period\n @cluster.automated_snapshot_retention_period\n end",
"def file_retention_days\n file_retention / DAY_SECS\n end",
"def retention_days\n @retention_days.nil? ? 0 : @retention_days.to_i\n end",
"def renew_days\n @config[:renew_days]\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Provides List of active DB security group names | def security_groups
sgs = []
@dbi.db_security_groups.each do |sg|
sgs << sg.db_security_group_name if sg.status == 'active'
end
sgs
end | [
"def security_groups\n sgs = []\n @cluster.cluster_security_groups.each do |sg|\n sgs << sg.cluster_security_group_name if sg.status == 'active'\n end\n sgs\n end",
"def security_groups\n data[:security_groups]\n end",
"def lookup_securit... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Provides List of VPC security group elements that the DB instance belongs to | def vpc_security_groups
vsgs = []
@dbi.vpc_security_groups.each do |vsg|
vsgs << vsg.vpc_security_group_id if vsg.status == 'active'
end
vsgs
end | [
"def vpc_security_groups\n data[:vpc_security_groups]\n end",
"def vpc_security_groups\n vsgs = []\n @cluster.vpc_security_groups.each do |vsg|\n vsgs << vsg.vpc_security_group_id if vsg.status == 'active'\n end\n vsgs\n end",
"def list_s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Specifies the name of the Availability Zone the DB instance is located in | def availability_zone
@dbi.availability_zone
end | [
"def set_AvailabilityZone(value)\n set_input(\"AvailabilityZone\", value)\n end",
"def availability_zone\n @availability_zone || (cluster && cluster.availability_zone)\n end",
"def set_PlacementAvailabilityZone(value)\n set_input(\"PlacementAvailabilityZone\", value)\n en... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Indicates the database engine version | def engine_version
@dbi.engine_version
end | [
"def db_engine_version_description\n data.db_engine_version_description\n end",
"def engine_version\n return @engine_version\n end",
"def db_engine_version_description\n data[:db_engine_version_description]\n end",
"def version\n @db['db_version'].to_i || 0\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Contains the identifier of the source DB instance if this DB instance is a Read Replica | def read_replica_source_db_instance_identifier
@dbi.read_replica_source_db_instance_identifier
end | [
"def read_replica_source_db_instance_identifier\n data[:read_replica_source_db_instance_identifier]\n end",
"def read_replica_source_db_cluster_identifier\n data[:read_replica_source_db_cluster_identifier]\n end",
"def read_replica_db_instance_identifiers\n data[:read_replica_db_instance_id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
License model information for this DB instance | def license_model
@dbi.license_model
end | [
"def license_model\n data[:license_model]\n end",
"def license_info\n self.dig_for_array(\"licenseInfo\")\n end",
"def license_details\n return @license_details\n end",
"def license\n read_property 'License'\n end",
"def licenses\n data[:licenses]\n end"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Provides the list of option group memberships for this DB instance | def option_group_memberships
@dbi.option_group_memberships
end | [
"def db_cluster_option_group_memberships\n data[:db_cluster_option_group_memberships]\n end",
"def group_memberships(opts = {})\n find_collection(\"group_memberships\", opts)\n end",
"def memberships\n @memberships ||= session.post('facebook.groups.getMembers', :gid => gid).map do |hash|\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
If present, specifies the name of the secondary Availability Zone for a DB instance with multiAZ support | def secondary_availability_zone
@dbi.secondary_availability_zone
end | [
"def set_EC2AvailabilityZone(value)\n set_input(\"EC2AvailabilityZone\", value)\n end",
"def set_availability_zone\n logger.debug { \"#{self.class}##{__method__}\" }\n return unless self.zone.blank? && self.project.master_slave_mode?\n ec2.availability_zones.each do |z|\n if z.state == :... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Specifies the storage type associated with DB instance | def storage_type
@dbi.storage_type
end | [
"def storage_type=(value)\n @storage_type = value\n end",
"def storage_type\n @storage_type\n end",
"def type=(v)\n RestrictionValidator.validate :storage_type, TYPES.values, v\n @type = v\n end",
"def db_type\n @db_type || self.class.db_type\n end",
"def storage... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The identifier of the CA certificate for this DB instance | def ca_certificate_identifier
@dbi.ca_certificate_identifier
end | [
"def encryption_certificate_id\n return @encryption_certificate_id\n end",
"def root_certificate\n @ca_cert\n end",
"def certificate_serial_number\n return @certificate_serial_number\n end",
"def encryption_certificate_id=(value)\n @encryp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
def show brand = Brand.find_by(id: params[:id]) render json: BrandSerializer.new(brand, options).serialized_json end | def show
brand = Brand.find_by(name: params[:name])
render json: BrandSerializer.new(brand, options).serialized_json
end | [
"def show\n @brand_name = BrandName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brand_name }\n end\n end",
"def show\n #if params[:name]\n #\t@brand = Brand.find_by_name(params[:name])\n #else \n \t@brand = Brand.find(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Filling the axon array (connection between dendrites and neurons) | def axon(connections)
@axons = connections
end | [
"def initialize_neurons!\n @phenotype.initialize_neurons\n end",
"def initialize(x, y)\n\t\t@neurons = Array.new\n\t\tx.times do\n\t\t\tneuron = Array.new(y)\n\t\t\t\n\t\t\t#create random weights\n\t\t\tneuron.each_index do |weight|\n\t\t\t\tneuron[weight] = rand * 2.0 - 1.0\n\t\t\tend\n\t\t\t@neurons << ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the values of axons | def print_axons
return @axons
end | [
"def axonValue\n\t\t@af.call(@bias + @weights)\n\tend",
"def values\n @observables.map{|observable| @values[observable] }\n end",
"def values\n @observables.map{|observable| @values[observable] }\n end",
"def axes\r\n self.axis_count.times.map do |index|\r\n self.axis_info(inde... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the values of the weights | def print_weight
return @weights
end | [
"def weights\n @weights.map { |mat| mat.to_a }\n end",
"def weights()\r\n @weights = @layers.map {|layer| layer.to_a}.flatten\r\n @num_weights = @weights.size\r\n return @weights\r\n end",
"def weights()\r\n @weights = @layers.map {|layer|\r\n # Don't count the ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Query Nexus3 API for list of repos, returns struct (parsed JSON) | def list_repositories
JSON.parse(request(:get, ''))
end | [
"def repos\n api.repos.map(&:to_hash)\n end",
"def repositories\n response = self.class.get('/repositories').body\n JSON.parse(response)\n end",
"def fetch_all_repos\n access_token = User.first.oauth_token\n url = \"https://api.github.com/orgs/zense/repos?access_token=#{access_token}\"\n all... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the value of a feature flag or setting identified by the given `key`. :param key [String] the identifier of the feature flag or setting. :param default_value in case of any failure, this value will be returned. :param user [User] the user object to identify the caller. :return the value. | def get_value(key, default_value, user = nil)
settings, fetch_time = _get_settings()
if settings.nil?
message = "Config JSON is not present when evaluating setting '#{key}'. Returning the `default_value` parameter that you specified in your application: '#{default_value}'."
@log.error(1000, ... | [
"def get_value_details(key, default_value, user = nil)\n settings, fetch_time = _get_settings()\n if settings.nil?\n message = \"Config JSON is not present when evaluating setting '#{key}'. Returning the `default_value` parameter that you specified in your application: '#{default_value}'.\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the value and evaluation details of a feature flag or setting identified by the given `key`. :param key [String] the identifier of the feature flag or setting. :param default_value in case of any failure, this value will be returned. :param user [User] the user object to identify the caller. :return [EvaluationDet... | def get_value_details(key, default_value, user = nil)
settings, fetch_time = _get_settings()
if settings.nil?
message = "Config JSON is not present when evaluating setting '#{key}'. Returning the `default_value` parameter that you specified in your application: '#{default_value}'."
@log.erro... | [
"def get_value(key, default_value, user = nil)\n settings, fetch_time = _get_settings()\n if settings.nil?\n message = \"Config JSON is not present when evaluating setting '#{key}'. Returning the `default_value` parameter that you specified in your application: '#{default_value}'.\"\n @log.e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets all setting keys. :return list of keys. | def get_all_keys
settings, _ = _get_settings()
if settings === nil
@log.error(1000, "Config JSON is not present. Returning empty list.")
return []
end
return settings.keys
end | [
"def get_keys()\n\t\t\treturn @config.keys\n\t\tend",
"def getallkeys\t\t\t\t\n\t\t\treturn $redis.keys\"*\"\n\t\tend",
"def all_keys\n self.key_list_set.members.to_a\n end",
"def all\n @keys\n end",
"def keys\n @config.keys\n end",
"def all_keys\n all_flags.keys\n end"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the key of a setting, and it's value identified by the given Variation ID (analytics) :param variation_id [String] variation ID :return key and value | def get_key_and_value(variation_id)
settings, _ = _get_settings()
if settings === nil
@log.error(1000, "Config JSON is not present. Returning nil.")
return nil
end
for key, value in settings
if variation_id == value.fetch(VARIATION_ID, nil)
return KeyValue.new(... | [
"def get_forced_variation(experiment_key, user_id)\n forced_variation_key = nil\n forced_variation = @config.get_forced_variation(experiment_key, user_id)\n forced_variation_key = forced_variation['key'] if forced_variation\n\n forced_variation_key\n end",
"def get_stored_variation(_user_id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Evaluates and returns the values of all feature flags and settings. :param user [User] the user object to identify the caller. :return dictionary of values | def get_all_values(user = nil)
settings, _ = _get_settings()
if settings === nil
@log.error(1000, "Config JSON is not present. Returning empty dictionary.")
return {}
end
all_values = {}
for key in settings.keys
value = get_value(key, nil, user)
if !value.e... | [
"def get_all_feature_variables(feature_flag_key, user_id, attributes = nil)\n unless is_valid\n @logger.log(Logger::ERROR, InvalidProjectConfigError.new('get_all_feature_variables').message)\n return nil\n end\n\n return nil unless Optimizely::Helpers::Validator.inputs_valid?(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the values along with evaluation details of all feature flags and settings. :param user [User] the user object to identify the caller. :return list of all evaluation details | def get_all_value_details(user = nil)
settings, fetch_time = _get_settings()
if settings.nil?
@log.error(1000, "Config JSON is not present. Returning empty list.")
return []
end
details_result = []
for key in settings.keys
details = _evaluate(key, user, nil, nil, s... | [
"def get_all_feature_variables(feature_flag_key, user_id, attributes = nil)\n unless is_valid\n @logger.log(Logger::ERROR, InvalidProjectConfigError.new('get_all_feature_variables').message)\n return nil\n end\n\n return nil unless Optimizely::Helpers::Validator.inputs_valid?(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Initiates a force refresh on the cached configuration. :return [RefreshResult] | def force_refresh
return @_config_service.refresh if @_config_service
return RefreshResult(false,
"The SDK uses the LocalOnly flag override behavior which prevents making HTTP requests.")
end | [
"def refresh\n send(:flush_cache) if respond_to?(:flush_cache)\n end",
"def refresh_cache\n @cache = build_cache\n end",
"def refresh!\n self.config['last_refresh_attempt'] = Clock.time.to_i\n refresh_status = refresh_content()\n if refresh_status\n self.config['last_ok_refresh'] =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the default user. :param user [User] the user object to identify the caller. | def set_default_user(user)
@_default_user = user
end | [
"def target_user(user = \"root\")\n @platform.target_user = user\n end",
"def user=(user)\n @user = user ? Struct::User.new(user) : user\n end",
"def user=(value)\n @user = value\n end",
"def first_user=(user)\n self.memberships.create(user_id: user.id, admin: true, host: ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the default user to nil. | def clear_default_user
@_default_user = nil
end | [
"def set_default_user(user)\n @_default_user = user\n end",
"def clear_current_user\n set_current_user(nil)\n end",
"def unset_current_user\n Strongbolt.current_user = nil\n end",
"def clear_user\n warden.set_user(nil) if warden.user.present?\n end",
"def unset_current_user_in_cu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH /applications/1/decline PATCH /applications/1/decline.json | def decline
authorize! :decline, @application
@application.decline
respond_to do |format|
if @application.save
format.html { redirect_to @application, notice: 'Application was successfully declined.' }
format.json { head :no_content }
else
... | [
"def decline\n respond_to do |format|\n if request.request_method_symbol == :put\n if membership.decline_renewal( decline_membership_attributes, user: current_user )\n format.html { redirect_to membership, flash: { success: 'Membership renewal declined.' } }\n else\n format.h... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds base exceptions for each DP LPI record for which there is no corresponding LGA record. | def add_exceptions_for_missing_dp_lpi_records
missing_dp_lpi_records.each do |lpi_record|
add_exception_to_base(
NotInLgaError.new(
"'%s' is present in LPI database but not in this LGA" % [lpi_record]
)
)
end
end | [
"def add_exceptions_for_missing_sp_lpi_records\n missing_sp_lpi_records.each do |lpi_record|\n add_exception_to_base(\n NotInLgaError.new(\n \"'%s' is present in LPI database but not in this LGA\" % [lpi_record]\n )\n )\n end\n end",
"def lookup_all_error; end",
"def exce... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Adds base exceptions for each SP LPI record for which there is no corresponding LGA record. | def add_exceptions_for_missing_sp_lpi_records
missing_sp_lpi_records.each do |lpi_record|
add_exception_to_base(
NotInLgaError.new(
"'%s' is present in LPI database but not in this LGA" % [lpi_record]
)
)
end
end | [
"def add_exceptions_for_missing_dp_lpi_records\n missing_dp_lpi_records.each do |lpi_record|\n add_exception_to_base(\n NotInLgaError.new(\n \"'%s' is present in LPI database but not in this LGA\" % [lpi_record]\n )\n )\n end\n end",
"def lookup_all_error; end",
"def fail... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an array of matches for the search term. The term can be a code of any kind, or it can be one of the words contained in the English or French name field. | def search(term)
term ||= ''
normalized_term = term.downcase.strip
indexes = INVERTED_INDEX[normalized_term]
indexes ? ISO_639_2.values_at(*indexes).uniq : []
end | [
"def matches(term)\n set = base_search(term)\n set.map do |i|\n # doc_id = get_id(i.to_i)\n # offset = documents.offset_of(doc_id)\n # a,b = nil\n # if offset\n # a = i.to_i - offset\n # b = a + term.length\n # ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The entry's alpha3 bibliotigraphic code. | def alpha3_bibliographic
self[0]
end | [
"def alpha3_bibliographic; self[0] end",
"def citekey\n @hash['citekey']\n end",
"def citation_name\n Rantly {\n sized(32) {\n string(:alpha)\n }\n }\n end",
"def publisher_code_and_title\n @code[(group_identifier.length + 3)..11].join\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The entry's alpha3 terminologic (when given) | def alpha3_terminologic
self[1]
end | [
"def alpha3_bibliographic; self[0] end",
"def movable_accent?\n # accent on the 2nd last (instead of 3rd last) syllable?\n self[-3].include? 'r1'\n end",
"def alpha3_bibliographic\n self[0]\n end",
"def three_word_name; end",
"def is_key_entry(aliaz)\n\n end",
"def n3\n \"[#{self... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The entry's alpha2 code (when given) | def alpha2
self[2]
end | [
"def incode\n \"0AA\"\n end",
"def get_code(c)\n c.upcase.ord - 'A'.ord + 1\nend",
"def iso_code; end",
"def alpha_string\n alpha.round(8).to_s\n end",
"def parse_key_code(key)\n if key[0..5].downcase = 'ascii='\n # return the ASCII code directly\n return key[6..key.length]\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The entry's first part of english name. | def first_english_name
self[3].split(';').first
end | [
"def english_name\n self[3]\n end",
"def first_name\n if I18n.locale == :ka\n self.read_attribute(:first_name)\n else\n# require 'utf8_converter'\n# Utf8Converter.convert_ka_to_en(self.read_attribute(:first_name)).gsub(/[^A-Za-z ]/,'').titlecase\n self.read_attribute(:first_name).lat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.