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
Saturday, August 15, 2020 Afternoon Session EX 3
def multiplication(x, y) # number = y nums = [] # x.times do # nums << number # number += y # end i = 1 x.times do nums << y * i i += 1 end return nums end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yday() end", "def beginning_of_week; end", "def beginning_of_week; end", "def w_day; end", "def day() end", "def wday() end", "def opening_hour\n 11 # 11am\n end", "def yday\n end", "def opening_time\n Time.current.beginning_of_week(:sunday)\n end", "def cweek\n end", "def upcomin...
[ "0.615533", "0.6038506", "0.6038506", "0.6032903", "0.5973238", "0.5961056", "0.58930904", "0.5885907", "0.5881222", "0.58536804", "0.58148414", "0.57933533", "0.5784506", "0.5777081", "0.57511866", "0.5733868", "0.571692", "0.56563306", "0.56107116", "0.5597867", "0.5597515"...
0.0
-1
log tailer = = = = = = = = = = = = =
def remote_file_exists?(full_path) 'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tail_last\n log_name = last_log\n File.open log_name do |f|\n f.extend File::Tail\n f.interval = 2\n f.backward(2)\n f.return_if_eof = true\n loop do\n f.tail { |line| color_print line }\n break unless last_log == log_name\n end\n end\nend", "def tail; end", "def on_tail(*opt...
[ "0.7101595", "0.69445145", "0.64918834", "0.63693774", "0.62211275", "0.6179311", "0.61161304", "0.61161304", "0.6068253", "0.6068253", "0.6068253", "0.6068253", "0.6068253", "0.6068253", "0.6068253", "0.6068253", "0.60663956", "0.6043602", "0.6039302", "0.6039302", "0.603125...
0.0
-1
Find a way to accumulate the :worldwide_grosses and return that Integer using director_data as input
def gross_for_director(director_data) sum = 0 director_data[:movies].each do |movie| sum += movie[:worldwide_gross] end return sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gross_for_director(director_data)\n movie_index = 0\n worldwide_grosses = 0\n while movie_index < director_data[:movies].length\n worldwide_grosses += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\nworldwide_grosses\nend", "def gross_for_director(director_data)\n m...
[ "0.8031094", "0.7979809", "0.7938483", "0.7927118", "0.7893617", "0.78402203", "0.77561146", "0.77524376", "0.7717609", "0.76706547", "0.7670455", "0.7654349", "0.7608682", "0.76027364", "0.7602346", "0.7588497", "0.7581547", "0.75780565", "0.7557646", "0.75266427", "0.751795...
0.79803103
1
PE15116 overrides 'environment' and 'environmentpath' in the 'puppet infrastructure' face. The original values are required by methods in this class.
def pe_environment(certname) environment = catalog_environment(certname) if environment @environment = environment else Puppet.debug("No Environment found in PuppetDB using: #{certname}") Puppet.debug("Querying 'puppet config print environment' for Environment") @environment = Puppet::Util::Execution.execute('/opt/puppetlabs/puppet/bin/puppet config print environment --section master', 'combine' => false).chomp end @environmentpath = Puppet::Util::Execution.execute('/opt/puppetlabs/puppet/bin/puppet config print environmentpath --section master', 'combine' => false).chomp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env=(environment); end", "def env=(environment); end", "def environmentpath\n @@memoized_environmentpath ||= master.puppet['environmentpath']\n end", "def env_config; end", "def env_config; end", "def env_config; end", "def env_config; end", "def original_env; end", "def environment...
[ "0.6900148", "0.6900148", "0.67681146", "0.6712449", "0.6712449", "0.6712449", "0.6712449", "0.6666342", "0.66341394", "0.65727216", "0.65713847", "0.65049225", "0.65010995", "0.64134836", "0.6393978", "0.6351867", "0.6303482", "0.6302961", "0.62807626", "0.62735265", "0.6261...
0.6012544
53
Query PuppetDB for the environment of a PE Infrastructure node.
def catalog_environment(certname) Puppet.debug("Querying PuppetDB for Environment using: #{certname}") pql = ['from', 'nodes', ['extract', ['certname', 'catalog_environment'], ['and', ['=', 'certname', certname], ] ] ] results = query_puppetdb(pql) return nil if results.nil? Puppet.debug(results) results[0]['catalog_environment'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pe_environment(certname)\n environment = catalog_environment(certname)\n if environment\n @environment = environment\n else\n Puppet.debug(\"No Environment found in PuppetDB using: #{certname}\")\n Puppet.debug(\"Querying 'puppet config print environm...
[ "0.6245968", "0.6217883", "0.5933417", "0.58181465", "0.5772176", "0.57079685", "0.55580884", "0.54747", "0.5469225", "0.53735536", "0.53419995", "0.5318516", "0.5317306", "0.5282923", "0.5248009", "0.5245411", "0.523556", "0.52177536", "0.5166648", "0.5144442", "0.5118819", ...
0.5930436
3
Query PuppetDB for the count of active nodes.
def active_node_count Puppet.debug('Querying PuppetDB for Active Nodes') pql = ['from', 'nodes', ['and', ['=', ['node', 'active'], true], ] ] results = query_puppetdb(pql) return nil if results.nil? Puppet.debug(results) results.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepared_nodes_count\n Bebox::Node.list(self.project_root, self.environment, 'prepared_nodes').count\n end", "def active_on_cluster_count\n (waiting_count + running_count)\n end", "def concurrent_count\n debug(\"Getting puppet status\")\n\n running = 0\n\n @puppet.status do |resp|\n b...
[ "0.6777508", "0.6715817", "0.6706187", "0.66664416", "0.6465062", "0.6413843", "0.6409302", "0.63257277", "0.6267954", "0.62641305", "0.62095034", "0.6181772", "0.6177919", "0.6177919", "0.616891", "0.6161074", "0.6159261", "0.61477655", "0.61442876", "0.6118399", "0.61160755...
0.9138855
0
Query PuppetDB for config_retrieval or total time metrics. "name" => "catalog_application", "name" => "config_retrieval", "name" => "convert_catalog", "name" => "fact_generation", "name" => "node_retrieval", "name" => "plugin_sync", "name" => "transaction_evaluation", "name" => "total",
def average_compile_time(query_limit = 1000) Puppet.debug('Querying PuppetDB for Average Compile Time') pql = ['from', 'reports', ['extract', ['hash', 'start_time', 'end_time', 'metrics'], ], ['limit', query_limit] ] results = query_puppetdb(pql) return nil if results.nil? random_report_hash = results.sample['hash'] Puppet.debug("Random report: #{random_report_hash}") # run_times = results.map do |report| # Time.parse(report['end_time']) - Time.parse(report['start_time']) # end # avg_run_time = (run_times.inject(0.0) { |sum, element| sum + element } / run_times.size).ceil # Filter out reports that do not contain metric data. results.delete_if { |report| report['metrics']['data'].empty? } # Collect config_retrieval time, or if absent (for a run with a catalog compilation error), total time. config_retrieval_times = results.map do |report| report['metrics']['data'].select { |md| md['category'] == 'time' && (md['name'] == 'config_retrieval' || md['name'] == 'total') }.first.fetch('value') end avg_config_retrieval_time = config_retrieval_times.reduce(0.0) { |sum, element| sum + element } / config_retrieval_times.size avg_config_retrieval_time.ceil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom(cfg)\n metrics = []\n @client.query(cfg['query']).each do |result|\n source = if result['metric']['instance'] =~ /^\\d+/\n result['metric']['app']\n else\n result['metric']['instance']\n end\...
[ "0.6119568", "0.57647365", "0.5699026", "0.5680077", "0.5634543", "0.5490276", "0.5443047", "0.54408497", "0.5385424", "0.53706855", "0.5353782", "0.53019917", "0.53019917", "0.5287075", "0.52867806", "0.5268027", "0.5253391", "0.52411425", "0.5234713", "0.5230306", "0.522486...
0.5611071
5
Query PuppetDB for nodes with a PE Infrastructure class.
def infra_nodes_with_class(classname) Puppet.debug("Querying PuppetDB for Class: Puppet_enterprise::Profile::#{classname}") pql = ['from', 'resources', ['extract', ['certname', 'parameters'], ['and', ['=', 'type', 'Class'], ['=', 'environment', @environment], ['=', 'title', "Puppet_enterprise::Profile::#{classname}"], ['=', ['node', 'active'], true], ] ] ] results = query_puppetdb(pql) return nil if results.nil? Puppet.debug(results) results.map { |resource| resource.fetch('certname') } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pe_infra_nodes_by_class(class_name, environment = 'production')\n Puppet.debug(\"Querying PuppetDB for Class: Puppet_enterprise::Profile::#{class_name}\")\n pql = ['from', 'resources',\n ['extract', ['certname', 'parameters'],\n ['and',\n ...
[ "0.63063705", "0.52054495", "0.5156998", "0.50528455", "0.504817", "0.5041159", "0.5016746", "0.49795547", "0.49730802", "0.49607265", "0.49468708", "0.49335214", "0.49182153", "0.49027905", "0.4895766", "0.48852268", "0.4840358", "0.4840358", "0.4840358", "0.4838539", "0.482...
0.60311586
1
Query PuppetDB for facts for a node.
def node_facts(certname) Puppet.debug("Querying PuppetDB for Facts for: #{certname}") pql = ['from', 'facts', ['extract', ['name', 'value'], ['and', ['=', 'certname', certname], ['=', 'environment', @environment], ] ] ] results = query_puppetdb(pql) return nil if results.nil? Puppet.debug(results) facts = {} results.each do |fact, _nil| facts[fact['name']] = fact['value'] end facts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_facts(host)\n curl = setup_curl(\"#{@puppetdb_url}/v3/nodes/#{host}/facts\")\n curl.get\n result = JSON.parse(curl.body_str)\n warn \"Error #{host} not found in puppetdb\" if result.empty?\n result\n end", "def get_facts(nodename)\n facts_puppetdb = Hash.new\n response_facts...
[ "0.7020529", "0.6641798", "0.58815706", "0.5854147", "0.57390535", "0.5720782", "0.56910866", "0.5662852", "0.56384754", "0.5635627", "0.5525166", "0.5498303", "0.5459306", "0.54346687", "0.5419321", "0.5388703", "0.53849876", "0.5330754", "0.5302914", "0.5281682", "0.5272536...
0.70528924
0
Return settings configured in Hiera and the Classifier, identifying duplicates and merging the results.
def hiera_classifier_settings(certname, settings) duplicates = [] overrides_hiera, overrides_classifier = hiera_classifier_overrides(certname, settings) Puppet.debug("Settings from Hiera for: #{certname}: #{overrides_hiera}") Puppet.debug("Settings from Classifier for: #{certname}: #{overrides_classifier}") overrides = overrides_hiera overrides_classifier.each do |classifier_k, classifier_v| next unless settings.include?(classifier_k) if overrides.key?(classifier_k) duplicates.push("#{classifier_k} ... Hiera: #{overrides_hiera[classifier_k]} ... Classifier: #{classifier_v} ") end # Classifer settings take precedence over Hiera settings. # Hiera settings include pe.conf. overrides[classifier_k] = classifier_v end return { 'params' => overrides, 'duplicates' => duplicates } rescue Puppet::Error return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_hiera_classifier_overrides(certname, settings)\n # (PE-24106) Change Recover to a Class\n if defined?(Puppet::Util::Pe_conf::Recover.facts_for_node) == 'method'\n # PE 2017\n node_facts = Puppet::Util::Pe_conf::Recover.facts_for_node(certname, @environment)\n node_...
[ "0.56559044", "0.54791504", "0.521006", "0.5179166", "0.5095266", "0.50573105", "0.50388306", "0.50379354", "0.49385303", "0.49357712", "0.49291524", "0.48380274", "0.48378214", "0.48251122", "0.48012185", "0.47868398", "0.4771288", "0.47614992", "0.47399372", "0.47255203", "...
0.67893434
0
If 'puppet/util/puppetdb' would be required at the top of the file, then it would be autoloaded/required as part of the install process, resulting in an error.
def query_puppetdb(pql) require 'puppet/util/puppetdb' return Puppet::Util::Puppetdb.query_puppetdb(pql) rescue Puppet::Error return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_preconditions(_, _)\n require 'nokogiri'\n require 'open-uri'\n rescue LoadError => err\n raise LoadError, \"#{err.message}: you need to add \"\\\n \"'nokogiri' to your Gemfile to use this driver!\",\n err.backtrace\n end", "def tr...
[ "0.64889014", "0.6455116", "0.6029326", "0.58974785", "0.5833561", "0.581855", "0.5798611", "0.5610756", "0.5574637", "0.5547271", "0.5528352", "0.55244017", "0.54998416", "0.547514", "0.54550725", "0.54460186", "0.54254025", "0.54041237", "0.53347564", "0.53276217", "0.53276...
0.0
-1
Extract the beating heart of a puppet compiler for lookup purposes.
def hiera_classifier_overrides(certname, settings) if recover_with_instance_method? recover = Puppet::Util::Pe_conf::Recover.new node_facts = recover.facts_for_node(certname, @environment) node_terminus = recover.get_node_terminus overrides_hiera = recover.find_hiera_overrides(certname, settings, node_facts, @environment, node_terminus) overrides_classifier = recover.classifier_overrides_for_node(certname, node_facts, node_facts['::trusted']) else node_facts = Puppet::Util::Pe_conf::Recover.facts_for_node(certname, @environment) if recover_with_node_terminus_method? node_terminus = Puppet::Util::Pe_conf::Recover.get_node_terminus overrides_hiera = Puppet::Util::Pe_conf::Recover.find_hiera_overrides(certname, settings, node_facts, @environment, node_terminus) else overrides_hiera = Puppet::Util::Pe_conf::Recover.find_hiera_overrides(settings, node_facts, @environment) end overrides_classifier = Puppet::Util::Pe_conf::Recover.classifier_overrides_for_node(certname, node_facts, node_facts['::trusted']) end [overrides_hiera, overrides_classifier] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basic_compiler\n @basic_compiler ||= indirection.terminus(config['basic_compiler'])\n end", "def compiler\n guess_compiler unless @compiler\n @compiler && @compiler.class.to_sym\n end", "def extract_declares!\n # Recurse on the block.\n return self.block.extract_decla...
[ "0.54117554", "0.5254043", "0.5253209", "0.50578177", "0.49579716", "0.49579716", "0.49409345", "0.4920392", "0.48682076", "0.48559988", "0.48533407", "0.4836821", "0.48358697", "0.48265597", "0.4824915", "0.4815718", "0.48094413", "0.47953376", "0.47866955", "0.47839913", "0...
0.0
-1
PE24106 changes Recover to a class with instance methods.
def recover_with_instance_method? defined?(Puppet::Util::Pe_conf::Recover.facts_for_node) != 'method' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_instance_method(klass,method_name)\n restore_method_by_type(klass,method_name,METHOD_TYPE_INSTANCE)\n end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def public_class_method(*rest) end", "def instance...
[ "0.61671054", "0.60928273", "0.60928273", "0.60928273", "0.60928273", "0.59543324", "0.5921404", "0.5706542", "0.5698933", "0.56963325", "0.5695951", "0.56600064", "0.5638965", "0.5571478", "0.5517862", "0.5517862", "0.548587", "0.5477876", "0.54594326", "0.5454301", "0.54426...
0.5945154
6
In some versions, Puppet::Util::Pe_conf::Recover does not implement get_node_terminus() and implements find_hiera_overrides(params, facts, environment)
def recover_with_node_terminus_method? defined?(Puppet::Util::Pe_conf::Recover.get_node_terminus) == 'method' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hiera_classifier_overrides(certname, settings)\n if recover_with_instance_method?\n recover = Puppet::Util::Pe_conf::Recover.new\n node_facts = recover.facts_for_node(certname, @environment)\n node_terminus = recover.get_node_terminus\n overrides_hiera = rec...
[ "0.7492527", "0.691438", "0.6187946", "0.57156634", "0.56307006", "0.5556964", "0.54163134", "0.5415703", "0.528943", "0.5271096", "0.5266957", "0.5242843", "0.5184455", "0.51746714", "0.51556563", "0.5051311", "0.5000107", "0.49812105", "0.49568638", "0.49503714", "0.4941055...
0.5651026
4
GET /admin/additional_descriptions GET /admin/additional_descriptions.json
def index @admin_additional_descriptions = AdditionalDescription.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_admin_additional_description\n @admin_additional_description = AdditionalDescription.find(params[:id])\n end", "def admin_additional_description_params\n params.require(:additional_description).permit(:name, :description)\n end", "def create\n @admin_additional_description = @product...
[ "0.7016744", "0.67503273", "0.6580968", "0.65681154", "0.6460205", "0.62730265", "0.61665726", "0.6098843", "0.6062361", "0.60286355", "0.60286355", "0.602204", "0.60185933", "0.60175365", "0.60085297", "0.5990022", "0.5952145", "0.5948463", "0.5939341", "0.5895009", "0.58846...
0.7823175
0
GET /admin/additional_descriptions/1 GET /admin/additional_descriptions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @admin_additional_descriptions = AdditionalDescription.all\n end", "def set_admin_additional_description\n @admin_additional_description = AdditionalDescription.find(params[:id])\n end", "def create\n @admin_additional_description = @product.additional_descriptions.build(admin_additi...
[ "0.7650786", "0.712004", "0.67192954", "0.66077036", "0.6313555", "0.62427807", "0.6193142", "0.61829716", "0.61371666", "0.6117476", "0.60889864", "0.605384", "0.5999043", "0.59673584", "0.59553784", "0.59398913", "0.59398913", "0.5896968", "0.5894385", "0.58737874", "0.5850...
0.0
-1
POST /admin/additional_descriptions POST /admin/additional_descriptions.json
def create @admin_additional_description = @product.additional_descriptions.build(admin_additional_description_params) respond_to do |format| if @admin_additional_description.save format.html { redirect_to admin_products_path, notice: 'Additional description was successfully created.' } format.json { render :show, status: :created, location: @admin_additional_description } else format.html { render :new } format.json { render json: @admin_additional_description.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_additional_description_params\n params.require(:additional_description).permit(:name, :description)\n end", "def index\n @admin_additional_descriptions = AdditionalDescription.all\n end", "def set_admin_additional_description\n @admin_additional_description = AdditionalDescription.fi...
[ "0.7309304", "0.6942816", "0.6746176", "0.6328609", "0.62935895", "0.6252944", "0.6252041", "0.62443984", "0.62008065", "0.61238253", "0.6120728", "0.6093135", "0.5967229", "0.5911946", "0.58927476", "0.58295304", "0.5806976", "0.5793085", "0.5779586", "0.5759264", "0.5755029...
0.7455854
0
PATCH/PUT /admin/additional_descriptions/1 PATCH/PUT /admin/additional_descriptions/1.json
def update respond_to do |format| if @admin_additional_description.update(admin_additional_description_params) format.html { redirect_to admin_products_path, notice: 'Additional description was successfully updated.' } format.json { render :show, status: :ok, location: @admin_additional_description } else format.html { render :edit } format.json { render json: @admin_additional_description.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_admin_additional_description\n @admin_additional_description = AdditionalDescription.find(params[:id])\n end", "def update\n json_response(@description.update!(description_params))\n end", "def update\n respond_to do |format|\n if @admin_description.update(admin_description_...
[ "0.63581717", "0.6338332", "0.6238993", "0.61605823", "0.5990277", "0.596866", "0.59147835", "0.5866275", "0.5767587", "0.5755213", "0.57507294", "0.57410526", "0.57396686", "0.57395345", "0.5712593", "0.5712593", "0.5704861", "0.56887764", "0.56670904", "0.5654416", "0.56544...
0.70768577
0
DELETE /admin/additional_descriptions/1 DELETE /admin/additional_descriptions/1.json
def destroy @admin_additional_description.destroy respond_to do |format| format.html { redirect_to admin_products_path, notice: 'Additional description was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @admin_description.destroy\n respond_to do |format|\n format.html { redirect_to admin_descriptions_url, notice: 'Description was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteEntityDescription( entity_id, gen_id)\n params = Hash.new\n ...
[ "0.69003695", "0.67747164", "0.6672713", "0.665303", "0.6568457", "0.653045", "0.6529776", "0.64738816", "0.64149344", "0.6408158", "0.6327547", "0.63214225", "0.6313326", "0.63069946", "0.63069946", "0.63069946", "0.6277057", "0.6261904", "0.6242038", "0.62378496", "0.623658...
0.737303
0
Use callbacks to share common setup or constraints between actions.
def set_admin_additional_description @admin_additional_description = AdditionalDescription.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 admin_additional_description_params params.require(:additional_description).permit(:name, :description) 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
this method is reserved for styles specific to plugin
def plugin_styles @@plugin_callbacks.each { |block| block.call(@fragment, @opts) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def styles; end", "def styles; end", "def styles; end", "def style; end", "def style; end", "def style; end", "def style\n end", "def styles=(_arg0); end", "def myletter\n \n end", "def style=(_); end", "def style_conversion; end", "def style\n self\n end", "def css_styles\...
[ "0.7813299", "0.7813299", "0.7813299", "0.7672482", "0.7672482", "0.7672482", "0.74445105", "0.7229336", "0.6957489", "0.69123954", "0.6883956", "0.68193954", "0.6746262", "0.6733601", "0.6733601", "0.6733601", "0.67219687", "0.67219687", "0.67219687", "0.66694057", "0.666847...
0.65038353
25
edit implies read, so read_groups is the union of edit and read groups
def read_groups read_group_field = Hydra.config[:permissions][:read][:group] rg = edit_groups | ((@permissions_solr_document == nil || @permissions_solr_document.fetch(read_group_field,nil) == nil) ? [] : @permissions_solr_document.fetch(read_group_field,nil)) logger.debug("read_groups: #{rg.inspect}") return rg end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_groups\n search_by_type_and_mode(:group, ::ACL.Write).map(&:agent_name)\n end", "def read_groups(pid)\n read_group_field = Hydra.config[:permissions][:read][:group]\n doc = permissions_doc(pid)\n rg = edit_groups(pid) | ((doc == nil || doc.fetch(read_group_field,nil) == nil) ? [] : ...
[ "0.7021909", "0.67212284", "0.6416295", "0.62356657", "0.6154178", "0.6057203", "0.5982665", "0.5973819", "0.5927357", "0.58516866", "0.56641036", "0.56509644", "0.5630909", "0.5612716", "0.56040746", "0.55849546", "0.55782795", "0.55205065", "0.5518868", "0.550824", "0.55046...
0.71065205
0
edit implies read, so read_persons is the union of edit and read persons
def read_persons read_individual_field = Hydra.config[:permissions][:read][:individual] rp = edit_persons | ((@permissions_solr_document == nil || @permissions_solr_document.fetch(read_individual_field,nil) == nil) ? [] : @permissions_solr_document.fetch(read_individual_field,nil)) logger.debug("read_persons: #{rp.inspect}") return rp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_persons(pid)\n read_individual_field = Hydra.config[:permissions][:read][:individual]\n doc = permissions_doc(pid)\n rp = edit_persons(pid) | ((doc == nil || doc.fetch(read_individual_field,nil) == nil) ? [] : doc.fetch(read_individual_field,nil))\n logger.debug(\"[CANCAN] read_persons: #{rp.i...
[ "0.7122455", "0.6114267", "0.60947925", "0.60947925", "0.60947925", "0.6023717", "0.59462786", "0.5899476", "0.5899476", "0.5899476", "0.5899476", "0.5899476", "0.5899476", "0.5899476", "0.5899476", "0.5899476", "0.5899476", "0.5899476", "0.5899476", "0.5899476", "0.5899476",...
0.71741533
0
| | | |
def test_crosses seg_h = LineSeg.new(p(0,1),p(3,1)) seg_v1 = LineSeg.new(p(1,0), p(1,2)) seg_v2 = LineSeg.new(p(2,0), p(2,2)) expected = [ LineSeg.new(p(0,1),p(1,1)), LineSeg.new(p(1,1),p(2,1)), LineSeg.new(p(2,1),p(3,1)), LineSeg.new(p(1,0),p(1,1)), LineSeg.new(p(1,1),p(1,2)), LineSeg.new(p(2,0),p(2,1)), LineSeg.new(p(2,1),p(2,2)), ] segs = [seg_h, seg_v1, seg_v2] canon = CanonicalLineSegList.new segs.each {|seg| canon.add(seg)} assert_equal(expected.size, canon.line_segs.size) expect(canon, expected) canon = CanonicalLineSegList.new segs = segs.rotate(1) segs.each {|seg| canon.add(seg)} assert_equal(expected.size, canon.line_segs.size) expect(canon, expected) canon = CanonicalLineSegList.new segs = segs.rotate(1) segs.each {|seg| canon.add(seg)} assert_equal(expected.size, canon.line_segs.size) expect(canon, expected) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nebula; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def star; end", "def x2\n x + width\n end", "def legionnairs\n\n end", "def pos\n end", "def pos\n end", "def pos\n end", "def ravel; end", "def border=(_arg0); end...
[ "0.6497622", "0.6114329", "0.6114329", "0.6114329", "0.6114329", "0.6114329", "0.6114329", "0.60996395", "0.6060858", "0.5998477", "0.59968007", "0.59968007", "0.59968007", "0.598528", "0.59676695", "0.5956033", "0.5956033", "0.5956033", "0.5956033", "0.5945233", "0.59404", ...
0.0
-1
The two segments intersect at a nonterminus point.
def test_add_intersection # Intersection at (1,1) canon = CanonicalLineSegList.new canon.add(LineSeg.new(p(0,0), p(2,2))) canon.add(LineSeg.new(p(0,2), p(2,0))) assert_equal(4, canon.line_segs.size) expect(canon, [ LineSeg.new(p(0,0), p(1,1)), LineSeg.new(p(1,1), p(2,2)), LineSeg.new(p(0,2), p(1,1)), LineSeg.new(p(1,1), p(2,0)) ] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersectLineSegment seg\n line_result = intersect(two_points_to_line(seg.x1,seg.y1,seg.x2,seg.y2))\n line_result.intersectWithSegmentAsLineResult seg\n end", "def intersectLineSegment seg\n line_result = intersect(two_points_to_line(seg.x1,seg.y1,seg.x2,seg.y2))\n line_result.intersectWithSegme...
[ "0.72462976", "0.72462976", "0.72462976", "0.7214122", "0.70925146", "0.70925146", "0.70925146", "0.70892835", "0.70600927", "0.7018956", "0.7009942", "0.6987697", "0.68281984", "0.6717665", "0.6684086", "0.6537712", "0.6537712", "0.6537712", "0.65160906", "0.6480118", "0.645...
0.59648186
46
One seg terminates along the line of the other. This should result in one segment being split into two.
def test_add_midpoint_terminus expected_segs1 = [LineSeg.new(p(0,0), p(1, 0)), LineSeg.new(p(1, 0), p(2, 0)), LineSeg.new(p(1,0), p(1,1))] expected_segs2 = [LineSeg.new(p(0,0), p(1, 0)), LineSeg.new(p(1, 0), p(2, 0)), LineSeg.new(p(1,1), p(1,0))] # new/1: new segment has its point 1 along the other segment. canon = CanonicalLineSegList.new canon.add(LineSeg.new(p(0,0), p(2,0))) canon.add(LineSeg.new(p(1,0), p(1,1))) assert_equal( 3, canon.line_segs.size) expect(canon, expected_segs1) # new/2: new segment has its point 2 along the other segment. canon = CanonicalLineSegList.new canon.add(LineSeg.new(p(0,0), p(2,0))) canon.add(LineSeg.new(p(1,1), p(1,0))) assert_equal(3, canon.line_segs.size) expect(canon, expected_segs2) # old/1: old segment has its point 1 along the other segment. canon = CanonicalLineSegList.new canon.add(LineSeg.new(p(1,0), p(1,1))) canon.add(LineSeg.new(p(0,0), p(2,0))) assert_equal(3, canon.line_segs.size) expect(canon, expected_segs1) # old/2: old segment has its point 2 along the other segment. canon = CanonicalLineSegList.new canon.add(LineSeg.new(p(1,1), p(1,0))) canon.add(LineSeg.new(p(0,0), p(2,0))) assert_equal(3, canon.line_segs.size) expect(canon, expected_segs2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redistribute_to_segments(seg_one, scpos_one, seg_two, scpos_two, remaining_cluster)\n #scpos is short for 'segment center position'\n sc1x, sc1y = scpos_one[0], scpos_one[1]\n sc2x, sc2y = scpos_two[0], scpos_two[1]\n\n first_seg = seg_one\n second_seg = seg_two\n remaining_cluster.each do |x...
[ "0.65075713", "0.5891862", "0.5737131", "0.5711784", "0.5675378", "0.5675378", "0.5675378", "0.5618614", "0.5612091", "0.55398065", "0.5415644", "0.5415644", "0.53894943", "0.5372635", "0.5348438", "0.53267765", "0.5282161", "0.5222355", "0.51962745", "0.5189173", "0.51753515...
0.5843335
2
02 Project Euler Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the evenvalued terms.max = 4000000
def fibonacci_seq(max) first = 1 second = 2 sum = 2 # accounts for the first fibonacci pair while((first + second) < max) third = first + second first = second second = third sum += third if third.even? end puts sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_even_fib_terms(max)\n sum = 0\n \n # initialize sequence\n t0 = 1\n t1 = 2\n \n while t1 < max\n if t1 % 2 == 0\n sum += t1\n end\n\n # advance to next term in the sequence\n t2 = t0 + t1\n t0 = t1\n t1 = t2\n end\n\n sum\nend", "def euler002\n sum = 0\n fib = [1, 1]\n ...
[ "0.8286219", "0.82189554", "0.816825", "0.80576104", "0.79610014", "0.79563874", "0.7912931", "0.7904693", "0.78295565", "0.7822253", "0.78184354", "0.7763924", "0.77306044", "0.77058005", "0.7701735", "0.7645425", "0.76187193", "0.7604982", "0.75975245", "0.75973374", "0.757...
0.747475
32
index. The function should return another index, `j`: this should satisfy: (a) `arr[i] < arr[j]`, AND (b) there is no `j2` closer to `i` than `j` where `arr[i] < arr[j2]`. In case of ties (see example below), choose the earliest (leftmost) of the two indices. If no number in `arr` is larger than `arr[i]`, return `nil`.
def nearest_larger(arr, i) # array = [2,3,4,8], indec [i=1]= 3 d = 1 while true l = i - d r = i + d if (l >= 0) && (arr[l] > arr[i]) return l elsif (r < arr.length) && (arr[r] > arr[i]) return r elsif (l < 0 ) && (r >= arr.length) return nil end d += 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest_larger(arr, idx)\n # if idx is the first\n if idx == 0\n # if right is bigger\n if arr[idx + 1] > arr[idx]\n return idx + 1\n # else search through everything else\n else\n biggest_value = arr[idx]\n biggest_value_index = -1\n arr.each_with_index do |number, jdx|\n ...
[ "0.7298648", "0.72391385", "0.71328884", "0.70165634", "0.70102215", "0.69695765", "0.6958047", "0.69226766", "0.6914601", "0.6909252", "0.690685", "0.6897814", "0.678788", "0.6722649", "0.6671319", "0.6628044", "0.66170335", "0.66098046", "0.66019857", "0.6588231", "0.656870...
0.6659567
15
verifies user answer for the intro of the program
def verify_user_answer(user_answer) until user_answer == "1" || user_answer == "2" || user_answer == "3" puts "That's not a valid answer. Please enter 1, 2, or 3" user_answer = gets.chomp.to_s end return user_answer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intro_prompt(intro_prompt_answer, current_user)\n\n if intro_prompt_answer == \"Run inside and save them\"\n system \"clear\"\n\n puts user_stats(current_user)\n\n puts \"You run up the steps to save the villages. The doors have been chained shut.\"\n # sleep 1\n\n run_into_temple(c...
[ "0.7564445", "0.724912", "0.72198373", "0.7200829", "0.71351194", "0.7129121", "0.7069617", "0.7065441", "0.7041917", "0.7023977", "0.6991393", "0.69694656", "0.6960876", "0.695705", "0.6932838", "0.69122285", "0.6899078", "0.6888653", "0.6888642", "0.68709826", "0.6869634", ...
0.0
-1
verifies user entry for choosing a valid planet to view it's info
def verify_planet_choice(user_choice) until user_choice == "earth" || user_choice == "jupiter" || user_choice == "mars" puts "That's not a valid planet on this list! Please type the planet name." user_choice = gets.chomp end return user_choice end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_planet\n if @planet_hash.key? @name\n return true\n elsif planet != @name\n puts \"Sorry, I don't know anything about planet #{@name}!\"\n return false\n end\n end", "def pick_a_planet\n display_planet = nil\n puts \"\\nPlease choose from the following list of planets....
[ "0.76418275", "0.7000079", "0.66779506", "0.66724783", "0.64776474", "0.6471103", "0.6397003", "0.63028944", "0.629224", "0.6248113", "0.62418187", "0.6134562", "0.61067903", "0.6105825", "0.6104187", "0.6090936", "0.6062753", "0.6058254", "0.5999683", "0.5961588", "0.5953539...
0.6757304
2
allows user to input a new planet and it's info
def add_a_planet(solar_system) print "Please enter the planet name: " name = gets.chomp print"What is #{name}'s color? " color = gets.chomp print "What is the mass of #{name}? " mass_kg = gets.chomp print "What is the #{name}'s distance from the sun? " distance_from_sun_km = gets.chomp print "What's a fun fact about #{name}? " fun_fact = gets.chomp new_planet = Planet.new(name, color, mass_kg, distance_from_sun_km, fun_fact) solar_system.add_planet(new_planet) puts return "Here is the info you entered about this new planet: \n" + new_planet.summary end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_planet (solar_system)\n print\"Enter a planet name: \"\n planet_name = gets.chomp # ask them for the name of the planet they wish to learn about\n planet = solar_system.find_planet_by_name(planet_name)\n if planet.nil?\n # Ask the user for details about the planet (W3.3)\n puts\"What is the plane...
[ "0.8069157", "0.8061858", "0.80476743", "0.8039219", "0.7933017", "0.79298973", "0.79068196", "0.78757375", "0.7847417", "0.7787685", "0.7713235", "0.77040577", "0.76626253", "0.76617485", "0.75741416", "0.7557486", "0.7535307", "0.75349694", "0.7373399", "0.73467845", "0.728...
0.7870721
8
outputs user choice from intro_to_program definition
def control_loop_options(solar_system) user_answer = verify_user_answer(gets.chomp) case user_answer when "1" puts puts "Here are some " + solar_system.list_planets puts puts "Which planet would you like to see info on?" user_choice = verify_planet_choice(gets.chomp) found_planet = solar_system.find_planet_by_name(user_choice) puts puts found_planet when "2" puts puts add_a_planet(solar_system) when "3" puts puts "You are exiting the program. Thanks for playing!" exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def menu\n puts \"EEG query app\"\n puts \"1: return EEG value\"\n puts \"2: return attention value\"\n puts \"3: return meditation value\"\n gets.chomp\nend", "def provide_user_option \r\n @user_choice = user_input \"\\nWhat would you like to do?\\nPress 1 to pick a file and play normally\\nPress 2 to pla...
[ "0.74104285", "0.725734", "0.71587825", "0.7083244", "0.69709224", "0.6970787", "0.6941129", "0.6932346", "0.69195884", "0.69119817", "0.6898987", "0.68934083", "0.68875873", "0.6880817", "0.68789923", "0.68752295", "0.68515265", "0.6834155", "0.681113", "0.6791765", "0.67878...
0.0
-1
Called after every test method runs. Can be used to tear down fixture information. Fake test
def test_1 assert_equal(@first.class > @second.class, true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_teardown; end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown...
[ "0.80787945", "0.80348516", "0.80348516", "0.79532427", "0.79532427", "0.79532427", "0.79532427", "0.79532427", "0.79532427", "0.79532427", "0.79532427", "0.7929417", "0.7898116", "0.7898116", "0.7896045", "0.7896045", "0.784597", "0.7843842", "0.7832242", "0.7832242", "0.783...
0.0
-1
Input: s = "abcabcbb" Output: 3
def length_of_longest_substring(s) head, tail, len, max_len = 0, 0, 0, 0 while tail < s.size len = tail + 1 - head max_len = [len, max_len].max return max_len if s.size - head <= max_len if s[head..tail].include?(s[tail + 1]) head += 1 tail += 1 if tail < head else tail += 1 end end max_len end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def char_count(s,c)\n\t\tcont = 0\n\t\ts.length.times do |i|\n\t\t\tif(s[i] == c)\n\t\t\t\tcont += 1\n\t\t\tend\n\t\tend\n\t\tcont\n\tend", "def getCount(str)\n str.count(\"AEIOUaeiou\")\nend", "def count_string(string, characters)\n i = 0\n size = characters.length\n hits = 0\n while i < string.l...
[ "0.75738347", "0.75562614", "0.7539704", "0.7521183", "0.7519975", "0.74746144", "0.74730694", "0.74266696", "0.7406119", "0.73720276", "0.73565257", "0.73526084", "0.7350566", "0.7350566", "0.7344836", "0.73414546", "0.7330587", "0.73211765", "0.73211765", "0.72815114", "0.7...
0.0
-1
Get the current version for a DOR object. This comes from ObjectVersion table in the DSA
def current resp = connection.get do |req| req.url "#{base_path}/current" end return resp.body if resp.success? raise_exception_based_on_response!(resp) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_object\n @definitions.fetch_version(version)\n end", "def version\n\t\treturn @version ||= self.find_version\n\tend", "def current_version\n self.class.superclass.find(rid)\n end", "def current_version\n find( :first, :order => 'number DESC' )\n end", "def cu...
[ "0.69911206", "0.67437834", "0.6665874", "0.66376704", "0.662946", "0.66152054", "0.66152054", "0.6581571", "0.6581571", "0.656778", "0.6478747", "0.6444105", "0.6440429", "0.64359516", "0.64088964", "0.6344017", "0.63363165", "0.62874496", "0.6282374", "0.62754554", "0.62454...
0.0
-1
Determines if a new version can be opened for a DOR object.
def openable? resp = connection.get do |req| req.url "#{base_path}/openable" end raise_exception_based_on_response!(resp) unless resp.success? case resp.body when 'true' true when 'false' false else raise MalformedResponse, "Expected true or false, not #{resp.body}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version_object\n return unless accessioned?\n\n unless DorObjectWorkflowStatus.new(cocina.externalIdentifier, version: cocina.version).can_open_version?\n log.puts(\"argo.bulk_metadata.bulk_log_unable_to_version #{cocina.externalIdentifier}\") # totally unexpected\n return\n end\n commit_...
[ "0.6697393", "0.6432288", "0.63415474", "0.6139396", "0.6120216", "0.61160964", "0.60824627", "0.5977413", "0.59767115", "0.59536743", "0.5952625", "0.59452784", "0.59035385", "0.5839867", "0.5812336", "0.5760339", "0.575525", "0.575525", "0.57502145", "0.5745203", "0.5745147...
0.0
-1
rubocop:enable Metrics/MethodLength Open new version for an object
def open(**params) resp = connection.post do |req| req.url open_new_version_path req.headers['Content-Type'] = 'application/json' req.body = params.to_json if params.any? end raise_exception_based_on_response!(resp) unless resp.success? build_cocina_from_response(resp) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_new_object\n save_state\n oid = open_object\n close_object\n add_object(oid)\n reopen_object(oid)\n oid\n end", "def version_for(object)\n old_obj = self[object.send(\"#{self.name.underscore}_id\".to_sym)].values\n old_obj.delete(:id)\n old_version = old_obj.de...
[ "0.7448863", "0.67529666", "0.65850216", "0.64585227", "0.6330049", "0.6310305", "0.6267242", "0.6067859", "0.59896624", "0.5941691", "0.58995265", "0.5868306", "0.5859284", "0.5833784", "0.5744951", "0.57306415", "0.5679831", "0.5666873", "0.56604916", "0.5633722", "0.562078...
0.61564463
7
Close current version for an object
def close(**params) resp = connection.post do |req| req.url close_version_path req.headers['Content-Type'] = 'application/json' req.body = params.to_json if params.any? end return resp.body if resp.success? raise_exception_based_on_response!(resp) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n\n # nothing to do here.\n end", "def close\n # this method may be left unimplemented if that is applicable\n end", "def close_version\n unless params[:bulk] || !params[:severity] || !params[:description]\n severity = params[:severity]\n desc = params[:description]\n ...
[ "0.68941253", "0.68717414", "0.6812632", "0.6806664", "0.68049353", "0.68029475", "0.68029475", "0.68029475", "0.679294", "0.677015", "0.6748571", "0.670916", "0.670152", "0.67010015", "0.67010015", "0.67010015", "0.67010015", "0.67010015", "0.67010015", "0.67010015", "0.6701...
0.6334048
85
Find a record by ID using the specified Client.
def initialize(client, id) @client = client @id = id options = {:id => @id} @xml = @client.fetch(:record, options) parse_record end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_by_id(client, id, params = {})\n params = default_params.merge(params)\n\n client.get(\"#{resource_name}/#{id}\", params).data[resource_name_singular]\n end", "def find(id)\n @records.find { |record| record.id == id }\n end", "def find(record_id)\n result = DATABASE.execute(\...
[ "0.7837301", "0.7189392", "0.6986425", "0.6943913", "0.6939603", "0.6939603", "0.6900209", "0.6852946", "0.6674162", "0.6657427", "0.66019064", "0.66019064", "0.6583202", "0.6531743", "0.6524828", "0.6524828", "0.6522158", "0.65156746", "0.65156746", "0.6508935", "0.65048593"...
0.0
-1
Fetch the availability information from the API
def availability @availability ||= begin xml = @client.fetch(:record_availability, :id => self.id) doc = Nokogiri::XML(xml) returning({}) do |hash| doc.xpath('//holding').each do |xdata| holding = xdata.xpath('name').text hash[holding] = xdata.xpath('available').text == 'true' end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def availability(*args)\n @client.get \"#{@path}/availability\", Hash[*args]\n end", "def availability\n STATUS_TO_AVAILABILITY[self.status]\n end", "def available?\n AvailableResponse.new(request(:get, '/information')).success?\n end", "def availability\n end", "def availability\n...
[ "0.75039864", "0.70745057", "0.69069624", "0.67523724", "0.6751974", "0.6713944", "0.65632635", "0.65632635", "0.6556981", "0.6523046", "0.65004593", "0.6417746", "0.6339766", "0.63358945", "0.63345313", "0.63273066", "0.62826234", "0.6279637", "0.6125617", "0.6120542", "0.60...
0.6814783
3
Return a Nokogiri document for the XML
def document @doc ||= Nokogiri::XML(@xml) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n xml\n end", "def xml_document\n xml = XML::Document.new\n xml.root = self.to_xml\n xml\n end", "def xml_doc version = nil\n Nokogiri::XML::Document.new version\n end", "def document(source)\n ::...
[ "0.7727292", "0.76820827", "0.7681778", "0.74800265", "0.74030286", "0.7390381", "0.7340226", "0.7250392", "0.71637464", "0.7132673", "0.7036456", "0.69717705", "0.68770814", "0.6856269", "0.6845538", "0.6845538", "0.68433094", "0.6839946", "0.68128914", "0.68018764", "0.6736...
0.8118901
0
Parse the result into an array of DNZ::Result
def parse_record @data = NamespaceArray.new document.xpath('//xmlns:xmlData').each do |xdata| xdata.children.each do |child| if child.element? @data << child end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_results(results)\n out = []\n results = [results] if results.is_a?(Hash) # no array if only one result\n results.each do |r|\n out << Result.new(r)\n end\n out\n end", "def parse_results(results)\n\t\t\tresults.map { |result| [result[:id], result[:success], result[:se...
[ "0.77913636", "0.7061656", "0.6893967", "0.6893184", "0.661541", "0.64869624", "0.63821405", "0.634212", "0.63239646", "0.62103546", "0.6189881", "0.6183819", "0.6035341", "0.60283613", "0.6027542", "0.6004565", "0.5999194", "0.59712857", "0.59545535", "0.5938906", "0.5908833...
0.0
-1
parameters for drill down detail
def addAnd(column, value) # If we see a column we don't recognize, stop everything if (@andparams[column] == "") puts("Unrecognized column") else # We have a hash of arrays for when we have multiple criteria for one column @andparams[column].push(value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details\n\n end", "def details\n end", "def details(*args); end", "def details_for(**options)\n\t\t\t\t\toptions[:details]\n\t\t\t\tend", "def details; end", "def additional_details\n\n end", "def show_details\n @selected.details\n end", "def show\n setup_variables(params)\n\n end...
[ "0.61945003", "0.6170155", "0.61517787", "0.59689224", "0.5936739", "0.5897457", "0.58830124", "0.5631259", "0.55910796", "0.5561027", "0.5539127", "0.5535122", "0.5507724", "0.5502608", "0.5502608", "0.54979956", "0.5473771", "0.546345", "0.5456012", "0.54544586", "0.5442087...
0.0
-1
parameters for select statement
def add(column, value) # If we see a column we don't recognize, stop everything if (@params[column] == "") puts("Unrecognized column") else # We have a hash of arrays for when we have multiple criteria for one column @params[column].push(value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select(*) end", "def select(sql, name = nil, binds = [])\n hash_query(sql, name, binds)\n end", "def select_all(sql, name = nil) end", "def select_statement\n \"select \" + selected_field_names.map { |field_name| zuora_field_name(field_name) }.join(', ')\n end", "def select(*arg...
[ "0.68567324", "0.68189377", "0.681279", "0.67978275", "0.67567796", "0.66531503", "0.66079307", "0.6599685", "0.6599685", "0.65623266", "0.6559231", "0.6461403", "0.6408935", "0.64044034", "0.6327686", "0.6283204", "0.6238863", "0.6224248", "0.6182509", "0.61770725", "0.61770...
0.0
-1
TODO: What attributes are needed here? shouldn't be returning Find users where they have been shared on the same lists as current user Filter out usere that are already shared on the supplied list
def related_users_query(list_id) <<-SQL SELECT DISTINCT "users".* FROM "users" INNER JOIN "users_lists" ON "users"."id" = "users_lists"."user_id" WHERE "users_lists"."list_id" IN ( SELECT "lists"."id" FROM "lists" INNER JOIN "users_lists" ON "lists"."id" = "users_lists"."list_id" WHERE "users_lists"."user_id" = #{id} ) AND NOT "users"."id" IN ( SELECT "users_lists"."user_id" FROM "users_lists" WHERE "users_lists"."list_id" = #{list_id} ); SQL end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_common_users(item1, item2, list = @users)\n #list.collect { |u| u if u.has_item? item1.id and u.has_item? item2.id }.compact\n #list.collect { |u| u if u.list.items[item1.id] and u.list.items[item2.id] }.compact\n common = []\n list.each_value do |u|\n common << u if u...
[ "0.733174", "0.6532454", "0.62526095", "0.61758024", "0.60615957", "0.60446376", "0.5972122", "0.59015954", "0.5866766", "0.586257", "0.5847487", "0.58376056", "0.583609", "0.58320755", "0.5832028", "0.583058", "0.5804547", "0.57964075", "0.5767077", "0.57648504", "0.5760346"...
0.62941974
2
empty action, does not do anything, not even block
def pass end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def run_actions; end", "def action_nothing\n logger.trace(\"Doing nothing for #{@new_resource}\")\n true\n end", "def default_action(msg)\n #\n # do nothing.\n ...
[ "0.7039078", "0.7039078", "0.7039078", "0.7039078", "0.7039078", "0.69777703", "0.69041574", "0.6875959", "0.682607", "0.6778664", "0.6778664", "0.6778664", "0.6778664", "0.6778664", "0.6778664", "0.6726684", "0.6719927", "0.66578954", "0.6619325", "0.66110814", "0.6596994", ...
0.0
-1
convert to pixel coordinates
def normalize_x x (x.to_f + ((@width - @height) / @height) / 2) * @width / (@width/@height) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_coordinates\n\n CGPointMake(self.x.to_coordinates, self.y.to_coordinates)\n end", "def transform \n \n @pixel_location = get_pixel_points \n puts \"px loc : #{@pixel_location}\"\n \n while @pixel_location.size != 0 \n transform_pixel_points(@pixel_location)\n @pixel_location.sh...
[ "0.73317444", "0.73305166", "0.7021287", "0.6949263", "0.6768034", "0.6731859", "0.6677283", "0.6672539", "0.6628504", "0.6608687", "0.6537207", "0.65193164", "0.65193105", "0.64875776", "0.6454542", "0.6430837", "0.6424197", "0.6423173", "0.6416333", "0.6416333", "0.63860893...
0.0
-1
Replace this with your real tests.
def test_truth assert true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testing\n # ...\n end", "def __dummy_test__\n end", "def tests; end", "def tests; end", "def spec; end", "def spec; end", "def self_test; end", "def self_test; end", "def test \n end", "def test_0_dummy\n\t\tend", "def test\n\n end", "def test\n end", "def test\n end"...
[ "0.7446459", "0.6956364", "0.69155836", "0.69155836", "0.6864151", "0.6864151", "0.66406286", "0.66406286", "0.66253287", "0.6547665", "0.6524571", "0.6484549", "0.6484549", "0.6484549", "0.6403847", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188"...
0.0
-1
TODO: specify a start cell should also work for polar grids
def start_cell if options[:type] == :polar grid[grid.rows-1, 0] else if !options[:distances] || options[:distances] == :auto column = grid.columns.times.find {|i| grid[0,i] } return grid[0,column] if column row = grid.rows.times.find {|i| grid[i,0] } return grid[row,0] else grid[*options[:distances]] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finish_cell\n if options[:type] == :polar\n row = grid.rows-1\n columns = grid.columns row\n grid[row, columns.size / 2]\n else\n if !options[:solution] || options[:solution] == :auto\n column = grid.columns.times.find {|i| grid[grid.rows-1,grid.columns-1-i] }\n return g...
[ "0.73601013", "0.6884154", "0.68472785", "0.6375854", "0.6349071", "0.6345852", "0.63275933", "0.61921746", "0.61921746", "0.61153746", "0.6089568", "0.60747963", "0.6058589", "0.6003311", "0.5996001", "0.59675825", "0.5955248", "0.59481883", "0.59091276", "0.5908921", "0.588...
0.8347695
0
TODO: specify a finish cell should also work for polar grids
def finish_cell if options[:type] == :polar row = grid.rows-1 columns = grid.columns row grid[row, columns.size / 2] else if !options[:solution] || options[:solution] == :auto column = grid.columns.times.find {|i| grid[grid.rows-1,grid.columns-1-i] } return grid[grid.rows-1,grid.columns-1-column] if column row = grid.rows.times.find {|i| grid[grid.rows-1-i,grid.columns-1] } return grid[grid.rows-1-row,grid.columns-1] else grid[*options[:solution]] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_cell\n if options[:type] == :polar\n grid[grid.rows-1, 0]\n else\n if !options[:distances] || options[:distances] == :auto\n column = grid.columns.times.find {|i| grid[0,i] }\n return grid[0,column] if column\n row = grid.rows.times.find {|i| grid[i,0] }\n retu...
[ "0.74925804", "0.6505543", "0.6238749", "0.6164297", "0.6152001", "0.5995412", "0.5995412", "0.59833616", "0.59807914", "0.5961691", "0.5911807", "0.58449036", "0.58219695", "0.5791923", "0.57590157", "0.57209337", "0.5653472", "0.56236815", "0.5623249", "0.5563307", "0.55266...
0.827967
0
Reads keypresses from the user including 2 and 3 escape character sequences.
def read_char STDIN.echo = false STDIN.raw! input = STDIN.getc.chr if input == "\e" then input << STDIN.read_nonblock(3) rescue nil input << STDIN.read_nonblock(2) rescue nil end input ensure STDIN.echo = true STDIN.cooked! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_pressed\n if STDIN.ready?\n input = STDIN.read_nonblock(1) rescue nil\n if input == \"\\e\" \n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n end\n # STDIN.cooked!\n input\n\nend", "def pressKey\n STDIN.echo = false\n STDIN.raw!\n ...
[ "0.717189", "0.71680975", "0.70763326", "0.7075197", "0.70361507", "0.6969546", "0.6937639", "0.6894975", "0.67837787", "0.6695388", "0.66821814", "0.66595066", "0.6654973", "0.6571633", "0.6534268", "0.6481354", "0.6472208", "0.6462229", "0.64368916", "0.6432087", "0.6412788...
0.6489353
15
Retrieve your caller IDs Get available caller IDs, you may add them, but 2FA confirmation is required for every new callerId.
def caller_ids_get(opts = {}) data, _status_code, _headers = caller_ids_get_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_ids()\n return [1, 2]\n end", "def requester_ids\n @requester_ids ||= []\n end", "def caller_ids_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CallerIdsApi.caller_ids_get ...'\n end\n # resource ...
[ "0.6576898", "0.64653915", "0.6090984", "0.60339445", "0.59802616", "0.59398973", "0.5922219", "0.59192437", "0.59006244", "0.58505744", "0.58314544", "0.579299", "0.57911694", "0.577943", "0.57264465", "0.5715919", "0.5711786", "0.5710005", "0.5705241", "0.56804264", "0.5673...
0.6800031
0
Retrieve your caller IDs Get available caller IDs, you may add them, but 2FA confirmation is required for every new callerId.
def caller_ids_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CallerIdsApi.caller_ids_get ...' end # resource path local_var_path = '/callerIds' # 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 = ['apiKey'] 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 => 'CallerIdsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CallerIdsApi#caller_ids_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def caller_ids_get(opts = {})\n data, _status_code, _headers = caller_ids_get_with_http_info(opts)\n data\n end", "def account_ids()\n return [1, 2]\n end", "def requester_ids\n @requester_ids ||= []\n end", "def get_lawyer_user_ids\n @assigned_lawfirm_users.map(&:id)\n end",...
[ "0.6800031", "0.6576898", "0.64653915", "0.60339445", "0.59802616", "0.59398973", "0.5922219", "0.59192437", "0.59006244", "0.58505744", "0.58314544", "0.579299", "0.57911694", "0.577943", "0.57264465", "0.5715919", "0.5711786", "0.5710005", "0.5705241", "0.56804264", "0.5673...
0.6090984
3
Internal: Append another string to self.
def append(other) other.concat_head(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concat(str)\n @string << str\n self\n end", "def append(input, string); end", "def append(s)\n if @input.nil?\n @input = \"\"\n end\n @input += s\n @output.text = @input\n end", "def <<(string)\n @string << string\n self\n end", "def string_append(strin...
[ "0.77842844", "0.7243721", "0.7208042", "0.7188082", "0.7161969", "0.71613234", "0.71613234", "0.71613234", "0.7131331", "0.70477", "0.6916564", "0.6916564", "0.6823779", "0.6767092", "0.6627288", "0.6627288", "0.66253483", "0.659675", "0.65924275", "0.6488758", "0.6449678", ...
0.0
-1
Internal: prepend another string to self.
def concat_head(other) StringWrapper.new(other.to_s + to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepend(input, string); end", "def prepend!(buffer)\n @str = buffer.to_s + @str\n self\n end", "def prepend!(buffer)\n @str = buffer.to_s + @str\n self\n end", "def prepend(str)\n @buffer.insert(0, str)\n @range.first -= str.bytesize\n str.bytesize\n end", "d...
[ "0.77301776", "0.73044556", "0.73044556", "0.6812848", "0.66266847", "0.66230655", "0.6543505", "0.64583206", "0.6377258", "0.6239208", "0.6181443", "0.6165812", "0.6134458", "0.6133172", "0.6118905", "0.60570484", "0.59663886", "0.59482884", "0.5875215", "0.58535296", "0.583...
0.6314964
9
Private: Prepend another string to self. If the other string end with a word character, A space is inserted between the two string.
def concat_head(other) if other.to_s.empty? self elsif other.to_s.match(/[\W&&[:ascii:]]\Z/) DecorationWrapper.new(other.to_s + to_s) else DecorationWrapper.new("#{other} #{to_s}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepend(input, string); end", "def new_word(s)\n\ts[0] = ''\n\treturn s\nend", "def concat_without_endcaps(string1, string2)\n return nil if !string1 and !string2\n return string1 if string2.nil?\n return string2 if string1.nil?\n s1 = string1[-1] == ?$ ? string1[0..-2] ...
[ "0.6291408", "0.6107307", "0.60943687", "0.6077634", "0.5766145", "0.5747661", "0.5730146", "0.5707961", "0.56947225", "0.56771445", "0.5658891", "0.5648063", "0.5627798", "0.5590298", "0.55400676", "0.55361474", "0.55292606", "0.5528621", "0.552548", "0.5522884", "0.55220574...
0.5912864
4
Internal: Return Array of Strings, where there are separators between each string.
def to_a extracted_children = children.map { |c| c.respond_to?(:to_a) ? c.to_a : c } extracted_children.zip(Array.new(children.length, separator)).flatten[0..-2] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_delimiters\r\n\t\toutput = []\r\n\t\toutput << input.split(\"]\\n\").first[3..-1].split(\"][\") if input.start_with?('//')\r\n\t\toutput.flatten\r\n\tend", "def extract_separator\n if meta_tags[:separator] == false\n # Special case: if separator is hidden, do not display suffix/prefix\n ...
[ "0.6609526", "0.6212196", "0.6208066", "0.61640775", "0.6152267", "0.60928917", "0.60835016", "0.6017132", "0.59844553", "0.5977726", "0.5949035", "0.5922729", "0.5911826", "0.5891616", "0.58620876", "0.58616453", "0.5849883", "0.57922065", "0.5790293", "0.5789554", "0.569668...
0.0
-1
Allows to register middleware for Faraday v0.8 and v0.9
def register_middleware(type, sym, cls) cls = DeskApi.const_get(type.capitalize).const_get(cls) if Faraday.respond_to?(:register_middleware) Faraday.register_middleware type, sym => cls else Faraday.const_get(type.capitalize).register_middleware sym => cls end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_faraday\n faraday_options = options.slice(:headers, :params)\n if options[:insecure]\n faraday_options[:ssl] = { verify: false }\n end\n Faraday.new(nil, faraday_options) do\n # options\n if options[:url_prefix]\n _1.url_prefix = options[:url_prefix]\n ...
[ "0.70027167", "0.68342936", "0.6635883", "0.62428296", "0.6167699", "0.59687024", "0.5905734", "0.5866064", "0.5853779", "0.5853009", "0.5825979", "0.5824134", "0.57624215", "0.5644592", "0.5564366", "0.5501938", "0.54833907", "0.54647684", "0.54582924", "0.5449414", "0.54451...
0.57387316
13
Registers the middleware when the module is included.
def included(_base) register_middleware :request, :desk_encode_dates, :EncodeDates register_middleware :request, :desk_encode_json, :EncodeJson register_middleware :request, :desk_oauth, :OAuth register_middleware :request, :desk_retry, :Retry register_middleware :response, :desk_parse_dates, :ParseDates register_middleware :response, :desk_parse_json, :ParseJson register_middleware :response, :desk_raise_error, :RaiseError register_middleware :response, :desk_follow_redirects, :FollowRedirects end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def middleware(&block)\n @@middleware << block\n end", "def use(middleware)\n @middlewares << middleware\n end", "def app_middleware; end", "def _install_middleware_if_needed\n return if @__middleware_installed\n @__middleware_installed = true\n\n if defined?(Rails) && Rails.re...
[ "0.67002696", "0.64841336", "0.64770615", "0.63348615", "0.6334201", "0.6210301", "0.620648", "0.62016684", "0.6152596", "0.61126757", "0.6100705", "0.6087294", "0.6046669", "0.59765446", "0.5973134", "0.5933101", "0.58918494", "0.58721197", "0.5863268", "0.58445334", "0.5832...
0.6654281
1
Builds the endpoint using the subdomain if the endpoint isn't set
def endpoint @endpoint ||= "https://#{@subdomain}.desk.com" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_endpoint(endpoint)\n raise 'Endpoint not a valid URI' if (endpoint =~ URI::ABS_URI).nil?\n @endpoint = endpoint.chomp('/') + '/'\n end", "def to_sub_domain\n return nil unless to_host\n\n dot_domain = \".#{to_domain}\"\n return nil unless include?(dot_domain)\n...
[ "0.6517751", "0.6372619", "0.6234651", "0.6198331", "0.61147004", "0.6021812", "0.5961822", "0.59138006", "0.59003794", "0.58593804", "0.58565265", "0.5839755", "0.58372724", "0.58064747", "0.5790946", "0.5790901", "0.578068", "0.57648546", "0.57540756", "0.5723406", "0.57084...
0.65827227
0
Returns the middleware proc to be used by Faraday
def middleware @middleware ||= proc do |builder| builder.request(:desk_encode_dates) builder.request(:desk_encode_json) builder.request(*authorize_request) builder.request(:desk_retry) builder.response(:desk_parse_dates) builder.response(:desk_follow_redirects) builder.response(:desk_raise_error, DeskApi::Error::ClientError) builder.response(:desk_raise_error, DeskApi::Error::ServerError) builder.response(:desk_parse_json) builder.adapter(Faraday.default_adapter) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def middleware(&block); end", "def middleware; end", "def middleware\n Yeah.application.server.middleware\n end", "def middleware\n connection.builder\n end", "def app_middleware; end", "def default_middleware\n Proc.new do |builder|\n builder.use Faraday::Request::Multipa...
[ "0.69821143", "0.6741374", "0.65072715", "0.6446681", "0.6387039", "0.6325284", "0.63214296", "0.631082", "0.6267026", "0.6237969", "0.62288827", "0.6108695", "0.6086364", "0.6060183", "0.60509527", "0.60366964", "0.6034569", "0.6033481", "0.5985266", "0.5929691", "0.5901931"...
0.73468447
0
Allows to configure the client by yielding self.
def configure yield self validate_credentials! validate_endpoint! self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure\n yield client\n end", "def configure()\n\t\t\tyield self\n\t\tend", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n yield self\n end", "def configure\n ...
[ "0.8684968", "0.81468153", "0.8102667", "0.8102667", "0.8102667", "0.8102667", "0.8102667", "0.8076844", "0.8076844", "0.8076844", "0.8076844", "0.8076844", "0.8076844", "0.8076844", "0.8076844", "0.8076844", "0.8076844", "0.8076844", "0.8076844", "0.8076844", "0.8076844", ...
0.0
-1
Resets the client to the default settings.
def reset! DeskApi::Configuration.keys.each do |key| send("#{key}=", DeskApi::Default.options[key]) end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_client\n @client = nil\n init_client\n end", "def reset\n @client = nil\n end", "def reset_client!\n @client = nil\n end", "def reset\n @config = nil\n @client = nil\n end", "def reset!\n client.reset!\n end", "def reset\n self.client_account ...
[ "0.79605937", "0.7937661", "0.78635484", "0.7641181", "0.75611395", "0.7523864", "0.74797636", "0.7464598", "0.7084436", "0.69532615", "0.6939343", "0.6922093", "0.68881327", "0.68505824", "0.68442756", "0.6810016", "0.680533", "0.68052167", "0.67869395", "0.6767656", "0.6757...
0.65216565
45
Returns true if either all oauth values or all basic auth values are set.
def credentials? oauth.values.all? || basic_auth.values.all? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_oauth_credentials?\n return false if @configuration.nil?\n RightSignature2013::Connection.oauth_keys.each do |key| \n return false if @configuration[key].nil? || @configuration[key].match(/^\\s*$/)\n end\n\n return true\n end", "def using_oauth?\n oauth_request? || oauth_...
[ "0.69891953", "0.67933726", "0.6683278", "0.6658534", "0.6652545", "0.6615422", "0.6610999", "0.659869", "0.6594644", "0.6577796", "0.65756464", "0.6548823", "0.65439546", "0.65327674", "0.6520778", "0.65037644", "0.64879036", "0.64828247", "0.644138", "0.6412593", "0.6347276...
0.80247307
0
Returns a hash of current configuration options.
def options Hash[ DeskApi::Configuration.keys.map do |key| [key, instance_variable_get(:"@#{key}")] end ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options\n Hash[ *Configuration::VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def options\n opts = {}\n self.configuration_options.each do |option|\n opts.merge!({option.name.to_sym => option.value})\n end\n opts\n end", "def options\n Hash[\n *Co...
[ "0.7960832", "0.79068476", "0.79046935", "0.77586854", "0.77586854", "0.74774337", "0.74418277", "0.74418277", "0.74260384", "0.7350849", "0.7350849", "0.73275644", "0.73212206", "0.73161083", "0.7290366", "0.72759205", "0.7254382", "0.72541183", "0.7243873", "0.7243873", "0....
0.73041517
14
Returns the oauth configuration options.
def oauth { consumer_key: @consumer_key, consumer_secret: @consumer_secret, token: @token, token_secret: @token_secret } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oauth_options\n {\n consumer_key: client_id,\n consumer_secret: client_secret,\n token: access_token,\n token_secret: access_token_secret\n }\n end", "def parse_oauth_options\n {\n :request_token_url => full_oauth_url_for(:request_t...
[ "0.8353999", "0.75388616", "0.7293665", "0.7202322", "0.7004859", "0.6888537", "0.6842899", "0.67725646", "0.6676686", "0.6652374", "0.66140515", "0.6552176", "0.65185356", "0.6475543", "0.6462889", "0.6423173", "0.63995844", "0.6377984", "0.6363493", "0.63478655", "0.6294623...
0.6730869
8
Returns the basic auth configuration options.
def basic_auth { username: @username, password: @password } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_options\n cfg = APP_CONFIG[\"ldap\"]\n {\n auth: {\n username: cfg[\"authentication\"][\"bind_dn\"],\n password: cfg[\"authentication\"][\"password\"],\n method: :simple\n }\n }\n end", "def default_options\n {\n ...
[ "0.73602504", "0.71745634", "0.6961411", "0.68804455", "0.6829094", "0.67629015", "0.6694478", "0.6672955", "0.66363394", "0.6633015", "0.65153706", "0.64766186", "0.64636135", "0.6431374", "0.6355126", "0.63457704", "0.63400275", "0.6328692", "0.6324044", "0.6324044", "0.632...
0.6795035
5
Returns an array to authorize a request in the middleware proc.
def authorize_request if basic_auth.values.all? [:basic_auth, @username, @password] else [:desk_oauth, oauth] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perms_required_for( request )\n\t\tself.log.debug \"Gathering required perms for: %s %s\" % [ request.verb, request.app_path ]\n\n\t\t# Return the empty set if any negative auth criteria match\n\t\treturn [] if self.negative_perms_criteria_match?( request )\n\n\t\t# If there aren't any positive criteria, defau...
[ "0.603504", "0.59184146", "0.5760772", "0.5678278", "0.5522265", "0.5482626", "0.5482626", "0.5473406", "0.5461428", "0.544263", "0.5410963", "0.53848875", "0.53767985", "0.5361409", "0.5340941", "0.5331477", "0.5314449", "0.5306927", "0.530155", "0.53010744", "0.5288828", ...
0.5841675
2
GET /called_numbers/1 GET /called_numbers/1.xml
def show bingo_session = BingoSession.find(params[:bingo_session_id]) @player = bingo_session.players.find(params[:id]) next_page = [@player.bingo_session.games.last, :stab => 1] unless @player.bingo_session.games.length == 0 next_page = @player.bingo_session if @player.bingo_session.games.length == 0 #todo - want to select the players tab, but stab param not being passed through respond_to do |format| format.html { redirect_to(next_page) } format.json { render :json => @player} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @call_num = CallNum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @call_num }\n end\n end", "def index\n @phone_numbers = @kontact_information.phone_numbers.find(:all)\n\n respond_to do |format|\n format.html # ...
[ "0.6432421", "0.6026801", "0.5957547", "0.5635295", "0.5572257", "0.55207074", "0.543322", "0.54192877", "0.54166186", "0.5398247", "0.53938085", "0.53677946", "0.5358643", "0.53585106", "0.53344494", "0.5317223", "0.53147566", "0.53147566", "0.53147566", "0.53147566", "0.528...
0.0
-1
GET /called_numbers/new GET /called_numbers/new.xml
def new bingo_session = BingoSession.find(params[:bingo_session_id]) @player = Player.new @player.bingo_session = bingo_session respond_to do |format| format.html # new.html.erb format.xml { render :xml => @player } format.json { render :json => @player} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @call_num = CallNum.new\n @book = Book.find(params[:book_id])\n @call_nums = CallNum.find(:all, :conditions => ['book_id = ?', @book])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @call_num }\n end\n end", "def new\n @call = Call.ne...
[ "0.71344805", "0.66850007", "0.66418505", "0.6530006", "0.6481091", "0.6472754", "0.6360616", "0.63558924", "0.6352467", "0.63130105", "0.62990624", "0.6294667", "0.62321126", "0.6203223", "0.6194555", "0.61834246", "0.61767626", "0.61494994", "0.61381686", "0.6129573", "0.61...
0.0
-1
POST /called_numbers POST /called_numbers.xml
def create bingo_session = BingoSession.find(params[:bingo_session_id]) @player = Player.new(params[:player]) @player.bingo_session = bingo_session @player.caller = current_caller respond_to do |format| if @player.save format.html { redirect_to(@player, :notice => 'Player was successfully created.') } format.xml { render :xml => @player, :status => :created, :location => @player } format.json { render :json => @player} else format.html { render :action => "new" } format.xml { render :xml => @player.errors, :status => :unprocessable_entity } format.json { render :json => @player.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_digits(params)\n path = @version + '/Call/SendDigits/'\n method = 'POST'\n return request(path, method, params)\n end", "def create\n @call_num = CallNum.new(params[:call_num])\n\n respond_to do |format|\n if @call_num.save\n flash[:success] = 'Call number was success...
[ "0.5537629", "0.55127954", "0.5213401", "0.51831156", "0.51831156", "0.518236", "0.5147877", "0.5137531", "0.51213485", "0.51134574", "0.5112982", "0.506419", "0.5063335", "0.5052763", "0.50115305", "0.4991252", "0.4947363", "0.49247676", "0.48999003", "0.489375", "0.48907426...
0.0
-1
PUT /players/1 PUT /players/1.xml
def update bingo_session = BingoSession.find(params[:bingo_session_id]) @player = bingo_session.players.find(params[:id]) respond_to do |format| if @player.update_attributes(params[:player]) format.html { redirect_to(@player, :notice => 'Player was successfully updated.') } format.xml { head :ok } format.json { render :json => @player} else format.html { render :action => "edit" } format.xml { render :xml => @player.errors, :status => :unprocessable_entity } format.json { render :json => @player.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @player = Player.find(params[:id])\n\n respond_to do |format|\n if @player.update_attributes(params[:player])\n flash[:notice] = 'Player was successfully updated.'\n format.html { redirect_to(@player) }\n format.xml { head :ok }\n else\n format.html { rende...
[ "0.6518195", "0.6518195", "0.64573336", "0.6432195", "0.6350137", "0.6350109", "0.63201773", "0.62731624", "0.62502843", "0.6207475", "0.6164538", "0.6144399", "0.61200637", "0.6075441", "0.60736656", "0.60673934", "0.60672265", "0.60672265", "0.60672265", "0.60672265", "0.60...
0.6024223
23
DELETE /players/1 DELETE /players/1.xml
def destroy bingo_session = BingoSession.find(params[:bingo_session_id]) @player = bingo_session.players.find(params[:id]) @player.destroy respond_to do |format| format.html { redirect_to(players_url) } format.xml { head :ok } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n format.html { redirect_to(players_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @player = Player.find(params[:id])\n @player.destroy\n\n respond_to do |format|\n f...
[ "0.7140511", "0.7140511", "0.7140511", "0.7140511", "0.7140511", "0.70677996", "0.7024825", "0.68334705", "0.67315525", "0.6675455", "0.6625119", "0.65786517", "0.6490818", "0.64758426", "0.64732134", "0.6432913", "0.6432913", "0.64187455", "0.641455", "0.641455", "0.641455",...
0.636683
31
get a copious public profile if it's a user, otherwise, point to a facebook public profile
def link_to_person_profile(person, options = {}) if person.registered? link_to_user_profile person.user, options else facebook_profile = person.for_network(:facebook) link_to_network_profile(facebook_profile, options) if facebook_profile end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\n end", "def profile\n @profile ||= @request.do_request { FacebookUserProfile.populate(user) }\n end", "def user_profile\n @current_user = current_user\n\n if params...
[ "0.7594776", "0.714637", "0.687589", "0.68749297", "0.68597203", "0.6858141", "0.6842586", "0.67629945", "0.6751866", "0.67336637", "0.6710441", "0.670961", "0.6696251", "0.6658839", "0.66489094", "0.66469806", "0.6644257", "0.66381747", "0.66046345", "0.66013896", "0.6587727...
0.65553576
21
most phases will stop the flow of the game (while an action is being taken)
def lock_movements? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop\n super\n @player.action_queue.next_action\n end", "def stop_game?\n finished? || user_turn?\n end", "def action_b\n play_cancel_se\n @running = false\n end", "def stopping; end", "def end_game\n end", "def dealer_stop\n game_owner_only!\n if @game.dealer_sto...
[ "0.7384906", "0.72771925", "0.68792313", "0.67434436", "0.67263085", "0.6721499", "0.6716958", "0.6716958", "0.6702911", "0.6651924", "0.66432256", "0.66027313", "0.66027313", "0.66027313", "0.66027313", "0.66027313", "0.66027313", "0.66027313", "0.65880525", "0.6578859", "0....
0.0
-1
Decides, which of the processes should be moved away from the current_list(checks reactivation time).
def run_in_future(time_now) for_react = @_list.select { |p| p.reactivation_time > time_now } remove(for_react) for_react end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrement_positions_on_lower_items\n return unless in_list?\n acts_as_list_class.update_all(\n \"#{:position} = (#{:position} - 1)\", \"#{:position} > #{send(:position).to_i}\"\n )\n end", "def shift_down_next_tasks\n return if next_associated_tasks.e...
[ "0.55977917", "0.55137175", "0.54766846", "0.5475508", "0.5449429", "0.54374397", "0.54294735", "0.5371689", "0.53710675", "0.5341155", "0.5324887", "0.5313615", "0.52955633", "0.5278817", "0.5278383", "0.52634716", "0.52627337", "0.524897", "0.5240626", "0.5231519", "0.52184...
0.58425415
0
determine if a device exists
def device_exists?(domain,input_name,device_ip) Chef::Log.debug("Loggly/#{domain}: Checking to see if device IP #{device_ip} exists on input #{input_name}...") answer = false devices = get_devices(domain,input_name) unless devices.nil? devices.each do |device| if device.has_value?(device_ip) Chef::Log.debug("Loggly/#{domain}: Found existing device for IP #{device_ip} on input #{input_name}.") answer = true else Chef::Log.debug("Loggly/#{domain}: Did not find existing device for IP #{device_ip} on input #{input_name}.") end end end return answer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_device_exists\n render json: { error: 'device not found' }, status: :internal_server_error unless Device.exists?(params[:device_id])\n end", "def exists?\n begin\n partition= resource[:name]\n device=partition[0,(partition.length-1)]\n if File.exist?(partition)\n true\n...
[ "0.7465555", "0.7358759", "0.72210306", "0.72139126", "0.7194388", "0.7180952", "0.69972074", "0.6947687", "0.68915343", "0.672513", "0.66856676", "0.6682335", "0.66239434", "0.66062665", "0.65964985", "0.65674704", "0.65640336", "0.6555596", "0.6485777", "0.6435487", "0.6412...
0.7223025
2
find the node's device id for a given domain and input_name
def find_device_id(domain,input_name,device_ip) Chef::Log.debug("Loggly/#{domain}: Attempting to find device id for device #{device_ip} on input #{input_name}") input_id = find_input_id(domain,input_name) get_devices(domain,input_name).each do |device| if device.has_value?(device_ip) Chef::Log.debug("Loggly/#{domain}: Found id #{device["id"]} for device #{device_ip}") return device["id"] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_device(domain,input_name,device_ip)\n input_id = find_input_id(domain,input_name)\n begin\n Chef::Log.debug(\"Loggly/#{domain}: Attempting to add device #{device_ip} to input #{input_name}...\")\n http = Net::HTTP.new(\"#{domain}.loggly.com\")\n request = Net::HTTP:...
[ "0.6895212", "0.63848794", "0.6158541", "0.6035702", "0.59944683", "0.5977134", "0.5864377", "0.58574796", "0.5848474", "0.5764428", "0.57391226", "0.57391226", "0.5710551", "0.5671527", "0.56667167", "0.56667167", "0.56667167", "0.5650653", "0.56423426", "0.56423426", "0.563...
0.83507603
0
add the node as a device on the specified domain and input_name returns the resulting device id
def add_device(domain,input_name,device_ip) input_id = find_input_id(domain,input_name) begin Chef::Log.debug("Loggly/#{domain}: Attempting to add device #{device_ip} to input #{input_name}...") http = Net::HTTP.new("#{domain}.loggly.com") request = Net::HTTP::Post.new("/api/devices/") request.set_form_data({'input_id' => input_id, 'ip' => device_ip, 'name' => node.name}) request.set_content_type("text/plain") request.basic_auth node[:loggly][:username], node[:loggly][:password] response = http.request(request) parsed_response = JSON.parse(http.request(request).body) Chef::Log.debug("Loggly/#{domain}: Received response code #{response.code}.") unless response["id"].nil? Chef::Log.info("Loggly/#{domain}: Added device #{device_ip} on input #{input_name} as device id #{parsed_response["id"]}.") end return response["id"] rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, JSON::ParserError => e Chef::Log.error("Loggly/#{domain}: Error adding node to input #{input_name}: #{e}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_device_id(domain,input_name,device_ip)\n Chef::Log.debug(\"Loggly/#{domain}: Attempting to find device id for device #{device_ip} on input #{input_name}\")\n input_id = find_input_id(domain,input_name)\n get_devices(domain,input_name).each do |device|\n if device.has_value?(d...
[ "0.68482625", "0.590337", "0.5627347", "0.56145364", "0.5590646", "0.55883044", "0.5574309", "0.5574309", "0.5574309", "0.5407191", "0.5362895", "0.5362895", "0.5362895", "0.5362895", "0.5345463", "0.5345463", "0.5344691", "0.5323523", "0.52813643", "0.526723", "0.52482027", ...
0.8107281
0
ex) hello is not an isogram, as it contains two l's. Trumpet is an isogram, as each letter appears only once in the word.
def isogram string x = 0 while x < string.length y = x + 1 while y < string.length if string[x] == string[y] return false end y = y + 1 end x = x + 1 end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step_through_with(s)i\n # It doesn't solve the kata because it returns true even if same chars are met in diffrent part of the word. Like \"ThaT\"\n s.chars.count == s.chars.uniq.count\nend", "def is_isogram(word)\n new_word = word.downcase.split('')\n letter_list = []\n for letter in new_word\n if l...
[ "0.76627964", "0.754166", "0.74487174", "0.7332646", "0.73104376", "0.7287639", "0.7279536", "0.72654027", "0.7205567", "0.70951784", "0.70279795", "0.6877994", "0.6866088", "0.68588537", "0.6763244", "0.6743477", "0.6669547", "0.66136116", "0.6596472", "0.65598804", "0.64711...
0.6505429
20
Convenience. Only pick out interesting parts of parameters
def parameters params = [] self.command_parameters.each do |param| params << OpenStruct.new( :param_id => param.id, :name => param.Description, :param_type => param.type.Description ) end params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtered_parameters; end", "def filter_parameters; end", "def filter_parameters; end", "def params(*); {}; end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def parse_parameters; end", "def filter_parameters=(_arg0); end", "def filter_parameters...
[ "0.7383781", "0.68852144", "0.68852144", "0.6885167", "0.6637844", "0.6618504", "0.6616922", "0.6616922", "0.65569353", "0.64558506", "0.6418778", "0.64046884", "0.634543", "0.63069934", "0.6277054", "0.62735015", "0.62613636", "0.6208592", "0.6208592", "0.6208592", "0.620859...
0.0
-1
Write a method named include? that takes an Array and a search value as arguments. This method should return true if the search value is in the array, false if it is not. You may not use the Arrayinclude? method in your solution.
def include?(ary, number) return false if ary.size == 0 result = ary.detect do |item| item == number end !!(result == number) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include?(array, search)\n array.each do |value|\n return true if value == search\n end\n false\nend", "def include?(arr, search)\n arr.any? { |i| i == search }\nend", "def include?(array, search_value)\n array.any? { |element| element == search_value }\nend", "def include?(arr, search)\n arr.any...
[ "0.8731904", "0.8564619", "0.8558662", "0.85322165", "0.85316736", "0.8438064", "0.839816", "0.83941615", "0.8369818", "0.8355078", "0.83157307", "0.83049655", "0.8291306", "0.81654096", "0.8138219", "0.8130911", "0.81197417", "0.81119424", "0.81073266", "0.8079102", "0.80751...
0.6955724
75
Public: Render css in the styles directory. Returns nothing.
def render Dir.glob(File.join(@working_dir, STYLES_DIR, '**/*')) do |filename| @filename = filename if @filename.end_with?(".sass") render_sass :sass elsif @filename.end_with?(".scss") render_sass :scss end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rcss\n # :rcssfile is defined in routes.rb\n if @stylefile = params[:rcssfile]\n #prep stylefile with relative path and correct extension\n @stylefile.gsub!(/.css$/, '')\n @stylefile = File.join(\"vendor\", \"plugins\", \"template_derby\", \"app\", \"views\", \"rcss\", @stylefile + \".rcss...
[ "0.7045012", "0.6856035", "0.6845001", "0.66660196", "0.6536637", "0.6536637", "0.6500276", "0.64712447", "0.64626926", "0.64169675", "0.63996035", "0.63572645", "0.6355827", "0.6231572", "0.6137601", "0.6116157", "0.6116148", "0.6106218", "0.6106218", "0.6053702", "0.6043836...
0.7023434
1
Render css from sass in the styles directory. type A Symbol for the sass syntax, either :sass or :scss. Returns nothing.
def render_sass type template = File.open(@filename).read begin css = Sass::Engine.new(template, syntax: type).render rescue Exception => ex error "In #{@filename}\n #{ex}" end @filename.gsub!(/(sass|scss)$/, 'css') File.open(@filename, "w") {|out| out.puts css } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def syntax\n :sass\n end", "def syntax\n\t\t\t\t:sass\n\t\t\tend", "def syntax\n :scss\n end", "def render\n Dir.glob(File.join(@working_dir, STYLES_DIR, '**/*')) do |filename|\n @filename = filename\n if @filename.end_with?(\".sass\")\n render_sass :sass\n...
[ "0.7047652", "0.6934267", "0.69164926", "0.6763924", "0.6646976", "0.64505583", "0.6256111", "0.62550676", "0.6234568", "0.6146465", "0.6146465", "0.61059415", "0.59997755", "0.59876096", "0.5968934", "0.5937632", "0.5908844", "0.58532864", "0.5822773", "0.576304", "0.5742461...
0.83574986
0
Never trust parameters from the scary internet, only allow the white list through.
def user_params params.require(:user).permit(:password, :password_confirmation) 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
GET /dominos/1 GET /dominos/1.xml
def show @domino = Domino.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @domino } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @datos = Dato.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @datos }\n end\n end", "def show\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { ...
[ "0.6413342", "0.64124644", "0.6339787", "0.6293697", "0.62804025", "0.6278365", "0.61906374", "0.6166741", "0.6166741", "0.61109716", "0.6094542", "0.6089111", "0.6071558", "0.6065164", "0.60553086", "0.6048067", "0.60378337", "0.6036513", "0.6013828", "0.6001457", "0.5996039...
0.68919134
0
GET /dominos/new GET /dominos/new.xml
def new @domino = Domino.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @domino } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { rend...
[ "0.7306309", "0.70881474", "0.7080706", "0.7048763", "0.7030928", "0.7030928", "0.6959725", "0.6954193", "0.6941527", "0.69128436", "0.69024175", "0.6893047", "0.6869521", "0.6869521", "0.6868098", "0.6819158", "0.6813703", "0.6808221", "0.67729974", "0.6771546", "0.67663145"...
0.76896715
0
POST /dominos POST /dominos.xml
def create @domino = Domino.new(params[:domino]) respond_to do |format| if @domino.save flash[:notice] = 'Domino was successfully created.' format.html { redirect_to(@domino) } format.xml { render :xml => @domino, :status => :created, :location => @domino } else format.html { render :action => "new" } format.xml { render :xml => @domino.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def dominio_params\n params.require(:dominio).permit(:id_valor, :nombre_valor)\n end", "def create\n @municipio_dominio = MunicipioDominio.new(params[:municipio_d...
[ "0.6132088", "0.6096348", "0.5969056", "0.58738863", "0.5857651", "0.5762162", "0.5753062", "0.57156783", "0.56791925", "0.56610376", "0.56390995", "0.5635959", "0.56290054", "0.56031084", "0.55631596", "0.5559849", "0.5559849", "0.5557759", "0.5554381", "0.55419916", "0.5530...
0.68315125
0
PUT /dominos/1 PUT /dominos/1.xml
def update @domino = Domino.find(params[:id]) respond_to do |format| if @domino.update_attributes(params[:domino]) flash[:notice] = 'Domino was successfully updated.' format.html { redirect_to(@domino) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @domino.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n if @nossos_servico.update_attributes(params[:nossos_servico])\n forma...
[ "0.63027054", "0.6097881", "0.6046961", "0.58114105", "0.57362777", "0.5717068", "0.57063365", "0.56747264", "0.5671489", "0.5671215", "0.5662271", "0.56613153", "0.56479734", "0.5620107", "0.55800974", "0.55763704", "0.5535427", "0.55257833", "0.55033517", "0.5484958", "0.54...
0.6580285
0
DELETE /dominos/1 DELETE /dominos/1.xml
def destroy @domino = Domino.find(params[:id]) @domino.destroy respond_to do |format| format.html { redirect_to(dominos_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::H...
[ "0.6728069", "0.66782296", "0.6614402", "0.66076857", "0.65723884", "0.65627295", "0.65627295", "0.6547333", "0.6509345", "0.6461556", "0.64459145", "0.6438363", "0.6419024", "0.64108235", "0.63962185", "0.63956845", "0.6384693", "0.63788086", "0.63755864", "0.6375243", "0.63...
0.7216034
0
s= source, t= target, w= weight
def add_edge(s, t, w) if (not @graph.has_key? s) @graph[s] = {t => w} else @graph[s][t] = w end @nodes.merge [s,t] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight\n @graph.weight(source, target)\n end", "def weight(u, v)\n @weights[[u,v]]\n end", "def weight; end", "def weight w=nil\n if w.nil?\n @weight\n else\n @weight = w\n end\n end", "def edge_weight(source, target)\r\n\t\t@edges.each do |edge|\r\n\t\t\...
[ "0.7261844", "0.6562616", "0.6513542", "0.6477821", "0.6432776", "0.61676866", "0.60389584", "0.5995556", "0.5975765", "0.5971731", "0.59535074", "0.5921104", "0.58977014", "0.588101", "0.58804184", "0.5877035", "0.58216286", "0.58173335", "0.5813072", "0.5809514", "0.5777640...
0.5110609
80
uses Dijkstra's to find shortest paths from source takes a source node and returns a map of destinations and their shortest distances
def shortest_distances( src ) raise ArgumentError if (not @graph.has_key? src) # keep a priority queue of nodes, ordered by known distances distances = CPriorityQueue.new @nodes.each { |node| distances[node] = INFINITY } distances[src] = 0; # results accumulator results = {} while( not distances.empty? ) do # get the shortest known pair = distances.delete_min node = pair[0] node_dist = pair[1] # record results[node] = node_dist # traverse all neighbors neighbors = @graph[node] || {} neighbors.each { |neighbor, dist| # if it's nearer to go by me, update neighbor_d = distances[neighbor] || -1 # neighbor may have been found already if (node_dist + dist < neighbor_d) distances[neighbor] = node_dist + dist end } end return results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dijkstra(source)\n\t\t@distances = {}\n\t\t@predecessor_node = {}\n\t\t@nodes.each do |node|\n\t\t\t@distances[node] = @infinity\n\t\t\t@predecessor_node[node] = -1\n\t\tend\t\n\t\t@distances[source] = 0\n\t\tnodes_compressed = @nodes.compact\n\t\twhile (nodes_compressed.size > 0)\n\t\t\tnode_near = nil;\n\t\t...
[ "0.8089458", "0.79029876", "0.7636723", "0.75352466", "0.75319475", "0.73959357", "0.7387533", "0.73738337", "0.7349041", "0.71709156", "0.7120489", "0.70656574", "0.7010849", "0.695957", "0.69561666", "0.6956086", "0.6938855", "0.69171345", "0.68933666", "0.685372", "0.68076...
0.7999799
1
GET / Displays a list of organizations from which the user can get information.
def index @organizations = Organization.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = or...
[ "0.85172904", "0.8049", "0.8017486", "0.7990744", "0.7838484", "0.77657413", "0.7761766", "0.7761123", "0.77514124", "0.77475154", "0.7588763", "0.757728", "0.75697786", "0.7548523", "0.75307393", "0.75271016", "0.75082827", "0.75012547", "0.7489694", "0.74657595", "0.743117"...
0.7694865
18
GET /users GET /users.xml GET /users.json HTML and AJAX
def index @users = User.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def index\n if params[...
[ "0.7276838", "0.7097732", "0.7084988", "0.7049285", "0.7038029", "0.702052", "0.69235355", "0.689721", "0.6892086", "0.6882375", "0.68354195", "0.6826302", "0.6825547", "0.68189406", "0.6794075", "0.6780519", "0.67695117", "0.67669696", "0.6766153", "0.67612404", "0.67612404"...
0.0
-1
GET /users/1 GET /users/1.xml GET /users/1.json HTML AND AJAX
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ...
[ "0.7182033", "0.68983227", "0.68433166", "0.6807405", "0.67792535", "0.67291373", "0.67149854", "0.67144346", "0.67098176", "0.67074317", "0.6690831", "0.6658321", "0.6656662", "0.66264135", "0.66263115", "0.6621024", "0.6613159", "0.66089964", "0.66089964", "0.66089964", "0....
0.0
-1
GET /users/new GET /users/new.xml GET /users/new.json HTML AND AJAX
def new @user = User.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @user = User.new\n\n respond_to do |format|\n format.xml { render :xml => @user }\n format.js #new.js.rjs\n end\n end", "def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end", "def ...
[ "0.7441039", "0.74126405", "0.73443556", "0.7292345", "0.7261168", "0.723409", "0.7212972", "0.72024935", "0.71834195", "0.71521777", "0.71082044", "0.7104121", "0.70847774", "0.7056942", "0.705122", "0.7028986", "0.7026946", "0.70049053", "0.7003732", "0.69495", "0.6948966",...
0.0
-1
GET /users/1/edit GET /users/1/edit.xml GET /users/1/edit.json HTML AND AJAX
def edit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n respond_to do |format|\n format.json { render :json => @user } \n format.xml { render :xml => @user }\n format.html\n end\n end", "def edit\n # When a http GET request to '/users/1/edit' is received, have it render:\n # a view file with a form with user 1's information i...
[ "0.76060855", "0.75116086", "0.7276706", "0.69044065", "0.66233224", "0.6621314", "0.6598274", "0.65003437", "0.64812833", "0.6471442", "0.6457956", "0.6438041", "0.6434634", "0.64299494", "0.6420875", "0.6409807", "0.640714", "0.6397414", "0.6397137", "0.63751316", "0.637513...
0.0
-1
DELETE /users/1 DELETE /users/1.xml DELETE /users/1.json HTML AND AJAX
def destroy @user.destroy! respond_to do |format| format.json { respond_to_destroy(:ajax) } format.xml { head :ok } format.html { respond_to_destroy(:html) } end rescue ActiveRecord::RecordNotFound respond_to_not_found(:json, :xml, :html) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Users.delete(params[\"id\"])\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n format.js { head :ok }\n end\n end", "def delete\...
[ "0.7353212", "0.73092854", "0.7308483", "0.7250896", "0.72435844", "0.7240575", "0.7238288", "0.71927416", "0.7192262", "0.7182366", "0.71721905", "0.71647274", "0.7142331", "0.7140834", "0.7134683", "0.71243787", "0.71111864", "0.7109596", "0.7109319", "0.7108335", "0.709769...
0.72143865
7
POST /users POST /users.xml POST /users.json HTML AND AJAX
def create @user = User.new(params[:user]) if @user.save respond_to do |format| format.json { render :json => @user.to_json, :status => 200 } format.xml { head :ok } format.html { redirect_to :action => :index } end else respond_to do |format| format.json { render :text => "Could not create user", :status => :unprocessable_entity } # placeholder format.xml { head :ok } format.html { render :action => :new, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def create\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n @changed << @user.id\...
[ "0.63951313", "0.59153754", "0.5893482", "0.5843497", "0.58187115", "0.57677174", "0.57386374", "0.5719198", "0.5708517", "0.5697782", "0.5686867", "0.5686867", "0.56660694", "0.56497794", "0.5643494", "0.56409484", "0.55918014", "0.5586367", "0.5578127", "0.556875", "0.55674...
0.55936706
16