query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Use callbacks to share common setup or constraints between actions.
def set_order_detali @order_detali = OrderDetali.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def order_detali_params params.require(:order_detali).permit(:order_id, :book_id, :price) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Alter self.development with contents, and optionally save.
def apply!(options={}) should_ignore_conflict = options.fetch(:ignore_conflict, false) should_save = options.fetch(:save, true) if !should_ignore_conflict return false unless applyable? end apply(options) if should_save # Maybe too much responsibility? # Or, this should be a transaction. Feels bloated. development.save if self.save end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contents=(new_contents)\n debug(\"#{self.class.name}#contents= called, going to update containing model's #{attr_name}\")\n @contents = new_contents\n write\n end", "def edit\n require 'ruby-debug'; debugger\n if storage.respond_to?(\"json_file\")\n output \"#{cyan(\"...
[ "0.56714255", "0.5660797", "0.56165534", "0.55975044", "0.5422964", "0.52603084", "0.5232118", "0.5193916", "0.51735365", "0.51671183", "0.51043427", "0.5090216", "0.5084106", "0.50835913", "0.5033807", "0.5005091", "0.4988624", "0.49694535", "0.4950044", "0.49338463", "0.491...
0.0
-1
"From" values in the edit are different from the current values of the development attributes. This doesn't necessarily invalidate the entire edit, but needs to be taken into account.
def conflict? from_values.select{ |d,e| d != e }.any? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_values\n d_attrs = development.reload.fields\n self.fields.map{ |field|\n name = field.fetch('name').to_s\n edit_from = field.fetch('from').to_s\n devel_from = d_attrs.fetch( name )\n [ devel_from, edit_from ]\n }\n end", "def destination_replace_from\n ...
[ "0.69445574", "0.5483634", "0.5477963", "0.5458728", "0.5289405", "0.5284324", "0.5284324", "0.5284324", "0.5272686", "0.5270673", "0.5227608", "0.52250606", "0.5209125", "0.52060586", "0.51923555", "0.51923555", "0.51895595", "0.5185874", "0.51841074", "0.5177107", "0.516477...
0.0
-1
Returns pairs of "from" values, from development and edit, in that order. All values are strings. TODO: May want to make each edited field its own model, to better enforce the schema.
def from_values d_attrs = development.reload.fields self.fields.map{ |field| name = field.fetch('name').to_s edit_from = field.fetch('from').to_s devel_from = d_attrs.fetch( name ) [ devel_from, edit_from ] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def changes\n Hash[(from.keys + to.keys).collect do |key|\n [key, [from[key], to[key]]]\n end]\n end", "def assignable_fields\n names = fields.map{|f| f.fetch \"name\" }\n to_values = fields.map{|f| f.fetch \"to\" }\n Hash[names.zip(to_values)]\n end", "def fields_for_...
[ "0.5473017", "0.5410282", "0.52394956", "0.52394956", "0.52394956", "0.51582205", "0.5071715", "0.50582904", "0.50582904", "0.50511974", "0.49796072", "0.49509707", "0.49368137", "0.493614", "0.4902217", "0.4898648", "0.4893831", "0.48906907", "0.48715574", "0.48627362", "0.4...
0.80623287
0
Returns a hash that can be used in assign_attributes or update_attributes.
def assignable_fields names = fields.map{|f| f.fetch "name" } to_values = fields.map{|f| f.fetch "to" } Hash[names.zip(to_values)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_hash\n self.class.attributes.inject({}) { |memo, name| memo[name] = send(name); memo }\n end", "def to_hash\n @attributes\n end", "def to_hash\n attributes\n end", "def to_hash\n attributes.dup\n end", "def to_hash\n @attributes\n end", "def attributes_h...
[ "0.7831759", "0.7761908", "0.77386785", "0.77325606", "0.7714387", "0.7684327", "0.7655504", "0.7655504", "0.7655504", "0.76483", "0.7636641", "0.7520305", "0.75115657", "0.74820614", "0.74315304", "0.7401671", "0.7361326", "0.73356074", "0.7331077", "0.73300683", "0.72988635...
0.0
-1
Cancancan GET /products GET /products.json
def index if user_signed_in? and current_user.admin == true @products = Product.where(nil) # creates an anonymous scope @products = Product.joins(:cultivation).where(cultivations: { id: params[:cultivation] }) if params[:cultivation].present? @products = @products.joins(:cycle).where(cycles: {id: params[:cycle]}) if params[:cycle].present? else @products = Product.ativos.where(nil) # creates an anonymous scope @products = Product.ativos.joins(:cultivation).where(cultivations: { id: params[:cultivation] }) if params[:cultivation].present? @products = @products.joins(:cycle).where(cycles: {id: params[:cycle]}) if params[:cycle].present? end ##@products = @products.cycle(params[:cycle]) if params[:cycle].present? ##if params[:cultivation] ##@products = Product.para_o_cultivo(params[:cultivation]) ##else ##@products = Product.all ##end ##@cycles = Cycle.all #category = Category.where(:name => params[:name]).first #@posts = category.posts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def products\n request :public, :get, :products\n end", "def user_products\n @products = current_user.products\n\n respond_to do |format|\n format.html\n format.json { render json: @products }\n end\n end", "def index\n if is_my_resource(params[:prossumer_id])\n @pro...
[ "0.75524724", "0.72646224", "0.72050476", "0.71545655", "0.70793116", "0.6971261", "0.6809366", "0.6802797", "0.6795268", "0.67786586", "0.6776278", "0.67725056", "0.6721342", "0.67189926", "0.6694022", "0.66917676", "0.668584", "0.66723", "0.6613482", "0.66031337", "0.660200...
0.0
-1
GET /products/1 GET /products/1.json
def show @benefits = ProductsPurposesRelation.where(product_id: @product.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product(name)\n get(\"/apiproducts/#{name}\")\n end", "def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end", "def show\n @product = Product.find(params[:id])\n\n render json: @product\n end", "def index\n @api_v1_products = Product.all\n jso...
[ "0.77224106", "0.76329553", "0.76313764", "0.7607208", "0.75760156", "0.7552171", "0.7506385", "0.7484625", "0.745622", "0.74501616", "0.74376804", "0.7421124", "0.7362056", "0.7318765", "0.73185545", "0.73185545", "0.73185545", "0.7316062", "0.7311976", "0.73088664", "0.7294...
0.0
-1
POST /products POST /products.json
def create @product = Product.new(product_params) #permitted_columns = params[:products_purposes_relations].permit(:product_id, :purpose_id, :stars) # @products_purposes_relation = @product.products_purposes_relations.create(permitted_columns) respond_to do |format| if @product.save format.html { redirect_to @product, notice: t('create_success') } format.json { render :show, status: :created, location: @product } else format.html { render :new } format.json { render json: @product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def create\n if params[:products]\n params[:products].each do |product|\n @...
[ "0.7674954", "0.7589692", "0.756074", "0.7531862", "0.7531213", "0.7507928", "0.7420413", "0.7391407", "0.7374718", "0.7355908", "0.73231804", "0.72869605", "0.7144144", "0.7050259", "0.7047559", "0.70415026", "0.7037288", "0.7037288", "0.7037288", "0.70322204", "0.70255643",...
0.0
-1
PATCH/PUT /products/1 PATCH/PUT /products/1.json
def update respond_to do |format| if @product.update(product_params) format.html { redirect_to @product, notice: t('update_success') } format.json { render :show, status: :ok, location: @product } else format.html { render :edit } format.json { render json: @product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def update\n if @product.update(product_params)\n render json: @product, status: :ok#, location: @colle...
[ "0.7269931", "0.6935652", "0.68690825", "0.6846676", "0.68126076", "0.67678404", "0.6749974", "0.6741848", "0.67151767", "0.6700884", "0.6686023", "0.66597176", "0.6654553", "0.66536564", "0.664067", "0.664067", "0.66382414", "0.6631012", "0.6631012", "0.6627257", "0.6620688"...
0.6420181
65
DELETE /products/1 DELETE /products/1.json
def destroy @product.destroy respond_to do |format| format.html { redirect_to products_url, notice: t('destroy_success') } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n product = Product.find(params[:id])\n product.destroy\n\n render json: { deleted: params[:id] }\n end", "def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end", "def destroy\n p @product.destroy!\n render json: { result: 'deleted' }, status: :ok\n end", ...
[ "0.7716745", "0.7592962", "0.7548045", "0.7501879", "0.75009406", "0.7474183", "0.743948", "0.74176705", "0.74075043", "0.7369892", "0.7352832", "0.7347189", "0.73354656", "0.73354656", "0.73354656", "0.73301345", "0.73301345", "0.73301345", "0.73301345", "0.73301345", "0.733...
0.72143084
59
Use callbacks to share common setup or constraints between actions.
def set_product @product = Product.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def product_params params.require(:product).permit(:name, :soil, :utilization, :active, :photo, :description, :cycle_id, :purpose_ids =>[], :products_purposes_relation_ids =>[], :cultivation_ids =>[]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
override this method to return false when this object should not be destroyed
def destroyable? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroyed?\n @destroyed ||= false\n end", "def destroyed?\n @destroyed ||= false\n end", "def destroyed?\n @destroyed ||= false\n end", "def destroyed?\n @destroyed ||= false\n end", "def destroyed?\n @destroyed == true\n end", "def destroyed?\n ...
[ "0.78683174", "0.78683174", "0.78683174", "0.78683174", "0.78434885", "0.7822502", "0.7822502", "0.7822502", "0.7822502", "0.7647162", "0.76309353", "0.76284796", "0.76284796", "0.76284796", "0.760819", "0.75922847", "0.7280206", "0.72371733", "0.70902073", "0.705745", "0.702...
0.70107234
23
GET /groups/1/products_auths GET /groups/1/products_auths.json
def index render json: ProductAuth.where({group_id: params[:group_id]}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n # is_my_resource(params[:id])\n\n # prossumerProductsIds = Prossumer.find(params[:id]).products.ids\n render json: ProductAuth.where({product_id: params[:id], group_id: params[:group_id]}).first.as_json(:include => :product)\n end", "def get_authorization_products_with_http_info(opts = {})\n...
[ "0.71310353", "0.6766916", "0.6560989", "0.60197455", "0.5978788", "0.59639066", "0.59567684", "0.5933693", "0.59054315", "0.5844431", "0.58251", "0.57575804", "0.57272196", "0.57269174", "0.57219607", "0.57190156", "0.57056576", "0.56819797", "0.5678574", "0.5677779", "0.566...
0.76373637
0
GET /groups/1/products_auths/1 GET /groups/1/products_auths/1.json
def show # is_my_resource(params[:id]) # prossumerProductsIds = Prossumer.find(params[:id]).products.ids render json: ProductAuth.where({product_id: params[:id], group_id: params[:group_id]}).first.as_json(:include => :product) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n render json: ProductAuth.where({group_id: params[:group_id]})\n end", "def get_authorization_products_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthorizationApi.get_authorization_products ...\"\n end\n \n ...
[ "0.77223885", "0.6924568", "0.6359968", "0.63030624", "0.6209846", "0.6191031", "0.60274035", "0.5961265", "0.5942114", "0.5941632", "0.5930532", "0.59239817", "0.5889648", "0.58429676", "0.5788566", "0.577226", "0.57682544", "0.57664394", "0.57484937", "0.5739547", "0.572989...
0.74003464
1
POST /groups/1/products_auths POST /groups/1/products_auths.json
def create params[:state] = 1; @product_auth = ProductAuth.new(params.permit(:state, :product_id, :group_id, :ecos, :euros)); if @product_auth.save render json: @product_auth else render json: @product_auth.errors end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n render json: ProductAuth.where({group_id: params[:group_id]})\n end", "def get_authorization_products_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthorizationApi.get_authorization_products ...\"\n end\n \n ...
[ "0.65927005", "0.59106016", "0.57836235", "0.57550025", "0.57131666", "0.5702658", "0.5685063", "0.56718564", "0.56688595", "0.56345135", "0.55863976", "0.5487059", "0.54579306", "0.5430024", "0.54161096", "0.538218", "0.53583395", "0.5358096", "0.5349153", "0.5323442", "0.53...
0.64231145
1
PATCH/PUT /groups/1/products_auths/1 PATCH/PUT /groups/1/products_auths/1.json
def update @product_auth = ProductAuth.where({product_id: params[:id], group_id: params[:group_id]}).first if @product_auth.update(params.permit(:state)) render json: @product_auth else render json: @product_auth.errors end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @product_group = ProductGroup.find(params[:id])\n\n respond_to do |format|\n if @product_group.update_attributes(params[:product_group])\n format.html { redirect_to @product_group, notice: 'Product group was successfully updated.' }\n format.json { head :no_content }\n el...
[ "0.6573923", "0.65565145", "0.6440347", "0.64181745", "0.6389186", "0.6264017", "0.61744535", "0.61492085", "0.6121792", "0.60784936", "0.60574424", "0.6049499", "0.6029907", "0.6022605", "0.59897363", "0.59818065", "0.59238225", "0.5919891", "0.5898103", "0.58950806", "0.587...
0.69279724
0
takie getery i setery sa niepraktyczne
def get_name @name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set; end", "def set; end", "def zuruecksetzen()\n end", "def suivre; end", "def result_of_setting; end", "def mi_carrera\n\n\tend", "def setting; end", "def schubert; end", "def set_inventario\n end", "def set_rodzaj_pracownika\n @rodzaj_pracownika = RodzajPracownika.find(params[:id]...
[ "0.70543814", "0.70543814", "0.6861453", "0.6693142", "0.6418386", "0.633405", "0.6044758", "0.60381496", "0.5949716", "0.5906479", "0.5890934", "0.58308923", "0.5818513", "0.58088523", "0.5793163", "0.57498306", "0.5741255", "0.573866", "0.57363963", "0.57179254", "0.5717189...
0.0
-1
Execute a database transaction
def transaction @database.transaction { yield self } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commit_db_transaction\n execute(\"COMMIT\")\n end", "def commit_db_transaction\n execute(\"COMMIT\")\n end", "def begin_db_transaction\n execute(\"BEGIN\")\n end", "def begin_db_transaction\n execute(\"BEGIN\")\n end", "def begin_db_transa...
[ "0.8071028", "0.8071028", "0.79221094", "0.79221094", "0.7782967", "0.7707029", "0.7681444", "0.76744187", "0.76744187", "0.76149297", "0.7599078", "0.7599078", "0.75765014", "0.7435153", "0.73936146", "0.7392829", "0.7390553", "0.7375686", "0.7375686", "0.73635817", "0.73450...
0.7256859
28
Optimize database internal structure
def optimize @database.execute 'VACUUM' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dbsize; end", "def dbsize; end", "def database_bloat\n data = select(<<-SQL, \"Database Bloat\")\n SELECT tablename AS table_name\n , ' ' AS index_name\n , reltupl...
[ "0.593455", "0.593455", "0.5806628", "0.57233053", "0.56322974", "0.5581713", "0.5546168", "0.553777", "0.5522078", "0.5470438", "0.5452566", "0.54294217", "0.5413984", "0.54117346", "0.5408922", "0.5405584", "0.53872675", "0.53866017", "0.5379075", "0.53425556", "0.5318195",...
0.5702872
4
Register a new Word entry
def insert_word(word) word = word.clone word_id = word.id @index_sense ||= @database.prepare('insert into senses_fts values (?, ?)') @index_literal ||= @database.prepare('insert into literals_fts values (?, ?, ?)') @insert_word ||= @database.prepare('insert into words values (?, ?)') word.literals.each do |literal| @index_literal.execute(literal.text, word_id, literal.priority) end word.readings.each do |reading| @index_literal.execute(reading.text, word_id, reading.priority) end word.senses.each do |sense| @index_sense.execute(sense.texts.join(';'), word_id) end # We can derive ID from table ID. word.id = 0 @insert_word.execute(word_id, Word.encode(word)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_word(word)\n \n end", "def add_word(word)\r\n \r\n end", "def add_word(word, definition)\r\n @word << {Word: word, Definition: definition}\r\n # puts \"This is @word: #{@word}\"\r\n end", "def add(word, w)\n if word != \"\" \n cur = self\n ...
[ "0.69925016", "0.6955626", "0.6931956", "0.6886098", "0.6740981", "0.65768975", "0.657635", "0.63593745", "0.6315144", "0.62976617", "0.6296913", "0.6245495", "0.62302846", "0.62298506", "0.62181634", "0.6209627", "0.61562204", "0.61460274", "0.61460274", "0.6085285", "0.6081...
0.6188542
16
Register a new Kanji entry
def insert_kanji(kanji) kanji = kanji.clone kanji_id = kanji.id @index_kanji ||= @database.prepare('insert into kanji_fts values (?, ?)') @insert_kanji ||= @database.prepare('insert into kanji values (?, ?)') @index_kanji.execute(kanji.character, kanji_id) # We can derive these data from FTS table. kanji.id = 0 kanji.character = '' @insert_kanji.execute(kanji_id, Kanji.encode(kanji)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_kanji\n @kanji = Kanji.find(params[:id])\n end", "def set_kanji\n @kanji = Kanji.find(params[:id])\n end", "def create\n @kanji = Kanji.new(kanji_params)\n\n respond_to do |format|\n if @kanji.save\n format.html { redirect_to @kanji, notice: 'Kanji was successfully cre...
[ "0.6294566", "0.6294566", "0.59592146", "0.59492", "0.55789036", "0.5529804", "0.54679143", "0.5467237", "0.54045975", "0.53881544", "0.5365606", "0.5327453", "0.53089637", "0.5302342", "0.5283817", "0.52235025", "0.5191792", "0.5166446", "0.51229167", "0.5102627", "0.5071384...
0.6248506
2
Search Word entries matching the given query string
def search_words(query) query = query.downcase if query.contains_japanese? words = search_words_by_literals(query, 50) else words = search_words_by_senses(query, 50) if words.size <= 10 extra_words = [] extra_words += search_words_by_literals(query.hiragana, 20) extra_words += search_words_by_literals(query.katakana, 20) extra_words.sort! { |w1, w2| w1.score <=> w2.score } words += extra_words end end words end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(query); end", "def search(word)\n Parser.new(query(word)).parse\n end", "def search_words\n begin\n regex = Regexp.new(@pattern)\n rescue RegexpError => msg\n error_msg(msg)\n rescue NameError => msg\n error_msg(msg)\n end\n @results = DICT.select do |word|\n r...
[ "0.7479644", "0.7378742", "0.72571397", "0.709236", "0.6955676", "0.69323564", "0.678248", "0.6759103", "0.6757562", "0.6754827", "0.67451084", "0.67448854", "0.67338794", "0.6714071", "0.66898596", "0.66889894", "0.6687218", "0.66858417", "0.66459876", "0.6641491", "0.661620...
0.67104805
14
Search Kanji entries matching the given query string
def search_kanji(query, limit = 10) tokens = query.chars.select { |c| c.kanji? } results = [] if tokens.present? @search_kanji ||= @database.prepare(SEARCH_KANJI_SQL) rows = @search_kanji.execute(tokens.join(' OR '), limit).to_a end rows.map do |row| kanji = Kanji.decode(row['serialized']) kanji.character = row['character'] kanji.id = row['id'].to_i kanji end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(query); end", "def search(query)\n @all.each_with_object([]) do |record, matches|\n matches << record if ((record['866']['t'] == query) || (record['866']['s'] == query))\n end\n end", "def search\n unless params[:search].blank?\n @search = Sunspot.search(KyuEntry) do\n ful...
[ "0.6834786", "0.6806134", "0.65217036", "0.62539136", "0.6223015", "0.6213546", "0.6148502", "0.6113235", "0.60944456", "0.6087862", "0.60752463", "0.60740215", "0.606002", "0.6004547", "0.5976069", "0.59660643", "0.59478706", "0.5946668", "0.59425825", "0.5923288", "0.591575...
0.7027388
0
Return input files based on the provided output files
def input_files @input_files ||= to_file(@args.input) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_files\n @output_files ||= to_file(@args.output)\n end", "def build_input_files\n @input_files.map { |file| build_file(file) }\n end", "def files_from_generator_output(output, type = 'create')\n output.to_a.map { |line| line.scan(/#{type}\\s+([^\\s]+)$/).flatten.first }.compact.selec...
[ "0.7032774", "0.70138144", "0.6730175", "0.66165453", "0.65996295", "0.65400815", "0.65400815", "0.63889563", "0.6332165", "0.61729926", "0.61503655", "0.6077135", "0.6071689", "0.6044346", "0.5937593", "0.5893649", "0.5862156", "0.5841952", "0.57922214", "0.5784225", "0.5779...
0.6940107
2
Return output files based on the provided output files
def output_files @output_files ||= to_file(@args.output) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_files\n @output_files ||= Fileset.new()\n end", "def output_files\n get_info :output_files\n end", "def output_files\n @output_files ||= Fileset.new\n end", "def output_files\n @output_files ||= Fileset.new\n end", "def _output_paths(file)\n input_file_dir = ...
[ "0.74933153", "0.7390097", "0.7365953", "0.7365953", "0.6977151", "0.695596", "0.65952736", "0.6273493", "0.622142", "0.61954045", "0.61948967", "0.6146341", "0.6115349", "0.596583", "0.5951703", "0.59373564", "0.5876065", "0.5872588", "0.582961", "0.5817462", "0.58139235", ...
0.82316995
0
Creates a new author time.
def initialize(author, time) @author = author @time = time freeze end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_time=(time)\n @create_time = time\n update_times\n end", "def create\n self[:created] = Time.now.to_s\n save\n end", "def time\n Time.parse(inner_author.date.to_s)\n end", "def create(hour, minute, second, usec = 0)\n t = date\n meth = Sequel.application_t...
[ "0.6283268", "0.6208966", "0.5957836", "0.58763534", "0.58646804", "0.5765599", "0.573955", "0.5738108", "0.56839454", "0.567565", "0.56525135", "0.56482875", "0.5640177", "0.5631206", "0.5626972", "0.5626972", "0.56126696", "0.5602776", "0.5591157", "0.5589196", "0.55754215"...
0.6469384
0
Redirects stderr and stdout to /dev/null.
def silence_output @orig_stderr = $stderr @orig_stdout = $stdout # redirect stderr and stdout to /dev/null $stderr = File.new('/dev/null', 'w') $stdout = File.new('/dev/null', 'w') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stdout_to_dev_null\n $stdout = File.open('/dev/null', 'w')\n yield\n $stdout = STDOUT\n end", "def stdout_to_dev_null\n $stdout = File.open('/dev/null', 'w')\n yield\n $stdout = STDOUT\n end", "def dev_null(&block)\n orig_stdout = $stdout.dup # does a dup2() internally\n $stdout.reope...
[ "0.781298", "0.781298", "0.7732118", "0.768003", "0.7649619", "0.7530993", "0.7511257", "0.75067335", "0.7145987", "0.71257967", "0.7005881", "0.68246317", "0.6683403", "0.66793615", "0.6647123", "0.6643985", "0.66033554", "0.6582603", "0.65248203", "0.65067434", "0.63578904"...
0.77290887
3
Replace stdout and stderr so anything else is output correctly.
def enable_output $stderr = @orig_stderr $stdout = @orig_stdout @orig_stderr = nil @orig_stdout = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_output\n $stderr = @original_stderr\n $stdout = @original_stdout\n @original_stderr = nil\n @original_stdout = nil\nend", "def enable_output\n # $stderr = @orig_stderr\n $stdout = @orig_stdout\n # @orig_stderr = nil\n @orig_stdout = nil\nend", "def stdout_redirect(stdout = T.unsafe(nil), std...
[ "0.7068447", "0.7055271", "0.69756573", "0.6945191", "0.67468333", "0.6693161", "0.66484386", "0.6645464", "0.6613646", "0.65677196", "0.6555749", "0.6540932", "0.6477912", "0.6471895", "0.646281", "0.64559585", "0.6444204", "0.6433146", "0.64129597", "0.63809717", "0.6335418...
0.71049917
1
Removes any existing console handler, and adds a ColorConsoleHandler.
def replace_console_logger(options = {}) logger = options[:logger] name = options.fetch(:outputter, 'color-console') level = case options.delete(:level) when String, Symbol then Log4r::LNAMES.index(options[:level].to_s.upcase) end log = logger ? Log4r::Logger[logger] : Log4r::Logger.root log = Log4r::Logger.new(logger) unless log # Remove any existing console handler Log4r::Logger.each_logger do |l| l.outputters.each do |o| l.remove(o.name) if o.is_a?(Log4r::StdoutOutputter) end end # Add a ColorConsoleHandler out = Log4rLogger::ColorConsoleOutputter.new(name, options) log.add out # Set the log level log.level = level if level end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_console_logger(options = {})\n logger = options.fetch(:logger, '')\n level = options[:level]\n format = options.fetch(:format, JavaUtilLogger::RubyFormatter::DEFAULT_FORMAT)\n\n # Remove any existing console handler\n l = Java::JavaUtilLogging::Logger.getLogger(logger...
[ "0.6482822", "0.519442", "0.5058755", "0.49304107", "0.4911241", "0.48777553", "0.48175898", "0.47757718", "0.4648921", "0.46487862", "0.46147546", "0.46146566", "0.46029788", "0.46029788", "0.46029788", "0.46029788", "0.46029788", "0.45920813", "0.45699403", "0.45699403", "0...
0.6661214
0
GET /incidentfiles GET /incidentfiles.json
def index @incidentfiles = Incidentfile.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @treq = Treq.find(params[:id])\n @treq_files = @treq.treq_files.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @treq }\n end\n end", "def index\n @incidentattachments = Incidentattachment.all\n @incident = Incident.all\n end", "d...
[ "0.63998556", "0.63369095", "0.6141543", "0.609517", "0.6063753", "0.60319984", "0.59550637", "0.59429413", "0.59327", "0.59200436", "0.59195596", "0.5896033", "0.586666", "0.58649904", "0.58425474", "0.58373386", "0.5836639", "0.58086884", "0.5807181", "0.57908887", "0.57739...
0.7626278
0
GET /incidentfiles/1 GET /incidentfiles/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @incidentfiles = Incidentfile.all\n end", "def show\n @treq = Treq.find(params[:id])\n @treq_files = @treq.treq_files.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @treq }\n end\n end", "def get_file(file_id)\n\tputs \"Getting fil...
[ "0.7518787", "0.67327553", "0.6653261", "0.6556415", "0.6489992", "0.6403362", "0.6321794", "0.63129157", "0.6297115", "0.6265356", "0.6222869", "0.62089425", "0.62032455", "0.61940295", "0.618106", "0.6175662", "0.61054575", "0.61018884", "0.60957474", "0.60893846", "0.60690...
0.0
-1
POST /incidentfiles POST /incidentfiles.json
def create @incidentfile = Incidentfile.new(incidentfile_params) respond_to do |format| if @incidentfile.save format.html { redirect_to @incidentfile, notice: 'Incidentfile was successfully created.' } format.json { render :show, status: :created, location: @incidentfile } else format.html { render :new } format.json { render json: @incidentfile.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if(params[:incId]).present?\n @incident = Incident.find(params[:incId])\n @incident.report_type = params[:incident][:report_type] \n @incident.your_name = params[:incident][:your_name]\n @incident.job_title = params[:incident][:job_title]\n @incident.injury_date = params[:i...
[ "0.64833826", "0.6448247", "0.6322326", "0.6237543", "0.62092316", "0.6165968", "0.5931547", "0.5913957", "0.586241", "0.58463055", "0.57442194", "0.57401264", "0.5737596", "0.56944656", "0.5692664", "0.56840324", "0.56753296", "0.56732726", "0.5669069", "0.5666979", "0.56648...
0.7233455
0
PATCH/PUT /incidentfiles/1 PATCH/PUT /incidentfiles/1.json
def update respond_to do |format| if @incidentfile.update(incidentfile_params) format.html { redirect_to @incidentfile, notice: 'Incidentfile was successfully updated.' } format.json { render :show, status: :ok, location: @incidentfile } else format.html { render :edit } format.json { render json: @incidentfile.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes...
[ "0.7109997", "0.6488839", "0.6424058", "0.6397617", "0.6268176", "0.6266148", "0.6218408", "0.62089175", "0.62015504", "0.6189543", "0.61234224", "0.60915154", "0.6084955", "0.60793304", "0.6070471", "0.60656935", "0.6038007", "0.60187334", "0.601735", "0.6000651", "0.5987279...
0.7129484
0
DELETE /incidentfiles/1 DELETE /incidentfiles/1.json
def destroy @incidentfile.destroy respond_to do |format| format.html { redirect_to incidentfiles_url, notice: 'Incidentfile was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @incidentattachment.destroy\n respond_to do |format|\n format.html { redirect_to incidentattachments_url, notice: 'Incidentattachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n...
[ "0.71035445", "0.70188427", "0.6959227", "0.6935799", "0.6914682", "0.68984425", "0.68955624", "0.6882368", "0.6856593", "0.6834718", "0.6815744", "0.6796455", "0.679489", "0.6792165", "0.67862576", "0.67862576", "0.6785758", "0.67519444", "0.67402273", "0.67349565", "0.67213...
0.777575
0
Use callbacks to share common setup or constraints between actions.
def set_incidentfile @incidentfile = Incidentfile.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def incidentfile_params params.require(:incidentfile).permit(:incident_id, :filetype, :state) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
=begin car ship plane train ["car", "ship", "plane", "submarine", "train"] =end
def next2 vehicles = ["car", "ship", "plane", "submarine", "train"] i = 0 while i < vehicles.size v = vehicles[i] i += 1 next if v.length == 5 puts v end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pariculars\n\t\t[\"Concentration\", \"Concept\", \"Participation\", \"Completion of Task\"]\n\tend", "def arith(b,opt=\"M\") return \"@SP\\nAM=M-1\\nD=M\\nA=A-1\\n\"+opt+\"=M\"+b+\"D\\n\" end", "def draw_me_a_train\n puts %Q{ .---- - -\n ( ,----- - -\n \\_/ ___\n c--U---^--'o [...
[ "0.5018968", "0.4945763", "0.4929118", "0.49246505", "0.49246505", "0.48243096", "0.48022875", "0.47756255", "0.47665703", "0.47657916", "0.476206", "0.47393003", "0.47198325", "0.47146022", "0.4691572", "0.4688209", "0.46785837", "0.46510273", "0.46494558", "0.46473074", "0....
0.0
-1
=begin car ship submarine nil =end
def next3 vehicles = ["car", "ship", "plane", "submarine", "train"] countries = ["japan", "us", "germany", "france", "russia"] vehicles.each do |vehicle| countries.each do |country| next if country.include?("j") puts "#{vehicle}, #{country}" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ship; end", "def sub_sector; end", "def region; end", "def nasa_space_craft; end", "def yeast; end", "def nebula; end", "def starship; end", "def vehicle; end", "def vehicle; end", "def vehicle; end", "def vehicle; end", "def vehicle; end", "def medical_fellowships\n # blank\n end",...
[ "0.5593012", "0.5591009", "0.5480554", "0.5415526", "0.54060555", "0.53649586", "0.5258123", "0.5249705", "0.5249705", "0.5249705", "0.5249705", "0.5249705", "0.5229712", "0.5196641", "0.51964045", "0.5189839", "0.51775247", "0.5146525", "0.51414627", "0.5137114", "0.5118467"...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_checklist_item @checklist_item = ChecklistItem.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def checklist_item_params params.require(:checklist_item).permit( :description, :checked ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
clear cache of ECMA262 elements
def clear_cache @lit_cache = {} @lit_nextpos = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_cache() @cache = {}; end", "def clear_cache; end", "def clear_cache\n @all = nil\n end", "def clear!\n @cache = {}\n end", "def cache_clear\n @moneta.clear\n end", "def clear_cache\n @results = nil\n @result_ids = nil\n @num_...
[ "0.7347165", "0.7269472", "0.7045574", "0.7045122", "0.694833", "0.69387525", "0.69051886", "0.6892014", "0.68281543", "0.6808932", "0.6758927", "0.6749398", "0.6749398", "0.6698103", "0.66908604", "0.6682596", "0.66582125", "0.6645091", "0.66368103", "0.66311175", "0.662571"...
0.7439159
0
Fetch next literal and forward position.
def next_input_element(hint) if ret = @lit_cache[@pos] @pos = @lit_nextpos[@pos] @head_pos = @pos return ret end pos0 = @pos # # skip white space here, because ECMA262(5.1.2) says: # # Simple white space and single-line comments are discarded and # do not appear in the stream of input elements for the # syntactic grammar. # while white_space or single_line_comment end ret = line_terminator || multi_line_comment || token if ret @lit_cache[pos0] = ret @lit_nextpos[pos0] = @pos @head_pos = @pos return ret end if @codes[@pos].nil? return nil end if hint.nil? if @codes[@pos] == 0x2f ECMA262::LIT_DIV_OR_REGEXP_LITERAL else nil end elsif hint == :div ret = div_punctuator if ret @lit_cache[pos0] = ret @lit_nextpos[pos0] = @pos end @head_pos = @pos return ret elsif hint == :regexp ret = regexp_literal if ret @lit_cache[pos0] = ret @lit_nextpos[pos0] = @pos end @head_pos = @pos return ret else if @codes[@pos] == 0x2f ECMA262::LIT_DIV_OR_REGEXP_LITERAL else nil end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_token\n result = peek_token\n @start = @finish\n return result if @start >= @expr.length\n\n if @expr[@start].numeric?\n @finish = @start + 1\n while @finish < @expr.length && @expr[@finish].to_s.numeric?\n @finish = @finish + 1\n end\n else\n @finish = @start + 1...
[ "0.6730959", "0.64939874", "0.62412304", "0.6231001", "0.6211954", "0.6209109", "0.6181599", "0.6154133", "0.6126161", "0.61195827", "0.6113218", "0.60787266", "0.6060403", "0.605908", "0.59823674", "0.5961887", "0.59591913", "0.59438837", "0.5924103", "0.59197617", "0.591921...
0.5853007
25
Tests next literal is WhiteSpace or not. If literal is WhiteSpace return ECMA262::WhiteSpace object and forward lexical parser position. Otherwise return nil and position is not changed. Even if next literal is sequence of two or more white spaces, this method returns only one white space.
def white_space if white_space?(@codes[@pos]) begin @pos += 1 end until !white_space?(@codes[@pos]) return ECMA262::WhiteSpace.get else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nextWhite()\r\n str = \"\"\r\n while /\\s/.match?(@c)\r\n str += @c\r\n nextCh()\r\n end\r\n \r\n return Token.new(Token::WHITESPACE, str)\r\n end", "def parse_whitespace\n @lexer.next! while @lexer.get and @lexer.get.type == :whitespace\n ...
[ "0.7012271", "0.6961337", "0.68803036", "0.680081", "0.6706844", "0.6389385", "0.6382983", "0.6251076", "0.62392366", "0.62300813", "0.6194158", "0.61813813", "0.61427003", "0.6138353", "0.60783905", "0.60439825", "0.59633714", "0.592747", "0.5923118", "0.58975196", "0.588977...
0.8135252
0
Tests next literal is LineTerminator or not. If literal is LineTerminator return ECMA262::LineTerminator object and forward lexical parser position. Otherwise return nil and position is not changed. Even if next literal is sequence of two or more line terminators, this method returns only one line terminator.
def line_terminator if line_terminator?(@codes[@pos]) begin @pos += 1 end until !line_terminator?(@codes[@pos]) return ECMA262::LineTerminator.get else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newline_token(offset)\n @tokens.pop while value == ';'\n\n # 1. function prototype\n if tag == ':'\n indent_token(@indent+2)\n outdent_token(2)\n\n # 2. prevent doubles terminators\n # 3. prevent terminator after indent\n # 4. prevent starting with a term on an empty file\n elsif...
[ "0.62339807", "0.6189396", "0.58698416", "0.5824755", "0.58021665", "0.5767977", "0.5617591", "0.5596281", "0.5551471", "0.5545358", "0.5520693", "0.54861367", "0.54738474", "0.54681635", "0.5443173", "0.5406055", "0.5393491", "0.5372871", "0.5351362", "0.53352094", "0.532987...
0.8169687
0
Tests next literal is Comment or not. If literal is Comment return ECMA262::MultiLineComment or SingeLineComment object and forward lexical parser position. Otherwise return nil and position is not changed.
def comment multi_line_comment || single_line_comment end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_comment\n return false unless @lexer.get and @lexer.get.type == :comment_start\n @lexer.next!\n\n buf = ''\n while token = @lexer.get\n break if token.type == :comment_end\n buf << token.value\n @lexer.next!\n ...
[ "0.73834175", "0.7323518", "0.7208017", "0.71247345", "0.71201324", "0.691946", "0.6904402", "0.6860326", "0.6812443", "0.66707355", "0.6609536", "0.6508557", "0.65068537", "0.6457085", "0.6401644", "0.636546", "0.6330941", "0.6329964", "0.63258374", "0.6316141", "0.62840015"...
0.6439953
14
Tests next literal is MultiLineComment or not. If literal is MultiLineComment return ECMA262::MultiLineComment object and forward lexical parser position. Otherwise return nil and position is not changed.
def multi_line_comment # /* if @codes[@pos] == 0x2f and @codes[@pos + 1] == 0x2a @pos += 2 pos0 = @pos # */ while (code = @codes[@pos] != 0x2a) or @codes[@pos + 1] != 0x2f raise ParseError.new("no `*/' at end of comment", self) if code.nil? @pos += 1 end @pos +=2 return ECMA262::MultiLineComment.new(@codes[pos0...(@pos-2)].pack("U*")) else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 end\n return ECMA262::SingleLineComment.new(@codes[pos0...@pos].pack(\"U*\"))...
[ "0.7013821", "0.657153", "0.64667755", "0.6453468", "0.64014614", "0.63901246", "0.63828933", "0.63772035", "0.62741184", "0.62337816", "0.622274", "0.6112313", "0.6060025", "0.59266126", "0.5868521", "0.58633566", "0.58363307", "0.583429", "0.5823855", "0.58218694", "0.58218...
0.7715293
0
Tests next literal is SinleLineComment or not. If literal is SingleLineComment return ECMA262::SingleLineComment object and forward lexical parser position. Otherwise return nil and position is not changed.
def single_line_comment # // if @codes[@pos] == 0x2f and @codes[@pos + 1] == 0x2f @pos += 2 pos0 = @pos while (code = @codes[@pos]) and !line_terminator?(code) @pos += 1 end return ECMA262::SingleLineComment.new(@codes[pos0...@pos].pack("U*")) else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multi_line_comment\n # /*\n if @codes[@pos] == 0x2f and @codes[@pos + 1] == 0x2a\n @pos += 2\n pos0 = @pos\n # */\n while (code = @codes[@pos] != 0x2a) or @codes[@pos + 1] != 0x2f\n raise ParseError.new(\"no `*/' at end of comment\", self) if code.nil?\n ...
[ "0.74113905", "0.7284103", "0.71344495", "0.7119543", "0.70029366", "0.68539715", "0.68034357", "0.67353487", "0.66335565", "0.66077757", "0.66077757", "0.65505517", "0.6515373", "0.65053785", "0.6493863", "0.6464445", "0.64538324", "0.64524835", "0.6403432", "0.63938177", "0...
0.79788345
0
Tests next literal is Token or not If literal is Token return ECMA262::Base object and forward lexical parser position. Otherwise return nil and position is not changed.
def token identifier_name || numeric_literal || punctuator || string_literal end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_token\n\n if @ss.bol?\n @line+=1\n @old_pos=@ss.pos\n end\n\n position=[@line,@ss.pos-@old_pos+1]\n\n return :eos if @ss.eos?\n\n case\n when text = @ss.scan(NEWLINE)\n next_token()\n when text = @ss.scan(SPACE)\n next_token()\n when text...
[ "0.6609497", "0.6435141", "0.6293766", "0.62336534", "0.61545026", "0.61502826", "0.61282426", "0.6104507", "0.6080465", "0.60489666", "0.604669", "0.60290664", "0.601942", "0.5971353", "0.5968677", "0.58435327", "0.5819494", "0.5810206", "0.5802134", "0.57788855", "0.5751459...
0.5511946
44
Tests next literal is IdentifierName or not If literal is IdentifierName return ECMA262::IdentifierName object and forward lexical parser position. Otherwise return nil and position is not changed.
def identifier_name return nil if (code = @codes[@pos]).nil? pos0 = @pos chars = [] if code == 0x5c and ucode = unicode_escape? and identifier_start?(ucode) chars.push(ucode) @pos += 6 elsif identifier_start?(code) chars.push(code) @pos += 1 else return nil end while true code = @codes[@pos] if code == 0x5c and ucode = unicode_escape? and identifier_part?(ucode) chars.push(ucode) @pos += 6 elsif identifier_part?(code) chars.push(code) @pos += 1 else name = chars.pack("U*").to_sym return ECMA262::IdentifierName.get(name) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_identifier?(text = nil)\n text = @s.current + @s.peek(2) if text.nil?\n\n case text[0]\n when '-'\n nextChar = text[1]\n !!(nextChar == '-' || nextChar =~ RE_NAME_START || valid_escape?(text[1, 2]))\n\n when RE_NAME_START\n true\n\n when '\\\\'\n valid...
[ "0.656172", "0.6277313", "0.6253718", "0.5884431", "0.5764008", "0.5759629", "0.56021506", "0.55904865", "0.54731596", "0.5452019", "0.54476976", "0.54029274", "0.53734994", "0.53411716", "0.5317944", "0.5303333", "0.52950895", "0.5293675", "0.52487403", "0.52416605", "0.5236...
0.69444585
0
Tests next literal is Punctuator or not If literal is Punctuator return ECMA262::Punctuator object and forward lexical parser position. Otherwise return nil and position is not changed.
def punctuator code0 = @codes[@pos] code1 = @codes[@pos+1] code2 = @codes[@pos+2] code3 = @codes[@pos+3] if false elsif code0 == 0x28 # ( @pos += 1 # ( return ECMA262::PUNC_LPARENTHESIS elsif code0 == 0x29 # ) @pos += 1 # ) return ECMA262::PUNC_RPARENTHESIS elsif code0 == 0x7b # { @pos += 1 # { return ECMA262::PUNC_LCURLYBRAC elsif code0 == 0x7d # } @pos += 1 # } return ECMA262::PUNC_RCURLYBRAC elsif code0 == 0x3b # ; @pos += 1 # ; return ECMA262::PUNC_SEMICOLON elsif code0 == 0x3d # = if code1 == 0x3d and code2 == 0x3d # === @pos += 3 return ECMA262::PUNC_SEQ end if code1 == 0x3d # == @pos += 2 return ECMA262::PUNC_EQ end @pos += 1 # = return ECMA262::PUNC_ASSIGN elsif code0 == 0x21 # ! if code1 == 0x3d and code2 == 0x3d # !== @pos += 3 return ECMA262::PUNC_SNEQ end if code1 == 0x3d # != @pos += 2 return ECMA262::PUNC_NEQ end @pos += 1 # ! return ECMA262::PUNC_LNOT elsif code0 == 0x25 # % if code1 == 0x3d # %= @pos += 2 return ECMA262::PUNC_MODASSIGN end @pos += 1 # % return ECMA262::PUNC_MOD elsif code0 == 0x26 # & if code1 == 0x3d # &= @pos += 2 return ECMA262::PUNC_ANDASSIGN end if code1 == 0x26 # && @pos += 2 return ECMA262::PUNC_LAND end @pos += 1 # & return ECMA262::PUNC_AND elsif code0 == 0x2a # * if code1 == 0x3d # *= @pos += 2 return ECMA262::PUNC_MULASSIGN end @pos += 1 # * return ECMA262::PUNC_MUL elsif code0 == 0x2b # + if code1 == 0x3d # += @pos += 2 return ECMA262::PUNC_ADDASSIGN end if code1 == 0x2b # ++ @pos += 2 return ECMA262::PUNC_INC end @pos += 1 # + return ECMA262::PUNC_ADD elsif code0 == 0x2c # , @pos += 1 # , return ECMA262::PUNC_COMMA elsif code0 == 0x2d # - if code1 == 0x3d # -= @pos += 2 return ECMA262::PUNC_SUBASSIGN end if code1 == 0x2d # -- @pos += 2 return ECMA262::PUNC_DEC end @pos += 1 # - return ECMA262::PUNC_SUB elsif code0 == 0x2e # . @pos += 1 # . return ECMA262::PUNC_PERIOD elsif code0 == 0x3a # : @pos += 1 # : return ECMA262::PUNC_COLON elsif code0 == 0x3c # < if code1 == 0x3d # <= @pos += 2 return ECMA262::PUNC_LTEQ end if code1 == 0x3c and code2 == 0x3d # <<= @pos += 3 return ECMA262::PUNC_LSHIFTASSIGN end if code1 == 0x3c # << @pos += 2 return ECMA262::PUNC_LSHIFT end @pos += 1 # < return ECMA262::PUNC_LT elsif code0 == 0x3e # > if code1 == 0x3e and code2 == 0x3e and code3 == 0x3d # >>>= @pos += 4 return ECMA262::PUNC_URSHIFTASSIGN end if code1 == 0x3e and code2 == 0x3e # >>> @pos += 3 return ECMA262::PUNC_URSHIFT end if code1 == 0x3e and code2 == 0x3d # >>= @pos += 3 return ECMA262::PUNC_RSHIFTASSIGN end if code1 == 0x3e # >> @pos += 2 return ECMA262::PUNC_RSHIFT end if code1 == 0x3d # >= @pos += 2 return ECMA262::PUNC_GTEQ end @pos += 1 # > return ECMA262::PUNC_GT elsif code0 == 0x3f # ? @pos += 1 # ? return ECMA262::PUNC_CONDIF elsif code0 == 0x5b # [ @pos += 1 # [ return ECMA262::PUNC_LSQBRAC elsif code0 == 0x5d # ] @pos += 1 # ] return ECMA262::PUNC_RSQBRAC elsif code0 == 0x5e # ^ if code1 == 0x3d # ^= @pos += 2 return ECMA262::PUNC_XORASSIGN end @pos += 1 # ^ return ECMA262::PUNC_XOR elsif code0 == 0x7c # | if code1 == 0x7c # || @pos += 2 return ECMA262::PUNC_LOR end if code1 == 0x3d # |= @pos += 2 return ECMA262::PUNC_ORASSIGN end @pos += 1 # | return ECMA262::PUNC_OR elsif code0 == 0x7e # ~ @pos += 1 # ~ return ECMA262::PUNC_NOT end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token\n identifier_name || numeric_literal || punctuator || string_literal\n end", "def div_punctuator\n if @codes[@pos] == 0x2f\n if @codes[@pos+1] == 0x3d\n @pos += 2\n return ECMA262::PUNC_DIVASSIGN\n else\n @pos += 1\n return ECMA262::PUNC_DI...
[ "0.61056906", "0.59732217", "0.5820936", "0.5812468", "0.5586082", "0.548437", "0.5427205", "0.54215664", "0.5326504", "0.53190356", "0.53150266", "0.5258005", "0.5222149", "0.52096945", "0.51778907", "0.51275945", "0.5126917", "0.51174825", "0.51143944", "0.50990427", "0.509...
0.7801193
0
Tests next literal is DivPunctuator or not. If literal is DivPunctuator return ECMA262::PUNC_DIV or ECMA262::PUNC_DIVASSIGN object and forward lexical parser position. Otherwise return nil and position is not changed.
def div_punctuator if @codes[@pos] == 0x2f if @codes[@pos+1] == 0x3d @pos += 2 return ECMA262::PUNC_DIVASSIGN else @pos += 1 return ECMA262::PUNC_DIV end end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def punctuator\n code0 = @codes[@pos]\n code1 = @codes[@pos+1]\n code2 = @codes[@pos+2]\n code3 = @codes[@pos+3]\n if false\n elsif code0 == 0x28 # (\n @pos += 1 # (\n return ECMA262::PUNC_LPARENTHESIS\n elsif code0 == 0x29 # )\n @pos += 1 # )\n return...
[ "0.6782242", "0.5594302", "0.55533934", "0.5289627", "0.52322054", "0.5069714", "0.49227703", "0.486671", "0.48258868", "0.47825617", "0.47686204", "0.47656333", "0.47576725", "0.47445497", "0.47300968", "0.47278628", "0.46645477", "0.46503067", "0.45705864", "0.45445508", "0...
0.83846706
0
Tests next literal is RegExp or not. If literal is RegExp return ECMA262::ECMA262RegExp object and forward lexical parser position. Otherwise return nil and position is not changed.
def regexp_literal # RegularExpressionLiteral:: # / RegularExpressionBody / RegularExpressionFlags pos0 = @pos return nil unless @codes[@pos] == 0x2f body = regexp_body flags = regexp_flags return ECMA262::ECMA262RegExp.new(body, flags) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regexp(r0, which)\n source, stop_index = r0.source, r0.stop_index\n return factor_result(source, stop_index, stop_index+$&.length) \\\n if source.index(@regexps[which],stop_index)==stop_index\n terminal_parse_failure(r0, which)\n end", "def supports_regexp?\n true\n ...
[ "0.63690096", "0.62792087", "0.6277775", "0.61385995", "0.6078573", "0.6020639", "0.5961838", "0.5928929", "0.5928929", "0.588866", "0.5882437", "0.5882437", "0.5882437", "0.58812636", "0.58812636", "0.58812636", "0.5800408", "0.572743", "0.5661076", "0.5660501", "0.5659312",...
0.75792164
0
Tests next literal is NumericLiteral or not. If literal is NumericLiteral return ECMA262::ECMA262Numeric object and forward lexical parser position. Otherwise return nil and position is not changed.
def numeric_literal hex_integer_literal || octal_integer_literal || decimal_literal end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decimal_literal\n pos0 = @pos\n code = @codes[@pos]\n\n if code.nil?\n return nil\n elsif code == 0x2e #.\n @pos += 1\n f = decimal_digits\n if f.nil? #=> this period is punctuator\n @pos = pos0 + 1\n return ECMA262::PUNC_PERIOD\n end\n ...
[ "0.69190603", "0.65402716", "0.6429054", "0.61556596", "0.6020203", "0.58928955", "0.5867733", "0.58218485", "0.5782044", "0.5770232", "0.57624775", "0.57278407", "0.5707754", "0.57007396", "0.56994337", "0.56495124", "0.56194323", "0.5616846", "0.55748755", "0.55400306", "0....
0.5983177
5
7.8.3 HexIntegerLiteral :: 0x HexDigit 0X HexDigit HexIntegerLiteral HexDigit
def hex_integer_literal code = @codes[@pos] if code.nil? return nil #0x / 0X elsif code == 0x30 and (@codes[@pos+1] == 0x78 || @codes[@pos+1] == 0x58) @pos += 2 pos0 = @pos while code = @codes[@pos] and hex_digit?(code) @pos += 1; end if identifier_start?(code) raise ParseError.new("The source character immediately following a NumericLiteral must not be an IdentifierStart or DecimalDigit", self) else return ECMA262::ECMA262Numeric.new(@codes[pos0...@pos].pack("U*").to_i(16)) end else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hex_literal!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 68 )\n\n\n\n type = HexLiteral\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 523:14: '0' ( 'x...
[ "0.69237506", "0.66149974", "0.66149974", "0.66079575", "0.6539955", "0.6500011", "0.63553786", "0.62480104", "0.6160922", "0.6156475", "0.6146044", "0.6136119", "0.6101334", "0.606544", "0.6061789", "0.60541445", "0.6048677", "0.6035734", "0.601013", "0.6002893", "0.59985405...
0.7719524
0
B.1.1 OctalIntegerLiteral :: 0 OctalDigit OctalIntegerLiteral OctalDigit
def octal_integer_literal code = @codes[@pos] if code.nil? return nil elsif code == 0x30 and (code1 = @codes[@pos + 1]) >= 0x30 and code1 <= 0x37 @pos += 1 pos0 = @pos while code = @codes[@pos] and code >= 0x30 and code <= 0x37 @pos += 1 end if identifier_start?(code) raise ParseError.new("The source character immediately following a NumericLiteral must not be an IdentifierStart or DecimalDigit", self) else return ECMA262::ECMA262Numeric.new(@codes[pos0...@pos].pack("U*").to_i(8)) end else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def octal(digits)\n string(OCTAL_DIGITS, digits)\n end", "def numeric_literal\n hex_integer_literal || octal_integer_literal || decimal_literal\n end", "def oct\n str = self.__zreplace_first_double_underscore.strip # for 1.8.7\n arr = str.__extract_base(8)\n base = arr.__at(0)\n sign_s...
[ "0.71400386", "0.70107275", "0.6917653", "0.6913211", "0.6716382", "0.6342048", "0.6255834", "0.6240928", "0.6075841", "0.6063916", "0.60505784", "0.6028", "0.5994561", "0.5980611", "0.59784025", "0.59563553", "0.5898845", "0.5700946", "0.56559426", "0.565179", "0.564919", ...
0.7675887
0
7.8.3 DecimalLiteral :: DecimalIntegerLiteral . DecimalDigitsopt ExponentPartopt . DecimalDigits ExponentPartopt DecimalIntegerLiteral ExponentPartopt
def decimal_literal pos0 = @pos code = @codes[@pos] if code.nil? return nil elsif code == 0x2e #. @pos += 1 f = decimal_digits if f.nil? #=> this period is punctuator @pos = pos0 + 1 return ECMA262::PUNC_PERIOD end if (code = @codes[@pos]) == 0x65 || code == 0x45 @pos += 1 e = exponent_part end if identifier_start?(@codes[@pos]) raise ParseError.new("The source character immediately following a NumericLiteral must not be an IdentifierStart or DecimalDigit", self) end return ECMA262::ECMA262Numeric.new('0', f, e) elsif code == 0x30 # zero i = "0" @pos += 1 if @codes[@pos] == 0x2e #. @pos += 1 f = decimal_digits if (code = @codes[@pos]) == 0x65 || code == 0x45 #e or E @pos += 1 e = exponent_part end elsif (code = @codes[@pos]) == 0x65 || code == 0x45 #e or E @pos += 1 e = exponent_part end if identifier_start?(@codes[@pos]) raise ParseError.new("The source character immediately following a NumericLiteral must not be an IdentifierStart or DecimalDigit", self) end return ECMA262::ECMA262Numeric.new(i, f, e) elsif code >= 0x31 and code <= 0x39 i = decimal_digits if @codes[@pos] == 0x2e #. @pos += 1 f = decimal_digits if (code = @codes[@pos]) == 0x65 || code == 0x45 #e or E @pos += 1 e = exponent_part end elsif (code = @codes[@pos]) == 0x65 || code == 0x45 #e or E @pos += 1 e = exponent_part end if identifier_start?(@codes[@pos]) raise ParseError.new("The source character immediately following a NumericLiteral must not be an IdentifierStart or DecimalDigit", self) end return ECMA262::ECMA262Numeric.new(i, f, e) end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decimal_part(digits: T.unsafe(nil)); end", "def numeric_literal\n hex_integer_literal || octal_integer_literal || decimal_literal\n end", "def DISABLED_test_decimal_exponent_sequence\n assert_tokenises_as '2.^2.0', DecimalToken.new(2), ExponentOpToken.instance, DecimalToken.new(2)\n asser...
[ "0.6437505", "0.64167", "0.6341209", "0.6310946", "0.62470144", "0.62351096", "0.61921334", "0.6191976", "0.6112107", "0.5943463", "0.59008086", "0.58140814", "0.5803592", "0.5799678", "0.57473916", "0.5744536", "0.5724994", "0.56137663", "0.55923784", "0.55648774", "0.554575...
0.67425597
0
7.8.3 ExponentPart :: ExponentIndicator SignedInteger
def exponent_part if (code = @codes[@pos]) == 0x2b @pos += 1 elsif code == 0x2d @pos += 1 neg = true end d = decimal_digits raise ParseError.new("unexpecting token", self) if d.nil? if neg e = "-#{d}" else e = d end e end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exponent\n e = @exp\n digs = @digits\n unless digs == 0\n e += digs.__decimal_digits_length_approx(false)\n end\n e\n end", "def exponent; end", "def exp(number, exponent)\n number * (10**exponent)\nend", "def exponent\n return @exp\n end", "def exponent\n Math.log10(subu...
[ "0.6949241", "0.6768834", "0.6450049", "0.6366699", "0.62178034", "0.61935323", "0.6123252", "0.60276663", "0.6018495", "0.5966022", "0.59605044", "0.59280956", "0.5922054", "0.589215", "0.5840528", "0.58131653", "0.5787539", "0.57789415", "0.5742632", "0.5741708", "0.5741708...
0.7587559
0
7.8.3 DecimalDigit :: one of 0 1 2 3 4 5 6 7 8 9
def decimal_digits pos0 = @pos if (code = @codes[@pos]) >= 0x30 and code <= 0x39 @pos += 1 while code = @codes[@pos] and code >= 0x30 and code <= 0x39 @pos += 1 end return @codes[pos0...@pos].pack("U*") else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decimal_part(digits: 10)\n num = ''\n if digits > 1\n num = non_zero_digit\n digits -= 1\n end\n leading_zero_number(digits: digits) + num.to_s\n end", "def non_zero_digit; end", "def to_digit\n return NUMBER[self] if self <= 9 && self >= 0\n NUMBER[...
[ "0.7206913", "0.69871384", "0.6909503", "0.6789734", "0.66710514", "0.66146016", "0.6581263", "0.65359426", "0.6485555", "0.64837825", "0.6482358", "0.64792246", "0.64187557", "0.6418712", "0.6403715", "0.64019895", "0.6362964", "0.6342442", "0.6269263", "0.62669444", "0.6265...
0.6937585
2
Tests next literal is StringLiteral or not. If literal is StringLiteral return ECMA262::ECMA262String object and forward lexical parser position. Otherwise return nil and position is not changed.
def string_literal # StringLiteral :: # " DoubleStringCharactersopt " # ' SingleStringCharactersopt ' # # DoubleStringCharacters :: # DoubleStringCharacter DoubleStringCharactersopt # # SingleStringCharacters :: # SingleStringCharacter SingleStringCharactersopt # # DoubleStringCharacter :: # SourceCharacter but not one of " or \ or LineTerminator # \ EscapeSequence # LineContinuation # # SingleStringCharacter :: # SourceCharacter but not one of ' or \ or LineTerminator # \ EscapeSequence # LineContinuation # if (code = @codes[@pos]) == 0x27 #' term = 0x27 elsif code == 0x22 #" term = 0x22 else return nil end @pos += 1 pos0 = @pos str = [] while (code = @codes[@pos]) if code.nil? raise ParseError.new("no `#{term}' at end of string", self) elsif line_terminator?(code) raise ParseError.new("string has line terminator in body", self) elsif code == 0x5c #\ @pos += 1 str.push(escape_sequence) elsif code == term @pos += 1 return ECMA262::ECMA262String.new(str.compact.pack("U*")) else @pos += 1 str.push(code) end end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_literal!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 42)\n\n type = STRING_LITERAL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 486:4: '\\\\'' LITERAL_CHAR ( LITERAL_CHAR )* '\\\\''...
[ "0.69983554", "0.6350717", "0.61525947", "0.5958539", "0.59156597", "0.58566576", "0.5797107", "0.56965303", "0.5658084", "0.56444263", "0.5640862", "0.5638683", "0.55706257", "0.553737", "0.5528167", "0.5525175", "0.5500137", "0.5494996", "0.5481568", "0.5480121", "0.5457949...
0.7373966
0
Returns true if posision is at end of file
def eof? peek_lit(nil).nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def at_end?\n peek.type == :eof\n end", "def eof?\n @pos == @data.bytesize\n end", "def eof?\n @position >= @size\n end", "def eof?\r\n false\r\n end", "def eof?\n @eof\n end", "def eof?\n @eof\n end", "def eof?\n @eof\n end", "def eof?\n ...
[ "0.80565715", "0.79875726", "0.79805964", "0.76524806", "0.7619679", "0.7619679", "0.7619679", "0.7590048", "0.7590048", "0.7590048", "0.7529541", "0.7505213", "0.7499178", "0.7473564", "0.7473564", "0.7473564", "0.74581635", "0.74108106", "0.73829067", "0.73551977", "0.73463...
0.65727645
70
check next literal is strictly equal to _l_ or not. white spaces and line terminators are skipped and ignored. if next literal is not _l_, position is not forwarded if next literal is _l_, position is forwarded
def eql_lit?(l, hint = nil) lit = peek_lit(hint) if lit.eql? l fwd_after_peek lit else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_lit_nolt?(l, hint = nil)\n lit = peek_lit_nolt(hint)\n if lit == l\n fwd_after_peek\n lit\n else\n nil\n end\n end", "def match_lit?(l, hint = nil)\n lit = peek_lit(hint)\n if lit == l\n fwd_after_peek\n lit\n else\n nil\n ...
[ "0.61675394", "0.6134503", "0.60336643", "0.58739287", "0.5837285", "0.5837285", "0.5837285", "0.5816137", "0.5600111", "0.5600111", "0.5600111", "0.5549727", "0.55136937", "0.5398834", "0.5327225", "0.5316233", "0.5312511", "0.5312511", "0.5312511", "0.5294847", "0.5272985",...
0.584392
4
check next literal is strictly equal to _l_ or not. white spaces are skipped and ignored. line terminators are not ignored. if next literal is not _l_, position is not forwarded if next literal is _l_, position is forwarded
def eql_lit_nolt?(l, hint = nil) lit = peek_lit_nolt(hint) if lit.eql? l fwd_after_peek lit else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_lit_nolt?(l, hint = nil)\n lit = peek_lit_nolt(hint)\n if lit == l\n fwd_after_peek\n lit\n else\n nil\n end\n end", "def match_lit?(l, hint = nil)\n lit = peek_lit(hint)\n if lit == l\n fwd_after_peek\n lit\n else\n nil\n ...
[ "0.622008", "0.61925745", "0.606427", "0.5912112", "0.58234286", "0.58234286", "0.58234286", "0.57885873", "0.55616665", "0.55616665", "0.55616665", "0.55249256", "0.5514974", "0.53779286", "0.5363948", "0.533078", "0.53150797", "0.53150797", "0.53150797", "0.52767444", "0.52...
0.58858633
4
check next literal is equal to _l_ or not. white spaces and line terminators are skipped and ignored. if next literal is not _l_, position is not forwarded if next literal is _l_, position is forwarded
def match_lit?(l, hint = nil) lit = peek_lit(hint) if lit == l fwd_after_peek lit else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_lit_nolt?(l, hint = nil)\n lit = peek_lit_nolt(hint)\n if lit == l\n fwd_after_peek\n lit\n else\n nil\n end\n end", "def parse_lit\n case l.front.type\n when :str then parse_str_lit\n when :chr then parse_char_lit\n when :num then parse_num_lit\n...
[ "0.6243398", "0.6158129", "0.60829586", "0.60829586", "0.60829586", "0.60687613", "0.58029675", "0.5778378", "0.5778378", "0.5778378", "0.5704982", "0.55836326", "0.55836326", "0.55836326", "0.5499322", "0.54896456", "0.5468292", "0.5447602", "0.5445223", "0.5434087", "0.5417...
0.62729967
0
check next literal is equal to _l_ or not. white spaces are skipped and ignored. line terminators are not ignored. if next literal is not _l_, position is not forwarded if next literal is _l_, position is forwarded
def match_lit_nolt?(l, hint = nil) lit = peek_lit_nolt(hint) if lit == l fwd_after_peek lit else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_lit?(l, hint = nil)\n lit = peek_lit(hint)\n if lit == l\n fwd_after_peek\n lit\n else\n nil\n end\n end", "def is_lpar(latex, step)\n\tlatex[step+1..step+5].join == \"left(\"\nend", "def parse_lit\n case l.front.type\n when :str then parse_str_lit\n ...
[ "0.63618225", "0.6109549", "0.608009", "0.6075154", "0.6075154", "0.6075154", "0.59064585", "0.58042985", "0.5745842", "0.5745842", "0.5745842", "0.55970234", "0.55970234", "0.55970234", "0.55190486", "0.5509483", "0.5465702", "0.54279286", "0.5418955", "0.5417631", "0.541169...
0.6321066
1
fetch next literal. position is not forwarded. white spaces and line terminators are skipped and ignored.
def peek_lit(hint) pos0 = @pos while lit = next_input_element(hint) and (lit.ws? or lit.lt?) end @pos = pos0 lit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_token\n result = peek_token\n @start = @finish\n return result if @start >= @expr.length\n\n if @expr[@start].numeric?\n @finish = @start + 1\n while @finish < @expr.length && @expr[@finish].to_s.numeric?\n @finish = @finish + 1\n end\n else\n @finish = @start + 1...
[ "0.6661161", "0.65402114", "0.6508427", "0.6461592", "0.631385", "0.63018566", "0.6278044", "0.6261783", "0.6228459", "0.62183183", "0.6217015", "0.62010616", "0.6128506", "0.6119794", "0.6070626", "0.607005", "0.607005", "0.607005", "0.6038593", "0.6032305", "0.6027879", "...
0.0
-1
fetch next literal. position is not forwarded. white spaces are skipped and ignored. line terminators are not ignored.
def peek_lit_nolt(hint) pos0 = @pos while lit = next_input_element(hint) and lit.ws? end @pos = pos0 lit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_token\n result = peek_token\n @start = @finish\n return result if @start >= @expr.length\n\n if @expr[@start].numeric?\n @finish = @start + 1\n while @finish < @expr.length && @expr[@finish].to_s.numeric?\n @finish = @finish + 1\n end\n else\n @finish = @start + 1...
[ "0.65581006", "0.6516196", "0.6512108", "0.64047813", "0.63073653", "0.6299561", "0.62135106", "0.6199663", "0.6189973", "0.61801773", "0.61611176", "0.61535245", "0.61292636", "0.6067928", "0.60310274", "0.60310274", "0.60310274", "0.6014107", "0.6001202", "0.59818244", "0.5...
0.0
-1
Forwards position after calling peek_lit. This method quickly forward position after calling peek_lit.
def fwd_after_peek @pos = @head_pos end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peek_lit(hint)\n pos0 = @pos\n while lit = next_input_element(hint) and (lit.ws? or lit.lt?)\n end\n @pos = pos0\n lit\n end", "def peek_lit_nolt(hint)\n pos0 = @pos\n while lit = next_input_element(hint) and lit.ws?\n end\n @pos = pos0\n lit\n end", ...
[ "0.67667997", "0.65343904", "0.6196432", "0.6132759", "0.61087483", "0.6024115", "0.60034144", "0.59756315", "0.59578156", "0.59487754", "0.5940611", "0.5933561", "0.5921195", "0.59079677", "0.59079677", "0.58957845", "0.5888137", "0.5881644", "0.5878967", "0.5874191", "0.587...
0.72775227
0
fetch next literal. position is forwarded. white spaces and line terminators are skipped and ignored.
def fwd_lit(hint) while lit = next_input_element(hint) and (lit.ws? or lit.lt?) end lit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_lit\n case l.front.type\n when :str then parse_str_lit\n when :chr then parse_char_lit\n when :num then parse_num_lit\n else\n error \"expected a literal\"\n end\n end", "def literal\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method_...
[ "0.66224873", "0.6524835", "0.6495376", "0.6463879", "0.63447595", "0.62518346", "0.6235981", "0.61942846", "0.6128024", "0.61243206", "0.60881156", "0.6084366", "0.6065472", "0.6055462", "0.60457474", "0.6039622", "0.6003619", "0.5981759", "0.5981759", "0.5981759", "0.593630...
0.0
-1
fetch next literal. position is forwarded. white spaces are skipped and ignored. line terminators are not ignored.
def fwd_lit_nolt(hint) while lit = next_input_element(hint) and lit.ws? end lit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_lit\n case l.front.type\n when :str then parse_str_lit\n when :chr then parse_char_lit\n when :num then parse_num_lit\n else\n error \"expected a literal\"\n end\n end", "def literal\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method_...
[ "0.6587464", "0.6517174", "0.6437756", "0.640805", "0.63313323", "0.62394625", "0.6230809", "0.6162557", "0.61176914", "0.6086427", "0.6084447", "0.60331476", "0.6032339", "0.6005101", "0.5995011", "0.5986573", "0.596949", "0.596949", "0.596949", "0.5933468", "0.5915246", "...
0.0
-1
break => position is rewind, then break with return => position is rewind, then return next => position is not rewind, then break with
def eval_lit(&block) begin saved_pos = @pos @eval_nest += 1 ret = yield ensure @eval_nest -= 1 if ret.nil? @pos = saved_pos nil else if @eval_nest == 0 #STDERR.puts "clear_cache [#{saved_pos}..#{@pos}]" clear_cache end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next\n last? ? nil : locate + 1\n end", "def next\n at(position + 1)\n end", "def next?()\n !end?\n end", "def next(pointer); end", "def next(pointer); end", "def next\n peek.tap { @position += 1 }\n end", "def seek\n while @next < @n && @ptns[@next].size == @nums[@next]\...
[ "0.64874", "0.63333476", "0.63201773", "0.626301", "0.626301", "0.6254629", "0.6173073", "0.6171248", "0.6171248", "0.6171248", "0.6171248", "0.6102457", "0.6062894", "0.60593617", "0.604659", "0.6034351", "0.6034351", "0.59989417", "0.59989417", "0.59989417", "0.59680724", ...
0.0
-1
position to [row, col]
def row_col(pos) _pos = 0 row = 0 col = 1 @codes.each do |code| break if _pos >= pos if line_terminator?(code) row += 1 col = 0 else col += 1 end _pos += 1 end return [row+1, col+1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_position(row, col)\n if row.between?(0, 7) && col.between?(0, 7)\n @position[:row] = row\n\t @position[:col] = col\n\tend\n end", "def position\n [ @row_offset, @col_offset ]\n end", "def position\n [row.position, column.position]\n end", "def move row, col\n @row = row\n ...
[ "0.78684074", "0.7549625", "0.7248122", "0.7154973", "0.71535504", "0.7065209", "0.7061515", "0.7041118", "0.69991076", "0.6984821", "0.6839706", "0.67913014", "0.67176014", "0.6717497", "0.6716835", "0.6703385", "0.6648231", "0.6620229", "0.6580714", "0.65406114", "0.6540611...
0.0
-1
Returns string of input data around _pos_
def debug_str(pos = nil, row = 0, col = 0) if pos.nil? pos = @head_pos or @pos end t = '' if col >= 80 t << @codes[(pos-80)..(pos+80)].pack("U*") col = 81 else t << line(pos) end if col and col >= 1 col = col - 1; end t << "\n" t << (' ' * col) + "^" t end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_pos(pos = @pos)\t\n\t\treturn to_text(pos[0]) + (pos[1] + 1).to_s\n\tend", "def to_offset(text, position); end", "def to_s\n \"#{position[0]} #{position[1]} #{@direction}\"\n end", "def pos() end", "def pos() end", "def pos() end", "def pos() end", "def pos_to_index(position)\n positi...
[ "0.729527", "0.7034711", "0.65570784", "0.6426135", "0.6426135", "0.6426135", "0.6426135", "0.63888615", "0.63688344", "0.6288623", "0.62551737", "0.62439734", "0.62432516", "0.62406826", "0.6224327", "0.6224327", "0.6224327", "0.6224327", "0.6224327", "0.6224327", "0.6215989...
0.60360533
27
Override Thread.new to prevent threads being created if there isn't runtime support for it
def new(*args,&block) unless defined? @_rubycocoa_threads_allowed then # If user has explicilty disabled thread support, also disable the # check (for debugging/testing only) @_rubycocoa_threads_allowed = ENV['RUBYCOCOA_THREAD_HOOK_DISABLE'] || OSX::RBRuntime.isRubyThreadingSupported? end if !@_rubycocoa_threads_allowed then warn "#{caller[0]}: Ruby threads cannot be used in RubyCocoa without patches to the Ruby interpreter" end pre_rubycocoa_new(*args,&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowing_other_threads; end", "def spawn_thread\n Thread.new{ run_thread }.tap do |t|\n t.abort_on_exception = true\n end\n end", "def start_thread #does this need to be its own thread?\n @@thread = Thread.new do\n self.run\n end\n end", "def do_not_thread; true; end", "...
[ "0.6906716", "0.66781485", "0.64136916", "0.63996524", "0.63996524", "0.63996524", "0.61905897", "0.6128272", "0.6047312", "0.6047312", "0.59888667", "0.5952064", "0.5927961", "0.5898756", "0.5893623", "0.5786867", "0.57800984", "0.5765258", "0.5756319", "0.57507795", "0.5744...
0.6995929
0
def add puts "holaaa" hol = params[:name] puts hol
def tag #ban = true puts "entro" port_str = "/dev/ttyACM0" #may be different for you baud_rate = 115200 data_bits = 8 stop_bits = 1 parity = SerialPort::NONE sp = SerialPort.new(port_str, baud_rate, data_bits, stop_bits, parity) # while ban do while (i = sp.gets.chomp) do i.slice!("Tag is not NDEF formatted.") tagUID = i puts "el while" puts tagUID if tagUID.empty? ban= true else $global = 0 session[:prueba] = tagUID $global = tagUID return tagUID end end #end #sp.closes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(params)\n post 'add', params\n end", "def param_name_add(name, id, default)\n param = Hash.new\n param['name'] = name\n param['id'] = id\n param['value_db'] = 0\n param['value_ar'] = 0\n param['default'] = default\n @params << param\n end", "def param_name_add(n...
[ "0.7055181", "0.7051024", "0.68499786", "0.67512953", "0.66545373", "0.6561442", "0.6475256", "0.64695305", "0.6437187", "0.6374592", "0.6374592", "0.6358891", "0.63342464", "0.6305712", "0.6287832", "0.6258247", "0.6246468", "0.62252754", "0.6202081", "0.6164553", "0.6155023...
0.0
-1
Confirm the correct user, for authorization purposes such as updating their own profile and not any other user's profile information.
def correct_user @user = User.find(params[:id]) redirect_to '/' unless @user == current_user || current_user.isadmin? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_user\n msg = \"You do not have permission to update another user's information\"\n require_correct_user(@user, msg)\n end", "def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the ow...
[ "0.7820566", "0.7487571", "0.747985", "0.7421584", "0.7403223", "0.7374018", "0.73545015", "0.73001206", "0.7287012", "0.7282314", "0.7262213", "0.72599703", "0.7259919", "0.7256439", "0.7236024", "0.7179469", "0.7169858", "0.7164624", "0.7161283", "0.7150804", "0.71371025", ...
0.0
-1
Admin users will have special permissions, such as deleting members or posts.
def admin_user redirect_to('/') unless current_user.isadmin? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "def custom_permissions\n if current_user.admin?\n can :manage, :all\n end\n end", "def custom_permissions\n # Limits deleting objects to a the admin user\...
[ "0.7950692", "0.78213316", "0.7780422", "0.77437794", "0.7643459", "0.76227283", "0.7619482", "0.76084095", "0.76039666", "0.7603168", "0.7582445", "0.7582445", "0.7582445", "0.75734454", "0.7561273", "0.75477785", "0.75477785", "0.7531823", "0.7525776", "0.7477768", "0.74687...
0.0
-1
GET /visit_people GET /visit_people.json
def index @visit_people = VisitPerson.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end", "def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end", "def people\n Birdman::Requester.get(\"movi...
[ "0.7164006", "0.7164006", "0.69264215", "0.6859905", "0.6818042", "0.66891676", "0.66564393", "0.6645254", "0.6614189", "0.65685946", "0.65561116", "0.654978", "0.64583695", "0.63975155", "0.6370652", "0.63647944", "0.6357036", "0.6350222", "0.6349708", "0.63458526", "0.63298...
0.7042639
2
GET /visit_people/1 GET /visit_people/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @visit_people = VisitPerson.all\n end", "def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) }\n end", "def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p) ...
[ "0.6920599", "0.6836075", "0.6836075", "0.6777743", "0.67722195", "0.6764108", "0.6759153", "0.67513764", "0.6732482", "0.6655684", "0.6647889", "0.66406447", "0.66394913", "0.6625896", "0.6625896", "0.66253173", "0.65987176", "0.6595223", "0.6590298", "0.6584921", "0.6571143...
0.0
-1
POST /visit_people POST /visit_people.json
def create @visit_person = VisitPerson.new(visit_person_params) respond_to do |format| if @visit_person.save format.html { redirect_to @visit_person, notice: 'Visit person was successfully created.' } format.json { render :show, status: :created, location: @visit_person } else format.html { render :new } format.json { render json: @visit_person.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @visit = Visit.new(params[:visit])\n\n respond_to do |format|\n if @visit.save\n format.html {\n redirect_to :controller => 'people', :action => 'edit', :id => @visit.person_id\n }\n format.json { render json: @visit, status: :created, location: @visit }\n ...
[ "0.69635516", "0.6725972", "0.67029834", "0.6656723", "0.6522561", "0.6466752", "0.6366526", "0.63440424", "0.6340844", "0.6336101", "0.6274313", "0.62431777", "0.62282056", "0.6205908", "0.6204968", "0.6189914", "0.61597675", "0.6142676", "0.61196166", "0.6108959", "0.610023...
0.6923559
1
PATCH/PUT /visit_people/1 PATCH/PUT /visit_people/1.json
def update respond_to do |format| if @visit_person.update(visit_person_params) format.html { redirect_to @visit_person, notice: 'Visit person was successfully updated.' } format.json { render :show, status: :ok, location: @visit_person } else format.html { render :edit } format.json { render json: @visit_person.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_requ...
[ "0.6928483", "0.68815166", "0.67492306", "0.6742536", "0.67113584", "0.66931224", "0.6684623", "0.66673857", "0.66655344", "0.66316587", "0.66316587", "0.6526323", "0.6523786", "0.65052253", "0.649264", "0.6435726", "0.6435726", "0.64292026", "0.64284277", "0.64284277", "0.64...
0.694742
0
DELETE /visit_people/1 DELETE /visit_people/1.json
def destroy @visit_person.destroy respond_to do |format| format.html { redirect_to visit_people_url, notice: 'Visit person was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n track_activity @person\n\n respond_to do |format|\n format.html { re...
[ "0.7289311", "0.7275337", "0.7267954", "0.7251916", "0.7251916", "0.7251916", "0.72199297", "0.72199297", "0.72199297", "0.72199297", "0.72086364", "0.7166149", "0.7166149", "0.7166149", "0.7166149", "0.7166149", "0.7136831", "0.7117537", "0.70828074", "0.70825285", "0.706724...
0.7716077
0
Use callbacks to share common setup or constraints between actions.
def set_visit_person @visit_person = VisitPerson.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def visit_person_params params.require(:visit_person).permit(:visit_id, :person_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
add ras yardstick tasks to namespace :docs
def initialize namespace :docs do config = YAML.load_file(".yardstick.yml") desc "Measure YARD coverage. see yardstick/report.txt for output" require "yardstick/rake/measurement" Yardstick::Rake::Measurement.new(:measure_ras, config) do |measurement| measurement.output = "yardstick/ras_report.txt" end task measure_ras: [:measure_ras_message] # another way to force a dependent task desc "" # empty description so this doesn't show up in rake -T task :measure_ras_message do puts "creating a report in yardstick/ras_report.txt" end desc "Verify YARD coverage" require "yardstick/rake/verify" Yardstick::Rake::Verify.new(:verify_ras, config) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doc_task; end", "def define_seattlerb_tasks\n if Hoe.plugins.include? :publish then\n base = \"/data/www/docs.seattlerb.org\"\n rdoc_locations << \"docs-push.seattlerb.org:#{base}/#{remote_rdoc_dir}\"\n end\n end", "def doc_task=(_arg0); end", "def define_asciidoc_tasks\n if defined?(...
[ "0.745012", "0.74387044", "0.68841517", "0.6852393", "0.674926", "0.6658012", "0.66527605", "0.65105695", "0.6449596", "0.6446869", "0.643214", "0.6293453", "0.6268048", "0.6184708", "0.6162877", "0.60477924", "0.60397905", "0.60304904", "0.58881825", "0.5866949", "0.5865069"...
0.62405163
13
prompt the user to repeat back the new sequence that was just shown to them, one color at a time. The game is over if the guess is incorrect.
def require_sequence puts "Repeat Sequence (Only repeat the first letter of each color):" seq.length.times do |i| print "> " input = gets.chomp if input != seq[i] self.game_over = true break end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_game \n\n @number_guesses = 0\n @start_time = Time.now\n puts \"I have generated a secret code, a sequence of four colors: (R)ed, (G)reen, (B)lue, and (Y)ellow\"\n\n game_over = false \n\n until game_over \n \n guess = get_guess\n\n exit_game if guess.upcase == \"Q\" \n guess...
[ "0.7354492", "0.72172844", "0.71080095", "0.70302904", "0.7019733", "0.69870675", "0.68975174", "0.6859837", "0.6847271", "0.6798628", "0.6536197", "0.6531533", "0.65227264", "0.6501217", "0.64770395", "0.64654136", "0.64632547", "0.6428728", "0.63727206", "0.6339941", "0.632...
0.7541607
0
Adds a random color to the sequence
def add_random_color seq << COLORS.sample end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_color\n if !color\n self.color = %w(\n #000000 #0000FF #00FF00 #FF0000 #FFFF00 #9900CC\n #CC0066 #00FFFF #FF00FF #C0C0C0 #00008B #FFD700\n #FFA500 #FF1493 #FF00FF #F0FFFF #EE82EE #D2691E\n #C0C0C0 #A52A2A #9ACD32 #9400D3 #8B008B #8B0000\n #87CEEB #808080 #800080 #...
[ "0.797875", "0.7633591", "0.7582373", "0.73997366", "0.72047055", "0.7145231", "0.70770097", "0.70254457", "0.6827469", "0.67569935", "0.67560965", "0.6747252", "0.67109215", "0.66429275", "0.6569292", "0.65565085", "0.6437411", "0.6426247", "0.63545126", "0.6226896", "0.6218...
0.90315664
0
Methods below to print the colors formatted
def yellow puts " yellow".yellow puts print "red" puts " blue" puts puts " green" puts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_colors\n 1.upto(6) { |i| print \"#{i} = \" + \"\\u2b24\".color(COLORS[i]) + \" \" }\n print \": \"\nend", "def print_colors\n 1.upto(COLORS.size) { |i| print \"#{i} = \" + \" \".color(COLORS[i]) + \" \" }\n print \": \"\nend", "def print_colors\n 1.upto(@board.number_of_pegs) { |i| print ...
[ "0.8401645", "0.83544445", "0.794392", "0.7561849", "0.7499658", "0.74204737", "0.7370787", "0.7359186", "0.7327295", "0.72326493", "0.72243935", "0.7222981", "0.71984416", "0.7150895", "0.7147547", "0.7136925", "0.712202", "0.7117745", "0.7099947", "0.709909", "0.7026124", ...
0.0
-1
global starting point function
def program_entry_point flag=1; input_choice=0; student_list = StudentList.new while flag>0 puts 'Student Management Program' puts '----------------------------------' puts '1. Enter New Student Data' puts '2. Display Student Data via Search' puts '3. Display Entire List' puts '4. Delete First Student Record' puts '5. Delete Last Student Record' puts '6. Exit' puts '----------------------------------' puts 'Enter Choice Number :' input_choice = gets.chomp.to_i; puts input_choice case input_choice when 1 s = getData student_list.append(s) when 2 puts 'Enter student roll number' key = gets.chomp.to_i student_list.[](key) when 3 student_list.display_list when 4 student_list.deleteFirst when 5 student_list.deleteLast when 6 puts 'Exiting.........' flag=0 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def starting; end", "def start;end", "def start; end", "def start; end", "def start; end", "def start; end", "def start; end", "def start; end", "def start; end", "def start; end", "def start; end", "def start; end", "def start; end", "def start; end", "def start; end", "def start; en...
[ "0.80667645", "0.7106009", "0.7059703", "0.7059703", "0.7059703", "0.7059703", "0.7059703", "0.7059703", "0.7059703", "0.7059703", "0.7059703", "0.7059703", "0.7059703", "0.7059703", "0.7059703", "0.7059703", "0.7059703", "0.698288", "0.698288", "0.698288", "0.698288", "0.6...
0.0
-1
test "the truth" do assert true end
def setup @frank = users(:frank) @mike = users(:mike) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_the_truth\n assert true\nend", "def test_the_truth\n assert true\n end", "def test_the_truth\n assert true\n end", "def test_this_works\n assert true\n end", "def test_truth\r\n assert true\r\n end", "def test_truth\r\n assert true\r\n end", "def test_truth\r\n assert t...
[ "0.9192157", "0.9121996", "0.9121996", "0.9044381", "0.90220094", "0.90220094", "0.90220094", "0.8968693", "0.8968693", "0.8968693", "0.8968693", "0.8968693", "0.8968693", "0.8968693", "0.8968693", "0.8968693", "0.8968693", "0.8968693", "0.8968693", "0.8968693", "0.8968693", ...
0.0
-1
method dumps data to file
def dump File.open(@meta_data_file_location,'w') { |f| f.write(YAML.dump(@meta_data))} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write\n open(@fname,\"wb\") do |file|\n Marshal.dump(@data,file)\n end\n end", "def dump_file_data(io)\n end", "def save\n pathname.open('w') { |file| file.write(data) }\n end", "def dump_data(to)\n data.keys.each do |key|\n FileUtils.mkdir_p(to + File.dirname(key))\n ...
[ "0.76638824", "0.7298004", "0.7202988", "0.7185437", "0.7137326", "0.7137326", "0.7137326", "0.713604", "0.7111296", "0.7104809", "0.708573", "0.70680314", "0.7013293", "0.7011336", "0.69803196", "0.69469416", "0.69469416", "0.69469416", "0.69469416", "0.6917348", "0.6912466"...
0.6216566
83
Initialize new System instance.
def initialize(options={}) extend self extend ShellUtils @root = options[:root] || Dir.pwd @ignore = options[:ignore] || [] #Ignore.new @rulebook = options[:rulebook] @state_file = options[:statefile] @session = OpenStruct.new @scripts = [] @rules = [] #@facts = [] @digests = {} @rulesets = {} import(*rulebook) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(keyring)\n @keyring = keyring\n @system = System.new\n end", "def initialize(name)\n # Initialize the system type structure.\n super(name)\n # Update the library of existing system types.\n # Note: no check is made so an exisiting system typ...
[ "0.724665", "0.7126794", "0.6942167", "0.6874744", "0.6853828", "0.6848445", "0.6805444", "0.67442214", "0.6483095", "0.6481711", "0.64611375", "0.6420318", "0.6398328", "0.63961893", "0.6332454", "0.63303274", "0.63118666", "0.6305797", "0.6298951", "0.6281667", "0.6281667",...
0.0
-1
def default(rulesets) ruleset :default => rulesets end Rulesets provide a separate space for rules which are only run when the ruleset name is specifically given. Return [Ruleset]
def ruleset(name_and_chain, &block) name, chain = parse_ruleset_name(name_and_chain) if @rulesets.key?(name) ruleset = @rulesets[name] ruleset.update(chain, &block) else ruleset = Ruleset.new(self, name_and_chain, &block) @rulesets[name] = ruleset end ruleset end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default\n defaults = {}\n @rules.each {|rule| rule.complete_defaults(defaults)}\n defaults\n end", "def default_rule; end", "def default_rules(key)\n @vertex.fetch(@rule_prefix + key, nil)\n end", "def default_collection_rule\n Proc.new do |collection_rule, objects, o...
[ "0.72728306", "0.6999354", "0.6238038", "0.5906943", "0.5906943", "0.586761", "0.5863049", "0.5844489", "0.56966907", "0.5692319", "0.56261885", "0.5594931", "0.5563753", "0.55405605", "0.55262625", "0.55262625", "0.55021584", "0.547669", "0.54765284", "0.545972", "0.5412245"...
0.5299962
30
Import from another file, or glob of files, relative to project root. TODO: Should importing be relative to the importing file? Returns nothing.
def import(*globs) globs.each do |glob| #if File.relative?(glob) # dir = Dir.pwd #session.root #File.dirname(caller[0]) # glob = File.join(dir, glob) #end Dir[glob].each do |file| next unless File.file?(file) # add warning next if @scripts.include?(file) @scripts << file module_eval(File.read(file), file) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import(glob, opts={})\n paths = []\n\n glob = glob + '**/*' if glob.end_with?('/')\n\n if from = opts[:from]\n paths = Find.path(glob, :from=>from)\n else\n if glob.start_with?('/')\n if root = lookup_root\n glob = File.join(root, glob)\n else\n ...
[ "0.7323573", "0.65813524", "0.6214822", "0.59600264", "0.58899266", "0.577969", "0.57250607", "0.568822", "0.5681246", "0.56758887", "0.5617326", "0.5614111", "0.5596892", "0.55946434", "0.55924934", "0.5525471", "0.5525471", "0.5525471", "0.5525471", "0.5494579", "0.5488046"...
0.67391557
2
Add paths to be ignored in file rules. globs List of file globs. [Array] Returns [Array]
def ignore(*globs) @ignore.concat(globs) unless globs.empty? @ignore end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignore!(*globs)\n @ignore.replace(globs)\n @ignore\n end", "def ignored\n [\n '.agignore',\n '.cvsignore',\n '.gitignore',\n '.hgignore',\n ].map do |file_with_ignore_patterns|\n if File.exist? file_with_ignore_patterns\n patterns = File.read(file_with_ignore_patterns).spli...
[ "0.7524156", "0.72494334", "0.7089483", "0.70458", "0.69992214", "0.6967921", "0.6935916", "0.69272983", "0.69156355", "0.6856292", "0.68418306", "0.6792441", "0.67896205", "0.66566366", "0.6635084", "0.66258883", "0.65988934", "0.65887755", "0.65515596", "0.6526204", "0.6482...
0.7656717
0
Replace globs in ignore list. globs List of file globs. [Array] Returns [Array]
def ignore!(*globs) @ignore.replace(globs) @ignore end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignore(*globs)\n @ignore.concat(globs) unless globs.empty?\n @ignore\n end", "def process_globs globs\n result = globs.flat_map do |glob|\n Dir[File.join directory, glob]\n .map{ |f| f.gsub(/\\\\/, '/') }\n .select { |f| File.file?(f) }\n end\n ...
[ "0.78354275", "0.72956806", "0.7157316", "0.6982517", "0.69178647", "0.6886567", "0.68079126", "0.6795027", "0.6770556", "0.6757173", "0.67300713", "0.6569321", "0.6523855", "0.64728034", "0.6457298", "0.64252776", "0.6421378", "0.64094037", "0.6372147", "0.6358228", "0.63311...
0.8189704
0
Home directory. Returns [String]
def home @home ||= File.expand_path('~') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home_path\n File.expand_path(\"~\")\n end", "def home_basedir\n if platform_family?('mac_os_x')\n '/Users'\n elsif platform_family?('solaris2')\n '/export/home'\n else\n '/home'\n end\n end", "def home(user=nil)\n File.expand_path(Dir.home(user))\n ...
[ "0.8425394", "0.8269689", "0.8140095", "0.8131916", "0.81192297", "0.80107266", "0.7614194", "0.7598574", "0.750214", "0.74339074", "0.7376708", "0.72619176", "0.72573215", "0.72062606", "0.71135294", "0.7016243", "0.7016243", "0.7014035", "0.69793147", "0.69261646", "0.68919...
0.81937206
2
Parse out a ruleset's name from it's ruleset dependencies. Returns [Array]
def parse_ruleset_name(name) if Hash === name raise ArgumentError if name.size > 1 list = [name.values].flatten.map{ |b| b.to_sym } name = name.keys.first else list = [] end return name.to_sym, list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rule_names\n @rule_names ||= []\n end", "def rule_names\n @rule_names ||= []\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def dependencies(ctx)\n @...
[ "0.64602107", "0.64602107", "0.5952154", "0.57682675", "0.56978804", "0.562175", "0.54411215", "0.5419487", "0.54030484", "0.5387683", "0.5371577", "0.53248554", "0.5307442", "0.52400666", "0.51720816", "0.5153674", "0.51429176", "0.50978535", "0.50768685", "0.5076735", "0.50...
0.56644225
6
See ActionController::Base for details Uncomment this to filter the contents of submitted sensitive data parameters from your application log (in this case, all fields with names like "password"). filter_parameter_logging :password
def generate_notifs follower, state begin @violations = Violation.find(:all, :from => "/violation/?idno=#{follower.idno}") @guidance = Guidance.find(:all, :from => "/guidance/?idno=#{follower.idno}") @attendance= Attendance.find(:all, :from => "/attendance/?idno=#{follower.idno}") @grades = Grade.find(:all, :from => "/grade/?idno=#{follower.idno}") @tf_assessment = Tfassessment.find(:all, :from => "/tfassessment/?idno=2067514") @tf_breakdown = Tfbreakdown.find(:all, :from => "/tfbreakdown/?idno=#{follower.idno}") if @violations.size>0 if state.violation_rows < @violations.size state.violation_rows = @violations.size state.save notif = Notification.new notif.delivered_at = Time.now notif.follower_id = follower.user_id notif.idno = follower.idno notif.details = "commited a violation." notif.notification = "Violation notice!" notif.new = true notif.save end end if @guidance.size>0 if state.guidance_rows < @guidance.size state.guidance_rows = @guidance.size state.save notif = Notification.new notif.delivered_at = Time.now notif.follower_id = follower.user_id notif.idno = follower.idno notif.details = " has a been guidanced." notif.notification = "guidace notice!" notif.new = true notif.save end end if @grades.size>0 if state.grade_rows < @grades.size state.grade_rows = @grades.size state.save notif = Notification.new notif.delivered_at = Time.now notif.follower_id = follower.user_id notif.idno = follower.idno notif.details = "'s grades are updated!" notif.notification = "grades notice!" notif.new = true notif.save end end if @tf_assessment.size >0 if state.tf_assessment_rows < @tf_assessment.size state.tf_assessment_rows = @tf_assessment.size state.save notif = Notification.new notif.delivered_at = Time.now notif.idno = follower.idno notif.details = " has new assessment information" notif.notification = "assessment notice!" notif.new = true notif.save end end if @tf_breakdown.size >0 if state.tf_breakdown_rows< @tf_breakdown.size state.tf_breakdown_rows= @tf_breakdown.size state.save notif = Notification.new notif.delivered_at = Time.now notif.idno = follower.idno notif.details = " has new breakdown information" notif.notification = "breakdown" notif.new = true notif.save end end if @attendance.size >0 if state.attendance_rows < @attendance.size state.attendance_rows = @attendance.size state.save notif = Notification.new notif.delivered_at = Time.now notif.idno = follower.idno notif.details = " was recorded absent!" notif.notification = "absence" notif.save end end rescue end ## update admin variable for next generation #dont forget to generate the mails and send the cp messages end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_password_confirmation\n log :filter_password_confirmation, \"\"\n replace_in_file 'config/initializers/filter_parameter_logging.rb',\n 'Rails.application.config.filter_parameters += [:password]',\n 'Rails.application.config.filter_parameters += [:password, :password_c...
[ "0.7593614", "0.63237154", "0.61230296", "0.6003861", "0.60023093", "0.59876466", "0.595132", "0.59297544", "0.58667344", "0.5831422", "0.5825646", "0.5774158", "0.57317674", "0.573017", "0.56739116", "0.56571597", "0.56367254", "0.562792", "0.562792", "0.5606785", "0.5606785...
0.0
-1