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
Will parse the Template, or the given Snippet
def parse_scripts(string_snippet = nil) insert_includes insert_globals insert_variables handle_loops insert_urls execute_functions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_snippet_template(template_name)\n source = if template_name.include?('{{')\n template_name\n else\n snippet = services.snippet_finder.find(template_name)\n if snippet\n snippet.liquid_source\n else\n L...
[ "0.724034", "0.6282523", "0.60887814", "0.6039011", "0.6009934", "0.59951234", "0.5947203", "0.59443545", "0.5837669", "0.5836679", "0.5763909", "0.5711898", "0.5667083", "0.56317943", "0.5611764", "0.5609382", "0.5504405", "0.5496913", "0.54675335", "0.54498315", "0.5448601"...
0.0
-1
Will match functions using regex and executes them if their defined in the FunctionCollection Class. Will return the unchanged matched String if the given function doesn't exist
def execute_functions # match functions like func(args); @output = @output.gsub(/(\w+)\("?(.*)"?\)\;/) {|row| function_name = Regexp.last_match[1] function_parameters = Regexp.last_match[2] return_content = "" functions = FunctionCollection.new args = function_parameters.sp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_all_handle_func(fun)\n if fun.is_a?(Regexp)\n my_each { |x| return false unless fun.match? x.to_s }\n else\n my_each { |x| return false unless fun === x }\n end\n true\n end", "def function\n function = '\\w+\\(\\)'\n end", "def reformat_math_functions\n funcs = %w(min max ...
[ "0.6221063", "0.613139", "0.6130644", "0.6124225", "0.5964316", "0.59328693", "0.59162426", "0.5903062", "0.5863272", "0.57324547", "0.5726053", "0.56930107", "0.56695414", "0.56569433", "0.56485325", "0.5630979", "0.5625406", "0.55961186", "0.55712825", "0.5533269", "0.55327...
0.7077262
0
Will match loops using regex and handles them
def handle_loops @output = @output.gsub(/=# each (.+) do (.+):([^-]*[^}]*)\n.*=# end/i) { table_name = Regexp.last_match[1] looper_name = Regexp.last_match[2] template = Regexp.last_match[3] database = Database.new generated_loop_content = "" if database.table_exist?(tab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_match_range(range, regex); end", "def matching_lines(regex); end", "def match_loop\n if dut_version > '0.15.0'\n put('q^1')\n yield\n put('q^0')\n else\n poke(\"#{testbench_top}.pins.match_loop\", 1)\n yield\n poke(\"#{testbench_top}.pins.match_loop\...
[ "0.6503134", "0.63995546", "0.60831094", "0.59064394", "0.5852724", "0.58188576", "0.57994473", "0.57811373", "0.57730424", "0.5767155", "0.57472813", "0.57418406", "0.5629543", "0.5629249", "0.5616047", "0.5604257", "0.5564413", "0.55615836", "0.55223626", "0.5503034", "0.54...
0.61739063
2
Will match includes using regex and inserts the targeted file
def insert_includes # match all variables, every variable begins with an at (@). # variables can also end with a semicolon to have a safe declaration. @output = @output.gsub(/\<(.+)\>/) { match = Regexp.last_match[1] match.prepend('/') unless match.start_with?('/') IO.read("#{PATHS[:templa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include(pattern)\n includes << pattern\n end", "def addSrcFilesByRE(re)\n Dir.for_each(@srcDir) { |f|\n next if File.stat(f).dir?\n @files << f if re =~ f\n }\n end", "def link_include_file(file); end", "def link_include_file(file); end", "def add_includes out, includes\n re...
[ "0.67484003", "0.6091521", "0.6031272", "0.6031272", "0.59903973", "0.5945506", "0.59424204", "0.5906923", "0.59065837", "0.59065837", "0.5900456", "0.5867223", "0.5866309", "0.57928085", "0.5788634", "0.5766072", "0.56912977", "0.5670733", "0.5667128", "0.5647227", "0.564558...
0.7312966
0
Will match global Variables using regex and replaces with it's content
def insert_globals # match all global variables, every variable begins with an at (@). # variables can also end with a semicolon to have a safe declaration. @output = @output.gsub(/\[{3}\@(\w+)\]{3}/).each { match = Regexp.last_match[1] @globals[match] || "" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_variables_in_document!\n document.css('w|t').each do |text_node|\n text = text_node.text\n\n next unless text =~ VARIABLE_MATCHER\n next if has_skippable_variable?(text)\n\n variable_replacement = special_variable_replacement(text)\n\n text.gsub!(VARIABLE_MATCHER...
[ "0.6669045", "0.6418559", "0.6405557", "0.6405557", "0.6405557", "0.6405557", "0.6405557", "0.6405557", "0.6405557", "0.6405557", "0.6405557", "0.6405557", "0.6405557", "0.6405557", "0.6405557", "0.6405557", "0.6396349", "0.639527", "0.63673264", "0.62385136", "0.62293935", ...
0.6807937
0
Will match variables using regex and replaces them with it's content
def insert_variables # match all variables, every variable begins with an at (@). # variables can also end with a semicolon to have a safe declaration. @output = @output.gsub(/\[{3}(\w+)\]{3}/) { match = Regexp.last_match[1] @variables[match] || "" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mess_with_vars(one, two, three)\n one.gsub!(\"one\",\"two\")\n two.gsub!(\"two\",\"three\")\n three.gsub!(\"three\",\"one\")\nend", "def mess_with_vars(one, two, three)\n one.gsub!(\"one\",\"two\")\n two.gsub!(\"two\",\"three\")\n three.gsub!(\"three\",\"one\")\nend", "def mess_with_vars(one, two, th...
[ "0.72561026", "0.72561026", "0.72561026", "0.72561026", "0.72561026", "0.72561026", "0.72561026", "0.72561026", "0.72561026", "0.72561026", "0.72561026", "0.72561026", "0.72561026", "0.72561026", "0.72295046", "0.70506704", "0.70178187", "0.70108104", "0.6982565", "0.6703873", ...
0.6580855
21
Will match links like self:// and replaces it with the IP and Port (if not 80) that the Client connected to the Server
def insert_urls # match all variables, every variable begins with an at (@). # variables can also end with a semicolon to have a safe declaration. ip = Thread.current['client'].connect_address.ip_address port = Thread.current['client'].connect_address.ip_port @output = @output.gsub(/self\:\/\//) { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linkify(str)\n\t\t\tstr.gsub( %r{http://[^\"\\s]+} ) do |url|\n\t\t\t\tshort = url.gsub(%r{^.*#{Regexp.quote(request.host_with_port)}}, '')\n \t\t\"<a href='#{url}'>#{short}</a>\"\n\t\t\tend\n\tend", "def host_with_port\n request.host + (request.port == 80 ? '' : ':' + request.port.to_s)\n end", "de...
[ "0.60204625", "0.5763945", "0.57403946", "0.55586284", "0.5551127", "0.55501145", "0.5547039", "0.5540342", "0.553469", "0.55242765", "0.5522265", "0.5489845", "0.5488937", "0.5481473", "0.545737", "0.5442218", "0.5428913", "0.5423595", "0.5397181", "0.5379057", "0.5368098", ...
0.66809464
0
Write a method that returns 2 times the number provided as an argument, unless the argument is a double number; double numbers should be returned asis.
def twice(num) double?(num)? num : num * 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def times_two(num)\n num * 2\nend", "def times_two(nums)\n # your code\nend", "def twice(num)\n if num.to_s.length.even? && check_double(num.to_s.split('')) == true\n num\n else\n num * 2\n end\nend", "def double(n)\n return n * 2\nend", "def double(n)\n n.to_i * 2\n end", "def double_i...
[ "0.79050666", "0.7602991", "0.7519869", "0.7497422", "0.74027866", "0.7392523", "0.7273096", "0.7262097", "0.7213324", "0.7166072", "0.7082899", "0.7001792", "0.6945905", "0.6894237", "0.6863066", "0.68395203", "0.6823159", "0.6811078", "0.6807743", "0.676664", "0.6755928", ...
0.8143947
0
before_action :set_s3_direct_post, only: [:new, :edit, :create, :update] GET /posts
def index @posts = Post.all render json: @posts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_post\n @post = Post.friendly.find(params[:id])\n # authorize @post\n end", "def before_request\n @post = Post.find(params[:post])\n end", "def use_s3_proxy?(post)\n post.id < 100\n end", "def set_post\n #@post = Post.find(params[:id])\n @post = Post.find_by_slug...
[ "0.6389541", "0.63310766", "0.6204552", "0.6128291", "0.60622406", "0.6059791", "0.6037021", "0.6011377", "0.60094154", "0.6000336", "0.5923415", "0.5921504", "0.5899935", "0.5897513", "0.5892516", "0.5892516", "0.5867884", "0.5829231", "0.58000845", "0.57984096", "0.57982534...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_post @post = Post.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
Subscribe to next event (at most once) for specified type.
def once(event, &block) add_listener(event) do |*args, &callback| block.call(*args, &callback) :delete end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe(event_type, &handler)\n agent.events.subscribe(event_type, &handler)\n end", "def event(type)\n Event.register(type, self)\n end", "def subscribe(agent, type, collective)\n source = make_target(agent, type, collective)\n unless @subscriptions.include?(source)\n ...
[ "0.6777618", "0.6063964", "0.60530716", "0.6042694", "0.59555125", "0.59022474", "0.58687365", "0.5795903", "0.57423747", "0.56746924", "0.5598314", "0.55143476", "0.5457693", "0.5395264", "0.53365636", "0.5333398", "0.52769303", "0.5252978", "0.52453667", "0.5241746", "0.520...
0.0
-1
Emit event with provided arguments.
def emit(event, *args, &block) listeners(event).delete_if do |cb| cb.call(*args, &block) == :delete end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emit event, *args\n @services.emit event, self, *args\n end", "def emit event, *args\n if @callbacks.key?(event)\n @callbacks[event].call(*args)\n end\n end", "def emit(evt, **args)\n if evt.is_a?(Event)\n evt.source = self\n else\n evt = Event.new(evt, sourc...
[ "0.7450192", "0.7420638", "0.70472234", "0.69401616", "0.66214097", "0.65963745", "0.6555744", "0.6546731", "0.6441685", "0.64250016", "0.6409153", "0.6400326", "0.6295229", "0.62108284", "0.61576575", "0.61034846", "0.60056245", "0.5982121", "0.5912917", "0.59110266", "0.583...
0.5109431
96
Defines the scope of the controller and action method (i.e. view path) for using in i18n calls Used by meta tag helper methods (also see ApplicationController for super)
def controller_action_scope @controller_action_scope ||= @selected_hierarchy_entry ? super << :hierarchy_entry : super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translation_scope\n \"controllers.#{params[:controller]}\"\n end", "def controller_action_scope\n @controller_action_scope ||= controller_path.split(\"/\") << action_name\n end", "def translation_scope\n \"kiqr.#{controller_name}\"\n end", "def controlled_scope\n if %i(update c...
[ "0.6610599", "0.63434315", "0.6325155", "0.6297604", "0.617642", "0.61452514", "0.5917882", "0.5917882", "0.5765577", "0.5765577", "0.5731995", "0.5704015", "0.5703437", "0.5703437", "0.56859785", "0.5643381", "0.56381017", "0.5561181", "0.5518123", "0.5518123", "0.5518123", ...
0.6243093
4
Defines base variables for use in scoped i18n calls, used by meta tag helper methods (also see ApplicationController for super)
def scoped_variables_for_translations @scoped_variables_for_translations ||= super.dup.merge({ preferred_common_name: @preferred_common_name.presence, scientific_name: @scientific_name.presence, hierarchy_provider: @taxon_page.hierarchy_provider, }).freeze end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scoped_variables_for_translations\n @scoped_variables_for_translations ||= {\n :default => '',\n :scope => controller_action_scope }.freeze # frozen to force use of dup, otherwise wrong vars get sent to i18n\n end", "def inherited(base)\n base.instance_variable_set(\"@counter_key\", co...
[ "0.65570426", "0.6249395", "0.6122863", "0.6089886", "0.59959394", "0.5994422", "0.5994422", "0.5977498", "0.5967085", "0.59424585", "0.58684784", "0.5753363", "0.57343936", "0.56626004", "0.56393194", "0.56254053", "0.5618499", "0.5603214", "0.55937093", "0.5582466", "0.5556...
0.6920615
0
==== Required arguments client:: An instance of FinalCutServer::Client. address:: The FCS address of the entity, i.e. +'/asset/352' ==== Optional arguments other_metadata:: A hash of keyvalue pairs for metadata to prepopulate.
def initialize(client, address, other_metadata = {}) super(client, address) @written_md_vars = {} @metadata_loaded = false @metadata = {} key_lookup = self.class.md_key_map type_lookup = self.class.md_type_coercion_map other_metadata.each do |key, value| insert_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @client_id = args[:client_id] if args.key?(:client_id)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def set_client_bt_addresses_data(client_bt_addresses_data)\n @client_bt_addresses = CompanyApi::Response::Entity::C...
[ "0.56934464", "0.50738275", "0.50373465", "0.4909774", "0.4908012", "0.4908012", "0.4908012", "0.48818403", "0.48756543", "0.48733538", "0.48702943", "0.48702943", "0.48702943", "0.48702943", "0.4866514", "0.48622245", "0.48612645", "0.48610303", "0.48546198", "0.4837152", "0...
0.6004147
0
A simple method to return a named attribute by passing in its name. This is designed to be more idiomatic in search routines than using send(). It also performs a few more checks in an attempt to match all possible names for a member variable (i.e. you can supply the variable name or the metadata attribute name). ==== ...
def get_attribute(name) str = name.to_s # try fetching an instance variable first value = instance_variable_get("@#{str}") return value unless value.nil? # not an instance variable -- try fetching from @metadata load_metadata unless @metadata_loaded value = @metad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attribute(name)\n @attributes[name.to_s]\n end", "def get_attribute(name)\n @attributes[name]\n end", "def get_attribute(name)\n return @attrs[name] if attrs.key?(name)\n end", "def attribute(name)\n @attributes[name.to_sym]\n end", "def find_attribute_named(name...
[ "0.7908048", "0.77529866", "0.7715577", "0.76632714", "0.7598041", "0.74767566", "0.7463431", "0.74596596", "0.73990095", "0.7343757", "0.72120434", "0.7190013", "0.7166134", "0.7155414", "0.7149664", "0.7149664", "0.71348107", "0.71207374", "0.71207374", "0.7070214", "0.7054...
0.742937
8
implementation of method_missing to dynamically create new member variables as appropriate. This is based on MyOpenStruct in the Ruby 1.9 book.
def method_missing(name, *args, &block) return super unless block.nil? # don't do anything if handed a block return super if name =~ /^find_$/ # superclass wants to handle these itself str = name.to_s if str.end_with?('=') # setter method? return super unless args.size == 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(id, *attr, &block); end", "def method_missing(meth, *args); end", "def method_missing( sym, *args )\n\t\tkey = sym.to_s.sub( /(=|\\?)$/, '' ).to_sym\n\t\treturn nil unless @struct.member?( key )\n\n\t\tself.log.debug( \"Autoloading #{key} accessors.\" )\n\n\t\tself.class.class_eval %{\n\t\t\...
[ "0.6424983", "0.6422261", "0.6418907", "0.6417395", "0.64103174", "0.64103174", "0.64103174", "0.64103174", "0.64000744", "0.6390382", "0.6390382", "0.6373804", "0.6363687", "0.6361731", "0.6325771", "0.6325771", "0.6325771", "0.6316643", "0.6316643", "0.6314739", "0.6301902"...
0.62109005
25
Stores all modified metadata values (and ONLY those which have been set/modified) into Final Cut Server via the 'setmd' command.
def save_metadata updates = all_updates return if updates.empty? # build an array of strings to be passed directly into the command # we do this because of the funny quoting we have to do for the shell # since FCS will include any quotes wrapping a value as part of that value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_metadata(dataset, metadata = {})\n metadata = get_metadata(metadata)\n metadata.each { |k, v| dataset.metadata[k] = v }\n dataset.save\n end", "def set_metadata(*args)\n self.metadata.set(*args)\n end", "def update!(**args)\n @metadata = args[:metadata] if args.key...
[ "0.6237804", "0.60636705", "0.57785946", "0.5753829", "0.5713393", "0.5713393", "0.5713393", "0.5713393", "0.57020956", "0.5682764", "0.5645866", "0.5645866", "0.56155324", "0.5614582", "0.5597139", "0.55665493", "0.55220574", "0.551964", "0.55041176", "0.54483867", "0.544801...
0.72890973
0
Used by method_missing: the singleton class hack, used to add methods ONLY to the receiving instance.
def _singleton_class class << self self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def singleton_method_added(*) end", "def method_missing(method, *args, &blk); end", "def method_missing(method_name, *args) self end", "def method_missing(method_name, *args) self end", "def method_missing(sym, *args)\n # Extend this object only when needed and immediately redefine\n # #method_mi...
[ "0.7148", "0.6831812", "0.6812431", "0.6812431", "0.67802453", "0.6705875", "0.6699537", "0.66825545", "0.6670733", "0.6606167", "0.6606167", "0.6606167", "0.6575854", "0.65649074", "0.65649074", "0.6563016", "0.6543269", "0.6513924", "0.6477699", "0.64492077", "0.64370203", ...
0.0
-1
Performs a reverselookup of a variable name to a metadata name, returning the input value if no match was found. === Required Arguments name:: A metadata variable name to convert. Returns String
def metadata_version_of(name) self.class.md_key_map.each do |md_name, var_name| return md_name if var_name.to_s == name end name # return input if no mapping was discovered end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup(name)\n begin\n eval(sanitize(name));\n rescue NameError\n return nil\n end\n end", "def resolve_name(name)\n name = resolve_name_without_remap(name)\n for k, v in @remappings\n if name.end_with?(k)\n if Resolver.global_name?(v)\n name = v\n ...
[ "0.6694559", "0.6511275", "0.6213936", "0.60622513", "0.60195965", "0.59140426", "0.58916706", "0.5870835", "0.58542746", "0.5836139", "0.5822999", "0.5818866", "0.58049357", "0.5756059", "0.5751936", "0.5728522", "0.5711737", "0.5686359", "0.5614984", "0.5608842", "0.5585704...
0.6106395
3
Loads metadata using the standard text format. This doesn't return as many variables as the XML format.
def load_text_metadata str = self.client.getmd({}, @address) keymap = self.class.md_key_map # subclasses implement this function types = self.class.md_type_coercion_map # subclasses might implement this function # regular expression: matches lines with: # 4 whitespace chara...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_xml_metadata\n str = self.client.getmd({:xml => true}, @address)\n return if str.empty?\n \n keymap = self.class.md_key_map\n types = self.class.md_type_coercion_map\n \n doc = REXML::Document.new(str)\n return if doc.nil?\n \n # <session><values>...</valu...
[ "0.6547107", "0.6219008", "0.6193891", "0.6193891", "0.6121503", "0.60392314", "0.60083413", "0.5948754", "0.59322596", "0.5931013", "0.5891169", "0.5806273", "0.57867646", "0.57546175", "0.5730961", "0.5723131", "0.5694644", "0.5686892", "0.56612915", "0.5653308", "0.5630027...
0.7158562
0
Loads metadata using the XML output format. This format returns more variables than the textbased stdout format, so is potentially more useful. It is not (currently) the default, however.
def load_xml_metadata str = self.client.getmd({:xml => true}, @address) return if str.empty? keymap = self.class.md_key_map types = self.class.md_type_coercion_map doc = REXML::Document.new(str) return if doc.nil? # <session><values>...</values></session> ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata_xml\n Nokogiri::XML(original_file.content)\n end", "def metadata\n Hash.from_xml(self[:metadata])['hash']\n end", "def metadata_print\n build_metadata_output\n if options[:metadata_output]\n if options[:out_format] == :json\n json_print_to_file\n end\n ...
[ "0.63095975", "0.57932216", "0.5695611", "0.56539524", "0.56111443", "0.5541462", "0.5463855", "0.54521704", "0.5448767", "0.5434201", "0.54000497", "0.539434", "0.53409", "0.5328668", "0.5310293", "0.5309125", "0.5300661", "0.5300661", "0.52612954", "0.5228875", "0.5211104",...
0.67365366
0
Performs the internals of inserting a metadata value into the metadata hash. This takes the key/value pair for the metadata item along with two hashes used to look up a custom variable name and a custom value type. ==== Required arguments key:: The key, as output by Final Cut Server. value:: The value, as a string, out...
def insert_metadata(key, value, key_lookup, type_lookup = {}, nodetype = nil) name = key_lookup[key] name ||= key coercion = type_lookup[key] unless coercion.nil? value = value.send(coercion) end @metadata[name.to_s] = value @metadata[key + "_node"] = {"value" => value,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_key_lookup_method(key_value, value)\n key_lookup_method_name = sanitize(\"#{value}_#{@key_name}\")\n @modyule::ClassMethods.instance_exec(key_lookup_method_name, key_value, value) do |method_name, key_value|\n define_method method_name do\n key_value\n end\n end\n e...
[ "0.5182496", "0.51729673", "0.5166195", "0.5059286", "0.50312924", "0.5008268", "0.5008268", "0.49937725", "0.49215883", "0.48887467", "0.47694024", "0.4731987", "0.4724641", "0.4713012", "0.47008118", "0.4664521", "0.45976898", "0.45687705", "0.45626447", "0.45593724", "0.45...
0.83128905
0
Writers keep track of which values have been set, for the benefit of +all_updates()+.
def md_writer(*accessors) accessors.each do |m| # build a definition (as above) class_eval <<-EOS def #{m}=(val) @written_md_vars["#{m}".to_sym] = (value.nil? ? false : true) instance_variable_set("@#{m}", val) end EOS end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_written; end", "def write(value_or_values)\n update(value_or_values)\n\n refresh\n end", "def write_changed_attributes\n @properties.each do |attribute, value|\n write_attribute(attribute, value) if changed_attributes.has_key?(attribute)\n end\n end", ...
[ "0.64717066", "0.6040058", "0.5875017", "0.57559687", "0.5718521", "0.5705889", "0.5691505", "0.5613956", "0.55958295", "0.55452263", "0.55452263", "0.55111533", "0.5471214", "0.5463771", "0.54307014", "0.54278207", "0.54278207", "0.5409729", "0.5391778", "0.53892183", "0.535...
0.5311128
23
Accessor creates both the reader and writer methods.
def md_accessor(*accessors) md_reader(*accessors) md_writer(*accessors) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_accessors(name, meth, options = {})\n field = fields[name]\n generated_field_methods.module_eval do\n if field.cast_on_read?\n define_method(meth) do\n field.get(read_attribute(name))\n end\n else\n define_method(meth) do\n ...
[ "0.694946", "0.6948891", "0.69260514", "0.69150925", "0.6850598", "0.67784816", "0.6776837", "0.67124194", "0.66730523", "0.6672978", "0.6645739", "0.66098887", "0.65441746", "0.65235186", "0.65055823", "0.6495506", "0.6436694", "0.64354014", "0.6396605", "0.6386599", "0.6330...
0.66855675
8
search games at BGA API
def search games_data = BoardGameAtlas::API.search(params[:name]) render json: { games: games_data.map } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_search(name)\n @search.offset(3)\n @search.limit(15) # max 100\n @search.resources('game')\n @search.fields('id')\n @search.query(name)\n return @search.fetch\n end", "def autocomplete_game_search \t\t\t\t \n #@games = Game.name_like(params[\"q\"...
[ "0.7728941", "0.7577367", "0.7462588", "0.718495", "0.7132607", "0.7077911", "0.6873956", "0.6736302", "0.6713676", "0.66998297", "0.66755366", "0.66598505", "0.66377807", "0.6632874", "0.6588735", "0.6540465", "0.64711744", "0.6455172", "0.6428813", "0.6397688", "0.63926226"...
0.78639144
0
Default site subtitle (also used in feed.xml.builder)
def site_subtitle "Cool site with cool stuff" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtitle\n if @subtitle.nil?\n subtitle_node = FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"atom10:subtitle\",\n \"subtitle\",\n \"atom03:tagline\",\n \"tagline\",\n \"description\",\n \"summary\",\n \"abstract\",\n ...
[ "0.7426333", "0.7041604", "0.6983768", "0.68574595", "0.67189986", "0.6580727", "0.65332544", "0.6523304", "0.6519509", "0.6485717", "0.6390189", "0.63786924", "0.6356014", "0.6356014", "0.63197696", "0.62933975", "0.6286959", "0.62716204", "0.6234324", "0.62275755", "0.62246...
0.74995404
0
Defines active class for navigation
def nav_active(url) active_nav_class = "current" if (url.instance_of? String) current_resource.url == url_for(url) ? {class: active_nav_class} : {} elsif (url.instance_of? Array) url.map { |url| url_for(url) }.include?(current_resource.url) ? {class: active_nav_class} : {} else {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_class(link_path)\n active = current_page?(link_path) ? \"active\" : \"no-active\"\n end", "def active_class(link_path)\n active = current_page?(link_path) ? \"active\" : \"no-active\"\n end", "def active_class(link_path)\n current_page?(link_path) ? 'active' : ''\n end", "def active_cl...
[ "0.7772538", "0.7772538", "0.7721563", "0.771901", "0.76885927", "0.7598109", "0.741929", "0.7378344", "0.7306055", "0.7237804", "0.72237355", "0.7197736", "0.70897716", "0.70582837", "0.7046552", "0.6939241", "0.69239175", "0.6905497", "0.69050515", "0.6863381", "0.68099266"...
0.760575
5
GET /session_infos/new GET /session_infos/new.json
def new @session_info = SessionInfo.new @downloads = Download.all(order: 'name') respond_to do |format| format.html # new.html.erb format.json { render json: @session_info } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @session = Session.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @session }\n end\n end", "def new\n @session = Session.new\n\n respond_to do |format|\n format.json { render json: @session }\n format.html # new.html.erb\n ...
[ "0.78751016", "0.77954537", "0.74880314", "0.7318297", "0.72459984", "0.72439575", "0.71582925", "0.7122344", "0.70199764", "0.701617", "0.699136", "0.6961006", "0.69321316", "0.6886025", "0.68395907", "0.68241537", "0.68106174", "0.6803262", "0.6797014", "0.6788581", "0.6787...
0.7556212
2
POST /session_infos POST /session_infos.json
def create @session_info = SessionInfo.new(params[:session_info]) respond_to do |format| if @session_info.save format.html { redirect_to session_information_path, notice: 'Session Info was successfully set up!' } format.json { render json: @session_info, status: :created, location: @sessi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_params(path, params, session)\n post path, params, {\"rack.session\" => {\"uid\" => session['uid']}}\n end", "def submitSessionInfos\n # check if data submission is offline\n is_offline_sensor_data_collection = false\n\n # not having valid device id or device type. \n if params.has_key?(...
[ "0.6610002", "0.6407373", "0.631703", "0.63137215", "0.6272456", "0.62656206", "0.61725247", "0.6128397", "0.6110168", "0.6100425", "0.60985047", "0.60948044", "0.609277", "0.60906124", "0.60652584", "0.6061413", "0.60509753", "0.599391", "0.5980114", "0.59765583", "0.5954522...
0.72543615
0
PUT /session_infos/1 PUT /session_infos/1.json
def update @session_info = SessionInfo.first respond_to do |format| if @session_info.update_attributes(params[:session_info]) format.html { redirect_to session_information_path, notice: 'Session Info was successfully updated.' } format.json { head :no_content } else format.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_session_info\n @session_info = SessionInfo.find(params[:id])\n end", "def update!(**args)\n @session_info = args[:session_info] if args.key?(:session_info)\n end", "def update\n @current_session = CurrentSession.find(params[:id])\n\n if @current_session.update(params[:curr...
[ "0.6777331", "0.6697766", "0.66371095", "0.6597923", "0.6580993", "0.65347904", "0.65108323", "0.65108323", "0.6510306", "0.6499074", "0.64884746", "0.6479503", "0.6409709", "0.6396149", "0.63598454", "0.63598454", "0.63598454", "0.63598454", "0.63492227", "0.6337136", "0.624...
0.72411245
0
DELETE /session_infos/1 DELETE /session_infos/1.json
def destroy @session_info = SessionInfo.first @session_info.destroy respond_to do |format| format.html { redirect_to session_infos_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n format.html { redirect_to sessions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @session = Session.find(params[:id])\n @session.destroy\n\n respond_to do |format|\n ...
[ "0.71607554", "0.71334016", "0.71201646", "0.70971656", "0.7039116", "0.70099235", "0.69956994", "0.69672155", "0.69610506", "0.69384515", "0.69098127", "0.6906188", "0.69012356", "0.68999255", "0.68944615", "0.6879059", "0.68107337", "0.68107337", "0.68107337", "0.68107337", ...
0.76051724
0
Tells the criteria that the cursor that gets returned needs to be cached. This is so multiple iterations don't hit the database multiple times, however this is not advisable when working with large data sets as the entire results will get stored in memory.
def cache clone.tap { |crit| crit.options.merge!(:cache => true) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each\n # If the caching cursor is closed and was not fully iterated,\n # the documents we have in it are not the complete result set and\n # we have no way of completing that iteration.\n # Therefore, discard that cursor and start iteration again.\n # The case of th...
[ "0.67836", "0.64725846", "0.6328692", "0.6186428", "0.61699015", "0.5932942", "0.59199744", "0.5845907", "0.5845907", "0.5745829", "0.5745829", "0.57315165", "0.572777", "0.56959", "0.562442", "0.562442", "0.562442", "0.562442", "0.562442", "0.562442", "0.562442", "0.561876...
0.58902323
7
Will return true if the cache option has been set.
def cached? options[:cache] == true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache?\n caching && true\n end", "def cached?\n cache_path.exist?\n end", "def cached?\n cache_path.exist?\n end", "def use_cache?(opts = {})\n return true if opts[:cache].nil?\n opts[:cache]\n end", "def cache?\n false\n end", "def cacheable...
[ "0.8540214", "0.83419806", "0.8334531", "0.81932855", "0.8168104", "0.7981698", "0.79800546", "0.79589504", "0.795544", "0.7924475", "0.79202956", "0.7826848", "0.7826848", "0.78129274", "0.7792382", "0.77902126", "0.77527595", "0.76887536", "0.7571769", "0.7554074", "0.75540...
0.89923304
0
Adds fields to be sorted in descending order. Will add them in the order they were passed into the method.
def descending(*fields) clone.tap do |crit| setup_sort_options(crit.options) unless fields.first.nil? fields.flatten.each { |field| merge_options(crit.options[:sort], [ localize(field), :desc ]) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_data_descending!(*sort_keys)\n self.sort_data!(false, sort_keys)\n end", "def sort sortfield = :id, descending = false\n @sortfield = sortfield.to_sym\n reverse = descending ? -1 : 1\n @data = @data.compact.sort { |us1, us2|\n comp =\n if us1[@sortfield] && us2[@sortfield]\n ...
[ "0.70184344", "0.68535954", "0.6753256", "0.6709293", "0.64873844", "0.6458653", "0.6458653", "0.64376307", "0.6432121", "0.64053994", "0.63183355", "0.63170326", "0.62534815", "0.623287", "0.62311345", "0.6210512", "0.6128143", "0.60705745", "0.60129136", "0.6012826", "0.600...
0.77105254
0
Adds a criterion to the +Criteria+ that specifies additional options to be passed to the Ruby driver, in the exact format for the driver.
def extras(extras) clone.tap do |crit| crit.options.merge!(extras) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_criterion(criterion_name, options = {})\n operators = options.delete(:operators) || self.default_operators\n display_name = options.delete(:display) || criterion_name.to_s.titleize\n type = options.delete(:type) || self.default_type\n choices = options.delete(:cho...
[ "0.6689618", "0.6107336", "0.56981736", "0.5630826", "0.56049937", "0.5536943", "0.5526683", "0.5508378", "0.5408553", "0.5393267", "0.53858405", "0.5372554", "0.5370306", "0.5349655", "0.5340124", "0.53361756", "0.530862", "0.5288347", "0.5287559", "0.52813", "0.52466226", ...
0.48567742
37
Adds a criterion to the +Criteria+ that specifies an id that must be matched.
def for_ids(*ids) field = klass.fields["_id"] ids.flatten! if ids.size > 1 any_in(:_id => ids.map{ |id| field.serialize(id) }) else where(:_id => field.serialize(ids.first)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_criteria(id)\n find(@data_criteria, :id, id)\n end", "def add_condition(condition)\n @conditions[condition.id] = condition\n end", "def set_criterion\n @criterion = Criterion.find(params[:id])\n end", "def set_criterion\n @criterion = Criterion.find(params[:id])\n end", ...
[ "0.6346296", "0.62905014", "0.6183764", "0.6183764", "0.6083398", "0.6051726", "0.56183636", "0.56183636", "0.5560778", "0.54164886", "0.53840077", "0.5371845", "0.5287795", "0.52802736", "0.52491635", "0.5113263", "0.5110251", "0.50713414", "0.5054926", "0.5053746", "0.50434...
0.0
-1
Adds a criterion to the +Criteria+ that specifies the maximum number of results to return. This is mostly used in conjunction with skip() to handle paginated results.
def limit(value = 20) clone.tap { |crit| crit.options[:limit] = value.to_i } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def limit(criteria, relation)\n return relation unless criteria.limit?\n\n relation.limit(criteria.limit)\n end", "def limit(max_results)\n params[:max_results] = max_results\n self\n end", "def add_limit(limit)\r\n filter.max_returned = limit if limit\r\n end", "def l...
[ "0.6629064", "0.6454987", "0.64077395", "0.6149204", "0.5939181", "0.5939181", "0.5939181", "0.5939181", "0.5939181", "0.5939181", "0.5939181", "0.5939181", "0.5857985", "0.5857985", "0.5857985", "0.5857985", "0.5857985", "0.5857985", "0.5857985", "0.5857985", "0.5857985", ...
0.6440333
2
Returns the offset option. If a per_page option is in the list then it will replace it with a skip parameter and return the same value. Defaults to 20 if nothing was provided.
def offset(*args) args.size > 0 ? skip(args.first) : options[:skip] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offset\n @options[:offset] || ((current_page - 1) * per_page)\n end", "def offset\n if page <= 1\n # We want first page of results\n 0\n else\n # Max offset for search API is 999\n # If there are 20 results and the user requests page 3, there will be an empty res...
[ "0.81844175", "0.7261554", "0.7110373", "0.70608175", "0.6996755", "0.6996755", "0.6996755", "0.6959245", "0.69124764", "0.6912208", "0.6882053", "0.68754655", "0.6796971", "0.6589937", "0.65462846", "0.6538712", "0.65279675", "0.64522517", "0.6451732", "0.64049214", "0.64009...
0.586202
61
Adds a criterion to the +Criteria+ that specifies the sort order of the returned documents in the database. Similar to a SQL "ORDER BY".
def order_by(*args) clone.tap do |crit| arguments = args.size == 1 ? args.first : args setup_sort_options(crit.options) unless args.first.nil? if arguments.is_a?(Array) #[:name, :asc] if arguments.size == 2 && (arguments.first.is_a?(Symbol) || arguments.firs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order(criteria, relation)\n return relation unless criteria.order?\n order_str = convert_order_exprs(criteria.order_by)\n relation.order(order_str)\n end", "def sort_criteria\n @sort_criteria ||=\n sort_params.reduce('') do |sum, (key, value)|\n comparables = [\...
[ "0.6505581", "0.6475437", "0.63960624", "0.63456553", "0.6086027", "0.60317916", "0.60203606", "0.5903549", "0.5817711", "0.5671406", "0.5654073", "0.5648508", "0.5619825", "0.5591694", "0.55770874", "0.556816", "0.5546382", "0.55103105", "0.54681855", "0.54172796", "0.537287...
0.5157102
58
Adds a criterion to the +Criteria+ that specifies how many results to skip when returning Documents. This is mostly used in conjunction with limit() to handle paginated results, and is similar to the traditional "offset" parameter.
def skip(value = 0) clone.tap { |crit| crit.options[:skip] = value.to_i } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip(val)\n @query[:skip] = val.to_i\n self\n end", "def skip(value)\n query_proxy = OData::Model::QueryProxy.new(self)\n query_proxy.skip(value.to_i)\n end", "def skip(num)\n @skip = num\n self\n end", "def skip(value = 0)\n update_query(:skip ...
[ "0.63028216", "0.6207649", "0.5867095", "0.5740079", "0.54251504", "0.5289611", "0.5199218", "0.51490885", "0.50720614", "0.5046218", "0.5008791", "0.5006943", "0.5003905", "0.49965066", "0.49692085", "0.49679887", "0.49660105", "0.49516445", "0.4912931", "0.49075317", "0.483...
0.6400104
0
Adds a criterion to the +Criteria+ that specifies a type or an Array of types that must be matched.
def type(types) types = [types] unless types.is_a?(Array) any_in(:_type => types) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_type_filter(criteria)\n unless params[:type_uri].blank?\n @type_filter = params[:type_uri]\n @type = RdfType.find(@type_filter) rescue nil\n criteria.where(\"?uri a <#{@type_filter}>\")\n end\n criteria\n end", "def search_type(value)\n fresh.tap do |criteria|\...
[ "0.6638304", "0.57155293", "0.5597093", "0.55251044", "0.5403183", "0.5390086", "0.53491557", "0.52369094", "0.5217489", "0.51956624", "0.51358175", "0.5114941", "0.5101192", "0.50955373", "0.5088192", "0.50861746", "0.50800115", "0.50701183", "0.5068001", "0.50436205", "0.50...
0.49208587
29
Build ordering options from given arguments on given criteria
def build_order_options(arguments, crit) case arguments when Hash if arguments.size > 1 raise ArgumentError, "Please don't use hash to define multiple orders " + "due to the fact that hash doesn't have order this may cause unpredictable results" end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_by(*args)\n clone.tap do |crit|\n arguments = args.size == 1 ? args.first : args\n setup_sort_options(crit.options) unless args.first.nil?\n if arguments.is_a?(Array)\n #[:name, :asc]\n if arguments.size == 2 && (arguments.first.is_a?(Symbol) || arg...
[ "0.7279252", "0.6927263", "0.68803287", "0.66803944", "0.66550803", "0.6526081", "0.65225", "0.63333654", "0.6329146", "0.6292499", "0.6276262", "0.6271736", "0.6168417", "0.61220783", "0.60992545", "0.60649854", "0.59822613", "0.5978428", "0.59556717", "0.59556717", "0.58904...
0.8215929
0
Merge options for order_by criterion Allow only one order direction for same field
def merge_options(options, new_option) old_option = options.assoc(new_option.first) if old_option options[options.index(old_option)] = new_option.flatten else options << new_option.flatten end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agregate_order_by(params, options)\n case params[:order_by].to_s\n when \"direction\" then\n order_by = \"destinations.direction_code\"\n when \"destination\" then\n order_by = \"destinations.name\"\n when \"customer_orig\" then\n order_by = \"nice_user\"\n when \"cu...
[ "0.7254095", "0.68443567", "0.68355936", "0.67659116", "0.67026067", "0.65082264", "0.6487163", "0.6487163", "0.6487163", "0.6440155", "0.6439937", "0.64179176", "0.63841414", "0.6349619", "0.6314057", "0.6308461", "0.62894475", "0.623257", "0.6216258", "0.61284214", "0.61207...
0.0
-1
Initialize the sort options Set options[:sort] to an empty array if it does not exist, or dup it if it already has been defined
def setup_sort_options(options) options[:sort] = options[:sort] ? options[:sort].dup : [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort(sort = nil)\n set_option(:sort, sort)\n end", "def sort_by(options)\n self.sort = options\n end", "def __sort_option__\n multi.inject({}) do |options, criteria|\n options.merge!(criteria.__sort_pair__)\n options\n end\n end", "...
[ "0.77580744", "0.74720985", "0.74361396", "0.7094499", "0.6853891", "0.68376184", "0.6736563", "0.6684697", "0.6626105", "0.66165036", "0.6519105", "0.65055937", "0.6495094", "0.6401503", "0.63508505", "0.6289324", "0.62623394", "0.62566864", "0.62024105", "0.6178901", "0.615...
0.89667267
0
Check if field is localized and return localized version if it is.
def localize(field) if klass.fields[field.to_s].try(:localized?) field = "#{field}.#{::I18n.locale}".to_sym end field end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localized?\n field = self.content_type.label_field\n !!field.try(:localized)\n end", "def localized?\n self.entries_custom_fields.where(localized: true).count > 0\n end", "def localized?\n true\n end", "def method_missing(*args, &block)\n if current_version...
[ "0.7064515", "0.66471714", "0.64903945", "0.6473739", "0.6194673", "0.60420907", "0.5957645", "0.5866293", "0.5844424", "0.5791125", "0.568738", "0.567192", "0.566203", "0.557825", "0.55254614", "0.55236334", "0.55042803", "0.55014974", "0.54862493", "0.54484135", "0.5445325"...
0.6978605
1
def date_save_format if self.years.present? years = self.years.insert(0, "01") self.years = DateTime.parse(years).to_date.to_s if self.years.present? end starting = self.starting.insert(0, "01") self.starting = DateTime.parse(starting).to_date.to_s end
def input_date_format(date) if date.split("-").count > 2 new_date = date.split("-") return new_date[1] + "-" + new_date[0] else return date end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reformat_date_for_save(date_string)\n return if date_string.nil?\n month = \"1\"\n day = \"1\"\n year = \"1900\"\n #match = date_string.gsub(\"-\",\"/\").match(/(\\d+)\\/|\\-(\\d+)\\/|\\-(\\d+)/)\n match = date_string.gsub(\"-\", \"/\").split(\"/\")\n month_numbers = {\"Jan\" => \"1\", \"F...
[ "0.65467304", "0.6423214", "0.64140713", "0.63018745", "0.6267532", "0.61573523", "0.61565113", "0.61402524", "0.6138775", "0.61218166", "0.6114782", "0.6070694", "0.606999", "0.60118395", "0.6000438", "0.59605706", "0.59456545", "0.59358764", "0.5924183", "0.59124273", "0.58...
0.0
-1
POST /attendances POST /attendances.xml
def create attendance = Attendance.new(params[:attendance]) event = Event.find(attendance.event_id) #fill out the vote and selection allowances for attendees attendance.votes_remaining = event.votes_per_attendee attendance.selections_remaining = event.selections_per_attendee if attendance.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @attendance = Attendance.new(attendance_params)\n\n respond_to do |format|\n if @attendance.save\n format.html { redirect_to @attendance, notice: 'Attendance was successfully created.' }\n format.json { render :show, status: :created, location: @attendance }\n else\n ...
[ "0.6887276", "0.6887276", "0.6887276", "0.6887276", "0.68746793", "0.6799558", "0.6755808", "0.66039085", "0.6541489", "0.6335083", "0.6249904", "0.6172988", "0.61415917", "0.6103511", "0.606883", "0.60686046", "0.60413486", "0.5993068", "0.5980936", "0.59747964", "0.5951633"...
0.5585522
79
DELETE /attendances/1 DELETE /attendances/1.xml
def destroy attendance = Attendance.find(params[:id]) if( current_user.authorized?(attendance.attending_id) or current_user.authorized?(attendance.inviting_id) ) attendance.destroy respond_to do |format| format.html { redirect_to(current_user, :notice => 'Successfully destroyed invitation or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @attendance = Attendance.find(params[:id])\n @attendance.destroy\n\n respond_to do |format|\n format.html { redirect_to(attendances_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @student_attendance = StudentAttendance.find(params[:id])\n @student_attend...
[ "0.7561458", "0.72912836", "0.7222697", "0.710577", "0.70458895", "0.70143265", "0.70143265", "0.6965131", "0.681375", "0.6768147", "0.6740856", "0.6740856", "0.6740856", "0.6740856", "0.6740856", "0.6740856", "0.6740856", "0.6729605", "0.6674631", "0.6654001", "0.66178256", ...
0.0
-1
Helps you slice and dice your addons to advacms load and slice (patch) the class +Existing::Stuff+ in 'ur/engine/existing/stuff_slice.rb' Adva.slice 'existing/stuff' do include do def fn0rd 23 + 42 end end attr_accessor :things end
def slice(path_with_namespace, &block) raise ArgumentError, 'must give block to slice and dice' unless block_given? if path_with_namespace =~ /^([^#]+)#([^#]+)$/ path, namespace = $1, $2 else raise ArgumentError, "first argument must be class_to_slice#your_slice_identifier" end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_slice(*args)\n # It also lazy-initializes the `Slice` subclass with the modules that are\n # whitelisted by `INHERITED_SLICE_MODULES`.\n unless defined? @_slice_class_initialized\n included_modules.each do |mod|\n if mod.name && INHERITED_SLICE_MODULES.include?(mod.name.sub(/...
[ "0.5753956", "0.5652503", "0.56276244", "0.5512477", "0.54944587", "0.5371841", "0.53424287", "0.53331435", "0.53128153", "0.531132", "0.5287377", "0.5287377", "0.5210767", "0.5210767", "0.5204373", "0.51864797", "0.5179551", "0.51567495", "0.5147195", "0.51447254", "0.512835...
0.5772339
0
returns the type of question as multiple response or multiple choice
def question_type if multiple_choice? I18n.t('course.assessment.question.multiple_responses.question_type.multiple_choice') else I18n.t('course.assessment.question.multiple_responses.question_type.multiple_response') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def question_type\n prompts.first.andand.question_type\n end", "def act_on_question_types\n case question_type\n when 'yes_no_question' then handle_yes_no_question\n when 'or_question' then handle_or_question\n else\n handle_not_a_question\n end\n end", "def get_formatted_question_type...
[ "0.7321216", "0.72312456", "0.71519357", "0.69230765", "0.6730114", "0.64955986", "0.6465162", "0.6387876", "0.6387876", "0.6368665", "0.63379353", "0.62367386", "0.621981", "0.621981", "0.61882204", "0.6168341", "0.6162953", "0.61433166", "0.6136578", "0.6127904", "0.6115897...
0.8202606
0
A Multiple Response Question can randomize the order of its options for all students (ignoring their weights) Each student's answer stores a seed that is used to deterministically shuffle the options since each student has a different seed, they see a different order to the options Certain options can ignore randomizat...
def ordered_options(current_course, seed = nil) return options if !current_course.allow_mrq_options_randomization || !randomize_options || seed.nil? randomized_options = [] non_randomized_options = [] options.each do |option| if option.ignore_randomization non_randomized_options.append(op...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answers\n return (distractor + [correct]).shuffle\n end", "def answers\n return (distractor + [correct]).shuffle\n end", "def show\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n @possible_answers = []\n @multiple_choice_question.wrong_answers.split(\...
[ "0.67800796", "0.67800796", "0.63346314", "0.6254849", "0.6210984", "0.61945415", "0.6150164", "0.61410373", "0.6140079", "0.61269957", "0.61080724", "0.609079", "0.6074944", "0.60660547", "0.60484636", "0.6014114", "0.5931301", "0.5924523", "0.5885433", "0.5841894", "0.57935...
0.7080348
0
Use callbacks to share common setup or constraints between actions.
def set_person @person = PartyPerson.find_by(ip: ip) 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
Sends an invitation associated with a mandatory user filter
def invite(email, role, label_or_expression, value) muf = prepare label_or_expression, value invitation = { "invitations" => [ { "invitation" => { "content" => { "email" => email, "userFilters" => [ muf[:url] ], "role" => role } } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accept_invitation\n \n end", "def match_to_invitation_or_send_email\n if invitation = joinable.membership_invitation_for(user)\n invitation.accept(invitation.user)\n else\n UserMailer.project_membership_request_created_email(joinable.who_can?(:manage), self).deliver\n end\n end", ...
[ "0.65699095", "0.64182264", "0.6366401", "0.6217742", "0.6145851", "0.61340106", "0.61091423", "0.60993344", "0.6092385", "0.60811055", "0.60720366", "0.60521764", "0.6048454", "0.6042676", "0.60005623", "0.5999328", "0.5961476", "0.595756", "0.59261936", "0.5918618", "0.5901...
0.5906182
20
Create a GoodData object holding the "key = value" filtering expression
def create_filter(title, expression) filter = { "userFilter" => { "content" => { "expression" => expression }, "meta" => { "category" => "userFilter", "title" => title } } } puts filter.to_json GoodData.post "/gdc/md/#{@project_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def [](*args)\n filtered = @conditions\n args.each do |filter|\n type = valid_operator?(filter) ? nil : :key\n filtered = filter_conditions(filtered) do |op, key, value|\n (match, type) = match_triple(filter, type, op, key, value)\n match\n ...
[ "0.6212296", "0.5999267", "0.59418607", "0.5906658", "0.5871781", "0.5838242", "0.5822208", "0.58063453", "0.57729864", "0.57374024", "0.5736424", "0.5721876", "0.56415635", "0.56270003", "0.5626426", "0.5625486", "0.557253", "0.55632514", "0.5525554", "0.55183774", "0.551587...
0.64998657
0
Associate the referenced filter with the referenced user
def set_user_filter(user_url, filter_url) user_filter = { "userFilters" => { "items" => [ { "user" => user_url, "userFilters" => [ filter_url ] } ] } } GoodData.post "/gdc/md/#{@project_id}/userfilters", user_filter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_filters\n @filters = @user.user_filters\n @filter = UserFilter.new\n @parent = @user\n end", "def add_challenge_reviewer_filter_to_submission_box(user)\n sub_collection = parent_submission_box&.submissions_collection\n\n return unless inside_a_challenge? && sub_collection.present? && user...
[ "0.63018423", "0.6206107", "0.60902154", "0.57976574", "0.569761", "0.56653297", "0.55163175", "0.55028826", "0.54553324", "0.54129744", "0.53770816", "0.5376727", "0.5376411", "0.53757596", "0.5366141", "0.5354415", "0.53508073", "0.5350524", "0.533523", "0.5334315", "0.5326...
0.6263312
1
Returns a GoodData URI representing the value of given label
def value2uri(label, value) elements_url = label['links']['elements'] uri = "#{elements_url}?filter=#{URI::encode value}" resp = GoodData.get uri elements = resp['attributeElements']['elements'] if elements && !elements.empty? matching = resp['attributeElements']['elements'].find { |e| e['ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parsed_label_uri(value)\n value.split('$').first\n end", "def location_label(value)\n value\n end", "def rdf_label\n labels = Array.wrap(self.class.rdf_label)\n labels += default_labels\n labels.each do |label|\n values = get_values(label)\n return values unless...
[ "0.6361304", "0.56663126", "0.56574595", "0.56556386", "0.5621052", "0.5614354", "0.5507734", "0.54949045", "0.54763144", "0.54728484", "0.54728484", "0.54728484", "0.54728484", "0.54728484", "0.54728484", "0.54611146", "0.5454869", "0.5453414", "0.5413013", "0.54034466", "0....
0.75914836
0
Helper methods for all objects:
def new_parser_with_data doc = load_sample_xml parser = GreenButton::Parser.new(doc) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "...
[ "0.7011118", "0.7011118", "0.7011118", "0.7011118", "0.7011118", "0.7011118", "0.7011118", "0.7011118", "0.7011118", "0.7011118", "0.7011118", "0.7011118", "0.7011118", "0.7011118", "0.7011118", "0.69673604", "0.68192405", "0.65793866", "0.6535871", "0.6479131", "0.64752305",...
0.0
-1
Accepts an array of abilities Each ability will be represented by a hash with a name and "coolness" rating
def initialize(abilities) @abilities = abilities end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abilities\n\t\t\t@abilities ||= {}\n\t\tend", "def abilities\n @abilities ||= Six.new\n end", "def ability(*_args)\n tests = {}\n if _args.last.is_a? Hash\n _args[1...-1].each { |sym| tests[sym] = {} }\n tests.merge!(_args.last)\n else\n _...
[ "0.6072003", "0.6054868", "0.60213083", "0.5937911", "0.5852241", "0.5784253", "0.56816006", "0.56725454", "0.5606029", "0.5545251", "0.5523871", "0.5480722", "0.5446989", "0.5433091", "0.540841", "0.54052716", "0.5394423", "0.5380122", "0.5335929", "0.53331554", "0.52959824"...
0.52634543
22
Returns the heros coolest ability
def coolest_ability coolest_ability = nil abilities.each do | current_ability | if coolest_ability == nil || current_ability[:coolness] > coolest_ability[:coolness] coolest_ability = current_ability end end coolest_ability end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ability\n return @ability_current\n end", "def current_ability\n current_user.ability\n end", "def current_ability\n current_admin.ability\n end", "def power_of_attorney\n claimants.first&.power_of_attorney\n end", "def power_of_attorney\n claimants.first&.power_of_attorney\n en...
[ "0.70090675", "0.63257414", "0.6224188", "0.61972666", "0.61972666", "0.6172296", "0.61680055", "0.61376184", "0.60244614", "0.60244614", "0.60244614", "0.60244614", "0.60244614", "0.6013164", "0.5965622", "0.59529305", "0.5947527", "0.5931438", "0.5931438", "0.5902878", "0.5...
0.6944584
1
Returns abilities Ordered Alphabetically
def ordered_abilities ability_names.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alphabetize!\n sort! { |a, b| grouped_compare(a, b) }\n end", "def hows_by_alphabetical_order\nend", "def sort_alpha\n @assets = @assets.sort_by { |h| h[:name] }\n #redirect_to user_path\n end", "def ordered_letters\n @word.chars.sort.join\n end", "def alphabetize\n\nend", "def s...
[ "0.6808894", "0.6537755", "0.6424173", "0.63859326", "0.62782276", "0.62661713", "0.62488025", "0.62488025", "0.6213758", "0.6213758", "0.6198303", "0.617542", "0.61442375", "0.61309624", "0.61106694", "0.60570145", "0.60268235", "0.6016342", "0.5961001", "0.5944792", "0.5930...
0.84788483
0
TODO(qingling128): Fix the inconsistent behavior of 'message', 'log' and 'msg' in the next major version 1.0.0.
def test_structured_payload_json_log_detect_json_with_hash_input hash_value = { 'msg' => 'test log entry 0', 'tag2' => 'test', 'data' => 5000, 'some_null_field' => nil } [ { config: APPLICATION_DEFAULT_CONFIG, field_name: 'log', expected_payload: 'jsonPa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def msg(message)\n end", "def message(message) end", "def message( message )\n\tend", "def info(msg) log(6, msg); end", "def message(message)\n log.info(message.to_s)\n end", "def message=(_); end", "def log(msg, meta = {})\n puts \"#{msg} --- #{meta}\"\nend", "def log_message( level, m...
[ "0.7424669", "0.74173975", "0.71555984", "0.71322554", "0.71127367", "0.71112293", "0.69663036", "0.6879838", "0.6870473", "0.6870473", "0.68206227", "0.68206227", "0.68206227", "0.68206227", "0.68206227", "0.68206227", "0.68200314", "0.68189263", "0.68189263", "0.6786096", "...
0.0
-1
Verify that when the log has only one effective field (named 'log', 'message', or 'msg') and the field is in JSON format, the field is parsed as JSON and sent as jsonPayload.
def test_detect_json_auto_triggered_with_one_field setup_gce_metadata_stubs json_string = '{"msg": "test log entry 0", "tag2": "test", ' \ '"data": 5000, "some_null_field": null}' PRESERVED_KEYS_TIMESTAMP_FIELDS.each do |timestamp_fields| setup_logging_stubs do @logs_sent = [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_payload(json, model,\n exclude = nil, # fields that should not be present\n allow = nil, # fields to check, overriding model accessible_attributes. Note: silently ignored if not an accessabie field - use augment!\n augment = [:server_time]) # n...
[ "0.6660364", "0.64861745", "0.61617637", "0.61161935", "0.59518987", "0.5917438", "0.5875431", "0.5783782", "0.56055295", "0.5603938", "0.549", "0.549", "0.54192334", "0.5401324", "0.53885025", "0.5379266", "0.53576237", "0.5331258", "0.5321828", "0.5306692", "0.52781767", ...
0.6311963
2
Verify that we drop the log entries when 'require_valid_tags' is true and any nonstring tags or tags with nonutf8 characters are detected.
def test_reject_invalid_tags_with_require_valid_tags_true setup_gce_metadata_stubs INVALID_TAGS.each_key do |tag| setup_logging_stubs do @logs_sent = [] d = create_driver(REQUIRE_VALID_TAGS_CONFIG, tag) d.emit('msg' => log_entry(0)) d.run end verify_log_entries(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sanitize_tags_with_require_valid_tags_false\n setup_gce_metadata_stubs\n ALL_TAGS.each do |tag, sanitized_tag|\n setup_logging_stubs do\n @logs_sent = []\n d = create_driver(APPLICATION_DEFAULT_CONFIG, tag)\n d.emit('msg' => log_entry(0))\n d.run\n end\n ve...
[ "0.74409944", "0.70318776", "0.63510543", "0.62408286", "0.6191839", "0.6109374", "0.5683196", "0.5605883", "0.56041235", "0.5575358", "0.5575358", "0.5575358", "0.55164224", "0.5503173", "0.546493", "0.5464537", "0.5442126", "0.5438464", "0.5421109", "0.5421109", "0.5413052"...
0.7332057
1
Verify that empty string container name should fail the kubernetes regex match, thus the original tag is used as the log name.
def test_handle_empty_container_name setup_gce_metadata_stubs setup_k8s_metadata_stubs container_name = '' # This tag will not match the kubernetes regex because it requires a # non-empty container name. tag = container_tag_with_container_name(container_name) setup_logging_stubs do d =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sanitize_tags_from_container_name_with_require_valid_tags_false\n setup_gce_metadata_stubs\n setup_k8s_metadata_stubs\n # Log names are derived from container names for containers. And container\n # names are extracted from the tag based on a regex match pattern. As a\n # prerequisite, the ...
[ "0.76134044", "0.73128915", "0.659963", "0.60203016", "0.57389325", "0.5615932", "0.55741143", "0.5391735", "0.5388342", "0.5303448", "0.526876", "0.5252807", "0.5193357", "0.5150922", "0.514077", "0.5123356", "0.5120736", "0.5099759", "0.5083868", "0.50462896", "0.50429046",...
0.7955884
0
Verify that container names with nonutf8 characters should be rejected when 'require_valid_tags' is true.
def test_reject_non_utf8_container_name_with_require_valid_tags_true setup_gce_metadata_stubs setup_k8s_metadata_stubs non_utf8_tags = INVALID_TAGS.select do |tag, _| tag.is_a?(String) && !tag.empty? end non_utf8_tags.each do |container_name, encoded_name| setup_logging_stubs do ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sanitize_tags_from_container_name_with_require_valid_tags_false\n setup_gce_metadata_stubs\n setup_k8s_metadata_stubs\n # Log names are derived from container names for containers. And container\n # names are extracted from the tag based on a regex match pattern. As a\n # prerequisite, the ...
[ "0.73017967", "0.6711245", "0.66149515", "0.6403938", "0.5963627", "0.59340453", "0.58842367", "0.57787365", "0.5758612", "0.5738305", "0.5630327", "0.5609964", "0.556677", "0.5528095", "0.5503997", "0.54952693", "0.54805577", "0.5467311", "0.5467311", "0.5466245", "0.5450581...
0.7991679
0
Verify that tags are properly encoded. When 'require_valid_tags' is true, we only accept string tags with utf8 characters.
def test_encode_tags_with_require_valid_tags_true setup_gce_metadata_stubs VALID_TAGS.each do |tag, encoded_tag| setup_logging_stubs do @logs_sent = [] d = create_driver(REQUIRE_VALID_TAGS_CONFIG, tag) d.emit('msg' => log_entry(0)) d.run end verify_log_entries(1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_invalid_tags\n unless self.invalid_tags.blank?\n errors.add(:base, \"The following tags are invalid: \" + self.invalid_tags.collect(&:name).join(', ') + \". Please make sure that your tags are less than #{ArchiveConfig.TAG_MAX} characters long and do not contain any invalid characters.\")\n ...
[ "0.6615188", "0.6132925", "0.61254233", "0.5994015", "0.5975674", "0.595351", "0.59089434", "0.58233285", "0.575319", "0.5748885", "0.5748885", "0.5742059", "0.5717532", "0.5677547", "0.5576227", "0.5574436", "0.5544296", "0.5541465", "0.55347526", "0.55224884", "0.55190766",...
0.6348028
1
Verify that tags extracted from container names are properly encoded.
def test_encode_tags_from_container_name_with_require_valid_tags_true setup_gce_metadata_stubs setup_k8s_metadata_stubs VALID_TAGS.each do |tag, encoded_tag| setup_logging_stubs do @logs_sent = [] d = create_driver(REQUIRE_VALID_TAGS_CONFIG, container_tag_with...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reject_non_utf8_container_name_with_require_valid_tags_true\n setup_gce_metadata_stubs\n setup_k8s_metadata_stubs\n non_utf8_tags = INVALID_TAGS.select do |tag, _|\n tag.is_a?(String) && !tag.empty?\n end\n non_utf8_tags.each do |container_name, encoded_name|\n setup_logging_stubs...
[ "0.74569947", "0.72808707", "0.611828", "0.6050943", "0.60018265", "0.59453845", "0.57540745", "0.57482624", "0.56968856", "0.56455183", "0.55158305", "0.54551995", "0.5448532", "0.5430556", "0.53507763", "0.5287778", "0.52409035", "0.5239297", "0.5218704", "0.52097636", "0.5...
0.7412447
1
Verify that tags are properly encoded and sanitized. When 'require_valid_tags' is false, we try to convert any nonstring tags to strings, and replace nonutf8 characters with a replacement string.
def test_sanitize_tags_with_require_valid_tags_false setup_gce_metadata_stubs ALL_TAGS.each do |tag, sanitized_tag| setup_logging_stubs do @logs_sent = [] d = create_driver(APPLICATION_DEFAULT_CONFIG, tag) d.emit('msg' => log_entry(0)) d.run end verify_log_entri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitized_allowed_tags=(tags); end", "def sanitized_allowed_tags=(tags); end", "def sanitized_tags\n @tags.select do |key, value|\n ALLOWED_TAG_KEY_TYPES.any? { |type| key.is_a? type } &&\n ALLOWED_TAG_VALUE_TYPES.any? { |type| value.is_a? type }\n end\n end", "def check_for_...
[ "0.6688646", "0.6688646", "0.6144084", "0.603871", "0.6010255", "0.58521086", "0.56380004", "0.5600529", "0.55902576", "0.556555", "0.55491674", "0.55414957", "0.54859453", "0.54507893", "0.5370389", "0.53689164", "0.53489053", "0.5347936", "0.53419447", "0.527332", "0.524222...
0.63091916
2
Verify that tags extracted from container names are properly encoded and sanitized.
def test_sanitize_tags_from_container_name_with_require_valid_tags_false setup_gce_metadata_stubs setup_k8s_metadata_stubs # Log names are derived from container names for containers. And container # names are extracted from the tag based on a regex match pattern. As a # prerequisite, the tag should...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reject_non_utf8_container_name_with_require_valid_tags_true\n setup_gce_metadata_stubs\n setup_k8s_metadata_stubs\n non_utf8_tags = INVALID_TAGS.select do |tag, _|\n tag.is_a?(String) && !tag.empty?\n end\n non_utf8_tags.each do |container_name, encoded_name|\n setup_logging_stubs...
[ "0.73830587", "0.70821357", "0.62674534", "0.6147552", "0.5950953", "0.5930637", "0.5866823", "0.5821067", "0.5662113", "0.551898", "0.5503425", "0.5491624", "0.54867256", "0.5466281", "0.5415208", "0.54105425", "0.5410308", "0.5410308", "0.53723484", "0.53133684", "0.5280697...
0.7761947
0
Test container logs when metadata is extracted from the 'kubernetes' field in the log record.
def test_container_logs_metadata_from_record verify_container_logs(method(:container_log_entry_with_metadata), CONTAINER_FROM_METADATA_PARAMS) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_container_logs_metadata_from_tag\n verify_container_logs(method(:container_log_entry),\n CONTAINER_FROM_TAG_PARAMS)\n end", "def test_k8s_container_monitored_resource\n [\n {\n config: APPLICATION_DEFAULT_CONFIG,\n setup_k8s_stub: false,\n log_en...
[ "0.7529421", "0.640986", "0.6352698", "0.6230043", "0.6166794", "0.58008856", "0.5779339", "0.5777783", "0.5768739", "0.5693834", "0.56246924", "0.559535", "0.5581943", "0.52857834", "0.51509464", "0.5121164", "0.5117916", "0.506919", "0.50163156", "0.49966264", "0.4970363", ...
0.75642914
0
Test container logs when metadata is extracted from the tag.
def test_container_logs_metadata_from_tag verify_container_logs(method(:container_log_entry), CONTAINER_FROM_TAG_PARAMS) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_container_logs_metadata_from_record\n verify_container_logs(method(:container_log_entry_with_metadata),\n CONTAINER_FROM_METADATA_PARAMS)\n end", "def test_encode_tags_from_container_name_with_require_valid_tags_true\n setup_gce_metadata_stubs\n setup_k8s_metadata_stub...
[ "0.738376", "0.6448948", "0.61758494", "0.6169632", "0.6117146", "0.60930544", "0.60420483", "0.60420483", "0.60420483", "0.5933674", "0.57558966", "0.5608871", "0.55115956", "0.55085045", "0.54712415", "0.53924847", "0.53644097", "0.5363336", "0.5363336", "0.5363336", "0.529...
0.8752527
0
Verify the subfields extraction of LogEntry fields.
def test_log_entry_http_request_field_from_record verify_subfields_from_record(DEFAULT_HTTP_REQUEST_KEY) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_log_entry_operation_field_partial_from_record\n verify_subfields_partial_from_record(DEFAULT_OPERATION_KEY)\n end", "def test_log_entry_http_request_field_partial_from_record\n verify_subfields_partial_from_record(DEFAULT_HTTP_REQUEST_KEY)\n end", "def assert_valid_field_list(values)\n if...
[ "0.726259", "0.6909215", "0.6246109", "0.58739454", "0.57585734", "0.5730926", "0.5708233", "0.568389", "0.56249005", "0.55236363", "0.55138105", "0.54919845", "0.5438278", "0.5371351", "0.53167486", "0.5286007", "0.5244057", "0.5228736", "0.5223354", "0.5221656", "0.5219652"...
0.6554095
2
Verify the subfields extraction of LogEntry fields when there are other fields.
def test_log_entry_http_request_field_partial_from_record verify_subfields_partial_from_record(DEFAULT_HTTP_REQUEST_KEY) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_log_entry_operation_field_partial_from_record\n verify_subfields_partial_from_record(DEFAULT_OPERATION_KEY)\n end", "def test_log_entry_http_request_field_from_record\n verify_subfields_from_record(DEFAULT_HTTP_REQUEST_KEY)\n end", "def assert_valid_field_list(values)\n if values.length =...
[ "0.72168195", "0.6442221", "0.63081694", "0.61875784", "0.59423006", "0.5852998", "0.5737244", "0.5651078", "0.5581971", "0.5568161", "0.5565309", "0.5553471", "0.55150616", "0.55059826", "0.54806244", "0.5460442", "0.5421019", "0.54114056", "0.5408339", "0.5407037", "0.53809...
0.68465596
1
We don't need a test like 'test_log_entry_labels_field_partial_from_record' because labels are free range strings. Everything in the labels field should be in the resulting logEntry>labels field. There is no need to check partial transformation (aka, some 'labels' fields are extracted, while others are left as it is).
def test_log_entry_operation_field_partial_from_record verify_subfields_partial_from_record(DEFAULT_OPERATION_KEY) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def labels!(lbl)\n save!(\"fields\" => { \"labels\" => lbl.uniq }) unless lbl.empty?\n end", "def test_labels_order\n [\n # Labels from the config \"labels\".\n {\n config: CONFIG_LABELS,\n emitted_log: {},\n expected_labels: LABELS_FROM_LABELS_CONFIG\n },\n # ...
[ "0.58961034", "0.5865785", "0.5850744", "0.5706813", "0.5487544", "0.54600143", "0.5449829", "0.5436449", "0.5382062", "0.538109", "0.5380336", "0.53776175", "0.5268668", "0.52679133", "0.5248358", "0.520723", "0.51803815", "0.51693046", "0.51624954", "0.5146164", "0.51398176...
0.5692283
4
Verify the subfields extraction of LogEntry fields when they are not hashes.
def test_log_entry_http_request_field_when_not_hash # TODO(qingling128) On the next major after 0.7.4, make all logEntry # subfields behave the same way: if the field is not in the correct format, # log an error in the Fluentd log and remove this field from payload. This # is the preferred behavior per ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_log_entry_operation_field_partial_from_record\n verify_subfields_partial_from_record(DEFAULT_OPERATION_KEY)\n end", "def test_log_entry_http_request_field_partial_from_record\n verify_subfields_partial_from_record(DEFAULT_HTTP_REQUEST_KEY)\n end", "def test_log_entry_http_request_field_from_re...
[ "0.6884922", "0.66774696", "0.6339703", "0.5932717", "0.57934564", "0.57811695", "0.5676738", "0.564776", "0.5644844", "0.56274015", "0.56239915", "0.55774975", "0.55772364", "0.54443324", "0.53477997", "0.52308404", "0.5217012", "0.52114856", "0.5199615", "0.51983374", "0.51...
0.6502698
2
Verify the subfields extraction of LogEntry fields when they are nil.
def test_log_entry_http_request_field_when_nil verify_subfields_when_nil(DEFAULT_HTTP_REQUEST_KEY) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_subfields?(**args)\n !any_subfields(args)\n end", "def test_log_entry_operation_field_partial_from_record\n verify_subfields_partial_from_record(DEFAULT_OPERATION_KEY)\n end", "def test_log_entry_http_request_field_partial_from_record\n verify_subfields_partial_from_record(DEFAULT_HTTP_RE...
[ "0.66064256", "0.6551674", "0.6442298", "0.6201501", "0.607007", "0.58784586", "0.57295984", "0.5717052", "0.5717052", "0.5703646", "0.56937116", "0.5675433", "0.5667293", "0.56449836", "0.5643986", "0.56202906", "0.56202394", "0.55808854", "0.5523543", "0.5482526", "0.543683...
0.68711126
0
Skip setting latency when the field is null or has invalid format.
def test_http_request_skip_setting_latency setup_gce_metadata_stubs [ '', ' ', nil, 'null', '123', '1.23 seconds', ' 123 s econds ', '1min', 'abc&^!$*(' ].each do |input| setup_logging_stubs do d = create_driver @logs_sent = [] d.emit('httpRequest' => HTTP_REQUEST_M...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latency_conversion\n _undefined\n end", "def delay_sanitize\n \tself.delay ||= 0\n end", "def default_latency\n DEFAULT_LATENCY\n end", "def latency(seconds)\n @adapter_options[:latency] = seconds\n self\n end", "def latency\n runopts(:latency)\n end", "def latency; end...
[ "0.6203072", "0.5146552", "0.51205266", "0.49977955", "0.49709943", "0.48844555", "0.48374015", "0.47728783", "0.47107768", "0.4702766", "0.47013527", "0.45695424", "0.45592555", "0.45546758", "0.45500115", "0.45220298", "0.4514475", "0.44906688", "0.44595283", "0.44561854", ...
0.5914077
1
Verify the default and customization of LogEntry field extraction key.
def test_log_entry_insert_id_field verify_field_key('insertId', default_key: DEFAULT_INSERT_ID_KEY, custom_key: 'custom_insert_id_key', custom_key_config: CONFIG_CUSTOM_INSERT_ID_KEY_SPECIFIED, sample_value: INSERT_ID) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_log_entry_http_request_field_from_record\n verify_subfields_from_record(DEFAULT_HTTP_REQUEST_KEY)\n end", "def test_log_entry_http_request_field_when_not_hash\n # TODO(qingling128) On the next major after 0.7.4, make all logEntry\n # subfields behave the same way: if the field is not in the co...
[ "0.6584625", "0.6376671", "0.63254595", "0.6275881", "0.6193029", "0.5439746", "0.5392814", "0.5391506", "0.53375536", "0.53269887", "0.53198427", "0.529126", "0.527953", "0.52692395", "0.5248732", "0.52468336", "0.522024", "0.5217075", "0.5147145", "0.51208854", "0.5117578",...
0.6266096
4
Verify the cascading JSON detection of LogEntry fields.
def test_cascading_json_detection_with_log_entry_insert_id_field verify_cascading_json_detection_with_log_entry_fields( 'insertId', DEFAULT_INSERT_ID_KEY, root_level_value: INSERT_ID, nested_level_value: INSERT_ID2 ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_cascading_json_detection_with_log_entry_fields(\n log_entry_field, default_key, expectation\n )\n root_level_value = expectation[:root_level_value]\n nested_level_value = expectation[:nested_level_value]\n expected_value_from_root = expectation.fetch(\n :expected_value_from_root, root_...
[ "0.69156384", "0.6147671", "0.5826012", "0.57521003", "0.5747345", "0.5599562", "0.5510692", "0.54266393", "0.5411666", "0.5407869", "0.5398741", "0.5392827", "0.5298521", "0.52801293", "0.52504987", "0.5236136", "0.5221604", "0.5123314", "0.5096658", "0.50889117", "0.5083146...
0.7385394
0
Verify that labels present in multiple inputs respect the expected priority order: 1. Labels from the field "logging.googleapis.com/labels" in payload. 2. Labels from the config "label_map". 3. Labels from the config "labels".
def test_labels_order [ # Labels from the config "labels". { config: CONFIG_LABELS, emitted_log: {}, expected_labels: LABELS_FROM_LABELS_CONFIG }, # Labels from the config "label_map". { config: CONFIG_LABEL_MAP, emitted_log: PAYLOAD_FOR_LABEL_MA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_labels(expected_labels, labels, check_exact_labels = true)\n return if expected_labels.empty? && labels.empty?\n\n expected_labels.each do |expected_key, expected_value|\n assert labels.key?(expected_key), \"Expected label #{expected_key} not\" \\\n \" found. Got labels: #{labels}....
[ "0.6841063", "0.6020588", "0.5905766", "0.58131796", "0.580297", "0.57508457", "0.5737953", "0.5582444", "0.5567833", "0.55450284", "0.5531316", "0.55135006", "0.54925627", "0.54165834", "0.5337946", "0.53091437", "0.53061926", "0.52900034", "0.52889824", "0.5281469", "0.5266...
0.78662276
0
Test k8s_container monitored resource.
def test_k8s_container_monitored_resource [ { config: APPLICATION_DEFAULT_CONFIG, setup_k8s_stub: false, log_entry: k8s_container_log_entry(log_entry(0)), expected_params: K8S_CONTAINER_PARAMS_FROM_FALLBACK }, { config: APPLICATION_DEFAULT_CONFIG, se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_k8s_pod_monitored_resource\n [\n {\n config: APPLICATION_DEFAULT_CONFIG,\n setup_k8s_stub: true,\n log_entry: k8s_pod_log_entry(log_entry(0)),\n expected_params: K8S_POD_PARAMS_FROM_LOCAL\n },\n {\n config: CUSTOM_K8S_CONFIG,\n setup_k8s_stub: fa...
[ "0.6842504", "0.67028266", "0.61338747", "0.60573757", "0.5761696", "0.5757711", "0.56754047", "0.55674595", "0.5515243", "0.54982716", "0.5496871", "0.54387665", "0.5408436", "0.53301156", "0.530116", "0.5296751", "0.52837235", "0.52563554", "0.5253844", "0.5223526", "0.5205...
0.73319703
0
Test k8s_pod monitored resource.
def test_k8s_pod_monitored_resource [ { config: APPLICATION_DEFAULT_CONFIG, setup_k8s_stub: true, log_entry: k8s_pod_log_entry(log_entry(0)), expected_params: K8S_POD_PARAMS_FROM_LOCAL }, { config: CUSTOM_K8S_CONFIG, setup_k8s_stub: false, lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_k8s_node_monitored_resource\n [\n {\n config: APPLICATION_DEFAULT_CONFIG,\n setup_k8s_stub: true,\n log_entry: k8s_node_log_entry(log_entry(0)),\n expected_params: K8S_NODE_PARAMS_FROM_LOCAL\n },\n {\n config: CUSTOM_K8S_CONFIG,\n setup_k8s_stub:...
[ "0.64212906", "0.6336618", "0.62554616", "0.61913764", "0.60219926", "0.5645732", "0.55931526", "0.55208373", "0.5493749", "0.5445348", "0.54203165", "0.54149884", "0.540012", "0.5353633", "0.5333994", "0.532976", "0.53141826", "0.52952695", "0.5292468", "0.52778786", "0.5273...
0.757207
0
Test k8s_node monitored resource.
def test_k8s_node_monitored_resource [ { config: APPLICATION_DEFAULT_CONFIG, setup_k8s_stub: true, log_entry: k8s_node_log_entry(log_entry(0)), expected_params: K8S_NODE_PARAMS_FROM_LOCAL }, { config: CUSTOM_K8S_CONFIG, setup_k8s_stub: false, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_k8s_pod_monitored_resource\n [\n {\n config: APPLICATION_DEFAULT_CONFIG,\n setup_k8s_stub: true,\n log_entry: k8s_pod_log_entry(log_entry(0)),\n expected_params: K8S_POD_PARAMS_FROM_LOCAL\n },\n {\n config: CUSTOM_K8S_CONFIG,\n setup_k8s_stub: fa...
[ "0.6422332", "0.609016", "0.6016344", "0.587029", "0.58365643", "0.5725533", "0.5722886", "0.56937283", "0.5660697", "0.5612758", "0.5526118", "0.5424959", "0.53863543", "0.53799516", "0.5334515", "0.53337914", "0.5316904", "0.52387553", "0.5224757", "0.5194539", "0.5177159",...
0.7597122
0
If check_exact_labels is true, assert 'labels' and 'expected_labels' match exactly. If check_exact_labels is false, assert 'labels' is a subset of 'expected_labels'.
def check_labels(expected_labels, labels, check_exact_labels = true) return if expected_labels.empty? && labels.empty? expected_labels.each do |expected_key, expected_value| assert labels.key?(expected_key), "Expected label #{expected_key} not" \ " found. Got labels: #{labels}." actual...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n other.class == self.class && other.labels == labels\n end", "def use_for_labels?(*labels)\n return true if labels.empty? || options[:labels].nil? || options[:labels].include?(:any)\n !(options[:labels] & labels).empty?\n end", "def test_labels_order\n [\n # Labels...
[ "0.59778965", "0.5932492", "0.5840323", "0.5744854", "0.5547207", "0.5301485", "0.52841455", "0.5221264", "0.5189559", "0.5179056", "0.51468104", "0.50582504", "0.5053624", "0.5050035", "0.5006269", "0.4999131", "0.49154803", "0.49150932", "0.4866653", "0.4845279", "0.4825622...
0.85735273
0
The caller can optionally provide a block which is called for each entry.
def verify_json_log_entries(expected_count, params, payload_type = 'textPayload', check_exact_entry_labels = true) entry_count = 0 @logs_sent.each do |request| request['entries'].each do |entry| unless payload_type.empty? assert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n entries.each &block\n end", "def each(&block)\n @entries.each(&block)\n end", "def each(&_block)\n yield(entry)\n end", "def each(&block)\n entries.each(&block)\n end", "def each(&block)\n entries.each(&block)\n end", "def each &block\n @entries...
[ "0.74608546", "0.7443322", "0.7440856", "0.74229944", "0.74229944", "0.73328686", "0.7301307", "0.72295713", "0.72295713", "0.72295713", "0.72295713", "0.72295713", "0.72295713", "0.72295713", "0.72295713", "0.72295713", "0.72295713", "0.72295713", "0.72295713", "0.72295713", ...
0.0
-1
Cascading JSON detection is only triggered when the record has one field left with name "log", "message" or "msg". This test verifies additional LogEntry fields like spanId and traceId do not disable that by accident.
def verify_cascading_json_detection_with_log_entry_fields( log_entry_field, default_key, expectation ) root_level_value = expectation[:root_level_value] nested_level_value = expectation[:nested_level_value] expected_value_from_root = expectation.fetch( :expected_value_from_root, root_level_value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cascading_json_detection_with_log_entry_insert_id_field\n verify_cascading_json_detection_with_log_entry_fields(\n 'insertId', DEFAULT_INSERT_ID_KEY,\n root_level_value: INSERT_ID,\n nested_level_value: INSERT_ID2\n )\n end", "def test_detect_json_auto_triggered_with_one_field\n ...
[ "0.7189809", "0.66397625", "0.60682493", "0.58261585", "0.57879543", "0.57609487", "0.5359615", "0.534365", "0.530053", "0.5191583", "0.5181466", "0.51182914", "0.51082665", "0.50999576", "0.50515217", "0.5031518", "0.50097513", "0.4929801", "0.48975947", "0.48853758", "0.487...
0.7211762
0
Replace the 'referer' field with nil.
def http_request_message_with_nil_referer HTTP_REQUEST_MESSAGE.merge('referer' => nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noreferrer?; end", "def convert_referer(value, definition)\n value == '-' ? nil : value\n end", "def http_request_message_with_absent_referer\n HTTP_REQUEST_MESSAGE.reject do |k, _|\n k == 'referer'\n end\n end", "def store_referer\n store_referer_except\n end", "def ref...
[ "0.6661836", "0.6650202", "0.6612543", "0.65686375", "0.65465057", "0.65159523", "0.63525814", "0.6169805", "0.5895295", "0.58945036", "0.58739495", "0.57266533", "0.5710171", "0.57011694", "0.56241196", "0.55960745", "0.55934334", "0.5582319", "0.55769426", "0.5567422", "0.5...
0.63059425
7
Unset the 'referer' field.
def http_request_message_with_absent_referer HTTP_REQUEST_MESSAGE.reject do |k, _| k == 'referer' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def referer(referer)\n @request.env['HTTP_REFERER'] = referer\n end", "def store_referer\n store_referer_except\n end", "def noreferrer?; end", "def request_referer(request, uri, referer); end", "def destroy\n @referer = Referer.find(params[:id])\n @referer.destroy\n\n respond_to do |f...
[ "0.6495014", "0.6319744", "0.6292872", "0.62625057", "0.6052892", "0.60063136", "0.5996439", "0.5984123", "0.5973542", "0.5874199", "0.5842193", "0.5779761", "0.5775527", "0.5774667", "0.5738212", "0.57176983", "0.568151", "0.56798655", "0.5669707", "0.5648521", "0.564664", ...
0.6612967
0
The conversions from user input to output.
def latency_conversion _undefined end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_convert \n puts \"What do you want to convert?\"\n puts \"- [lbs] to kg\\n- [oz] to grams\\n- [gallon] to litre\\n- [quart] to ml\\n- [kg] to lbs\\n- [grams] to ounce\\n- [ml] to quartz\\n- [litre] to gallon\".colorize(:yellow)\n user_input = gets.chomp\n case user_input\n ...
[ "0.6884553", "0.6592381", "0.65227765", "0.6419716", "0.6410761", "0.6269516", "0.62625235", "0.6205341", "0.6184389", "0.61385834", "0.61385834", "0.61385834", "0.60817105", "0.60360724", "0.60354906", "0.59996426", "0.59996426", "0.5861583", "0.58574057", "0.58039296", "0.5...
0.0
-1
This module expects the methods below to be overridden. Create a Fluentd output test driver with the Google Cloud Output plugin.
def create_driver(_conf = APPLICATION_DEFAULT_CONFIG, _tag = 'test') _undefined end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_driver(conf, tag = 'test')\n driver = Fluent::Test::BufferedOutputTestDriver.new(Fluent::SensuOutput, tag)\n driver.configure(conf)\n def (driver.instance).send_check(server, port, payload)\n @sent_data ||= []\n @sent_data.push([server, port, payload])\n end\n def (driver.instan...
[ "0.60622525", "0.5923927", "0.55498344", "0.52722055", "0.51995206", "0.5191885", "0.5147143", "0.512017", "0.5102381", "0.50992274", "0.50992274", "0.5077647", "0.50748384", "0.5058964", "0.50579983", "0.5056652", "0.5026954", "0.5026954", "0.5026954", "0.49486178", "0.49446...
0.5206805
4
Set up http or grpc stubs to mock the external calls.
def setup_logging_stubs(_error = nil, _code = nil, _message = nil) _undefined end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stub_api_init(source_types:, tenants:, application_types: nil, applications:, topology_sources:)\n stub_api_source_types_get(:response => source_types)\n stub_api_applications_get(:response => applications)\n stub_api_application_types_get(:response => application_types) if application_types\n stub...
[ "0.71698505", "0.67302716", "0.6647125", "0.65518475", "0.65220505", "0.64685386", "0.64544636", "0.642452", "0.64066726", "0.6381009", "0.6277233", "0.6218048", "0.62073743", "0.6164187", "0.61169714", "0.6103724", "0.60968024", "0.6057285", "0.60490245", "0.60402274", "0.60...
0.0
-1
Whether this is the grpc path
def use_grpc _undefined end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource?\n !@grpc.nil?\n end", "def reference?\n @grpc.nil?\n end", "def is_pathport?(); @type == GRT_PATHPORT; end", "def path?\n !path.empty?\n end", "def is_path?(); @type == GRT_PATH; end", "def path?\n !!@path\n end", "def path?\n !!@...
[ "0.7068403", "0.69757605", "0.68926245", "0.666378", "0.6655854", "0.66019887", "0.66019887", "0.6585771", "0.6585771", "0.6585771", "0.6585771", "0.6585771", "0.6585771", "0.6585771", "0.656091", "0.6478536", "0.63213784", "0.63042593", "0.62826896", "0.6254465", "0.6243874"...
0.0
-1
The OK status code.
def ok_status_code _undefined end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ok; @status = 200 end", "def ok; @status = 200 end", "def ok?\n @status == 200\n end", "def ok?\n @status == OK\n end", "def ok?\n @result.code.to_i != 200\n end", "def status\n head :ok\n end", "def status\n head :ok\n end", "def ok?\n code == F...
[ "0.8063305", "0.8063305", "0.80516887", "0.787773", "0.77954215", "0.7660875", "0.7660875", "0.7518462", "0.7269714", "0.72683907", "0.7233124", "0.721852", "0.720606", "0.7135123", "0.7098714", "0.7085179", "0.6948359", "0.69442123", "0.6927672", "0.6926939", "0.69200236", ...
0.8232686
0
A client side error status code.
def client_error_status_code _undefined end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_error_status_code\n _undefined\n end", "def http_err_code\n http_codes[@http_err]\n end", "def error(message, code)\n error_response = {\n message: message\n }\n render :json => error_response, :status => code\n end", "def error(status, code, message)\n render :js...
[ "0.8083254", "0.75984645", "0.7337997", "0.7225777", "0.72197294", "0.7177386", "0.71605116", "0.7132951", "0.7094642", "0.7081278", "0.70544106", "0.7024702", "0.6971743", "0.6949761", "0.6933477", "0.69304603", "0.6921962", "0.6918376", "0.69102436", "0.69004625", "0.685694...
0.8494272
0
A server side error status code.
def server_error_status_code _undefined end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_error_status_code\n _undefined\n end", "def status_code\n 500 # This should not be called directly\n end", "def http_err_code\n http_codes[@http_err]\n end", "def status_error\n @status = 500\n end", "def http_server_error?(code)\n http_status?(:s...
[ "0.8011115", "0.7733095", "0.75878704", "0.7538151", "0.7473252", "0.7340736", "0.7301875", "0.72138685", "0.7194861", "0.71939975", "0.71841604", "0.7168394", "0.7156572", "0.7153084", "0.71401155", "0.7132718", "0.7130643", "0.71293753", "0.71288", "0.71119326", "0.70982337...
0.86491907
0
The parent error type to expect in the mock
def mock_error_type _undefined end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(description, result)\n raise \"Implement this in a sub-class\"\n end", "def original_error; end", "def original_error; end", "def type\n @error['type']\n end", "def test_return_error_is_default\n _response, error = resolver_returning_error.query_raw(Dnsruby::Message.new)\n a...
[ "0.64796335", "0.6406696", "0.6406696", "0.6309884", "0.6256384", "0.6235835", "0.6216523", "0.6216523", "0.603155", "0.6012974", "0.59412587", "0.59001297", "0.58968633", "0.5885991", "0.5865032", "0.58524907", "0.5849772", "0.583672", "0.58268416", "0.58086246", "0.58085126...
0.7555979
0
Verify the number and the content of the log entries match the expectation. The caller can optionally provide a block which is called for each entry.
def verify_log_entries(_expected_count, _params, _payload_type = 'textPayload', _check_exact_entry_labels = true, &_block) _undefined end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_log_entries(n, params, payload_type='textPayload')\n i = 0\n @logs_sent.each do |batch|\n batch['entries'].each do |entry|\n assert entry.has_key?(payload_type)\n if (payload_type == 'textPayload')\n # Check the payload for textPayload, otherwise it is up to the caller....
[ "0.67680997", "0.6748324", "0.647639", "0.6475578", "0.6064647", "0.5906234", "0.5751277", "0.57368475", "0.5710025", "0.5676204", "0.55802643", "0.5564254", "0.5547464", "0.5487995", "0.54879886", "0.5483633", "0.5462846", "0.5439815", "0.5436966", "0.54125506", "0.5403676",...
0.74588
0
Defined in specific gRPC or REST files.
def expected_operation_message2 _undefined end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preflight; end", "def api_only; end", "def api_only; end", "def api_only; end", "def nonstandard_lro_require\n ruby_file_path @api, \"#{service_name_full}::#{nonstandard_lro_name}\"\n end", "def apis; end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def endpoi...
[ "0.5991619", "0.5891875", "0.5891875", "0.5891875", "0.5813728", "0.5805253", "0.57939434", "0.57939434", "0.57939434", "0.57939434", "0.5763709", "0.5761416", "0.5761416", "0.57545656", "0.5698373", "0.56723195", "0.56237936", "0.56237936", "0.56237936", "0.56237936", "0.560...
0.0
-1
Parse timestamp and convert it to a hash with the "seconds" and "nanos" keys if necessary. Defined in specific gRPC or REST files.
def timestamp_parse(_timestamp) _undefined end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_timestamps\n self.keys.each do |key|\n self[key].map! do |timestamp| \n timestamp.is_a?(Time) ? timestamp : Time.parse(timestamp)\n end\n end\n end", "def time_to_timestamp(time)\n Google::Protobuf::Timestamp.new(seconds: time.to_i, nanos: time.nsec)\n end", ...
[ "0.6578904", "0.64283764", "0.63248754", "0.6324651", "0.6297612", "0.6281849", "0.6275905", "0.59921193", "0.5984357", "0.5979672", "0.5938832", "0.59311765", "0.5927754", "0.59225243", "0.5902747", "0.58434105", "0.5838214", "0.5835238", "0.5826482", "0.5819765", "0.5764990...
0.6541612
1