query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
Disable SQL logging. You can use this method to turn off logging SQL when the migration is munging data that may vary between environments.
def disable_sql_logging(&block) sql_logging(enabled: false, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_activerecord_sql_logging\n ActiveRecord::Base.logger.level = 1\nend", "def enable_activerecord_sql_logging\n ActiveRecord::Base.logger.level = 0\nend", "def disable_verbose_log()\n PureHailDB.ib_cfg_set(\"print_verbose_log\", :bool, false)\n end", "def disable_logging\n @session.co...
[ "0.7638811", "0.73547393", "0.7012727", "0.69116277", "0.6882021", "0.6860995", "0.6671341", "0.6474205", "0.645211", "0.6391882", "0.6294125", "0.62443805", "0.62040585", "0.62040585", "0.607154", "0.6011172", "0.5978407", "0.5954865", "0.594431", "0.5910163", "0.59079236", ...
0.8257666
0
Enable SQL logging. You can call this method within a block where SQL logging was disabled to renable it.
def enable_sql_logging(&block) sql_logging(enabled: true, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_sql\n @opts[:log_sql]\n end", "def log_sql(log_sql = true)\n if log_sql\n Sierra::DB.db.loggers << Sierra::Logging.logger\n else\n Sierra::DB.db.loggers.delete(Sierra::Logging.logger)\n end\n end", "def disable_sql_logging(&block)\n sql_logging(enabled: ...
[ "0.73297447", "0.7178721", "0.6995771", "0.6811558", "0.6701986", "0.6605298", "0.65847754", "0.6432213", "0.6359256", "0.6253259", "0.6249488", "0.6209547", "0.61505383", "0.6128812", "0.61093336", "0.60587066", "0.60376793", "0.5924147", "0.5919858", "0.5833025", "0.5833025...
0.88641167
0
Use a different database connection for the block. You can use this if your application has multiple databases to swap connections for the migration. You can pass in either a database connection or an ActiveRecord::Base class to use the connection used by that class. The label argument will be added to the logged SQL a...
def using_connection(connection_or_class, label: nil, &block) if connection_or_class.is_a?(Class) && connection_or_class < ActiveRecord::Base label ||= connection_or_class.name connection_or_class.connection_pool.with_connection do |connection| switch_connection_in_block(connection, labe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use(name)\n with(database: name)\n end", "def use(name)\n with(database: name)\n end", "def current_database_name\n ActiveRecord::Base.connection_pool.spec.config[:name] || 'default'\n end", "def log_connection_yield(sql, conn, args=nil)\n if !@loggers.empty? && (external...
[ "0.58952796", "0.58952796", "0.5864107", "0.58073604", "0.5803836", "0.56988025", "0.5618647", "0.556568", "0.55474716", "0.5438245", "0.541401", "0.5365838", "0.5349817", "0.5346079", "0.5331299", "0.53275156", "0.52839667", "0.52775586", "0.5259137", "0.5258833", "0.5252176...
0.6936789
0
Extract the connection string for the rabbitmq service from the service information provided by Cloud Foundry in an environment variable.
def amqp_url if not ENV['VCAP_SERVICES'] return { :host => "172.16.32.11", :port => 5672, :username => "guest", :password => "guest", :vhost => "/", } end services = JSON.parse(ENV['VCAP_SERVICES'], :symbolize_names => true) url = services.values.map do |srvs| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def amqp_url\n if not ENV['VCAP_SERVICES']\n return {\n :host => \"localhost\",\n :port => 5672,\n :username => \"guest\",\n :password => \"guest\",\n :vhost => \"/\",\n }\n end\n\n services = JSON.parse(ENV['VCAP_SERVICES'], :symbolize_names => true)\n url = services.values.map ...
[ "0.7228656", "0.64117", "0.60329986", "0.5871954", "0.58560705", "0.57894254", "0.57065386", "0.5627882", "0.55615014", "0.5546482", "0.5546482", "0.55334806", "0.55314684", "0.55079055", "0.5474078", "0.54584104", "0.544193", "0.54413456", "0.542486", "0.542486", "0.54162025...
0.744864
0
Register a card that has been duplicated so it can be remapped
def register_duplicated_card(original_card_id:, to_card_id:) Cache.hash_set("#{@batch_id}_duplicated_cards", original_card_id, to_card_id) remapper = CardDuplicatorMapper::RemapLinkedCards.new( batch_id: @batch_id, ) # remap the card that was just duplicated remapper.remap_cards(o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addCard(givenCard)\n \tcards_users.create(card_id: givenCard.id, is_shared: false)\n end", "def add_card card\n card.deck = self\n @cards[card.id] = card\n end", "def add_card(card)\n \t@cards << card\n end", "def addSharedCard(givenCard)\n \tcards_users.create(card_id: givenCard.id, is...
[ "0.67919964", "0.67069805", "0.66378534", "0.66062117", "0.65801567", "0.65801567", "0.6567602", "0.65265167", "0.6503379", "0.64770275", "0.63998014", "0.63998014", "0.63998014", "0.63933533", "0.63773215", "0.63613427", "0.63472915", "0.6335032", "0.6329207", "0.6318804", "...
0.7502256
0
A hash that maps from the original card id to the duplicated card id
def duplicated_cards Cache.hash_get_all("#{@batch_id}_duplicated_cards").presence || {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_duplicated_card(original_card_id:, to_card_id:)\n Cache.hash_set(\"#{@batch_id}_duplicated_cards\", original_card_id, to_card_id)\n\n remapper = CardDuplicatorMapper::RemapLinkedCards.new(\n batch_id: @batch_id,\n )\n # remap the card that was just duplicated\n remapper...
[ "0.6899874", "0.66217256", "0.6553424", "0.6336948", "0.6322116", "0.6262354", "0.6208293", "0.6151167", "0.6149363", "0.6100726", "0.6077612", "0.60733", "0.60646814", "0.6054649", "0.6023997", "0.5946687", "0.59424937", "0.591993", "0.5900293", "0.5875312", "0.5863407", "...
0.7027408
0
converts hand from array of card to array of sorted scores of said cards
def cards_by_score scores = {} @cards.each do |card| scores[card] = card.score end Hash[scores.sort_by { |card, score| -score }] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hand_score\n cards.map {|a| a.value}.sort {|a,b| a <=> b}.last\n end", "def sort_by_suit\n \tnew_hand = []\n while @cards.size > 0\n \tpos = 0 # position of minimal card\n \tc = @cards[0] # minimal card\n \t@cards.each_with_index do |card, index|\n \t\tc1 = card\n # puts \"c: #{c....
[ "0.7948034", "0.7014165", "0.7000303", "0.6928356", "0.68609774", "0.6820641", "0.6737521", "0.6714905", "0.66206586", "0.6574508", "0.6560887", "0.6517915", "0.6503766", "0.6470747", "0.6426299", "0.6387371", "0.636609", "0.635723", "0.63561314", "0.6342808", "0.63078564", ...
0.7296949
1
check if only 5 cards in hand already
def hand? @cards_by_score.length == 5 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_house?\n return unless size >= 5\n\n the_cards = cards_by_rank.values\n the_cards[0].count >= 3 && the_cards[1].count >= 2\n end", "def complete?\n @cards.length == 5\n end", "def six_cards?(player_check)\n if (player_check.hand.length == 6) && (player_check.hand_total < 21)\n ...
[ "0.77190894", "0.7696931", "0.7544853", "0.7426773", "0.7379774", "0.71706223", "0.7072673", "0.7059381", "0.6965509", "0.69097555", "0.68847656", "0.6856932", "0.68359697", "0.68305546", "0.68256474", "0.6815574", "0.6785656", "0.67349523", "0.67292315", "0.67136276", "0.670...
0.80713946
0
returns an array of card with given number of multiples
def get_multiples(number) cards = [] @cards_by_score.each_key do |card| if @card_scores.count(card.score) == number cards << card end end cards end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_multiples(number)\n \n numbers = Array.new(number - 1, 0)\n count = 0\n while count < numbers.length \n numbers[count] = count + 1\n count += 1\n end\n\n numbers.select do |element|\n element % 3 == 0 || element % 5 == 0\n end\n\nend", "def collect_multiples(limit)\n array = []\n (1...
[ "0.7295955", "0.7234427", "0.71736974", "0.71499264", "0.71370065", "0.7105511", "0.7092792", "0.7009756", "0.6929065", "0.6902126", "0.6857695", "0.68308", "0.682126", "0.6779479", "0.6763631", "0.6746046", "0.6718843", "0.66709906", "0.66703296", "0.66694295", "0.6638205", ...
0.7604125
0
Used in development mode for onthefly generation of public/netzke/ext.[js|css]
def ext respond_to do |format| format.js { render :text => Netzke::Core::DynamicAssets.ext_js } format.css { render :text => Netzke::Core::DynamicAssets.ext_css } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netzke_init(params = {})\n theme = params[:ext_theme] || :default\n [netzke_css_include(theme), netzke_js_include, netzke_js].join(\"\\n\")\n end", "def initial_dynamic_javascript\n res = []\n # res << %(Ext.Ajax.extraParams = {authenticity_token: '#{form_authenticity_token...
[ "0.6672198", "0.63841134", "0.62464255", "0.62149256", "0.6169453", "0.61687607", "0.6008034", "0.59936416", "0.59929276", "0.59929276", "0.59812254", "0.59486586", "0.59182674", "0.59182674", "0.5897309", "0.58845794", "0.5853264", "0.5851368", "0.58097774", "0.57962453", "0...
0.6852749
0
Used in development mode for onthefly generation of public/netzke/touch.[js|css]
def touch respond_to do |format| format.js { render :text => Netzke::Core::DynamicAssets.touch_js } format.css { render :text => Netzke::Core::DynamicAssets.touch_css } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_dev\n timer_block(\n 'Start [development] build for *.js files',\n 'JS time: ') do\n all_js_into_one_file\n end\n end", "def precompile_assets; end", "def request_debug_assets?; end", "def request_debug_assets?; end", "def js\n puts 'Comp...
[ "0.66531837", "0.62821525", "0.6220736", "0.6220736", "0.6187166", "0.6154933", "0.6081586", "0.6038984", "0.5971961", "0.59503865", "0.5941376", "0.59234643", "0.5895388", "0.5889352", "0.5878378", "0.58676356", "0.58346045", "0.5809598", "0.5796627", "0.57818174", "0.578051...
0.65088785
1
Main dispatcher of oldstyle (Sencha Touch) HTTP requests. The URL contains the name of the component, as well as the method of this component to be called, according to the double underscore notation. E.g.: some_grid__post_grid_data.
def endpoint_dispatch(endpoint_path) component_name, *sub_components = endpoint_path.split('__') component_instance = Netzke::Base.instance_by_config(Netzke::Core.session[:netzke_components][component_name.to_sym]) # We render text/plain, so that the browser never modifies our response response...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatcher\n endpoint_dispatch(params[:address])\n end", "def method_missing(method_name, params = {})\n component, *action = method_name.to_s.split('__')\n component = component.to_sym\n action = !action.empty? && action.join(\"__\").to_sym\n\n if action\n if compone...
[ "0.59711206", "0.57147175", "0.5545272", "0.5320577", "0.5257479", "0.5120687", "0.510155", "0.5065449", "0.50552744", "0.50552744", "0.50552744", "0.5034021", "0.50314534", "0.5030001", "0.49982038", "0.49866804", "0.49825743", "0.4977301", "0.49751395", "0.49751395", "0.497...
0.58597404
1
GET /imagems/1 GET /imagems/1.xml
def show @imagem = @evento.imagems.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @imagem } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image(image_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Compute::Slicehost::GetImage.new,\n :path => \"images/#{image_id}.xml\"\n )\n end", "def show\n @imagem = Imagem.find(params[:id])\...
[ "0.69916815", "0.69894046", "0.6804412", "0.65871704", "0.6567679", "0.65181506", "0.64555717", "0.64343226", "0.64343226", "0.64343226", "0.64182395", "0.6405345", "0.64015716", "0.63921446", "0.63728523", "0.6349735", "0.63433266", "0.63350546", "0.6333711", "0.6321536", "0...
0.71077454
0
Public interface BlockCommand.new ||Arguments:|| `name` The String name of the command. `args` The NodeList of arguments given to the command. `raw_tokens` A TokenList that represents the entire BlockCommand, generated by the Tokenizer. You must override this method in your subclass of BlockCommand.
def initialize(*args) if self.class == BlockCommand raise TypeError, 'BlockCommand.new should not be called directly' end super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command *args, &block\n @commands ||= []\n @args ||= []\n @commands << block\n @args << args\n end", "def new_block_el(*args); end", "def initialize\n @block_args = []\n end", "def command_raw(args)\n\n end", "def initialize( name, *args, &block )\n\t\t\t@name\t\t ...
[ "0.6585519", "0.6168184", "0.6128972", "0.60842866", "0.6081653", "0.60322154", "0.59502864", "0.5863933", "0.5813367", "0.5808431", "0.5790726", "0.5786573", "0.5776735", "0.57718474", "0.57465255", "0.57334", "0.5682308", "0.5667897", "0.56664985", "0.56640947", "0.56623715...
0.73147696
0
BlockCommandactive_block Since BlockCommands have the ability to contain multiple blocks, this method returns (at least in theory) the block within this BlockCommand that the Parser is currently looking as it is iterating over it. You must override this method in your subclass of BlockCommand. It must return a NodeList...
def active_block raise NotImplementedError, 'BlockCommand#active_block should be overridden by a subclass' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_blocks\n @blocks\n end", "def block_node; end", "def block_node; end", "def block\n blockable.blocks.detect{|b| b.identifier == self.identifier.to_s} || \n blockable.blocks.build(:identifier => self.identifier.to_s)\n end", "def blocks\n @blocks ||= []\n end", "de...
[ "0.6610187", "0.64303994", "0.64303994", "0.6326704", "0.6225922", "0.62140965", "0.6201415", "0.61609197", "0.6132075", "0.61044264", "0.6054984", "0.60532784", "0.6030627", "0.6024402", "0.593743", "0.59208715", "0.5899928", "0.5820576", "0.5778507", "0.57395554", "0.573908...
0.74524754
0
Writes an object to the stream. Calls the object's write() method, if available. Uses to_s otherwise.
def write( object ) if object.responds_to?(:write_to) then object.write_to(@stream) else @stream << object.to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def puts( obj )\n return unless writeable?\n\n data = Marshal.dump(obj)\n @socket.write([data.size].pack('I')) + @socket.write(data)\n rescue SystemCallError\n return nil\n end", "def write_object(object)\n object\n end", "def write_object(object)\n @encoder.encode(object, @sock)...
[ "0.71540254", "0.6904508", "0.6904365", "0.67931956", "0.67856747", "0.62626743", "0.6194346", "0.6134303", "0.61313057", "0.60799366", "0.59159815", "0.59101236", "0.58574235", "0.58574235", "0.58492833", "0.5848072", "0.58037907", "0.5790163", "0.5717786", "0.5700183", "0.5...
0.8353593
0
Writes a string directly to the stream, without any filtering.
def write!( string ) @stream << string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(str)\n writing { write0 str }\n end", "def write(string)\n @handle.write(string)\n end", "def write(string)\n @buffer << string\n self\n end", "def write string\n end", "def write_(s)\n s = s.encode(@conf['encoding'], s.encoding)\n @sock.puts s\n log...
[ "0.75466233", "0.73717535", "0.7187002", "0.71484816", "0.6922733", "0.688927", "0.68741834", "0.67630714", "0.67505395", "0.6742431", "0.67225593", "0.65913945", "0.65913945", "0.65718716", "0.655634", "0.6544536", "0.6539199", "0.6489562", "0.64566904", "0.6446546", "0.6432...
0.82116294
0
USE ONLY if &f is assocoative, AT YOUR OWN RISK. s is used only for the last reduce.
def reduce (s, &f) self.parallelize{|slice| slice.reduce(&f)}.reduce(s, &f) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce\n _reduce = ->(acc, f, xs){\n xs == [] ? acc : _reduce.(f.(acc, xs[0]), f, xs[1..-1])\n }\n\n curry.(->(f, xs) {\n _reduce.(xs[0], f, xs[1..-1])\n })\n end", "def _reduce_1(val, _values, result)\n return \"\" \n result\nend", "def _reduce_667(val, _values, result); end", ...
[ "0.6401935", "0.6053761", "0.59972626", "0.5986387", "0.5986387", "0.59557736", "0.5932066", "0.5931145", "0.59285116", "0.5910238", "0.5904617", "0.5901731", "0.5901554", "0.58995897", "0.5892134", "0.5891917", "0.5890365", "0.5881632", "0.58763105", "0.5861768", "0.58616257...
0.721914
0
i^n mod p, where p is prime and i is a primitive root of p With this formula, generate a series through progressive squaring, from zero to (p1). Collect the residue, mod p and perform an xswap with each object's index number. The result will be the corresponding MOF series.
def mof(i, p) arr = [] x_swap = [] (0..(p-2)).each do |x| arr.push((i**x) % p) end (1..(p-1)).each do |n| x_swap.push((arr.index {|item| n == item }) % 12 ) end return x_swap end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mod_mult (p, n)\n q = p\n r = Point.new Float::INFINITY, Float::INFINITY\n\n while n > 0\n if n % 2 == 1\n r = self.mod_add r, q\n end\n\n q = self.mod_add q, q\n n = (n / 2).floor\n end\n r\n end", "def squared_primes(array)\n\n a=[]\n array...
[ "0.61392176", "0.588643", "0.57472026", "0.57002056", "0.5683183", "0.5673275", "0.5672151", "0.56346744", "0.56346744", "0.55487424", "0.5485087", "0.5465638", "0.5440824", "0.5367206", "0.53502285", "0.53487235", "0.5338467", "0.5331518", "0.5331102", "0.5328647", "0.528274...
0.7118193
0
Card Test cards belonging in the card class
def test_card_members card = Card.new("A", "Hearts") assert_equal(card.value, 1) assert_equal(card.face, "A") assert_equal(card.is_ace, true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cards\n @cards\n end", "def initialize(cards)\n @cards = cards\n end", "def initialize(cards)\n @cards = cards\n end", "def initialize(cards)\n @cards = cards\n end", "def cards\n\t\t@cards.each do |card|\n\t\t\tputs card.card\n\t\tend\n\tend", "def initialize\n @cards = []\n ...
[ "0.707315", "0.70665234", "0.70665234", "0.70665234", "0.7052203", "0.7004935", "0.69747305", "0.69489425", "0.69261783", "0.6864857", "0.684946", "0.68325603", "0.68214726", "0.6771567", "0.6768702", "0.6721055", "0.66996026", "0.6685493", "0.66793084", "0.6665216", "0.66616...
0.7157642
0
Checks to see whether anything currently exists at the given location.
def exists?(location_uri) r = client[connection.api.object_url(location_uri_to_fedora3_pid(location_uri), format: 'xml')].head # without disabling redirection, we should not get 3xx here (200..299).cover? r.code rescue RestClient::ExceptionWithResponse => e return false i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists?(location_uri)\n raise NotImplementedError\n end", "def is_here?(element)\n element.exists?\n rescue\n false\n end", "def exists?\n !@not_found\n end", "def here?\n @locations.any?(&:here)\n end", "def exists?\n folder_location.present?\n e...
[ "0.7274327", "0.6738706", "0.6724346", "0.6704184", "0.6701831", "0.63999087", "0.63611555", "0.63513106", "0.63443905", "0.63250864", "0.6246865", "0.6222583", "0.6213896", "0.6213896", "0.6213896", "0.62010026", "0.61985993", "0.61985993", "0.6178999", "0.6174857", "0.61539...
0.6895828
1
Closes the shared memory area end frees its content.
def close Shared::try("dhmdt") {Shared::shmdt(@mem)} Shared::try("shmctl") {Shared::shmctl(@id, Shared::IPC_RMID, nil)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n @sp.close if @sp != nil\n @sp = nil\n end", "def close\n @io.close if @io\n @m.munmap if @m\n @m = nil\n @io = nil\n end", "def dispose\n call Memory.deAlloc(self)\n end", "def dispose\n call Memory.deAlloc(self)\n end", "def close() end", "def close() en...
[ "0.6465218", "0.63502145", "0.63124734", "0.63124734", "0.62463796", "0.62463796", "0.62463796", "0.62463796", "0.6243381", "0.6235345", "0.6208395", "0.61819994", "0.616931", "0.616931", "0.616931", "0.616931", "0.616931", "0.616931", "0.616931", "0.616931", "0.616931", "0...
0.68270093
0
Writes a string len bytes.
def write(str, len=nil) raise ArgumentError, "str must respond to :to_s" unless str.respond_to? :to_s @mem.write_string(str.to_s, len) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(string)\n send(string)\n string.length\n end", "def write(str)\n s = str.to_s\n # TODO: implement String#bytesize\n @length += s.size\n @writer.call s\n\n set_header(Rack::CONTENT_LENGTH, @length)\n str\n end", "def write(string)\n string.to_s.bytesize...
[ "0.7160371", "0.6932254", "0.67634094", "0.65381235", "0.64792395", "0.62913436", "0.61667496", "0.6080244", "0.60673696", "0.6021334", "0.6009206", "0.596005", "0.5925651", "0.59051514", "0.5896064", "0.58767563", "0.5869751", "0.5854464", "0.58264357", "0.58109885", "0.5783...
0.8049257
0
As a user, if 'modify' is selected, I am prompted to enter an id for the contact to be modified. As a user, when an id is entered, I am prompted to type 'yes' or 'no' to confirm my selection. As a user, if 'yes' is typed, I am prompted to change 'firstname', 'lastname', 'email' or 'notes' by number. You shouldn't be ab...
def modify_contact puts "Please enter the id of the contact to modify: " id = gets.chomp.to_i puts "Please confirm 'yes' or 'no' to modify this contact: " puts @rolodex.display_contact(id) answer = gets.chomp.downcase if answer == 'yes' puts "Please enter the number of the attribute you would ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modify_contact\n puts \"Enter the id of the contact you would like to modify\"\n id_to_modify = gets.chomp \n\n contact = Contact.find(id_to_modify)\n \n puts \"Are you sure? (y/n)\"\n \tuser_input = gets.chomp\n\n if user_input == \"y\"\n puts \"Enter the id of the contact that you wou...
[ "0.7670978", "0.767083", "0.7332969", "0.7313281", "0.7264931", "0.7229206", "0.7188044", "0.7134588", "0.6988199", "0.6899287", "0.6848723", "0.6702242", "0.66444314", "0.6616212", "0.6594362", "0.6581", "0.65768516", "0.651908", "0.6315838", "0.6197697", "0.61948967", "0....
0.7869783
0
Returns the type of this comment. Inline comments correspond to `:inline`: whatever Block comments correspond to `:document`: =begin hi i am a document =end
def type case text when /^#/ :inline when /^=begin/ :document end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment?\n [\"text\", \"text_wholepage\"].include?(@type)\n end", "def commentable_type\n read_attribute(:commentable_type) == 'Topic' ? Topic.find(commentable_id).class.to_s : read_attribute(:commentable_type)\n end", "def type comment\n comment.nil? ? 'Solution' : 'Comment'\n end", "def get...
[ "0.6380302", "0.6371671", "0.6371038", "0.6366362", "0.6309205", "0.6304772", "0.60622334", "0.604331", "0.59842545", "0.5919068", "0.5901766", "0.5866075", "0.58624786", "0.5850932", "0.5850932", "0.5850932", "0.5850932", "0.5850932", "0.5850932", "0.5850932", "0.5847068", ...
0.7114647
0
Compares comments. Two comments are identical if they correspond to the same source range.
def ==(other) other.is_a?(Source::Comment) && @location == other.location end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_parses_with_comments(ast_pattern, source, comments_pattern)\n with_versions(ALL_VERSIONS) do |_ver, parser|\n source_file = Parser::Source::Buffer.new('(comments)', source: source)\n\n comments_pattern_here = comments_pattern.map do |(from, to)|\n range = Parser::Source::Range.new(so...
[ "0.63363314", "0.6174508", "0.5982283", "0.59663063", "0.5859584", "0.5847983", "0.58178973", "0.58064544", "0.58064544", "0.5803391", "0.5803391", "0.5803391", "0.57457685", "0.5739237", "0.57106584", "0.56896263", "0.56792617", "0.56792617", "0.5666213", "0.56462944", "0.56...
0.6715794
0
HTTParty raises an errors after time limit defined by ::default_timeout if it cannot connect to server, then it raises Net::OpenTimeout if it cannot read response from server, then it raises Net::ReadTimeout
def handle_timeouts yield rescue Net::OpenTimeout, Net::ReadTimeout {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_get(url)\n response = HTTParty.get(url)\n\n puts url\n\n if response.key?('errorMessage')\n puts 'error, retry...'\n begin\n http_get(url)\n rescue Net::ReadTimeout\n puts 'takes too long to respond, retry...'\n http_get(url)\n end\n else\n puts 'no error, return'\n re...
[ "0.7373712", "0.72976816", "0.6759297", "0.67525446", "0.66723037", "0.66665757", "0.66437876", "0.6566575", "0.65500784", "0.65281385", "0.65281385", "0.6470986", "0.64634985", "0.64576036", "0.64485043", "0.6425141", "0.6394152", "0.63933957", "0.6325352", "0.6325352", "0.6...
0.7299478
1
A singleuse login link for Express accounts to access their Stripe dashboard
def login_link(**options) ::Stripe::Account.create_login_link(processor_id) rescue ::Stripe::StripeError => e raise Pay::Stripe::Error, e end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_url\n generate_login_token unless login_token.present?\n ENV['RESERVE_URL'] + '/sign-in/' + login_token\n end", "def connect\n connector = StripeConnect.new( current_user )\n connect_url, error = connector.connect_url( redirect_uri: confirm_users_url )\n\n if connect_url.nil?\n fla...
[ "0.64338595", "0.6402026", "0.6330011", "0.62373126", "0.6001847", "0.5928493", "0.5902392", "0.5902392", "0.5902392", "0.5902392", "0.5902392", "0.5902392", "0.5902392", "0.5902392", "0.5902392", "0.5894325", "0.5872273", "0.58568376", "0.5845082", "0.5832217", "0.58172125",...
0.6526143
0
converts 0terminated ASCII string to ruby string
def asciiz_to_str(asciiz) zero_byte_idx = asciiz.index("\x00") if zero_byte_idx != nil return asciiz[0, zero_byte_idx] else return asciiz end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string(str)\n TYPE_STRING +\n word(str.length) +\n str.encode!(\"ASCII\")\n end", "def asciiz_to_str(asciiz)\n\t\t\t\t\t\t\tzero_byte_idx = asciiz.index(\"\\x00\")\n\t\t\t\t\t\t\tif zero_byte_idx != nil\n\t\t\t\t\t\t\t\treturn asciiz[0, zero_byte_idx]\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t...
[ "0.6826558", "0.66348594", "0.66280144", "0.66049564", "0.6590987", "0.65588754", "0.6540646", "0.6517224", "0.65146315", "0.6509764", "0.6485041", "0.6485041", "0.63960546", "0.63591695", "0.63521105", "0.6332553", "0.63181746", "0.62761414", "0.6260183", "0.625749", "0.6233...
0.673281
1
parses a number param and returns the value raises an exception if the param cannot be converted to a number examples: nil => 0 3 => 3 "MB_OK" => 0 "SOME_CONSTANT | OTHER_CONSTANT" => 17 "tuna" => !!!!!!!!!!Exception Parameter "consts_mgr" is a ConstantManager
def param_to_number(v, consts_mgr = @consts_mgr) if v.class == NilClass then return 0 elsif v.kind_of? Integer then return v # ok, it's already a number elsif v.kind_of? String then dw = consts_mgr.parse(v) # might raise an exception if dw != nil return dw else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_numeric_constant\n if peek?(:LIT_INT)\n ExprInt.new(expect(:LIT_INT))\n else\n ExprFloat.new(expect(:LIT_FLOAT))\n end\n end", "def parseNumber _args\n \"parseNumber _args;\" \n end", "def number\n # -> uncomment the next line to manually enable rule tracing\n # ...
[ "0.62339985", "0.6207843", "0.60914016", "0.60410696", "0.602025", "0.5942447", "0.5900362", "0.58967775", "0.58392525", "0.5786673", "0.5775598", "0.57234186", "0.57106143", "0.57106143", "0.56917995", "0.5656442", "0.5652993", "0.56514347", "0.56455946", "0.5641099", "0.563...
0.7642137
0
RESEARCHERS don't have a profile, but they shouldn't have a U.Va. computing id.
def virginia_borrower? # @profile !~ /^[a-z]{2,3}([0-9][a-z]{1,2})?$/i profile.match?(/Virginia Borrower|Other VA Faculty|Alum/i) || profile.blank? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_profile (profile_name)\n # Find the matching profile\n profile_data = @master_data.select { |p, d| p[/^#{profile_name}/] }\n profile_count = profile_data.count\n if profile_count > 1\n puts \"Profile match not specific enough. Please refine match\"\n exit 1\n elsif profile_count < 1\n puts \...
[ "0.57742465", "0.55844605", "0.5362191", "0.52931607", "0.52541614", "0.52518713", "0.52007985", "0.5175641", "0.51248634", "0.5113948", "0.509429", "0.50562435", "0.50559705", "0.5047303", "0.50360304", "0.5018535", "0.50017405", "0.4994866", "0.4987648", "0.49832666", "0.49...
0.62510306
0
Indicate whether the user can request item scanning.
def can_request_scanning? true # TODO: Should this be !virginia_borrower? ? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_allowed?(scan_result)\n logger.debug scan_result\n (scan_result['response_code'] < 1) || !contains_in_bases?(scan_result)\n end", "def validate_item_results?\n if @item.user.private\n authenticate_user!\n if !current_user.subscribed_to(@item.user)\n return false\n end...
[ "0.6683219", "0.64934236", "0.6476095", "0.6403977", "0.63911766", "0.6346303", "0.63239706", "0.6288409", "0.6245314", "0.6237274", "0.6226871", "0.6226871", "0.620057", "0.61792797", "0.6166664", "0.6158132", "0.61561495", "0.61561495", "0.61387146", "0.6111477", "0.6111416...
0.7451331
0
GET /skydata/1 GET /skydata/1.json
def show @skydatum = Skydatum.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @skydatum } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_surf_data\n url = \"http://magicseaweed.com/api/#{ENV['MAGIC_SEAWEED_API_KEY']}/forecast/?spot_id=6128&units=UK\"\n uri = URI(url)\n\n response = Net::HTTP.get(uri)\n ActiveSupport::JSON.decode(response) if response != ''\n end", "def index \n\t@skyrequest = Skyrequest::Connector.all.first\n...
[ "0.6829497", "0.6247083", "0.6238176", "0.61522734", "0.6127507", "0.6115243", "0.6096944", "0.6081085", "0.60582757", "0.6055503", "0.60550386", "0.6037855", "0.6026869", "0.5995837", "0.5995837", "0.59456366", "0.59098107", "0.5899252", "0.58925456", "0.5881252", "0.5866732...
0.71188694
0
GET /skydata/new GET /skydata/new.json
def new @skydatum = Skydatum.new respond_to do |format| format.html # new.html.erb format.json { render json: @skydatum } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @skydatum = Skydatum.new(params[:skydatum])\n\n respond_to do |format|\n if @skydatum.save\n format.html { redirect_to @skydatum, notice: 'Skydatum was successfully created.' }\n format.json { render json: @skydatum, status: :created, location: @skydatum }\n else\n ...
[ "0.6810448", "0.6803557", "0.67507285", "0.6744339", "0.6744339", "0.6675255", "0.6573055", "0.6561094", "0.6553184", "0.6551011", "0.6516404", "0.6516404", "0.6513286", "0.6508919", "0.6491953", "0.6461754", "0.64489913", "0.6439948", "0.6439326", "0.64370465", "0.64351285",...
0.75690526
0
POST /skydata POST /skydata.json
def create @skydatum = Skydatum.new(params[:skydatum]) respond_to do |format| if @skydatum.save format.html { redirect_to @skydatum, notice: 'Skydatum was successfully created.' } format.json { render json: @skydatum, status: :created, location: @skydatum } else format.html ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @sky = Sky.new(sky_params)\n\n respond_to do |format|\n if @sky.save\n format.html { redirect_to @sky, notice: 'Sky was successfully created.' }\n format.json { render :show, status: :created, location: @sky }\n else\n format.html { render :new }\n format.js...
[ "0.69015986", "0.6075114", "0.5954964", "0.5856782", "0.55876577", "0.558316", "0.55304563", "0.5490992", "0.5442317", "0.54271805", "0.5388965", "0.53783524", "0.5361033", "0.5328871", "0.53170747", "0.53074276", "0.53010297", "0.52858555", "0.528165", "0.5276898", "0.527114...
0.6743967
1
PUT /skydata/1 PUT /skydata/1.json
def update @skydatum = Skydatum.find(params[:id]) respond_to do |format| if @skydatum.update_attributes(params[:skydatum]) format.html { redirect_to @skydatum, notice: 'Skydatum was successfully updated.' } format.json { head :no_content } else format.html { render action: "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @sky.update(sky_params)\n format.html { redirect_to @sky, notice: 'Sky was successfully updated.' }\n format.json { render :show, status: :ok, location: @sky }\n else\n format.html { render :edit }\n format.json { render json: @sky.e...
[ "0.6673671", "0.6190524", "0.6128267", "0.60708034", "0.59574443", "0.5956493", "0.59364563", "0.57902145", "0.57610625", "0.57604295", "0.5743673", "0.5713474", "0.5699177", "0.56764513", "0.56631386", "0.5649809", "0.5641391", "0.56283784", "0.5625239", "0.56158745", "0.561...
0.66098225
1
DELETE /skydata/1 DELETE /skydata/1.json
def destroy @skydatum = Skydatum.find(params[:id]) @skydatum.destroy respond_to do |format| format.html { redirect_to skydata_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def api_delete(path, data = {})\n...
[ "0.7065175", "0.70328176", "0.6761301", "0.6746985", "0.66991705", "0.6678536", "0.6649326", "0.66250056", "0.66250056", "0.66237664", "0.6608072", "0.6595052", "0.6554437", "0.65450907", "0.65388983", "0.65388983", "0.6516033", "0.6509626", "0.6499219", "0.64822525", "0.6480...
0.7398046
0
Baseline implementation for the disable_xpn_host REST call
def disable_xpn_host request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_disable_xpn_host_request request_pb response = @client_stub.make_post_request( uri: uri, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/disableXpnHost\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"...
[ "0.74900347", "0.65866226", "0.6487242", "0.6405204", "0.62242097", "0.60866934", "0.60456496", "0.5968984", "0.588974", "0.5888264", "0.58156306", "0.5756981", "0.5699836", "0.56459945", "0.5637966", "0.56275225", "0.5570077", "0.55105084", "0.54867864", "0.5481838", "0.5469...
0.78032476
0
Baseline implementation for the disable_xpn_resource REST call
def disable_xpn_resource request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_disable_xpn_resource_request request_pb response = @client_stub.make_post_request( uri: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_xpn_resource request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/disableXpnResource\"\n body = request_pb.projects_disable_xpn_resource_request_resource.to_json\n\n response = @client_stub.make_post_request(\n u...
[ "0.76148224", "0.64701885", "0.6257961", "0.62534875", "0.62182504", "0.6121089", "0.61057836", "0.6075139", "0.60473377", "0.59914917", "0.59818035", "0.59754074", "0.5946178", "0.58969575", "0.5872311", "0.58631057", "0.5840956", "0.58352727", "0.581321", "0.5805529", "0.58...
0.76709634
0
Baseline implementation for the enable_xpn_host REST call
def enable_xpn_host request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_enable_xpn_host_request request_pb response = @client_stub.make_post_request( uri: uri, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/enableXpnHost\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"\"...
[ "0.70874244", "0.6420996", "0.63731235", "0.63036346", "0.6262263", "0.6165541", "0.59492815", "0.5906526", "0.58198625", "0.5789588", "0.5729914", "0.56694514", "0.56039906", "0.55609286", "0.55609286", "0.5553002", "0.5544773", "0.55361956", "0.55023575", "0.54946643", "0.5...
0.7431035
0
Baseline implementation for the enable_xpn_resource REST call
def enable_xpn_resource request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_enable_xpn_resource_request request_pb response = @client_stub.make_post_request( uri: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_xpn_resource request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/enableXpnResource\"\n body = request_pb.projects_enable_xpn_resource_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri:...
[ "0.7172265", "0.6231739", "0.6006011", "0.5932258", "0.58999354", "0.588118", "0.5855175", "0.58359385", "0.5815846", "0.5690324", "0.56875044", "0.5579524", "0.55619884", "0.55097157", "0.5461821", "0.5456827", "0.5438458", "0.5396896", "0.53866416", "0.53780454", "0.5378045...
0.72756726
0
Baseline implementation for the get_xpn_host REST call
def get_xpn_host request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, _query_string_params = transcode_get_xpn_host_request request_pb response = @client_stub.make_get_request( uri: uri, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/getXpnHost\"\n\n response = @client_stub.make_get_request(\n uri: uri,\n options: options,\n )\n\n result = ::Google::...
[ "0.7175156", "0.65536964", "0.6349638", "0.6277782", "0.6198358", "0.6165674", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.61478895", "0.60542005", "0.60414577", "0.60414577", "0.6010017", "0.6010017"...
0.70225894
1
Baseline implementation for the get_xpn_resources REST call
def get_xpn_resources request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_get_xpn_resources_request request_pb response = @client_stub.make_get_request( uri: uri,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xpn_resources request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/getXpnResources\"\n\n query_string_params = {}\n query_string_params[\"filter\"] = request_pb.filter.to_s if request_pb.filter && request_pb.filter != \"\"\n ...
[ "0.6579212", "0.60368466", "0.5889131", "0.5756236", "0.5748071", "0.57277274", "0.5681401", "0.56520116", "0.5607179", "0.5588175", "0.55734694", "0.5544406", "0.5519638", "0.5487556", "0.543016", "0.54168254", "0.5416376", "0.5393172", "0.5328364", "0.53093916", "0.53086144...
0.63943833
1
Baseline implementation for the list_xpn_hosts REST call
def list_xpn_hosts request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_list_xpn_hosts_request request_pb response = @client_stub.make_post_request( uri: uri, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_xpn_hosts request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/listXpnHosts\"\n body = request_pb.projects_list_xpn_hosts_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n ...
[ "0.74857867", "0.723118", "0.6974196", "0.6974196", "0.6974196", "0.67777866", "0.67777866", "0.671636", "0.66991603", "0.6595991", "0.6574017", "0.64809173", "0.6470523", "0.6466958", "0.6465235", "0.64368975", "0.64307463", "0.64129657", "0.63699335", "0.6310194", "0.629735...
0.7576346
0
Baseline implementation for the move_disk REST call
def move_disk request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_move_disk_request request_pb response = @client_stub.make_post_request( uri: uri, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_disk request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/moveDisk\"\n body = request_pb.disk_move_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: ...
[ "0.70715916", "0.6548687", "0.6484039", "0.61993146", "0.60974747", "0.6041206", "0.6041206", "0.5995685", "0.5972715", "0.593383", "0.59021443", "0.58517075", "0.5839177", "0.5828931", "0.57950985", "0.5774989", "0.57248795", "0.57248795", "0.5713674", "0.5682578", "0.564203...
0.7306026
0
Baseline implementation for the move_instance REST call
def move_instance request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_move_instance_request request_pb response = @client_stub.make_post_request( uri: uri, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_instance request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/moveInstance\"\n body = request_pb.instance_move_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n ...
[ "0.7261041", "0.68380046", "0.64573467", "0.6040252", "0.6040252", "0.5971018", "0.59322816", "0.58851117", "0.583903", "0.5821589", "0.58022183", "0.57998997", "0.5789968", "0.5789968", "0.5773893", "0.5762453", "0.5751228", "0.57282317", "0.5724356", "0.5676663", "0.5676663...
0.7474949
0
Baseline implementation for the set_common_instance_metadata REST call
def set_common_instance_metadata request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_set_common_instance_metadata_request request_pb response = @client_stub.make_post_request( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_common_instance_metadata request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/setCommonInstanceMetadata\"\n body = request_pb.metadata_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n...
[ "0.74214065", "0.59669435", "0.5650688", "0.5604885", "0.5567124", "0.5562294", "0.5514305", "0.54849464", "0.5435901", "0.5435901", "0.5379111", "0.53608197", "0.5331841", "0.53090143", "0.5303271", "0.52978647", "0.52880114", "0.52880114", "0.52880114", "0.52880114", "0.527...
0.7489561
0
Baseline implementation for the set_default_network_tier REST call
def set_default_network_tier request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_set_default_network_tier_request request_pb response = @client_stub.make_post_request( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_default_network_tier request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/setDefaultNetworkTier\"\n body = request_pb.projects_set_default_network_tier_request_resource.to_json\n\n response = @client_stub.make_post_request(\n ...
[ "0.77351016", "0.64955413", "0.5975011", "0.5937313", "0.58802915", "0.58199257", "0.579607", "0.5688632", "0.56367856", "0.5635349", "0.56249404", "0.5597112", "0.5568555", "0.5564882", "0.5563091", "0.5563091", "0.5545937", "0.55433923", "0.54807216", "0.5477234", "0.544526...
0.7897389
0
Baseline implementation for the set_usage_export_bucket REST call
def set_usage_export_bucket request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_set_usage_export_bucket_request request_pb response = @client_stub.make_post_request( u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_usage_export_bucket request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/setUsageExportBucket\"\n body = request_pb.usage_export_location_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri...
[ "0.7764203", "0.6104856", "0.6087291", "0.56268525", "0.5613061", "0.5583615", "0.5548671", "0.5513992", "0.54852957", "0.5484041", "0.54838175", "0.54838175", "0.54838175", "0.5476712", "0.54758847", "0.5384428", "0.5345993", "0.5324406", "0.5272792", "0.5270324", "0.5267032...
0.8040727
0
rename local variable rrlv
def rename_local_variable # Start on either 'asdf', and do viw<leader>rrlv asdf = 10 p asdf # TODO: make this work without 'v' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rename_var(var_name, opts={})\n @renames[var_name] = scope.rename_var(var_name, opts)\n end", "def renamenx(old_name, new_name); end", "def renamenx(old_name, new_name); end", "def rename_to_bob\n name = 'Bob'\n end", "def _get_var(name)\n\t\treturn @replace_vars[name]\n\tend", "def relvar(na...
[ "0.6476713", "0.62236726", "0.62236726", "0.57593536", "0.562595", "0.5613587", "0.555546", "0.5552649", "0.5541816", "0.55172426", "0.55069834", "0.5469401", "0.5469401", "0.5453131", "0.5394255", "0.53650665", "0.535592", "0.53248", "0.5324194", "0.5324194", "0.53170234", ...
0.72910327
0
create a dns record
def create_record(fqdn, type, ipdata) unless @dnss.is_valid? Puppet.crit dns.cstatus end priority = {} # TODO: research how to implement priority for puppet # priority = priority[0] # if priority.nil? # priority = {} # else # priority = { :prior...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dns_record(domain, hostname, type, content, ttl, priority = nil)\n body = {\n 'hostname' => hostname,\n 'type' => type,\n 'content' => content,\n 'ttl' => ttl\n }\n body.update!(:priority => priority) if priority\n connection.post \"/dns/create/#...
[ "0.79111874", "0.7601401", "0.751647", "0.74093896", "0.7280565", "0.7247105", "0.715277", "0.7105436", "0.7097465", "0.70457083", "0.70249116", "0.69983387", "0.69115025", "0.68434876", "0.67359436", "0.66986054", "0.6695808", "0.66878504", "0.65433764", "0.65114814", "0.651...
0.80369395
0
get a dns record object
def get_record(fqdn, type) matches = find_match(@dnss.records, fqdn, true) if matches != nil record = nil matches.each do |record| Puppet.debug "inspecting #{record.hash_type} == #{type}" if record.hash_type.to_s == type.to_s Puppet.notice "found...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_record(fqdn)\n\n url = \"https://dnsapi.cn/Record.List\"\n\n h = HTTPClient.new()\n\n default_params = {\n :login_email => \"\"\n }\n params = {\n\n }.merge(default_params)\n\n res = h.post(url, params)\n records = JSON.parse(res.body)['records']\n\n\n # ...
[ "0.71340287", "0.68997043", "0.6855213", "0.67315835", "0.6587001", "0.6580899", "0.6540604", "0.64740884", "0.64225733", "0.6381819", "0.6371659", "0.6353926", "0.63450676", "0.6343346", "0.63272756", "0.6322495", "0.6267944", "0.62651867", "0.6238346", "0.6217513", "0.62006...
0.70954484
1
create a dns zone
def create_zone(zone, email, ttl) @dnsh.name = zone @dnsh.email = email @dnsh.ttl = ttl if @dnsh.save == true Puppet.notice "Created dns zone #{zone} with id #{@dnsh.id}" else Puppet.err @dnsh.cstatus raise @dnsh.cstatus end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n Puppet.debug \"starting create #{self.class.to_s}\"\n dns_service = get_dns_service(get_zone)\n dns_service.create_zone(get_zone, get_email, get_ttl) if dns_service != nil\n Puppet.debug \"done with create #{self.class.to_s}\"\n end", "def zone_create(zone)\n ob...
[ "0.7931895", "0.739134", "0.7235577", "0.7179706", "0.698375", "0.6760779", "0.6733734", "0.6639063", "0.6634835", "0.6634155", "0.6612857", "0.6490288", "0.64193064", "0.6364734", "0.6350982", "0.63324004", "0.63143957", "0.6301615", "0.62735534", "0.62387955", "0.62060624",...
0.81226397
0
get a dns zone
def get_zone(zone) return find_match(@dns.domains, zone) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hosted_zone()\n\t\tresp = @r53.get_hosted_zone(:id => @zone)\n\t\tresp[:hosted_zone]\n\tend", "def get_zone(zone)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::GetZone.new,\n :path => \"/api/1.1/zone...
[ "0.7621107", "0.7456592", "0.7333731", "0.730833", "0.7251321", "0.6871877", "0.6811838", "0.67660356", "0.6747667", "0.6747667", "0.66899514", "0.6667358", "0.66535854", "0.66006154", "0.65746117", "0.6572665", "0.6535256", "0.6501411", "0.6485206", "0.6485206", "0.64761746"...
0.7733444
0
the unsigned m/z value
def mz _mz_signed = mz_signed _mz_signed >= 0 ? _mz_signed : -_mz_signed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def z\n return @z\n end", "def z_value\n @z_value ||= self.class.z_value\n end", "def unit \n\t\t\tunitq = self.dup\n\t\t\tmagnitude = self.abs\n\t\t\tunitq[0] /= magnitude\n\t\t\tunitq[1] /= magnitude\n\t\t\tunitq[2] /= magnitude\n\...
[ "0.6043465", "0.6006474", "0.5899675", "0.5866685", "0.57574797", "0.57383895", "0.5709954", "0.57004696", "0.5652513", "0.55898327", "0.55563855", "0.55516213", "0.5547633", "0.5527039", "0.5519486", "0.5519486", "0.55054855", "0.55054855", "0.55045134", "0.54850674", "0.541...
0.6661136
0
GET /supplies_providers_loans/1 GET /supplies_providers_loans/1.json
def show @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @supplies_providers_loan } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html #...
[ "0.7412478", "0.71966857", "0.69355094", "0.6468367", "0.6468367", "0.6420029", "0.62445724", "0.62176585", "0.61988497", "0.6192699", "0.61271405", "0.6050038", "0.6038974", "0.6025539", "0.6025539", "0.6006675", "0.5911915", "0.59048086", "0.59004813", "0.58405393", "0.5834...
0.7729894
0
GET /supplies_providers_loans/new GET /supplies_providers_loans/new.json
def new @supplies_providers_loan = SuppliesProvidersLoan.new respond_to do |format| format.html # new.html.erb format.json { render json: @supplies_providers_loan } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @supplies_loan = SuppliesLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html #...
[ "0.7858679", "0.7730011", "0.7593227", "0.7593227", "0.7569273", "0.73122126", "0.70767003", "0.7011588", "0.70106", "0.6993267", "0.69070226", "0.6868139", "0.68442243", "0.6826152", "0.680316", "0.6797949", "0.67949706", "0.67820007", "0.6753396", "0.6752861", "0.67484", ...
0.7965906
0
PUT /supplies_providers_loans/1 PUT /supplies_providers_loans/1.json
def update @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id]) respond_to do |format| if @supplies_providers_loan.update_attributes(params[:supplies_providers_loan]) format.html { redirect_to @supplies_providers_loan, notice: 'Supplies providers loan was successfully updated.' } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n if @supplies_loan.update_attributes(params[:supplies_loan])\n format.html { redirect_to @supplies_loan, notice: 'Supplies loan was successfully updated.' }\n format.json { head :no_content }\n el...
[ "0.67771786", "0.62539315", "0.618528", "0.6084787", "0.6064328", "0.6016281", "0.59802955", "0.59668136", "0.5912985", "0.5900591", "0.5874986", "0.5874986", "0.5851251", "0.5841423", "0.581742", "0.5806443", "0.5799978", "0.57990664", "0.5798691", "0.5778461", "0.573745", ...
0.7066614
0
DELETE /supplies_providers_loans/1 DELETE /supplies_providers_loans/1.json
def destroy @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id]) @supplies_providers_loan.destroy respond_to do |format| format.html { redirect_to supplies_providers_loans_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @supplies_loan = SuppliesLoan.find(params[:id])\n @supplies_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_loans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider = Provider.find(params[:id])\n @provider.destro...
[ "0.7558326", "0.6920013", "0.6920013", "0.6920013", "0.691344", "0.68868333", "0.68526495", "0.6796305", "0.6729628", "0.66929644", "0.66909593", "0.66909593", "0.66909593", "0.66542876", "0.6626142", "0.66153806", "0.66112024", "0.66065884", "0.6593572", "0.6592053", "0.6578...
0.7649287
0
returns a copy of the point
def get_point_clone return @point.clone end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub(point)\r\n new_point = Marshal.load(Marshal.dump(self))\r\n new_point.x = @x - point.x\r\n new_point.y = @y - point.y\r\n return new_point\r\n end", "def to_point\n if length == 2\n p = Point.new(*self)\n elsif length == 1\n p = self[0].clone\n end\n return p\n end", ...
[ "0.7704209", "0.73078203", "0.7215952", "0.71435744", "0.70725566", "0.7001392", "0.67546225", "0.67159456", "0.66975594", "0.66770905", "0.6642301", "0.6609255", "0.65990114", "0.6576018", "0.65734076", "0.6562474", "0.6559707", "0.6537596", "0.6490234", "0.63733876", "0.637...
0.87721944
0
checks whether the function is converging
def converging? # check the convergence in a given direction comparing the previous and current values def point_converged?(previous, current) pre = previous.value curr = current.value diff = (pre - curr).abs size = [pre.abs, curr.abs].max...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def converge(state) ; end", "def converge_complete\n end", "def converge\n transition_to(:converge)\n end", "def converge\n transition_to(:converge)\n end", "def solvable?\n steps > 0\n end", "def solved?\n self.fittest.fitness >= 1.0\n end", "def converge?(a, b)\n differe...
[ "0.6986648", "0.6911506", "0.6849328", "0.6849328", "0.6108658", "0.6070145", "0.606297", "0.6011228", "0.59503126", "0.57450545", "0.56002283", "0.55354744", "0.55287474", "0.5504217", "0.5498693", "0.5497953", "0.5497953", "0.54847443", "0.5481534", "0.54738367", "0.5472005...
0.7549439
0
Build an initial simplex == Parameters: start_point: starting point of the minimization search
def build_simplex(start_point) n = start_point.length raise "dimension mismatch" if n != @start_configuration.length # set first vertex @simplex = Array.new(n+1) @simplex[0] = PointValuePair.new(start_point, Float::NAN) # set remaining vertices 0.upto(n - 1) do |...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_simplex(x1=ParameterSet.new(-4.0,-4.0),c=8)\n p= c/Math.sqrt(2) * (Math.sqrt(3)-1)/2\n q= ParameterSet.new(p,p)\n x2 = x1 + q + ParameterSet.new(1.0,0.0) * (c/Math.sqrt(2))\n x3 = x1 + q + ParameterSet.new(0.0,1.0) * (c/Math.sqrt(2))\n @simplex = [x1,x2,x3]\n end", "def ev...
[ "0.6069061", "0.5490917", "0.54820216", "0.53754777", "0.53543246", "0.5308169", "0.5261818", "0.5249094", "0.5223264", "0.51858115", "0.5159656", "0.51582664", "0.50935674", "0.50349516", "0.503476", "0.5029023", "0.49839765", "0.49836835", "0.49726254", "0.495024", "0.49359...
0.8126109
0
Evaluate all the nonevaluated points of the simplex
def evaluate_simplex # evaluate the objective function at all non-evaluated simplex points 0.upto(@simplex.length - 1) do |i| vertex = @simplex[i] point = vertex.point if vertex.value.nan? @simplex[i] = PointValuePair.new(point, f(point)) end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate\n SQ.inject { |x, n| x + (@colors[n] == @mx ? (PST[n] + VALUE[@pieces[n]]) :\n @colors[n] == @mn ? -(PST[n] + VALUE[@pieces[n]]) : 0) }\n end", "def solve!\n while empty_squares.any?\n square = empty_squares.detect { |square| legal_values_for_square(squa...
[ "0.5377877", "0.52260196", "0.51628906", "0.5126159", "0.50868887", "0.50844866", "0.504259", "0.5021839", "0.5016635", "0.5001472", "0.49847087", "0.4974209", "0.49550626", "0.49518788", "0.4950949", "0.49488753", "0.4925819", "0.49192926", "0.49045908", "0.49043077", "0.490...
0.79259807
0
Replace the worst point of the simplex by a new point == Parameters: point_value_pair: point to insert
def replace_worst_point(point_value_pair) n = @simplex.length - 1 0.upto(n - 1) do |i| if (compare(@simplex[i], point_value_pair) > 0) point_value_pair, @simplex[i] = @simplex[i], point_value_pair end end @simplex[n] = point_value_pair end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_point point\n add_to_point! point.dup\n end", "def evaluate_simplex\n # evaluate the objective function at all non-evaluated simplex points\n 0.upto(@simplex.length - 1) do |i|\n vertex = @simplex[i]\n point = vertex.point\n if vertex.value.nan?\n ...
[ "0.568733", "0.5383071", "0.5202251", "0.51968026", "0.51624954", "0.5158071", "0.51291203", "0.5086484", "0.5053831", "0.5042788", "0.4954", "0.49424553", "0.49386322", "0.49386322", "0.49313292", "0.4928575", "0.49139407", "0.48842263", "0.48108265", "0.47963923", "0.478787...
0.8584808
0
loads structure file csv, returns structure as array
def loadStructure(file) csv_text = File.read(file) return CSV.parse(csv_text, :headers => true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_to_array(csv); end", "def csvReader(file, headers)\n begin\n csvTable = CSV.read(file, {col_sep:\"\\t\", quote_char:\"\\0\", headers:headers})\n rescue ArgumentError\n puts \"Error: Unsupported encoding, tabulated/CSV file must be in UTF-8 format.\"\n abort\n end\n parsed...
[ "0.68302494", "0.673602", "0.6607786", "0.659163", "0.6573549", "0.6573456", "0.65718514", "0.6570866", "0.6569528", "0.65678114", "0.65153396", "0.65033907", "0.6465346", "0.6458263", "0.6405393", "0.6377711", "0.6369217", "0.63432074", "0.6327245", "0.6321517", "0.6298861",...
0.76938415
0
Records the original rvm environment and sets up a new gemset.
def setup_rvm @@rvm_original_env ||= RVM.current.expanded_name @@env = RVM::Environment.current @@env.gemset_create(app_name) @@env.gemset_use!(app_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_rvm\n @@env.use!(@@rvm_original_env)\n end", "def restore_env(env); end", "def gemset_initial\n rvm(:gemset, :initial).successful?\n end", "def env=(environment); end", "def env=(environment); end", "def finish\n super\n @_env[ENV_KEY] = self\n end", "def _e...
[ "0.69092965", "0.62419206", "0.5963159", "0.59286314", "0.59286314", "0.57703185", "0.5767454", "0.5766548", "0.5700036", "0.5684107", "0.5649919", "0.56323075", "0.55625874", "0.5482174", "0.54086643", "0.5397399", "0.5397006", "0.53675944", "0.53661716", "0.5351091", "0.534...
0.7845773
0
Reverts to the original rvm environment
def reset_rvm @@env.use!(@@rvm_original_env) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_env(env); end", "def restore\n end", "def restore_env(env)\n @src, @tree, @block_ial, @stack, @text_type = *env\n end", "def restore; end", "def reset_env\n clear_env\n set_env self.env_defaults\n end", "def setup_rvm\n @@rvm_original_env ||= RVM.current.expan...
[ "0.7008531", "0.6195144", "0.60789096", "0.60209644", "0.5970747", "0.59668154", "0.59461004", "0.59411603", "0.58845127", "0.58845127", "0.58653486", "0.58198476", "0.5814897", "0.58031124", "0.57422304", "0.57039714", "0.5681587", "0.5634584", "0.562108", "0.56122756", "0.5...
0.8179662
0
Returns the rbenv ruby version
def rbenv_ruby `rbenv version`.split(' ').first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby_version\n if ruby = ENV['RUBY']\n File.basename(ruby)\n else\n RUBY_VERSION\n end\n end", "def most_recent_ruby_version\n node[:rbenv][:rubies].map do |version|\n Gem::Version.new(version)\n end.sort.map(&:to_s).last\nend", "def ruby_version\n\t\treturn RUBY_VERSIO...
[ "0.71018237", "0.7021712", "0.6862039", "0.677662", "0.67422354", "0.66946185", "0.65791935", "0.6559915", "0.6503853", "0.64653397", "0.64008373", "0.64001", "0.63920224", "0.6369104", "0.62895656", "0.62581515", "0.62406", "0.6203518", "0.618088", "0.60488933", "0.6047772",...
0.89887893
0
Returns the RVM ruby version
def rvm_ruby @@env.expanded_name.match(/([\w\-\.]+)/)[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby_version\n default = %x{ rvm current}.strip\n items = %x{ rvm ls strings }.split.compact\n\n ruby = menu_with_default \"RVM Ruby version to use for deployment:\", items,default\n ruby = ask \"Enter alternative RVM Ruby string: \" if ruby =~ /Other/\n ruby\n end", "def ruby_version\n ...
[ "0.79461366", "0.6698439", "0.6692845", "0.6652912", "0.66254026", "0.66031736", "0.6598809", "0.655525", "0.64827526", "0.64827526", "0.63912076", "0.6375008", "0.63747865", "0.6343658", "0.632626", "0.6312146", "0.62389517", "0.6225651", "0.6220597", "0.62051994", "0.619585...
0.755152
1
Returns true if rbenv is installed.
def rbenv_installed? @rbenv_installed ||= `which rbenv`.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_virtualenv_installed(python)\n `#{python} -m virtualenv --help 2>&1`\n if (0 != $?.to_i)\n false\n else\n true\n end\n end", "def ruby?\n exist? 'Gemfile'\n end", "def python?\n exist? 'requirements.txt'\n end", "def installed?\n !IO.popen(\"which #{self}\")...
[ "0.77486736", "0.72765374", "0.6919784", "0.67822814", "0.651632", "0.648404", "0.6482359", "0.64690065", "0.6451853", "0.64186656", "0.6410398", "0.63503563", "0.6338802", "0.6338802", "0.6338802", "0.6336043", "0.630004", "0.6287065", "0.6255579", "0.6255579", "0.62461686",...
0.88057137
0
Returns true if RVM is installed.
def rvm_installed? @rvm_installed ||= `which rvm`.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rvm_installed?\n cmd_test %{-s \"/usr/local/lib/rvm\"}\nend", "def rvm?\n\t\t\tFile.exists?(RvmPow::RVM_BINARY)\n\t\tend", "def ruby_installed?(ruby)\n cmd_if %{rvm list strings | grep -q \"#{ruby}\" >/dev/null}, true\nend", "def installed?\n !IO.popen(\"which #{self}\"){|i| i.read}.empty?\n end",...
[ "0.83704555", "0.78068435", "0.73033595", "0.72069067", "0.7049136", "0.6857459", "0.6763749", "0.66081756", "0.6594433", "0.6593279", "0.6572746", "0.6558013", "0.6551827", "0.65492225", "0.65381473", "0.65381473", "0.6535947", "0.64989525", "0.6495354", "0.64644104", "0.645...
0.86571807
0
GET /chase_vehicles GET /chase_vehicles.json
def index @chase_vehicles = ChaseVehicle.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vehicles\n @vehicles ||= begin\n _, json = get_json(\"/vehicles\")\n json.map { |data| Vehicle.new(self, data) }\n end\n end", "def show\n render json: @vehicle\n end", "def vehicle\n fetch('final_space.vehicles')\n end", "def index\n @vehicles = Vehicle....
[ "0.69964904", "0.69512826", "0.6920142", "0.6902806", "0.6787383", "0.67636365", "0.6747108", "0.66985935", "0.6606108", "0.6438546", "0.6360747", "0.6341063", "0.6323488", "0.63189006", "0.6306929", "0.62902707", "0.62902707", "0.6276853", "0.6272245", "0.6238601", "0.621447...
0.7339431
1
DELETE /chase_vehicles/1 DELETE /chase_vehicles/1.json
def destroy @chase_vehicle.destroy respond_to do |format| format.html { redirect_to :back } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |forma...
[ "0.75328815", "0.7520184", "0.7520184", "0.73870677", "0.7347832", "0.7293985", "0.72215956", "0.72215956", "0.72215956", "0.72215956", "0.7196833", "0.7184534", "0.71619755", "0.71357685", "0.7115856", "0.70986724", "0.70986724", "0.70474255", "0.702127", "0.7010943", "0.699...
0.76296186
1
Add a tag with the given key and data value to all collections matching the query condition. If append is true, this method will append the value to any existing data (if not already present), rather than overwriting it. The optional block gets passed Arrayuniq to determine whether a piece of data is already present in...
def add_tag(key, value, condition, token, append=false, only_granules=true, &block) query = tag_condition_to_query(condition) # https://bugs.earthdata.nasa.gov/browse/CMR-2855 will fix the need for some of this logic # https://bugs.earthdata.nasa.gov/browse/CMR-2609 as well if value.present? || ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_with(name)\n prepare do\n document[field] = [] unless document[field]\n docs = document.send(field).concat(value.__array__)\n execute(name)\n docs\n end\n end", "def append(key, value); end", "def append(key, value); end", "def a...
[ "0.5391321", "0.52631164", "0.52631164", "0.5191369", "0.5191369", "0.5127608", "0.5097426", "0.5065116", "0.4988599", "0.49810627", "0.4977901", "0.4927516", "0.49184278", "0.49057356", "0.4896496", "0.4853333", "0.48265657", "0.47767368", "0.47651803", "0.47464642", "0.4726...
0.5498181
0
The number of citizen not engaged in color pass in args
def citizens_ready_in(color) citizens.where(:color => color, :engaged => false).count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_pieces(color)\n color == \"red\" ? whites_count : reds_count\n end", "def lnbColor _args\n \"lnbColor _args;\" \n end", "def diversity\n color_count.keys\n end", "def students_with_brown_eyes(eye_colors)\n\tbrown_eyes = 0\n\n\teye_colors.each do |eye_color|\n \t\tif eye_colo...
[ "0.6854763", "0.6338841", "0.62112564", "0.61960584", "0.6104309", "0.60489833", "0.60388446", "0.5973139", "0.5876759", "0.5823264", "0.57989615", "0.57937104", "0.57759714", "0.5770552", "0.5724761", "0.5696262", "0.5661501", "0.5639451", "0.5629358", "0.56132853", "0.56058...
0.6579883
1
Return the IP associated with this record if it can be deduced from the record name
def ip ip = nil unless valid? return nil end begin case name when /\.in-addr\.arpa$/ name_without_suffix = name.sub(/\.in-addr\.arpa$/, '') quads = name_without_suffix.split('.') if quads.size == 4 quads.reverse! ip = quads.join('.') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n ip_address\n end", "def name\n ip_address\n end", "def get_ip(ip_name, resource_group = armrest_configuration.resource_group)\n get(ip_name, resource_group).properties.ip_address\n end", "def ptr(ip)\n # use cache if ip was already resolved\n return @cache...
[ "0.65940094", "0.63443494", "0.6335534", "0.6318545", "0.63108426", "0.62106514", "0.6176224", "0.6142758", "0.6051862", "0.6051862", "0.6042356", "0.6031375", "0.6025368", "0.5973925", "0.5969801", "0.5958472", "0.5955676", "0.595448", "0.5931934", "0.5925773", "0.59148896",...
0.6641284
0
PATCH/PUT /result_statistic_sections/1 PATCH/PUT /result_statistic_sections/1.json
def update respond_to do |format| if @result_statistic_section.update(result_statistic_section_params) format.html { redirect_to edit_result_statistic_section_path(@result_statistic_section), notice: t('success') } format.json { render :show, status: :ok, location: @resul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @result_statistic_section.update(result_statistic_section_params)\n format.html { redirect_to edit_result_statistic_section_path(@result_statistic_section),\n notice: t('success') }\n format.json { render :show, status: :ok, locati...
[ "0.7273932", "0.6620052", "0.62830526", "0.62604064", "0.6242381", "0.6073254", "0.6073254", "0.6072117", "0.59847325", "0.59212625", "0.5899397", "0.58261436", "0.57995874", "0.5789772", "0.57820976", "0.5774859", "0.5774859", "0.5770771", "0.57252145", "0.57252145", "0.5725...
0.70481396
1
POST /bugreports POST /bugreports.json
def create @bugreport = Bugreport.new(bugreport_params) @bugreport.reporter = current_user respond_to do |format| if @bugreport.save format.html { redirect_to root_url, notice: 'Bugreport was successfully created.' } format.json { render action: 'show', status: :created, location: @bu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @bug = Bug.new(bug_params)\n @bug.project_id = session[:project_id]\n @bug.user_id = current_user.id\n @bug.clean_summary\n @bug.clean_description\n @bug.status = 0 #New\n @bug.resolution = 0 #Open\n\n respond_to do |format|\n if @bug.save\n BugHistoric.create(bug_i...
[ "0.6781488", "0.65825206", "0.6582034", "0.6582034", "0.64818656", "0.64270556", "0.6361853", "0.63279647", "0.6293628", "0.62586296", "0.62543607", "0.6249598", "0.6227144", "0.62130576", "0.6190422", "0.6161469", "0.6136166", "0.6122411", "0.611669", "0.61154073", "0.594975...
0.69298863
0
PATCH/PUT /bugreports/1 PATCH/PUT /bugreports/1.json
def update respond_to do |format| if @bugreport.update(bugreport_params) format.html { redirect_to @bugreport, notice: 'Bugreport was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @bugreport...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @bug.update(bug_params)\n BugHistoric.create(bug_id: @bug.id, ref: BugHistoric.MODIFIED, user_id: current_user.id)\n format.html { redirect_to @bug, notice: 'Bug was successfully updated.' }\n format.json { render :show, status: :ok, location: @...
[ "0.7086432", "0.6667938", "0.66447854", "0.6626886", "0.66071826", "0.66071826", "0.65955746", "0.6494753", "0.6492648", "0.6436245", "0.62485963", "0.6247278", "0.62275034", "0.6176275", "0.6114004", "0.60641396", "0.6059335", "0.6047012", "0.6046641", "0.6044141", "0.603974...
0.70894927
0
DELETE /bugreports/1 DELETE /bugreports/1.json
def destroy @bugreport.destroy respond_to do |format| format.html { redirect_to bugreports_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @report.destroy!\n render json: {status: :ok}\n end", "def destroy\n @client_bug.destroy\n respond_to do |format|\n format.html { redirect_to client_bugs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bug.destroy\n respond_to do |format|\n ...
[ "0.71863943", "0.7172071", "0.7099058", "0.70983267", "0.7091251", "0.70906377", "0.70906377", "0.70906377", "0.7082701", "0.70794785", "0.7059974", "0.7059974", "0.70548797", "0.70184135", "0.70184135", "0.70184135", "0.70184135", "0.6989349", "0.6981774", "0.69305503", "0.6...
0.7836252
0
2. Metoda display_details() afiseaza numele si prenumele
def display_details() puts "Numele persoanei: #@nume" puts "Prenumele persoanei: #@prenume" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_details\n return @selected.details\n end", "def details\n end", "def details\n\n end", "def info_page_will_display_details\n if info_page_can_display_details && link.details_text_markup.to_s != ''\n true\n end\n end", "def details; end", "def show_details\n @selected.de...
[ "0.7489983", "0.74136686", "0.7353853", "0.7159857", "0.7116823", "0.7020158", "0.7009326", "0.697416", "0.6950837", "0.6901627", "0.68921447", "0.6859523", "0.68557215", "0.68552256", "0.67985594", "0.67267156", "0.6706501", "0.67044353", "0.6667234", "0.66666734", "0.666161...
0.7535434
1
Takes a host to and initializes `task` attribute as an empty array.
def initialize(host=nil) @host = host @tasks = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize # Initialize method that is similar to a Constructor in Java\n @all_tasks = [] # Method includes an array that stores all tasks\n end", "def tasksOnHost(filter, host)\n java_import 'java.net.URL'\n java_import 'java.net.SocketException'\n java_import 'java.io.InputStreamReader'\...
[ "0.67093545", "0.6549487", "0.63946384", "0.63946384", "0.62502074", "0.62445647", "0.6239553", "0.6239553", "0.6239553", "0.61795175", "0.6177458", "0.61316544", "0.6126421", "0.60572904", "0.60484326", "0.60366523", "0.6012856", "0.59558856", "0.5936936", "0.59276474", "0.5...
0.804462
0
This method will be called by the Logging framework when it first initializes. Here we require the redis appender code.
def initialize_redis require File.expand_path('../appenders/redis', __dir__) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init\n Logging.logger.root.level = :debug\n Logging.logger.root.add_appenders(\n Logging.appenders.stdout(\n :backtrace => false,\n :level => @config[:verbose] ? :debug : :info,\n :layout => Logging.layouts.pattern(:pattern => STDOUT_PATTERN)\n )...
[ "0.6999989", "0.6786388", "0.6674792", "0.65466744", "0.64838135", "0.64409333", "0.6401675", "0.63844216", "0.6337871", "0.63170874", "0.63118863", "0.6310815", "0.6283471", "0.6278116", "0.6253453", "0.625073", "0.6247212", "0.62417215", "0.62314206", "0.62251663", "0.62147...
0.69176537
1
helper method for self.highest_pledge to abstract away the process to get highest pledge amount
def highest_pledge_amount pledges.reduce(0) do |highest_pledge_amount, pledge| highest_pledge_amount = pledge.amount > highest_pledge_amount ? pledge.amount : highest_pledge_amount end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def biggest_investment()\n funding_rounds = self.funding_rounds.select {|funding| funding.amount}\n amount = 0\n\n funding_rounds.select do |funding|\n\n if funding.amount >= amount\n amount = funding.amount\n funding\n end\n \n...
[ "0.7359576", "0.69808304", "0.69797075", "0.6851441", "0.6802575", "0.6708251", "0.6638615", "0.66277385", "0.6613474", "0.65981984", "0.6587211", "0.6574272", "0.6553286", "0.65527064", "0.650865", "0.647831", "0.6453326", "0.6432564", "0.64111716", "0.64097774", "0.63974833...
0.85352814
0
Build an instance of BrandedCallInstance
def get_instance(payload) BrandedCallInstance.new(@version, payload, ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(from: nil, to: nil, reason: nil, call_sid: :unset)\n data = Twilio::Values.of({'From' => from, 'To' => to, 'Reason' => reason, 'CallSid' => call_sid, })\n\n payload = @version.create(\n 'POST',\n @uri,\n data: data\n )\n\n ...
[ "0.63680667", "0.6322264", "0.62932366", "0.6178401", "0.59782547", "0.59414494", "0.59082586", "0.58589464", "0.5767151", "0.57323474", "0.56939757", "0.56818175", "0.56554455", "0.5654454", "0.5649689", "0.5603783", "0.5573472", "0.5534251", "0.5508815", "0.5501636", "0.547...
0.76183873
0
check if the left child of is greater than parent
def left_child_greater?(array, index) array[left_child(index)] && (left_child(index) > array[index]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child? \n parent_id = self[parent_col_name]\n !(parent_id == 0 || parent_id.nil?) && (self[left_col_name] > 1) && (self[right_col_name] > self[left_col_name])\n end", "def child? \n parent_id = self[parent_col_name]\n ...
[ "0.7636001", "0.7636001", "0.7587314", "0.7325978", "0.6972412", "0.69609654", "0.6895651", "0.68921894", "0.68921894", "0.68766135", "0.67620105", "0.6760237", "0.6756421", "0.669682", "0.6637197", "0.6598437", "0.65784174", "0.65537393", "0.65490246", "0.65108603", "0.65002...
0.7770504
0
Below Sets params for admin library id from inherited AdminLibraries class.
def set_library @library = AdminLibrary.friendly.find(params[:admin_library_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_library\n @library = AdminLibrary.friendly.find(params[:id]) \n end", "def set_library\n @library = Library.find_by(id: params[:id])\n end", "def set_library\n #for getting one library\n @library = Library.find_by_red_id(params[:id])\n end", "def set_library\n @libra...
[ "0.66456765", "0.6317812", "0.6300191", "0.625822", "0.61746913", "0.59464914", "0.58952403", "0.57715607", "0.56993145", "0.5645499", "0.56342816", "0.55929744", "0.5572139", "0.55279535", "0.5471647", "0.5395107", "0.53885126", "0.53854704", "0.5384356", "0.53722453", "0.53...
0.70998466
0
Below Provides params for new library upload record.
def upload_params params.require(:library_upload).permit(:title, :description, :tags, :image, :file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def library_params\n params.require(:library).permit(:red_id, :purchased_on, :user_id, :description, :library_data)\n end", "def library_params\n params.require(:library).permit(:name, :cover, :cover_cache, :remove_cover, :desc, :file, :file_cache, :remove_file, :crop_x, :crop_y, :crop_w, :crop_h, :...
[ "0.7122363", "0.71116245", "0.6918736", "0.6917665", "0.6913336", "0.6913336", "0.686343", "0.6735816", "0.6684364", "0.66784006", "0.6670489", "0.66634995", "0.6642525", "0.6630823", "0.66180724", "0.66176736", "0.6602055", "0.65902513", "0.6558071", "0.655783", "0.65406513"...
0.7591383
0
Counts the number of quote characters in a line, excluding escaped quotes.
def count_quote_chars(line, quote_char) return 0 if line.nil? || quote_char.nil? count = 0 previous_char = '' line.each_char do |char| count += 1 if char == quote_char && previous_char != '\\' previous_char = char end count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_quote_markers(line)\n\n marker = \">> \"\n count = 0\n\n loop do\n break unless line.starts_with?(marker)\n\n line = line.sub(marker, '')\n count = count + 1\n end\n\n [line, count]\n end", "def count_characters(all_lines_from_file)\n all_lines_from_file.gsub(/\\n+/,\"\...
[ "0.637429", "0.63518494", "0.63001055", "0.62423486", "0.62383735", "0.6237805", "0.6217741", "0.61562014", "0.6153911", "0.59262764", "0.59262764", "0.5924019", "0.57923114", "0.57564396", "0.57545006", "0.5729501", "0.57252765", "0.5714425", "0.56468415", "0.5607265", "0.56...
0.87860364
0
Ruby equivalent of the Cextension for parse_line parses a single line: either a CSV header and body line quoting rules compared to RFC4180 are somewhat relaxed we are not assuming that quotes inside a fields need to be doubled we are not assuming that all fields need to be quoted (0 is even) works with multichar col_se...
def parse_csv_line_ruby(line, options, header_size = nil) return [] if line.nil? line_size = line.size col_sep = options[:col_sep] col_sep_size = col_sep.size quote = options[:quote_char] quote_count = 0 elements = [] start = 0 i = 0 previous_char = '' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(line, options, header_size = nil)\n # puts \"SmarterCSV.parse OPTIONS: #{options[:acceleration]}\" if options[:verbose]\n\n if options[:acceleration] && has_acceleration?\n # :nocov:\n has_quotes = line =~ /#{options[:quote_char]}/\n elements = parse_csv_line_c(line, option...
[ "0.6565621", "0.64743674", "0.585044", "0.57938266", "0.57859784", "0.5755265", "0.5731677", "0.5705156", "0.56596583", "0.559933", "0.5564447", "0.54969245", "0.5446638", "0.5443309", "0.5440782", "0.54093933", "0.53580254", "0.53291667", "0.53099924", "0.52911675", "0.52001...
0.7201294
0
If file has headers, then guesses column separator from headers. Otherwise guesses column separator from contents. Raises exception if none is found.
def guess_column_separator(filehandle, options) skip_lines(filehandle, options) delimiters = [',', "\t", ';', ':', '|'] line = nil has_header = options[:headers_in_file] candidates = Hash.new(0) count = has_header ? 1 : 5 count.times do line = readline_with_counts(fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inferred_separator\n SUPPORTED_SEPARATORS.each do |sep|\n return sep if data.scan(sep).length > 0\n end\n\n raise UnknownFormat.new(@path)\n end", "def column_seperator\n self.data.strip.each.first.gsub(/[;,]/).first\n end", "def column_headers(data)\n data.find { |line| line.split(' ...
[ "0.6036126", "0.5901849", "0.5612929", "0.54666996", "0.5438543", "0.5357109", "0.53222996", "0.5294445", "0.50595534", "0.49793327", "0.4963215", "0.49334764", "0.49233347", "0.4920066", "0.49138913", "0.48828658", "0.48672378", "0.48038948", "0.47681335", "0.47544372", "0.4...
0.8163416
0
GET /litigantes GET /litigantes.json
def index @litigantes = Litigante.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @litra = Litra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @litra }\n end\n end", "def show\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render j...
[ "0.6840143", "0.6735118", "0.67135036", "0.66299325", "0.6515038", "0.64215463", "0.63972616", "0.6362224", "0.63478523", "0.63315403", "0.6283525", "0.62643254", "0.6225559", "0.62150204", "0.6206708", "0.6193282", "0.61909634", "0.6187592", "0.61722666", "0.6141094", "0.613...
0.6933273
0
POST /litigantes POST /litigantes.json
def create @litigante = Litigante.new(litigante_params) respond_to do |format| if @litigante.save format.html { redirect_to @litigante, notice: 'Litigante was successfully created.' } format.json { render :show, status: :created, location: @litigante } else format.html { ren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @leito = Leito.new(params[:leito])\n\n respond_to do |format|\n if @leito.save\n format.html { redirect_to @leito, notice: 'Leito was successfully created.' }\n format.json { render json: @leito, status: :created, location: @leito }\n else\n format.html { render ac...
[ "0.6765753", "0.6617363", "0.64101124", "0.63843805", "0.6254881", "0.6250767", "0.6247321", "0.62227625", "0.6202175", "0.61843634", "0.6178186", "0.6176066", "0.61421204", "0.6141438", "0.6125902", "0.6119125", "0.6104647", "0.6095952", "0.60938144", "0.6085084", "0.6079238...
0.6908584
0
PATCH/PUT /litigantes/1 PATCH/PUT /litigantes/1.json
def update respond_to do |format| if @litigante.update(litigante_params) format.html { redirect_to @litigante, notice: 'Litigante was successfully updated.' } format.json { render :show, status: :ok, location: @litigante } else format.html { render :edit } format.json { r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n if @lieu.update_attributes(params[:lieu])\n format.html { redirect_to @lieu, notice: 'L...
[ "0.67894596", "0.667066", "0.6593973", "0.6529157", "0.6450816", "0.6448251", "0.6413122", "0.6404869", "0.6365288", "0.6345258", "0.6335578", "0.6335578", "0.6323793", "0.6323017", "0.63147813", "0.63147813", "0.6313628", "0.63045555", "0.6301771", "0.6301771", "0.62926155",...
0.6799611
0
Destroys the like tied to this user on this likeable model
def unliked_by(user) self.send(self.class.like_label.tableize.to_sym).find_by_user_id(user.id).destroy rescue false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n like = Like.find(params[:id])\n if like.user == current_user\n Like.destroy(params[:id])\n end\n redirect_to root_url\n end", "def destroy_like\n @like = Like.where(likeable_id: params[:comment_id], likeable_type: \"Comment\", user_id: current_user.id).first\n @like.destro...
[ "0.7908806", "0.7688841", "0.76653564", "0.7583854", "0.75662553", "0.7433691", "0.74025714", "0.7395852", "0.73752505", "0.73436856", "0.73384136", "0.730955", "0.72346383", "0.72338724", "0.7202475", "0.71232116", "0.70947874", "0.7093496", "0.70547974", "0.7019187", "0.695...
0.7718917
1
matches `[PERCENTAGE] of [NUM]` and `[PERCENTAGE] (off|on) [NUM]`
def parse_percentage_expression regex = /(?<percentage>-?[\d.]+)% (?<operator>(off?|on)) (?<expr>.*$)/ match = @expression.match(regex) if match operator = match.named_captures["operator"] percentage = match.named_captures["percentage"] expr = match.named_captures["expr"] percentag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 29 )\n\n type = PERCENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 163:11: '%'\n match( 0x25 )\n\n \n @state.type = t...
[ "0.55788255", "0.55465823", "0.5396152", "0.50461864", "0.49546033", "0.48955175", "0.48949093", "0.4863768", "0.4861592", "0.48227188", "0.48227188", "0.47872362", "0.47347498", "0.47109276", "0.47109276", "0.4707554", "0.47000086", "0.46835592", "0.4656993", "0.46562716", "...
0.67594284
0
reformat any mathmatical functions from lowercase to upper e.g. avg(1,2) > AVG(1,2)
def reformat_math_functions funcs = %w(min max sum avg count round rounddown roundup sin cos tan) regex = /\b(?<func>#{funcs}.join('|'))\((?<expr>[^()]+)\)/ match = @expression.match(regex) if match func = match.named_captures["func"] expr = match.named_captures["expr"] @expression = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_function_lower(scope, ast)\n scope, str = apply_ast(scope, ast.children.first)\n return scope, \"lower(#{str})\"\n end", "def shout (maj)\n maj.upcase\nend", "def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end", "def apply_function_upper(scope, ast)\...
[ "0.6066712", "0.58529526", "0.58274436", "0.5823314", "0.5795221", "0.57646775", "0.5761234", "0.57603145", "0.5735932", "0.5728774", "0.5704479", "0.5695553", "0.5692357", "0.56736153", "0.5672991", "0.5668631", "0.56610185", "0.56388676", "0.56373316", "0.5620427", "0.56000...
0.74625003
0
comments resemble cstyle, singleline statements `//[...]` when commented out, the processed expression will be blank
def detect_comments if @input =~ %r{^\s*[/]{2}} @mode = :comment @expression = '' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lex_comment line\n # do nothing\n end", "def consume_comments; end", "def single_line_comment\n # //\n if @codes[@pos] == 0x2f and @codes[@pos + 1] == 0x2f\n @pos += 2\n pos0 = @pos\n while (code = @codes[@pos]) and !line_terminator?(code)\n @pos += 1\n en...
[ "0.7427642", "0.7419718", "0.72615504", "0.7205587", "0.7187588", "0.7085778", "0.70835793", "0.69837433", "0.6953066", "0.6921879", "0.6921879", "0.6921879", "0.6921879", "0.69048876", "0.6899584", "0.6897714", "0.6876154", "0.68521494", "0.6847973", "0.6847973", "0.6847973"...
0.7622495
0
if input matches `[VAR] = [EXPRESSION]` extract variable name and expression
def process_variable_assignment regex = %r{(?<name>\w+)( = )(?<expression>.*$)} match = @input.match(regex) if match @name = match.named_captures["name"] @expression = match.named_captures["expression"] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_exp(input, variable, expression); end", "def expand_variables\n # self.tokens = self\n\n # var_regex = /^[\\w]+$/\n # var_regex = /([\\s\\b])[\\w]+([\\s\\b])/\n\n # expanded = []\n # self.tokens.each do |token|\n # expanded << expand_token(token)\n # end\n # @expression = expan...
[ "0.69910884", "0.6536794", "0.64713204", "0.6470084", "0.63306314", "0.6091931", "0.605322", "0.5949441", "0.593646", "0.580148", "0.5785296", "0.5775926", "0.5753371", "0.5744721", "0.57291156", "0.56937635", "0.56901443", "0.5671195", "0.56445926", "0.56445926", "0.56445926...
0.7523549
0
currently variables are only expanded when surrounded by whitespace or ends of line
def expand_variables # self.tokens = self # var_regex = /^[\w]+$/ # var_regex = /([\s\b])[\w]+([\s\b])/ # expanded = [] # self.tokens.each do |token| # expanded << expand_token(token) # end # @expression = expanded.join(' ') @expression = self.tokens.map do |token| expand_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_variables() end", "def capture_variables(line)\n noncomment, _ = line.split(\"#\", 2)\n noncomment.scan(/ENV(?:\\[|\\.fetch\\()['\"]([^'\"]+)['\"]/).flatten\n end", "def external_vars(opts={})\n if opts\n opts.each do |k,v|\n if v.include? \",\"\n if...
[ "0.6537794", "0.63158387", "0.6120582", "0.610311", "0.60432076", "0.6039906", "0.60265493", "0.5985823", "0.5981582", "0.596007", "0.596007", "0.59542567", "0.59515023", "0.59330624", "0.59330624", "0.59330624", "0.59330624", "0.59330624", "0.59330624", "0.59330624", "0.5933...
0.69487417
0