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
Attempts to determine if the host with Elastic IP is reachable If not reachable then returns false
def eip_healthy?(retries=5) # try to ping elastic IP with eip uri_str = "http://#{@eip}:#{@loadbalancer_healthcheck_port}#{@loadbalancer_healthcheck_path}" uri = URI(uri_str) result = false retries.times.each do case Net::HTTP.get_response(uri) when Net::HTTPSuccess then result = true break else result = false end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ip_reachable?(ip)\n external = Net::Ping::External.new(ip)\n\n log_info %(attempting to contact host \"#{ip}\")\n reachable = external.ping || external.ping6\n if reachable\n log_success %(host \"#{ip}\" is reachable)\n else\n log_error %(unable to contact h...
[ "0.77561027", "0.7622043", "0.7440091", "0.7254343", "0.71805686", "0.70520025", "0.7047166", "0.7031645", "0.69743425", "0.6959839", "0.69502234", "0.6913312", "0.69023716", "0.6899562", "0.6868326", "0.6863509", "0.6821681", "0.68003833", "0.68003833", "0.68003833", "0.6784...
0.71398634
5
reload/restart nginx, uses /etc/init.d/nginx
def reload_nginx if nginx_running? `/etc/init.d/nginx reload` else `/etc/init.d/nginx restart` end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload_proxy\n\t\t$LOGGER.info 'Reloading nginx'\n\t\tcmd = 'service nginx reload'\n\t\tsystem(cmd)\n\tend", "def reload_nginx(server, container_id)\n Net::SSH.start( server.host, server.user, :password => server.password) do|ssh|\n ssh.exec!(\"docker exec #{container_id} service nginx reload\"...
[ "0.79236126", "0.7102322", "0.67666537", "0.6441044", "0.6416849", "0.6408178", "0.6153345", "0.61178225", "0.60874027", "0.6076844", "0.60494095", "0.5964963", "0.59200037", "0.5871789", "0.5871153", "0.58465207", "0.5839313", "0.5826008", "0.5826008", "0.5814474", "0.580462...
0.88950115
0
Determine if nginx is running by looking at the pidfile
def nginx_running? if File.exists?('/var/run/nginx.pid') pid = File.open('/var/run/nginx.pid', 'r').readline begin Process.getpgid(pid) true rescue Errno::ESRCH false end else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_running?\n result = \"\"\n result = `ps -p #{pid} -o cmd=`.gsub(\"\\n\", \"\") unless pid.empty?\n\n result.split.first == \"unicorn\" ? true : false\n end", "def server_running?\n if File.exist? pid_path\n pid = read_pid\n begin\n Process.kill(0, pid)\n rescue E...
[ "0.6798805", "0.66890997", "0.66890997", "0.6441783", "0.6401759", "0.63586205", "0.6339175", "0.62783784", "0.62556356", "0.6184505", "0.61761665", "0.6166316", "0.6106308", "0.6073686", "0.6073686", "0.60048926", "0.5990481", "0.5972232", "0.59679294", "0.5958081", "0.59446...
0.87879604
0
application_id is duplicated across supported_permissions and user_application_permissions to efficiently address common queries for a user's permissions for a particular application
def assign_application_id self.application_id = supported_permission.application_id if supported_permission.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def application_id=(value)\n @application_id = value\n end", "def application_id\n return @application_id\n end", "def set_application\n @application = current_user.oauth_applications.find(params[:id])\n end", "def current_application\n fail 'A...
[ "0.6681327", "0.6640151", "0.6611282", "0.6348934", "0.6262077", "0.62194884", "0.6131442", "0.6131442", "0.6131442", "0.612916", "0.6129045", "0.6113676", "0.6101291", "0.6096036", "0.6041295", "0.6041295", "0.6041295", "0.60290617", "0.6013088", "0.59781474", "0.59571505", ...
0.7259442
0
Most of the input will be in USASCII, but an encoding can be set per buffer for the input. For just about all purposes, UTF8 should be what you want to input, and it's what Tk can handle best.
def string(text) common_string(text, text.event.unicode) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_encoding(string)\n ## removing newline (needed for pty/expect newlines)\n string[0, 2] = '' if string.start_with? \"\\r\\n\"\n string[0, 3] = '' if string.start_with? \"\\r\\r\\n\"\n string.gsub!(\"\\r\\n\", \"\\n\")\n # string.chomp!\n string\n end", "def fo...
[ "0.62089545", "0.61749285", "0.61656094", "0.61618555", "0.61497504", "0.612917", "0.6125854", "0.6116351", "0.61144567", "0.6085761", "0.6085222", "0.6085222", "0.6085222", "0.6085222", "0.6085222", "0.6082992", "0.6065431", "0.60567236", "0.6053171", "0.60266197", "0.602661...
0.0
-1
Insert characters literally, or enter decimal byte value (3 digits). This means we try to get up to 3 digits, but possibly don't get any. This code is less than elegant, but so is the behaviour we try to achieve. (none)decimal 3255 o or Ooctal 3377 (255) x or Xhexadecimal 2ff (255) uhexadecimal 4ffff (65535) Uhexadecimal 87fffffff (2147483647)
def literal(buffer) reader = lambda { |string = ''| buffer.major_mode.read(1) do |event| if unicode = event.unicode string += unicode # copy buffer.message string.inspect case result = literal_handle(buffer, string) when nil reader.call(string) when String literal_insert(buffer, result) end else return # Unverrichteter Dinge end end } reader.call end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decimal_digits\n pos0 = @pos\n if (code = @codes[@pos]) >= 0x30 and code <= 0x39\n @pos += 1\n while code = @codes[@pos] and code >= 0x30 and code <= 0x39\n @pos += 1\n end\n return @codes[pos0...@pos].pack(\"U*\")\n else\n nil\n end\n end", ...
[ "0.5902599", "0.5863495", "0.5655377", "0.56372917", "0.56148946", "0.5612942", "0.56124073", "0.5566831", "0.5557327", "0.55543005", "0.5542366", "0.5522904", "0.55095077", "0.5495558", "0.5483823", "0.5466012", "0.5429842", "0.54259497", "0.54177266", "0.53689665", "0.53318...
0.0
-1
returning nil means read next char returning a String means you're done and want the result inserted. returning anything else means you're giving up.
def literal_handle(_buffer, string) case string when /^\d{,3}$/ return if string.size < 3 [string.to_i].pack('U') when /^o([0-7]{,3})$/i return if Regexp.last_match(1).size < 3 [Integer("0#{Regexp.last_match(1)}")].pack('U') when /^x(\h{,2})$/i return if Regexp.last_match(1).size < 2 [Integer("0x#{Regexp.last_match(1)}")].pack('U') when /^u(\h{,4})$/ return if Regexp.last_match(1).size < 4 [Integer("0x#{Regexp.last_match(1)}")].pack('U') when /^U(\h{,8})$/ return if Regexp.last_match(1).size < 8 [Integer("0x#{Regexp.last_match(1)}")].pack('U') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readchar() end", "def readchar() end", "def readchar() end", "def next()\n return \" \" unless has_next()\n if(@count <= 0)\n @char = @compressed_string[@i]\n @i += 1\n @count = get_count()\n end\n @count -= 1\n return @char\n end", ...
[ "0.69239044", "0.69239044", "0.69239044", "0.6786132", "0.67764235", "0.674922", "0.674434", "0.67269707", "0.6571746", "0.6544318", "0.6481572", "0.6429834", "0.64214915", "0.6400068", "0.63948834", "0.6358198", "0.630603", "0.63028765", "0.6298821", "0.6281659", "0.6229167"...
0.0
-1
CONSTRUCTOR Creates OpenNebula section if not exists
def initialize(nsx_client) super(nsx_client) # Construct base URLs @base_url = NSXConstants::NSXT_DFW_BASE @url_sections = @base_url + \ NSXConstants::NSXT_DFW_SECTIONS @one_section_id = init_section end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_new\n @section = Section.new\n @section_count = Section.count + 1\n @section_position = @section_count\n end", "def add_new_section\n @section = Section.new\n end", "def init_section; end", "def create_section(section_name)\n section_spec = %(\n {\n ...
[ "0.6728407", "0.6633708", "0.662286", "0.64252007", "0.6407727", "0.6273686", "0.6273686", "0.627082", "0.6105464", "0.60184807", "0.59704065", "0.593554", "0.5924141", "0.5922524", "0.59101486", "0.57467073", "0.5740243", "0.57074213", "0.5653471", "0.56439894", "0.5643729",...
0.0
-1
Sections Creates OpenNebula section if not exists and returns its section_id. Returns its section_id if OpenNebula section already exists
def init_section one_section = section_by_name(NSXConstants::ONE_SECTION_NAME) one_section ||= create_section(NSXConstants::ONE_SECTION_NAME) return one_section['id'] if one_section end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_section(section_name)\n section_spec = %(\n {\n \"display_name\": \"#{section_name}\",\n \"section_type\": \"LAYER3\",\n \"stateful\": true\n }\n )\n section_id = @nsx_client.post(@url_sections,...
[ "0.6829747", "0.66241634", "0.6505443", "0.64422566", "0.6417074", "0.6398628", "0.6339004", "0.6321444", "0.62967265", "0.6289301", "0.62361777", "0.6213183", "0.6184537", "0.61252946", "0.60952663", "0.6063346", "0.6035641", "0.60046005", "0.595171", "0.59381676", "0.593314...
0.66754615
1
Get all sections Params: None Return nil | sections
def sections result = @nsx_client.get(@url_sections) result['results'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sections\n parsed {\n @sections\n }\n end", "def sections\n @sections.values\n end", "def sections\n return @sections\n end", "def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n ...
[ "0.7926308", "0.78306144", "0.7696838", "0.768655", "0.7659663", "0.7604488", "0.7522771", "0.7380303", "0.72824776", "0.7250462", "0.7250462", "0.71212864", "0.71003234", "0.70289266", "0.69745666", "0.6932351", "0.6836086", "0.6812029", "0.6782918", "0.6763463", "0.6700529"...
0.77827084
2
Get section by id Params:
def section_by_id(section_id = @one_section_id) url = @url_sections + '/' + section_id @nsx_client.get(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_section(section_id)\n self.sections.find { |s| s.id == section_id }\n end", "def section_by_id(section_id); end", "def get_section(id)\n @doc.at_css(\"##{id}\").parent.next_element\n end", "def find_section\n @section = Section.find(params[:section_id])\n end", "def section(elem_id,...
[ "0.83322215", "0.812857", "0.76840365", "0.76193494", "0.70402133", "0.70201045", "0.6900585", "0.6798192", "0.67924684", "0.6786544", "0.6786544", "0.6690141", "0.6687336", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467"...
0.7901185
2
Get section by name Params: section_name: Name of the section Return nil | section
def section_by_name(section_name) result = nil all_sections = sections return result unless all_sections all_sections.each do |section| result = section if section['display_name'] == section_name end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_by_name(section_name)\n section = sections.find do |s|\n s.name == section_name\n end\n if section.nil?\n raise RTrail::NotFound.new(\n \"Section '#{section_name}' not found in Suite '#{data.name}'\")\n end\n return section\n end", "def section(name)...
[ "0.8861133", "0.8657203", "0.8520992", "0.82854223", "0.80107296", "0.76988924", "0.75796956", "0.7544971", "0.74713176", "0.7404547", "0.71865743", "0.71547246", "0.71189713", "0.7028655", "0.70078534", "0.69828504", "0.69499475", "0.69382983", "0.69382983", "0.68813527", "0...
0.86222774
2
Create new section and return the section
def create_section(section_name) section_spec = %( { "display_name": "#{section_name}", "section_type": "LAYER3", "stateful": true } ) section_id = @nsx_client.post(@url_sections, section_spec) result = section_by_id(section_id) raise 'Section was not created in DFW' unless result result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_new\n @section = Section.new\n @section_count = Section.count + 1\n @section_position = @section_count\n end", "def add_new_section\n @section = Section.new\n end", "def create_new_section(title, options={})\n send_request('create_new_section', normalize_options(title, options)...
[ "0.78976536", "0.7784763", "0.7682556", "0.74519515", "0.7380818", "0.7380818", "0.71151096", "0.70988476", "0.70961267", "0.70697796", "0.6939649", "0.6892472", "0.6851308", "0.66867197", "0.6641996", "0.65986806", "0.6597911", "0.6589953", "0.6589928", "0.6580961", "0.65040...
0.7249533
6
Rules Get all rules of a Section, OpenNebula section if it's not defined Return: [Array]
def rules(section_id = @one_section_id) url = @url_sections + '/' + section_id + '/rules' @nsx_client.get(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def rules_by_name(rule_name, section_id = @one_section_id)\n rules = []\n return rules unless section_id\n\n all_rules =...
[ "0.7178252", "0.7178252", "0.6827643", "0.6758144", "0.67529285", "0.67529285", "0.67529285", "0.6748341", "0.6725025", "0.66927266", "0.6680149", "0.664293", "0.66340744", "0.6482018", "0.6482018", "0.639741", "0.63935256", "0.63638026", "0.63638026", "0.63638026", "0.636380...
0.7895761
0
Get rule by id Return: rule | nil
def rule_by_id(rule_id) url = @base_url + '/rules/' + rule_id valid_codes = [NSXConstants::CODE_CREATED, NSXConstants::CODE_OK, NSXConstants::CODE_BAD_REQUEST, NSXConstants::CODE_NOT_FOUND] additional_headers = [] @nsx_client.get(url, additional_headers, valid_codes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rule(rule_id)\n get(\"rules/#{rule_id}\")\n end", "def by_id(id)\n @rules.select { |rule| rule.id == id }\n end", "def find_rule(id)\n @sec_grp_objs.select { |security_group| security_group.rules.select{ |rule| rule.id == id }}\n end", "def rule_by_id; end", "def get_rule(ru...
[ "0.85478216", "0.7914231", "0.7713439", "0.7683067", "0.7523674", "0.72039235", "0.7026709", "0.70066994", "0.70030755", "0.70030755", "0.70030755", "0.70030755", "0.70030755", "0.6923857", "0.6869011", "0.6869011", "0.6869011", "0.6869011", "0.6817288", "0.6817288", "0.68172...
0.7895726
2
Get rules by name Return: Array with rules or an empty array
def rules_by_name(rule_name, section_id = @one_section_id) rules = [] return rules unless section_id all_rules = rules(section_id) return rules unless all_rules all_rules['results'].each do |rule| rules << rule if rule['display_name'] == rule_name end rules end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rules_by_name; end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def rules\n return [] if @rules.empty?\n @rules.sort_by { |k| k['priority'] }.map { |h| h['rule_name'] }\n end", "def rules\n @rules.map{|r| [r.name, r.r...
[ "0.79867315", "0.74063736", "0.74063736", "0.73643637", "0.71903485", "0.7157202", "0.7052736", "0.70458055", "0.6990094", "0.6828639", "0.68274844", "0.68274844", "0.68274844", "0.6779544", "0.6777009", "0.6730316", "0.6652361", "0.6652361", "0.65962505", "0.6592785", "0.656...
0.7983357
1
Get rule by regex Return: Array with rules or an empty array
def rules_by_regex(regex, section_id = @one_section_id) rules = [] return rules unless section_id all_rules = rules(section_id) return rules unless all_rules all_rules['results'].each do |rule| rules << rule if rule['display_name'].match(regex) end rules end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patterns\n #@rules.every.pattern\n @rules.map {|r| r.pattern }\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def rules_for(path)\n @rules.reverse.select do |rule| path.match(rule.pattern) end\n end", "def rules\n @rules.ma...
[ "0.6460382", "0.63995034", "0.63995034", "0.630223", "0.62057614", "0.6033021", "0.6027661", "0.60276264", "0.6020229", "0.5895967", "0.5850633", "0.57945204", "0.5789702", "0.57661474", "0.57350147", "0.57350147", "0.57350147", "0.57267535", "0.57172036", "0.5707666", "0.568...
0.7893675
0
Use callbacks to share common setup or constraints between actions.
def set_supplier_type @supplier_type = SupplierType.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
Only allow a trusted parameter "white list" through.
def supplier_type_params params.require(:supplier_type).permit(:name, :description) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
This method gets the very first content page plugin's contents FIXME: make it more robust
def get_contents_for(path) out = get_path(path) out.css("#content").inner_html end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contents\n @contents ||= begin\n # First collect the localized content\n contents_data = localized_contents\n contents_data = [] if contents_data.blank?\n # Then grab the content that belongs directly to the page\n contents_data << non_localized_contents\n unless ...
[ "0.6848077", "0.6744682", "0.6472699", "0.6437753", "0.63907194", "0.6331798", "0.6328279", "0.6266156", "0.6252447", "0.6235979", "0.6228377", "0.62120765", "0.6173939", "0.6155813", "0.6138418", "0.61300296", "0.60946107", "0.59651005", "0.5962457", "0.59218055", "0.5888204...
0.5858667
26
The 'product' is a Netvisor::Product object
def send_product(product) request(product, "product", :post, {method: "add"}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product\n nic_view.product\n end", "def product\n Zapi::Models::Product.new\n end", "def for(product)\n @product = product\n self\n end", "def product\n FarMar::Product.find(self.product_id)\n end", "def product\n CiscoISE::Product.new(@xml.elements['produc...
[ "0.78556895", "0.7513931", "0.73981184", "0.738854", "0.73283046", "0.7292463", "0.7279387", "0.72631866", "0.7232251", "0.72064364", "0.716114", "0.71467215", "0.71439165", "0.70951134", "0.7041157", "0.6988913", "0.6973837", "0.69716287", "0.6953211", "0.694975", "0.6941382...
0.67535573
30
The 'product' is a Netvisor::Product object the 'id' is the nexudus id of the product
def update_product(product, id) request(customer, "product", :post, {id: id, method: "edit"}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product(product_id)\n FarMar::Product.all.find { |product| product.id == product_id }\n end", "def product(product)\n products.find(product.id)\n end", "def set_product\n #クライアントから入力された商品IDの情報をすでに登録されているDBから取ってくる \n #/product/1\n @product = Product.find(params[:id])\n \n end"...
[ "0.7668423", "0.7643721", "0.7594649", "0.7494921", "0.74871963", "0.74462867", "0.74221015", "0.7419703", "0.7418802", "0.7375472", "0.7372648", "0.73545283", "0.73473233", "0.7329036", "0.73284996", "0.730528", "0.7303518", "0.7284543", "0.72837985", "0.72697645", "0.726742...
0.0
-1
The 'customer' is a Netvisor::Customer object
def send_customer(customer) request(customer, "customer", :post, {method: "add"}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customer_info(customer)\n return customer\n end", "def customer\n @customer ||= Customer.new(value_for('customer'))\n end", "def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end", "def customer(customer)\n id = epages_id(customer)\n perform_get_with_obje...
[ "0.78705794", "0.78291947", "0.769265", "0.7560057", "0.7452757", "0.7316684", "0.72371924", "0.7195455", "0.71931905", "0.7189734", "0.71513337", "0.7150798", "0.7141059", "0.7130278", "0.7121548", "0.71116644", "0.70989114", "0.7091971", "0.70737773", "0.70663786", "0.70663...
0.73114
6
The 'customer' is a Netvisor::Customer object the 'id' is the nexudus id of the customer
def update_customer(customer, id) request(customer, "customer", :post, {id: id, method: "edit"}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id\n customer_id\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def customer(id)\n response = get(\"customers/#{id}\")\n response.customer\n end", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{cu...
[ "0.8284351", "0.7942699", "0.78741604", "0.78025436", "0.77851367", "0.778428", "0.7749018", "0.74207723", "0.740835", "0.74030113", "0.7401913", "0.7364476", "0.7340759", "0.73258257", "0.72953635", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.729...
0.72594714
72
Returns an array of ancestors above this object. Note that a) this array is ordered with the most senior ancestor at the beginning of the list, and b) this is an _array_, not a _relation_. For that reason, you can pass any additional scope options to the method.
def ancestors(options={}) return [] if top_level? objects = self.class.ancestors_of(self).scoped(options).group_by(&:id) index_path.map { |id| objects[id].first } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ancestors\n ancestors = []\n current_ancestor = self\n \n while !current_ancestor.nil?\n \n if current_ancestor.respond_to?(:parent)\n ancestors << current_ancestor\n current_ancestor = current_ancestor.parent\n else\n current_ancestor = nil\n...
[ "0.79718834", "0.79634565", "0.7911822", "0.7903616", "0.78238004", "0.77665204", "0.7740373", "0.76524514", "0.76252556", "0.75986385", "0.7576189", "0.7547435", "0.75416523", "0.75060815", "0.74637353", "0.7448128", "0.7435253", "0.74239385", "0.74226195", "0.7411003", "0.7...
0.6575926
59
Makes a request to the service
def make_request(method, path, query, headers = {}, body = nil) full_path = @api_base_path + path request = ProxyClientUtils.build_request(method, full_path, query, headers, body) begin response = @connection.request(request) from_headers = ProxyClientUtils.normalize_headers( ProxyClientUtils.filter_response_headers(response.to_hash) ) [response.code.to_i, from_headers, [response.body]] rescue Errno::ECONNREFUSED => e raise RemoteConnectionError.new("#{self.class.base_uri} - #{e.class}: #{e.message}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_request\n response = @http.request(@request)\n end", "def make_request url, parameters={}, method=:get, settings={}\n raise 'not implemented'\n end", "def service_request(service); end", "def make_request\n query = {'income': @income, 'zipcode': @zipcode, 'age': @age}\...
[ "0.762387", "0.7271272", "0.7071317", "0.7026036", "0.6994136", "0.6906404", "0.6895634", "0.68669", "0.68506193", "0.6819396", "0.68122923", "0.67917764", "0.6784509", "0.67726475", "0.67551833", "0.675154", "0.6730632", "0.6723861", "0.67039114", "0.66909206", "0.6685219", ...
0.0
-1
POST /personas_nota_seguimiento POST /personas_nota_seguimiento.json
def create @persona = Persona.find(params[:persona_id]) @persona_nota_seguimiento = PersonaNotaSeguimiento.new(persona_nota_seguimiento_params) @persona_nota_seguimiento.persona = @persona @persona_nota_seguimiento.usuario = current_usuario if @persona_nota_seguimiento.save redirect_to @persona, notice: 'Guardado Correctamente.' else render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def persona_nota_seguimiento_params\n params.require(:persona_nota_seguimiento).permit(:fecha, :notas)\n end", "def set_persona_nota_seguimiento\n @persona_nota_seguimiento = PersonaNotaSeguimiento.find(params[:id])\n @persona = @persona_nota_seguimiento.persona\n end", "def create\n @n...
[ "0.7370511", "0.6545128", "0.6458106", "0.64423764", "0.6388305", "0.63723826", "0.62660915", "0.6233119", "0.6227858", "0.62270534", "0.62227035", "0.6217265", "0.6158079", "0.6150249", "0.61256623", "0.6123591", "0.6121697", "0.6101684", "0.6089453", "0.6079128", "0.6058509...
0.67692447
1
PATCH/PUT /personas_nota_seguimiento/1 PATCH/PUT /personas_nota_seguimiento/1.json
def update if @persona_nota_seguimiento.update(persona_nota_seguimiento_params) redirect_to @persona, notice: 'Actualizado Correctamente.' else render :edit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end"...
[ "0.6841325", "0.6619079", "0.65937996", "0.6589062", "0.65454906", "0.6499792", "0.6499037", "0.64868534", "0.64754456", "0.64686185", "0.64641", "0.6438015", "0.6416083", "0.640001", "0.6390569", "0.63641244", "0.6339741", "0.6337494", "0.63334876", "0.6330799", "0.6292913",...
0.662769
1
DELETE /personas_nota_seguimiento/1 DELETE /personas_nota_seguimiento/1.json
def destroy if @persona_nota_seguimiento.destroy redirect_to @persona, notice: 'Eliminado Correctamente.' else render :edit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end", "def destroy\n @personaje_mision = PersonajeMision.find(params[:id])\n @personaje_mision.destroy\n\n respond_to do |format|\n format.html ...
[ "0.753221", "0.74338907", "0.7379955", "0.7349902", "0.73273027", "0.7255175", "0.7255175", "0.7255175", "0.7242137", "0.72409093", "0.72394776", "0.7230385", "0.7212412", "0.7210099", "0.7205289", "0.72016984", "0.71847427", "0.7179976", "0.7166997", "0.71551627", "0.7120960...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_persona_nota_seguimiento @persona_nota_seguimiento = PersonaNotaSeguimiento.find(params[:id]) @persona = @persona_nota_seguimiento.persona end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def persona_nota_seguimiento_params params.require(:persona_nota_seguimiento).permit(:fecha, :notas) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
An image field for forms to upload
def image_field(field, options = {}) # Build options options = build_options(options, field) options['method_name'] = 'image_field' options.reverse_merge!(:image_size => :mini, :id => "image", :image_object => @object) # Create content html = content_tag :span, image_for(options[:image_object], options[:image_size], :default_image_from => options[:default_image_from]), :id => "image-#{@object.object_id}", :class => "image-field" html << self.hidden_field(field, :id => options[:id]) html << link_to("Bild auswählen", url_for(:controller => "/images", :action => "lightbox", :image_input => options[:id], :image_size => options[:image_size], :part => "image-#{@object.object_id}"), :class => 'remote-link chose-image') if options[:delete_link] == true html << content_tag(:span, :class => "remove-image-span") do " | " + link_to("Bild löschen", "javascript:void(0);", :class => "remove-form-image", :rel => options[:id]) end end # Get rid of unoppropriate options options.delete_if { |key, value| not [:rel, :style, :class, :id, :name, :value, :type, :size].include?(key.to_sym)} # Build html wrap_field(html, field, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_file_field(form_builder)\n image = form_builder.object\n form_builder.file_field :file, as: :file, class: 'image_file', id: 'image_files'\n end", "def image_file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n options.merge!(:class => field_error(field, options)...
[ "0.78787106", "0.7773775", "0.75542104", "0.75542104", "0.68560266", "0.6854362", "0.68429154", "0.67766774", "0.6744543", "0.66198164", "0.6582745", "0.6582745", "0.65782267", "0.6563947", "0.6563947", "0.65605044", "0.64935327", "0.6433617", "0.6419984", "0.64116323", "0.63...
0.6783711
7
Replace this with your real tests.
def we_can_find_the_current_configuration assert ! Confguration.current.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testing\n # ...\n end", "def __dummy_test__\n end", "def tests; end", "def tests; end", "def spec; end", "def spec; end", "def self_test; end", "def self_test; end", "def test \n end", "def test_0_dummy\n\t\tend", "def test\n\n end", "def test\n end", "def test\n end"...
[ "0.7446459", "0.6956364", "0.69155836", "0.69155836", "0.6864151", "0.6864151", "0.66406286", "0.66406286", "0.66253287", "0.6547665", "0.6524571", "0.6484549", "0.6484549", "0.6484549", "0.6403847", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188"...
0.0
-1
FOR EXAMPLE, IF HE ALREADY HAVE "a1", "a2" and "a3" IN HIS ARRAY (LOOK AT LINE 56 IN APP.RB) HE WINS
def winner? (self.array & ["a1","a2","a3"]).length == 3 || (self.array & ["b1","b2","b3"]).length == 3 || (self.array & ["c1","c2","c3"]).length == 3 || (self.array & ["a1","b1","c1"]).length == 3 || (self.array & ["a2","b2","c2"]).length == 3 || (self.array & ["a3","b3","c3"]).length == 3 || (self.array & ["a1","b2","c3"]).length == 3 || (self.array & ["c1","b2","a3"]).length == 3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contain_a(array)\n has_a = []\n\n array.each do |word|\n has_a << word if word.include?('a')\n end\n has_a\nend", "def winner1\n if [$a[1,3], $a[4,3], $a[7,3], [$a[1],$a[4],$a[7]], [$a[2],$a[5],$a[8]], [$a[3],$a[6],$a[9]], [$a[1],$a[5],$a[9]], [$a[3],$a[5],$a[7]]].any? { |e| e==['X','X','X']} \n ...
[ "0.6461033", "0.6255703", "0.62261987", "0.61913556", "0.6177656", "0.61187106", "0.60849464", "0.60564137", "0.5954729", "0.5938796", "0.59317416", "0.59267807", "0.59267354", "0.59046876", "0.5892153", "0.5889572", "0.5857643", "0.5854126", "0.5837481", "0.5837244", "0.5823...
0.58544266
17
This will attach employee to RO after the RO has been created.
def repair_order_employees_create @business_id = current_business_user.id @client_id = current_client.id @vehicle_id = current_vehicle.id @employee_repair_order = current_repair_order.employee_users_repair_orders.new( business_user_id: @business_id, client_id: @client_id, vehicle_id: @vehicle_id, employee_user_id: params[:id]) if @employee_repair_order.save render json: {employee_repair_order: @employee_repair_order.as_json(include: [:repair_order, :vehicle, :client])}, status: :created else render json: { errors: @employee_repair_order.errors.full_messages }, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_HR_record employee\n \n processed_record = \".\" \n \n firstname = employee[0].split(\" \")[0]\n lastname = employee[0].split(\" \")[1]\n fullname = employee[0]\n dept = @managers.has_value?(fullname.to_s) ? @managers.key(fullname.to_s) : get_dept #check if employee fullname a...
[ "0.63885224", "0.6322584", "0.6271402", "0.6156681", "0.61415297", "0.6074461", "0.6053985", "0.6041661", "0.60060596", "0.5958005", "0.59204525", "0.58645093", "0.58641046", "0.58548695", "0.5819343", "0.58140767", "0.57966465", "0.57876986", "0.5750316", "0.570618", "0.5704...
0.0
-1
This will remove employee from repair order.
def repair_order_employees_delete @repair_order_employee = current_business_user.employee_users_repair_orders.find(params[:id]) @repair_order_employee.destroy if @repair_order_employee render json: { repair_order_employees: @repair_order_employee.as_json }, status: :ok else render json: { errors: @repair_order_employee.errors.full_messages }, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_staff(employee)\n employee = Employee.find(employee.id)\n employee.delete!\n end", "def fire_employee(employee)\n @employees.reject! {|employ| employ.employee_id == employee.employee_id}\n\n end", "def remove_employee\n @leave_group = LeaveGroup.find(params[:id], :include => :leave_gro...
[ "0.6307913", "0.58369", "0.57848895", "0.5764783", "0.5715977", "0.5702808", "0.5700814", "0.56936324", "0.5478375", "0.54597366", "0.54225135", "0.53794736", "0.53688735", "0.53660476", "0.53537995", "0.53265333", "0.53108823", "0.5268773", "0.526638", "0.52505535", "0.52394...
0.66330475
0
Confirms if the user is dungeon user.
def is_dungeon_master_user game = Game.find_by id: params[:game_id] if game.nil? or !dungeon_master?(game.dungeon_master) redirect_to(root_url) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dungeon_master_user\n\t game = Game.find_by id: params[:id]\n\t if game.nil? or !dungeon_master?(game.dungeon_master)\n\t \tredirect_to(root_url) \n\t end\n\t end", "def mine?\n user && user.username == Codeplane.username\n end", "def dorm \n dorm_selection == 'd' || dorm_sele...
[ "0.6704577", "0.597449", "0.5938529", "0.58971345", "0.5706273", "0.5698041", "0.56844586", "0.5679694", "0.5609855", "0.5595255", "0.5530404", "0.55226296", "0.5505578", "0.54713666", "0.5470359", "0.544884", "0.5438849", "0.54307294", "0.5424523", "0.5394532", "0.5391846", ...
0.6637271
1
GET /ujumbes GET /ujumbes.json
def index @ujumbes = Ujumbe.all.order('id DESC') @ujumbe = current_user.ujumbes.build if current_user @user = current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @jugadores = Jugadore.all\n end", "def index\n @jichucanshus = Jichucanshu.all\n end", "def index\n @kifus = Kifu.all\n\n respond_to do |format|\n format.html # index.html.erb\n ...
[ "0.65405816", "0.62505263", "0.62289387", "0.61759555", "0.6143962", "0.61354285", "0.6124547", "0.60534817", "0.60516095", "0.6036577", "0.602003", "0.59967196", "0.59958285", "0.59547514", "0.5933968", "0.59311634", "0.5903261", "0.589951", "0.5893237", "0.5840614", "0.5810...
0.5764937
23
GET /ujumbes/1 GET /ujumbes/1.json
def show @user = current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def show\n @uchronia = Uchronia.find(p...
[ "0.6524254", "0.628556", "0.612124", "0.6115545", "0.61142176", "0.60980225", "0.60759443", "0.6056273", "0.60191447", "0.5977893", "0.5964593", "0.59524524", "0.59423435", "0.59404427", "0.5938506", "0.5928793", "0.5912061", "0.5902653", "0.5888407", "0.58535916", "0.5847182...
0.0
-1
POST /ujumbes POST /ujumbes.json
def create @ujumbe = current_user.ujumbes.build(ujumbe_params) @user = current_user respond_to do |format| if @ujumbe.save format.html { redirect_to edit_ujumbe_path(@ujumbe), notice: 'Ujumbe was successfully created. You can now complete it' } format.json { render action: 'show', status: :created, location: @ujumbe } else format.html { render action: 'new' } format.json { render json: @ujumbe.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @uen = Uen.new(uen_params)\n\n respond_to do |format|\n if @uen.save\n format.html { redirect_to @uen, notice: 'Uen was successfully created.' }\n format.json { render :show, status: :created, location: @uen }\n else\n format.html { render :new }\n format.js...
[ "0.5899258", "0.5831015", "0.58132327", "0.5761867", "0.57289183", "0.5721775", "0.5714176", "0.5666874", "0.563716", "0.56321365", "0.56295097", "0.5614453", "0.56131285", "0.55882555", "0.55615354", "0.5559517", "0.5544938", "0.55387336", "0.5536661", "0.5529917", "0.552656...
0.632247
0
PATCH/PUT /ujumbes/1 PATCH/PUT /ujumbes/1.json
def update @user = current_user respond_to do |format| if @ujumbe.update(ujumbe_params) format.html { redirect_to @ujumbe, notice: 'Ujumbe was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @ujumbe.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @da...
[ "0.64748055", "0.6399838", "0.63940495", "0.63187706", "0.6158683", "0.61522", "0.6146853", "0.6127007", "0.6119372", "0.6103074", "0.6072663", "0.6051205", "0.6050366", "0.6031628", "0.6014028", "0.6013454", "0.6002131", "0.5991991", "0.5982133", "0.59658694", "0.5964316", ...
0.5842808
42
DELETE /ujumbes/1 DELETE /ujumbes/1.json
def destroy @ujumbe.destroy respond_to do |format| format.html { redirect_to ujumbes_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.del...
[ "0.7217802", "0.7060332", "0.6929222", "0.68824005", "0.68503314", "0.6815148", "0.68062234", "0.6800676", "0.67934513", "0.67811805", "0.6777375", "0.67736965", "0.67726445", "0.67614836", "0.6754899", "0.6754666", "0.6753272", "0.674698", "0.67368186", "0.67328006", "0.6728...
0.74149317
0
Use callbacks to share common setup or constraints between actions.
def set_ujumbe @ujumbe = Ujumbe.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def ujumbe_params params.require(:ujumbe).permit(:title, :theme, :date, :description, :link, :type, :private, :what, :why, :how, :budget, :funding, :theme_ressources, :theme_education, :theme_housing, :theme_environnement, :theme_culture, :theme_economy, :theme_social, :theme_security, :theme_scientific, :theme_foreign, :image) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
outputs help for this command argv = commandline arguments
def cmd_help argv help end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_cli_help argv\n setup argv\n msg run_cmd(\"help\")\n end", "def cmd_help(*args)\n\t\tprint(shell.help_to_s)\n\tend", "def help(argm)\n\tif(argm)\n\t\tputs \"Commands:\"\n\t\tprintf \"%-15s %-6s %-10s # Shows the list of commands available\\n\", \n\t\tFile.basename(__FILE__), \"help\", \"\"\n\t\t...
[ "0.8152553", "0.7914385", "0.783073", "0.77173984", "0.77124316", "0.7677662", "0.7677662", "0.7625775", "0.76130044", "0.7587042", "0.75445396", "0.74787354", "0.74484926", "0.7411687", "0.73862004", "0.73381305", "0.7279913", "0.7276883", "0.72541434", "0.72463256", "0.7206...
0.83340836
1
restarts the Mu system services (this does not reboot the appliance) argv = commandline arguments
def cmd_restart argv setup argv response = @api.restart msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart(*services) = execute(services: services)", "def restart\n invoke :stop, :all => input[:all], :apps => input[:apps]\n\n line unless quiet?\n\n input[:apps].each do |app|\n unless input[:command].nil?\n app.command = input[:command]\n end\n app.update!\n ...
[ "0.7045368", "0.70075876", "0.6826488", "0.66758096", "0.6567114", "0.6566282", "0.6541809", "0.6541809", "0.6541809", "0.65368176", "0.64778584", "0.64727294", "0.64488095", "0.64143676", "0.63433516", "0.63240683", "0.62660694", "0.62453246", "0.6210048", "0.6174986", "0.61...
0.7552381
0
gets the complete System status page argv = commandline arguments
def cmd_status argv setup argv response = @api.status msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_line_info\n puts \"\\nCommand line arguments:\\n\\n\"\n puts \"This program will accept a single command line argument on launch. Arguments can be passed to draughts_app.rb directly or to draughts.sh\\n\"\n puts \"Example: draughts.sh --help\\n\\n\"\n puts \"-h or --help Display all co...
[ "0.6488304", "0.6299749", "0.61792845", "0.6164793", "0.61597157", "0.61445755", "0.61108774", "0.6023222", "0.6021952", "0.5862398", "0.5859729", "0.5814775", "0.5780555", "0.57691836", "0.5760154", "0.5750055", "0.569719", "0.567924", "0.5660239", "0.5642321", "0.56366444",...
0.6677714
0
gets additional system status information, imncluding hard drive, model and serial data argv = commandline arguments
def cmd_status2 argv setup argv response = @api.status2 msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n print_status(\"Gathering System info ....\")\n vm = nil\n dmi_info = nil\n ls_pci_data = nil\n\n if is_root?\n dmi_info = cmd_exec(\"/usr/sbin/dmidecode\")\n end\n\n # Check DMi Info\n if dmi_info\n case dmi_info\n when /microsoft corporation/i\n vm = \"MS Hy...
[ "0.67949957", "0.64729077", "0.60836583", "0.60778207", "0.60776764", "0.60496736", "0.59289396", "0.5904126", "0.5867659", "0.5824744", "0.5810097", "0.5796615", "0.5733989", "0.5717231", "0.57094574", "0.57057375", "0.5635945", "0.56178516", "0.56009525", "0.5591205", "0.55...
0.53667146
33
validate and save captured data for a given page PUT /answer_sheets/1/pages/1
def update @page = Page.find(params[:id]) questions = @presenter.all_questions_for_page(params[:id]) questions.post(params[:answers], @answer_sheet) questions.save @elements = questions.elements # Save references if params[:reference].present? params[:reference].each do |id, values| ref = @answer_sheet.reference_sheets.find(id) # if the email address has changed, we have to trash the old reference answers ref.attributes = values ref.save(:validate => false) end end @presenter.active_page = nil @answer_sheet.touch respond_to do |format| format.js #format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pages=(v) Axlsx.validate_int v; @pages = v; end", "def copy_to_page(page)\n #start matrix hash\n mq_qc_attribs = self.question_content.attributes\n .except(\"id\", \"created_at\", \"updated_at\", \"questionable_id\")\n\n cloneable_attributes = self.attributes\n .except(\"id\", \"created_at...
[ "0.59559906", "0.58840895", "0.56942695", "0.56148875", "0.5570189", "0.5558975", "0.54998183", "0.5483603", "0.5472866", "0.54584724", "0.5449766", "0.5444113", "0.54349697", "0.54214185", "0.5415297", "0.5396647", "0.5355351", "0.5349202", "0.5349202", "0.53480774", "0.5345...
0.634422
0
GET /organizations/1/sites GET /organizations/1/sites.json
def index @sites = @organization.sites.order(id: :desc).all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n...
[ "0.7147471", "0.7147471", "0.71254146", "0.69968307", "0.6986142", "0.68470156", "0.68342304", "0.6768329", "0.6639676", "0.6638731", "0.6638731", "0.6623737", "0.6592505", "0.6574429", "0.6573962", "0.6565332", "0.6518944", "0.6480263", "0.64783025", "0.64783025", "0.6478302...
0.7183256
0
GET /organizations/1/sites/1 GET /organizations/1/sites/1.json
def show redirect_to site_comments_path(@site.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sites = current_user.sites.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {...
[ "0.70622486", "0.70091885", "0.70091885", "0.6897232", "0.6870294", "0.6828743", "0.67364556", "0.661683", "0.65788525", "0.6577596", "0.6577596", "0.6577596", "0.6571647", "0.65419966", "0.64948934", "0.6477464", "0.64376307", "0.64315", "0.641028", "0.64070195", "0.63716733...
0.0
-1
POST /organizations/1/sites POST /organizations/1/sites.json
def create @site = @organization.sites.new(site_params) respond_to do |format| if @site.save format.html { redirect_to after_create_path, notice: 'Site was successfully created.' } format.json { render :show, status: :created, location: @site } else format.html { render :new } format.json { render json: @site.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n respond_to do |format|\n if @site = Site.find(entity_id_from_params(:site))\n current_user.account.sites << @site\n format.html { redirect_to root_path, notice: \"The site #{@site.name} @ #{@site.companies.last.name} was successfully added.\" }\n format.json { render json:...
[ "0.7058945", "0.6943568", "0.6846377", "0.6666819", "0.6637744", "0.6290428", "0.6283639", "0.6283639", "0.6283639", "0.6260006", "0.622562", "0.6222387", "0.6181914", "0.61598366", "0.6146918", "0.6116231", "0.6090384", "0.6071778", "0.60521716", "0.60495603", "0.604685", ...
0.7116671
0
PATCH/PUT /organizations/1/sites/1 PATCH/PUT /organizations/1/sites/1.json
def update respond_to do |format| if @site.update(site_params) format.html { redirect_to after_update_path, notice: 'Site was successfully updated.' } format.json { render :show, status: :ok, location: @site } else format.html { render :edit } format.json { render json: @site.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @site = current_user.sites.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { flash_and_redirect(\"successfully updated!\", sites_url) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" ...
[ "0.65415806", "0.6486838", "0.62991977", "0.6289661", "0.6283", "0.61884683", "0.61720824", "0.6142745", "0.612507", "0.6113049", "0.6109419", "0.61069435", "0.61048996", "0.6100842", "0.6095115", "0.6069081", "0.6058771", "0.6022002", "0.6022002", "0.60165375", "0.5978886", ...
0.56243247
85
DELETE /organizations/1/sites/1 DELETE /organizations/1/sites/1.json
def destroy @site.destroy respond_to do |format| format.html { redirect_to after_destroy_path, notice: 'Site was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @orbituarysite = Orbituarysite.find(params[:id])\n @orbituarysite.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.find(id_from_params)\n\n respond_to do |format|\n ...
[ "0.7169485", "0.7139715", "0.70999706", "0.70718527", "0.70718527", "0.70718527", "0.70718527", "0.70718527", "0.70562106", "0.7041012", "0.6977108", "0.6976829", "0.6965317", "0.6965317", "0.6965317", "0.6965317", "0.6965317", "0.69564766", "0.6931506", "0.6928645", "0.69284...
0.64404225
97
Only allow a list of trusted parameters through.
def site_params params.require(:site).permit(:domain, :name, :organization_id, setting_attributes: [ :id, :comment_display_created_at, :comment_repeatable ]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
Retrieves an instance variable from the controller from a request.
def assigns(key) $mack_app.instance_variable_get("@app").instance_variable_get("@response").instance_variable_get("@controller").instance_variable_get("@#{key}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance\n @controller.instance_variable_get(:\"@#{instance_name}\")\n end", "def request\n @controller.request\n end", "def request\n @controller.request\n end", "def request\n @controller.request\n end", "def get_resource_ivar\n instance_variable_get(\"@#{self.c...
[ "0.7073084", "0.6518171", "0.6518171", "0.6518171", "0.63648355", "0.6050599", "0.60416365", "0.6039451", "0.5967834", "0.5940491", "0.5940491", "0.5935501", "0.59234214", "0.59191304", "0.5841595", "0.5780147", "0.5709313", "0.56840026", "0.5649363", "0.5647205", "0.56299907...
0.5450504
35
create a wrapper object for file upload testing.
def file_for_upload(path) return Mack::Testing::FileWrapper.new(path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_file_upload(filename)\n ActionDispatch::Http::UploadedFile.new({\n filename: filename,\n content_type: 'application/octet-stream',\n tempfile: File.new(\"#{Rails.root}/test/...
[ "0.68456006", "0.6708279", "0.6616751", "0.6452521", "0.6378263", "0.63666016", "0.628917", "0.6283744", "0.62710756", "0.6263768", "0.6251646", "0.6228888", "0.6228575", "0.6222221", "0.6219284", "0.62192285", "0.62175095", "0.6174826", "0.6174584", "0.61704797", "0.61675054...
0.77494377
0
Performs a 'get' request for the specified uri.
def get(uri, options = {}) build_response(request.get(uri, build_request_options({:input => options.to_params}))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(uri, params = {})\n send_request(uri, :get, params)\n end", "def get(uri)\r\n request(Net::HTTP::Get.new(uri)) \r\n end", "def send_get(uri)\n _send_request('GET', uri, nil)\n end", "def get(uri, request_headers)\n request('get', uri, request_headers)\n end"...
[ "0.8387637", "0.837671", "0.8338571", "0.81162375", "0.8056223", "0.7621307", "0.747055", "0.74039745", "0.7383909", "0.73422194", "0.7302457", "0.72681206", "0.7199989", "0.71622753", "0.7090779", "0.7061202", "0.70087266", "0.69957787", "0.69744843", "0.69744843", "0.693323...
0.7504226
6
Performs a 'post' request for the specified uri.
def post(uri, options = {}) if options[:multipart] form_input = build_multipart_data(options) build_response(request.post(uri, build_request_options({"CONTENT_TYPE" => "multipart/form-data, boundary=Mack-boundary", "CONTENT_LENGTH" => form_input.size, :input => form_input}))) else build_response(request.post(uri, build_request_options({:input => options.to_params}))) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(uri, params = {})\n send_request(uri, :post, params)\n end", "def post(uri, request_headers, body)\n request('post', uri, request_headers, body)\n end", "def post(uri, query = {}, &block)\n request(:post, uri, query, &block)\n end", "def send_post(uri, data)\n ...
[ "0.8651799", "0.8294707", "0.8137126", "0.7920389", "0.7801342", "0.7714366", "0.76958954", "0.74513364", "0.73730826", "0.7363282", "0.7362048", "0.73539317", "0.7251813", "0.7232679", "0.7229354", "0.72117776", "0.7152942", "0.7096238", "0.7056676", "0.7022974", "0.6937728"...
0.0
-1
Performs a 'put' request for the specified uri.
def put(uri, options = {}) if options[:multipart] form_input = build_multipart_data(options) build_response(request.put(uri, build_request_options({"CONTENT_TYPE" => "multipart/form-data, boundary=Mack-boundary", "CONTENT_LENGTH" => form_input.size, :input => form_input}))) else build_response(request.put(uri, build_request_options({:input => options.to_params}))) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(uri, params = {})\n send_request(uri, :put, params)\n end", "def put(uri, request_headers, body)\n request('put', uri, request_headers, body)\n end", "def do_put(uri = '', body = '')\n build_request(:put, uri, body)\n end", "def put(uri, request_headers, body)\n ...
[ "0.8823323", "0.8358175", "0.829952", "0.7703336", "0.768153", "0.7620739", "0.7602549", "0.7583991", "0.7518064", "0.7510288", "0.74999356", "0.7343167", "0.72835237", "0.7190687", "0.7126894", "0.7060001", "0.7051917", "0.7048128", "0.70473593", "0.7000429", "0.6991651", ...
0.6615497
81
Performs a 'delete' request for the specified uri.
def delete(uri, options = {}) build_response(request.delete(uri, build_request_options({:input => options.to_params}))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(uri, params = {})\n send_request(uri, :delete, params)\n end", "def do_delete(uri = '')\n build_request(:delete, uri)\n end", "def delete(uri = nil)\n requestor(Net::HTTP::Delete.new(build_uri(uri)))\n end", "def delete(uri)\r\n request(Net::HTTP::Delete.new(uri)) ...
[ "0.88915133", "0.8791166", "0.8751137", "0.8732784", "0.84622073", "0.84440076", "0.82914513", "0.8085918", "0.78359455", "0.78152543", "0.78101385", "0.77709424", "0.77589166", "0.75738025", "0.74408925", "0.7413214", "0.73828167", "0.73614913", "0.7320503", "0.72638446", "0...
0.81417173
7
Returns a Rack::MockRequest. If there isn't one, a new one is created.
def request @request ||= Rack::MockRequest.new(mack_app) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_req\n Waxx::Req.new(ENV, {}, 'GET', \"/test/test/1\", {}, {}, {}, Time.new).freeze\n end", "def request\n @request ||= Rack::Request.new(@env)\n end", "def request\n @request ||= Rack::Request.new(@env)\n end", "def request(action = :echo)\n @request = Rack::MockReques...
[ "0.7302751", "0.6721054", "0.6721054", "0.6708992", "0.6705215", "0.65880847", "0.64892596", "0.6407008", "0.64007825", "0.6233579", "0.6158257", "0.6046235", "0.6020485", "0.6013836", "0.58620274", "0.5838313", "0.57673687", "0.57213414", "0.5719344", "0.5691426", "0.5667746...
0.76678216
0
Returns the last Rack::MockResponse that got generated by a call.
def response @testing_response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_response\n last_request_with_response = requests.reverse.detect do |r|\n r.response\n end\n return nil unless last_request_with_response\n\n last_request_with_response.response\n end", "def last_response\n @response\n end", "def last_response\n @last_response\n end", ...
[ "0.7475927", "0.727118", "0.70997083", "0.706564", "0.706564", "0.706564", "0.706564", "0.70136094", "0.6718882", "0.671573", "0.6562184", "0.6336279", "0.63322455", "0.622935", "0.6020902", "0.60023254", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", ...
0.0
-1
Returns all the Rack::MockResponse objects that get generated by a call.
def responses @responses end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stub_responses\n Creditsafe::Api::DummyResponse.new\n end", "def flexmock_calls\n @mock.flexmock_calls\n end", "def responses\n @responses ||= api::BatchResponse.new(responses: responses_by_request.values.uniq)\n end", "def call\n @called = true\n handleResponse @stu...
[ "0.67965686", "0.62189996", "0.6166518", "0.6095895", "0.5956443", "0.59077376", "0.5835776", "0.58202946", "0.5793826", "0.5793826", "0.57685274", "0.572455", "0.5695078", "0.56721073", "0.5668164", "0.56027293", "0.56006056", "0.5578861", "0.5571897", "0.55678666", "0.55567...
0.6235408
1
Returns a Mack::Session from the request.
def session # :nodoc: sess = Mack::SessionStore.get($current_session_id, nil, nil, nil) if sess.nil? id = String.randomize(40).downcase set_cookie(configatron.mack.session_id, id) sess = Mack::Session.new(id) Mack::SessionStore.store.direct_set(id, sess) $current_session_id = id sess end sess end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session\n @session ||= Session.new(@request)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session...
[ "0.76004106", "0.7596809", "0.7581253", "0.7581253", "0.7581253", "0.7581253", "0.7581253", "0.75213915", "0.75213915", "0.75213915", "0.7518643", "0.7518643", "0.75029856", "0.7482528", "0.73555684", "0.72758573", "0.71456385", "0.70637447", "0.70321345", "0.70183116", "0.69...
0.61995435
38
Used to create a 'session' around a block of code. This is great of 'integration' tests.
def in_session @_mack_in_session = true clear_session $current_session_id = session.id yield $current_session_id = nil clear_session @_mack_in_session = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_session\n @current_session = new_session\n @current_session.test_case = self\n yield @current_session if block_given?\n @current_session\n end", "def session(options={}, &block)\n self.class.session self, &block\n end", "def new_session\r\n session = ActionController::Integration...
[ "0.69773215", "0.6806127", "0.68036616", "0.6680183", "0.6658966", "0.6492243", "0.63686645", "0.6367675", "0.63018733", "0.62494874", "0.62382805", "0.62368846", "0.6220191", "0.619445", "0.6171879", "0.6092804", "0.60893023", "0.608359", "0.608359", "0.608359", "0.608359", ...
0.0
-1
Clears all the sessions.
def clear_session Mack::SessionStore.expire_all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_sessions \n sessions.each do |key, session|\n logger.info \"Closing: #{key}\"\n session.close\n end \n sessions.clear \n reset_password\n end", "def clear_sessions\n session.keys.each do |key|\n session.delete(key) if key =~ /ranme...
[ "0.8452414", "0.79263383", "0.7830362", "0.7818957", "0.7619269", "0.75342524", "0.7523698", "0.74714786", "0.7399382", "0.7399382", "0.7334237", "0.7311104", "0.72493696", "0.7209435", "0.7172796", "0.7132628", "0.71249425", "0.7069022", "0.7029094", "0.6985302", "0.69773436...
0.8288334
1
Returns a Hash of cookies from the response.
def cookies test_cookies end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookie_hash\n\t\t\t{ 'Cookie' => @cookies.to_s }\n\t\tend", "def cookies\n HTTY::CookiesUtil.cookies_from_string @headers[COOKIES_HEADER_NAME]\n end", "def to_hash\n cookies = {}\n\n @cookies.each do |cookie|\n cookies[cookie.name] = cookie.value\n end\n\n cookies\n...
[ "0.73291904", "0.7228556", "0.70573926", "0.6994414", "0.6915405", "0.68847084", "0.6674759", "0.6633787", "0.6632892", "0.6623553", "0.6579321", "0.6466347", "0.644647", "0.6438984", "0.643675", "0.63688904", "0.6267642", "0.62617695", "0.6240928", "0.6240928", "0.62336195",...
0.5445784
72
Sets a cookie to be used for the next request
def set_cookie(name, value) test_cookies[name] = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cookie(cookie=nil)\n self.headers[\"Cookie\"] = cookie\n end", "def set_cookie(response)\n response.set_cookie(Webmetrics::Config.cookie_name, {\n :value => self.id,\n :path => \"/\",\n :expires => Time.now+Webmetrics::Config.cookie_expiration\n })\n end", "def...
[ "0.8014738", "0.7657079", "0.7385363", "0.7276116", "0.7276116", "0.71348566", "0.7131406", "0.71025234", "0.70704186", "0.7029986", "0.7007636", "0.7004252", "0.6968154", "0.6968154", "0.6944519", "0.6941815", "0.69153404", "0.6872882", "0.6872882", "0.6851412", "0.68150866"...
0.69178516
16
GET /events/1 GET /events/1.json
def show @event = Event.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @event = Event.find(params[:id])\n render json: @event\n end", "def get(event_id)\n @client.request \"events/#{event_id}\"\n end", "def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @use...
[ "0.75029767", "0.74019474", "0.7361382", "0.7348975", "0.73475033", "0.7338018", "0.7317425", "0.72875094", "0.72813755", "0.7246173", "0.72317284", "0.7219172", "0.7219172", "0.7218839", "0.7218839", "0.721464", "0.7204848", "0.71989256", "0.7196662", "0.71925515", "0.719221...
0.0
-1
POST /events POST /events.json
def create @event = Event.new params[:event] authorize! :manage, @event @event.save! render 'show' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_event event, data={}\n data[:event] = event\n post '/event', data\n end", "def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end", "def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end", "def crea...
[ "0.7714071", "0.7611226", "0.76028967", "0.7541319", "0.7444731", "0.73206913", "0.73138195", "0.728203", "0.7251226", "0.7235907", "0.7235907", "0.7215051", "0.71682763", "0.7150409", "0.7126664", "0.7118896", "0.7117831", "0.71162695", "0.70964044", "0.70907074", "0.7083036...
0.0
-1
3 7 4 2 4 6 8 5 9 3 That is, 3 + 7 + 4 + 9 = 23. Find the maximum total from top to bottom of the triangle below:
def max_sum_triangle number = "75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 " number += "40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 " number += "38 17 14 91 43 58 50 27 29 48 63 66 04 68 89 53 67 30 73 16 69 87 40 31 04 62 98 27 23 09 70 98 73 93 38 53 60 04 23" # Place triangle in an array which is easier to manipulate @triangle = [] counter = 0 number = number.split(" ") while number.length > 0 counter += 1 row = [] counter.times { row << number.shift } @triangle << row end # Recursion method that returns the greater sum of the current cell and # each of the two adjacent cells in the next row def add_num(row, col) # If last row, simply return the cell number return @triangle[row][col].to_i if row == @triangle.length-1 # Find the adjacent two cells in the next row and add current cell's value a = add_num(row+1,col) + @triangle[row][col].to_i b = add_num(row+1,col+1) + @triangle[row][col].to_i # Return the greater of the two sums return [a,b].max end #Start the recursion at cell 0,0 puts add_num(0,0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_sum(triangle)\n # creating array from data input\n arr = triangle.each_line.map { |line| line.split.map(&:to_i) }\n arr.inject([]) { |res, x|\n maxes = [0, *res, 0].each_cons(2).map(&:max)\n x.zip(maxes).map{ |a, b| a + b }\n }.max\nend", "def compute\n # the position of the largest integer ...
[ "0.78049827", "0.7743565", "0.74132496", "0.7371364", "0.7051928", "0.69517654", "0.6834016", "0.6772471", "0.66732824", "0.6659748", "0.6641187", "0.6624022", "0.66204375", "0.6611804", "0.6606299", "0.65959936", "0.6594553", "0.65886986", "0.6586475", "0.6581508", "0.657751...
0.8145354
0
Recursion method that returns the greater sum of the current cell and each of the two adjacent cells in the next row
def add_num(row, col) # If last row, simply return the cell number return @triangle[row][col].to_i if row == @triangle.length-1 # Find the adjacent two cells in the next row and add current cell's value a = add_num(row+1,col) + @triangle[row][col].to_i b = add_num(row+1,col+1) + @triangle[row][col].to_i # Return the greater of the two sums return [a,b].max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_sum_triangle\r\n\r\n\tnumber = \"75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 \"\r\n\tnumber += \"40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 \"\r\n\tnum...
[ "0.71505237", "0.6784711", "0.6758994", "0.6402833", "0.6384807", "0.6324163", "0.6287884", "0.6236111", "0.62067807", "0.6199832", "0.6180452", "0.61697894", "0.61540025", "0.60700154", "0.6064571", "0.6056978", "0.6051725", "0.6045972", "0.60384154", "0.60223526", "0.601251...
0.6447779
3
GET /testimonios GET /testimonios.json
def index @testimonios = Testimonio.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end", "def index\n @testmoni...
[ "0.6846062", "0.6368691", "0.63255244", "0.63231325", "0.63231325", "0.608658", "0.606554", "0.5920407", "0.5920306", "0.58811176", "0.5878454", "0.5876871", "0.58477205", "0.58137375", "0.5809874", "0.5787835", "0.57025766", "0.56837815", "0.56659925", "0.5658202", "0.562114...
0.73134476
0
GET /testimonios/1 GET /testimonios/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @testimonios = Testimonio.all\n end", "def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @te...
[ "0.7100124", "0.6881578", "0.6466508", "0.6392654", "0.6091789", "0.6091789", "0.6069096", "0.5996124", "0.5942491", "0.5941217", "0.59117836", "0.58963174", "0.58531046", "0.5843974", "0.5809596", "0.5794616", "0.57789165", "0.5764538", "0.5760786", "0.57169074", "0.57052535...
0.0
-1
POST /testimonios POST /testimonios.json
def create @testimonio = Testimonio.new(testimonio_params) respond_to do |format| if @testimonio.save format.html { redirect_to @testimonio, notice: 'Testimonio was successfully created.' } format.json { render :show, status: :created, location: @testimonio } else format.html { render :new } format.json { render json: @testimonio.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def create\n @testmonial = Testmonial.new...
[ "0.6212472", "0.6196917", "0.6123075", "0.6037751", "0.59311587", "0.5880182", "0.58394265", "0.5687795", "0.5608448", "0.55609363", "0.5557644", "0.5522704", "0.547439", "0.54323614", "0.54271746", "0.54259235", "0.5421392", "0.53978586", "0.538322", "0.5375342", "0.53318685...
0.7398844
0
PATCH/PUT /testimonios/1 PATCH/PUT /testimonios/1.json
def update respond_to do |format| if @testimonio.update(testimonio_params) format.html { redirect_to @testimonio, notice: 'Testimonio was successfully updated.' } format.json { render :show, status: :ok, location: @testimonio } else format.html { render :edit } format.json { render json: @testimonio.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \...
[ "0.6371609", "0.6225694", "0.62197536", "0.61011976", "0.60881066", "0.60381603", "0.5989692", "0.59261614", "0.59036803", "0.58820486", "0.58652455", "0.58554685", "0.58460706", "0.5844932", "0.5835631", "0.5827716", "0.58217865", "0.57958645", "0.57856554", "0.5783353", "0....
0.6779583
0
DELETE /testimonios/1 DELETE /testimonios/1.json
def destroy @testimonio.destroy respond_to do |format| format.html { redirect_to testimonios_url, notice: 'Testimonio was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_respons...
[ "0.7171525", "0.7043059", "0.67855144", "0.67855144", "0.67855144", "0.67855144", "0.67782396", "0.67540795", "0.67471486", "0.6695716", "0.66632545", "0.6656628", "0.66558033", "0.66544634", "0.6642121", "0.66078633", "0.6572492", "0.65703607", "0.65622187", "0.65308535", "0...
0.7340553
0
Use callbacks to share common setup or constraints between actions.
def set_testimonio @testimonio = Testimonio.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def testimonio_params params.require(:testimonio).permit(:nombre, :descripcion, :link, :activo) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Configuration pointing to the SPEC tests and PIN tool to be used.
def load_configuration # Default configuration. config = File.open('pin_spec.yml', 'r') { |f| YAML.load f } if ARGV[0] # If the first argument is a Yaml configuration file, use that to override # the default configuration. if ARGV[0][-4, 4] == '.yml' config.merge! File.open(ARGV[0], 'r') { |f| YAML.load f } else # Argument 1: the output directory. config[:output_dir] = ARGV[0] end end # Supply a default output directory if no directory is given. config[:output_dir] ||= 'results_' + Time.now.strftime("%Y%m%d%H%M%S") config[:output_dir] = File.expand_path config[:output_dir], File.dirname(__FILE__) # Argument 2: pintool binary config[:tool_binary] = ARGV[1] if ARGV[1] config[:tool_binary] = File.expand_path ARGV[1] || config[:tool_binary], File.dirname(__FILE__) # Arguments 3..n: pintool arguments if ARGV[2] config[:tool_args] = ARGV[2..-1] end if config[:tool_args].respond_to? :to_str config[:tool_args] = config[:tool_args].split end # Suite location. suite_file = config[:suite_path] || './spec_suite.yml' config[:suite] = File.open(suite_file, 'r') { |f| YAML.load f } # Filter out tests in the suite. config[:suite].delete_if do |test_name, test_config| config[:skip_tests].include? test_name end config end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_config(tool, options={}, &block)\n tool = tool.to_s\n\n @setup ||= {}\n\n if block\n @setup[tool] = Setup.new(tool, options, &block)\n\n # REMOVED: Doing this automatically made it impossible for tools to set the profile.\n #if tool == current_tool\n # configu...
[ "0.6666171", "0.63427824", "0.63379824", "0.6295932", "0.6278882", "0.6180843", "0.61198395", "0.60151243", "0.5979334", "0.5968036", "0.59003645", "0.58436185", "0.5811028", "0.57996154", "0.579483", "0.57865864", "0.57649136", "0.576078", "0.57389414", "0.57224333", "0.5710...
0.7144003
0
Runs the SPEC test suite. Args:: config:: the configuration read by load_configuration
def run_suite(config) # Build the sandbox. FileUtils.rm_rf config[:output_dir] if File.exist? config[:output_dir] FileUtils.mkdir_p config[:output_dir] File.chmod 0777, config[:output_dir] temp_dir = File.join config[:output_dir], '__temp_' + "#{Time.now.strftime("%Y%m%d%H%M%S")}_#{$PID}_#{rand(1 << 20)}" FileUtils.mkdir_p temp_dir File.chmod 0777, config[:output_dir] # Figure out PIN's configuration. pin_config = { :temp_dir => temp_dir, :tool_binary => config[:tool_binary], :tool_args => config[:tool_args] || [] } if /^vlsifarm/ =~ Socket.gethostname # On vlsifarm. pin_config[:binary] = '/mit/6.823/Fall09/bin/pin' else # On linerva. pin_config[:tool_binary] += '.so' pin_config[:binary] = '/mit/6.823/Fall09/Pin2009/pin' end # Run the tests. test_number = 0 config[:suite].keys.sort.each do |test_name| test_data = config[:suite][test_name] next if config[:skip_tests].include? test_name test_number += 1 puts "Test #{test_name} -- #{test_number} of #{config[:suite].length}" out_file = File.basename(test_data['binary']) + '.out' pin_output = File.join config[:output_dir], out_file run_test test_data, pin_config, pin_output end # Tear down the sandbox. FileUtils.rm_rf temp_dir end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_setup(config)\n config_dir = File.join(Dir.pwd, 'test', 'specs', 'config')\n path = Dir.glob(File.join(config_dir, \"#{config}*\")).first\n\n msg = \"No file matching #{config} found in #{config_dir}\"\n raise msg unless path\n\n Thread.abort_on_exception = true\n runner = Thread.new do\n Jackal::...
[ "0.671999", "0.6521156", "0.6399976", "0.62786806", "0.60279274", "0.59057564", "0.5890867", "0.58558154", "0.5836383", "0.5824763", "0.5735378", "0.5709023", "0.56896734", "0.5681503", "0.56168157", "0.5600708", "0.55904984", "0.5569201", "0.55658704", "0.5545642", "0.554267...
0.6525058
1
Runs a test in the SPEC suite.
def run_test(test_data, pin_config, pin_output) command = %Q|"#{pin_config[:binary]}" -t "#{pin_config[:tool_binary]}"| + %Q| -o "#{pin_output}" | + pin_config[:tool_args].map { |arg| %Q|"#{arg}"| }.join(' ') + ' -- ' + %Q|"#{test_data['binary']}" | + test_data['args'].map { |arg| %Q|"#{arg}"| }.join(' ') command += %Q| < "#{test_data['stdin']}"| if test_data['stdin'] Dir.chdir(test_data['directory'] || pin_config[:temp_dir]) do puts command + "\n" Kernel.system command end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n @rspec_test_name = PATH_TO_RSPEC_SPEC_FOLDER + @rspec_test_name\n unless File.exists?(\"#{@rspec_test_name}\")\n @@failed_tests.push(\"Test not exists: #{@rspec_test_name}\")\n @@failed_tests_counter +=1\n return 1\n end\n @cmd = `rspec #{@rspec_test_name}`\n describe_test(@...
[ "0.6916185", "0.67599094", "0.6694415", "0.65807116", "0.65560234", "0.6497686", "0.64784235", "0.64758766", "0.64707375", "0.6436684", "0.6436684", "0.6429899", "0.64073473", "0.6405856", "0.6394599", "0.63932884", "0.63476515", "0.6307504", "0.62740535", "0.62712705", "0.62...
0.0
-1
Writes a marker file indicating the tests have completed running.
def write_success_marker(config) success_file = File.join config[:output_dir], 'success.yml' File.open(success_file, 'w') { |f| YAML.dump config, f } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def communicate_complete\n File.open(\"#{@options[:output_directory]}/finished.job\", 'w') do |f|\n f << \"Finished Workflow #{::Time.now}\"\n # make sure data is written to the disk one way or the other\n begin\n f.fsync\n rescue StandardError\n ...
[ "0.66625804", "0.6646036", "0.6387121", "0.61718774", "0.61125904", "0.60954624", "0.60485566", "0.603671", "0.5992934", "0.58318347", "0.5818525", "0.5753661", "0.57525164", "0.57284284", "0.57284075", "0.57007027", "0.5695459", "0.56833816", "0.5673226", "0.56328", "0.56126...
0.55451655
25
Store the related database object, in order to be able to correctly handle the database timezone.
def initialize(db) @db = db end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(object)\n db_id = derive_db_id(object.class.name, object.id)\n db.transaction do\n db[db_id] = object\n end\n end", "def _sync\n # Reset the stash map to ensure that it's reset before the next\n # transaction is being started.\n @_stash_map = nil\n\n db_obj =...
[ "0.66798556", "0.63102967", "0.6261971", "0.62364614", "0.6150229", "0.6150229", "0.6150229", "0.61287105", "0.61158574", "0.60939944", "0.6093928", "0.5954322", "0.5951211", "0.5909323", "0.5870558", "0.5864742", "0.58198434", "0.57542545", "0.5726686", "0.57196975", "0.5718...
0.0
-1
Return blobs as instances of Sequel::SQL::Blob instead of Amalgamite::Blob
def blob(s) SQL::Blob.new(s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sequel_blob\n SQL::Blob.new(self)\n end", "def to_sequel_blob\n self\n end", "def typecast_value_blob(value)\n value.is_a?(Sequel::SQL::Blob) ? value : Sequel::SQL::Blob.new(value)\n end", "def blob(s)\n if s.is_a?(SQL::Blob)\n s\n else\n SQL...
[ "0.79718906", "0.75431347", "0.7399565", "0.73858136", "0.7078076", "0.7078076", "0.7078076", "0.7078076", "0.7078076", "0.7078076", "0.70250577", "0.67801374", "0.67801374", "0.6623174", "0.6377873", "0.6377873", "0.62105966", "0.6203107", "0.6162549", "0.60899836", "0.60007...
0.74515295
2
Return numeric/decimal types as instances of BigDecimal instead of Float
def decimal(s) BigDecimal.new(s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numeric?; float?; end", "def typecast_value_decimal(value)\n if value.is_a?(String)\n BigDecimal.new(value)\n else\n super\n end\n end", "def to_f\n case @kind\n when :float_lit, :float_exp_lit,\n :integer_lit, :integer_exp_lit,\n :single_string_lit, :d...
[ "0.6786891", "0.6606618", "0.64820707", "0.6433429", "0.6386626", "0.6277584", "0.6251534", "0.6250775", "0.6210805", "0.6210805", "0.6187229", "0.6184887", "0.61290574", "0.60851866", "0.605962", "0.6056973", "0.6056973", "0.6053664", "0.5966792", "0.5951107", "0.5951107", ...
0.57323474
54
Return datetime types as instances of Sequel.datetime_class
def datetime(s) @db.to_application_timestamp(s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_classes\n [DateTime, Time, defined?(FmRest::StringDateTime) && FmRest::StringDateTime].compact.freeze\n end", "def convert_to_ruby_time_classes\n [Java::JavaSql::Timestamp, Java::JavaSql::Date]\n end", "def typecast_value_datetime(value)\n Sequel.typecast_to_application_ti...
[ "0.69144017", "0.66842693", "0.65414476", "0.65162", "0.64956695", "0.63690585", "0.6348501", "0.6334922", "0.62061596", "0.60849583", "0.6074508", "0.5995087", "0.5943269", "0.58665824", "0.57891005", "0.5715284", "0.57107157", "0.5675761", "0.5662952", "0.5618169", "0.55936...
0.0
-1
Don't raise an error if the value is a string and the declared type doesn't match a known type, just return the value.
def result_value_of(declared_type, value) if value.is_a?(::Amalgalite::Blob) SQL::Blob.new(value.to_s) elsif value.is_a?(String) && declared_type (meth = self.class.sql_to_method(declared_type.downcase)) ? send(meth, value) : value else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value?(value) value.is_a?(String) end", "def check_value!(value)\n # Allow nil and Strings to fall back on the validations for typecasting\n case value\n when nil, String, expected_type\n value\n else\n raise TypeError, \"#{@name} expected #{expected_type.inspect} but got #{...
[ "0.7221479", "0.72147024", "0.7171598", "0.71323115", "0.6995909", "0.69278914", "0.6885108", "0.6774034", "0.6739352", "0.67273307", "0.66842705", "0.66587967", "0.6496547", "0.642965", "0.637667", "0.6370853", "0.6370853", "0.6367957", "0.63265306", "0.63171583", "0.6294709...
0.0
-1
Connect to the database. Since SQLite is a file based database, the only options available are :database (to specify the database name), and :timeout, to specify how long to wait for the database to be available if it is locked, given in milliseconds (default is 5000).
def connect(server) opts = server_opts(server) opts[:database] = ':memory:' if blank_object?(opts[:database]) db = ::Amalgalite::Database.new(opts[:database]) db.busy_handler(::Amalgalite::BusyTimeout.new(opts.fetch(:timeout, 5000)/50, 50)) db.type_map = SequelTypeMap.new(self) connection_pragmas.each{|s| log_connection_yield(s, db){db.execute_batch(s)}} db end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_to_db()\n SQLite3::Database.new('db/database.db')\n end", "def open_db\n if Config.db =~ /^sqlite:\\/{3}(.+)$/\n dir = File.dirname($1)\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n end\n\n Sequel.datetime_class = Time\n\n @db = Sequel.connect(Conf...
[ "0.7518225", "0.74078405", "0.7138726", "0.6950009", "0.68906164", "0.6744066", "0.6677083", "0.66769075", "0.66544205", "0.6634824", "0.658784", "0.658784", "0.656098", "0.6491284", "0.648088", "0.64782315", "0.64599586", "0.64572763", "0.64544857", "0.6419102", "0.6416198",...
0.6398596
21
Amalgalite is just the SQLite database without a separate SQLite installation.
def database_type :sqlite end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_db\n SQLite3::Database.new \"flatiron.db\"\nend", "def default_adapter; :sqlite3 end", "def db\n @db ||= (create_directory cache_path; SQLite3::Database.new cache_path)\n end", "def connect_non_hash\r\n db=SQLite3::Database.new(\"db/slutpro.db\")\r\n return db\r\n ...
[ "0.64350206", "0.61068255", "0.6103155", "0.60929257", "0.6028462", "0.601257", "0.6006739", "0.59370416", "0.59343433", "0.5915107", "0.58316845", "0.58198816", "0.58198816", "0.57879275", "0.5786545", "0.5778258", "0.5775086", "0.57092655", "0.5705476", "0.5705361", "0.5704...
0.63700455
1
Run the given SQL with the given arguments. Returns nil.
def execute_ddl(sql, opts=OPTS) _execute(sql, opts){|conn| log_connection_yield(sql, conn){conn.execute_batch(sql)}} nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(sql, args=nil)\n q = query(sql, args)\n block_given? ? yield(q) : q.cmd_tuples\n end", "def execute(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n q = check_disconnect_errors{execute_query(sql, args)}\n begin\n block_gi...
[ "0.74507695", "0.7110664", "0.70995957", "0.70335305", "0.6844515", "0.6713801", "0.6710364", "0.67001057", "0.6601989", "0.6577286", "0.6560464", "0.6544741", "0.6495394", "0.64886", "0.6478463", "0.64776546", "0.6475999", "0.64702666", "0.64698017", "0.64581996", "0.6455174...
0.0
-1
Run the given SQL with the given arguments and return the number of changed rows.
def execute_dui(sql, opts=OPTS) _execute(sql, opts){|conn| log_connection_yield(sql, conn){conn.execute_batch(sql)}; conn.row_changes} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_update(sql)\n exec(sql)\n # return affected rows.\n end", "def update_sql(sql, name = nil) #:nodoc:\r\n execute( sql, name )\r\n return @affected_rows\r\n end", "def affected\n IBM_DB.num_rows(@stmt)\n end", "def update_sql(sql, name = nil) #:nodoc:\n sup...
[ "0.65926534", "0.63048047", "0.6213127", "0.60582316", "0.6021708", "0.5997024", "0.587067", "0.5829387", "0.5741632", "0.55804956", "0.5538182", "0.5518608", "0.55138236", "0.5482139", "0.547171", "0.5430524", "0.5404838", "0.5386027", "0.5377833", "0.53468674", "0.53310955"...
0.52809066
26
Run the given SQL with the given arguments and return the last inserted row id.
def execute_insert(sql, opts=OPTS) _execute(sql, opts){|conn| log_connection_yield(sql, conn){conn.execute_batch(sql)}; conn.last_insert_rowid} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil) #:nodoc:\r\n execute(sql, name)\r\n identity = last_inserted_id(nil)\r\n retval = id_value if retval == 0\r\n return retval\r\n end", "def insert(arel, name = nil, pk = nil, id_value = nil, sequence_na...
[ "0.7050797", "0.6902247", "0.6831938", "0.67946815", "0.6682866", "0.666634", "0.666561", "0.66645235", "0.66423583", "0.6619891", "0.66145515", "0.6551884", "0.65190595", "0.65190595", "0.6498258", "0.64939034", "0.6453291", "0.6448851", "0.64439315", "0.64439315", "0.644156...
0.7131899
0
Run the given SQL with the given arguments and yield each row.
def execute(sql, opts=OPTS) _execute(sql, opts) do |conn| begin yield(stmt = log_connection_yield(sql, conn){conn.prepare(sql)}) ensure stmt.close if stmt end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(sql, args=nil)\n q = query(sql, args)\n block_given? ? yield(q) : q.cmd_tuples\n end", "def execute_all( sql ) # :yields: row\n loop do\n stmt = prepare( sql )\n stmt.execute do |result|\n result.each { |row| yield row if block_given? }\n end\n ...
[ "0.776345", "0.75568527", "0.69860876", "0.6938213", "0.6884923", "0.68494165", "0.68387896", "0.68384504", "0.67876095", "0.676762", "0.6716615", "0.6597958", "0.6541283", "0.64263046", "0.6382324", "0.635289", "0.6338962", "0.6299832", "0.62997025", "0.6296386", "0.6291277"...
0.6261791
25
Run the given SQL with the given arguments and return the first value of the first row.
def single_value(sql, opts=OPTS) _execute(sql, opts){|conn| log_connection_yield(sql, conn){conn.first_value_from(sql)}} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_first_value( sql, *bind_vars )\n execute( sql, *bind_vars ) { |row| return row[0] }\n nil\n end", "def get_first_row( sql, *bind_vars )\n execute( sql, *bind_vars ) { |row| return row }\n nil\n end", "def query_return_first(sql, *binds)\n mysql.fetch(sql, *binds).first\n ...
[ "0.7733855", "0.74117714", "0.7393629", "0.732431", "0.7257244", "0.70951307", "0.69496214", "0.69496214", "0.68948066", "0.68589425", "0.673866", "0.6714616", "0.67020315", "0.66909945", "0.66905284", "0.6612036", "0.6549059", "0.64874566", "0.64864904", "0.64847827", "0.645...
0.6942135
8
The Amagalite adapter does not need the pool to convert exceptions. Also, force the max connections to 1 if a memory database is being used, as otherwise each connection gets a separate database.
def connection_pool_default_options o = super.dup # Default to only a single connection if a memory database is used, # because otherwise each connection will get a separate database o[:max_connections] = 1 if @opts[:database] == ':memory:' || blank_object?(@opts[:database]) o end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection_pool_default_options\n o = super\n uri == 'jdbc:sqlite::memory:' ? o.merge(:max_connections=>1) : o\n end", "def connection_pool_maximum_reuse\n super\n end", "def connection_limit\n super\n end", "def connection_limit\n super\n end", "def con...
[ "0.6586718", "0.65526295", "0.6497304", "0.6497304", "0.6497304", "0.6313745", "0.6311467", "0.6175766", "0.6105008", "0.6096257", "0.5994083", "0.59327847", "0.5848654", "0.5817521", "0.58068943", "0.57776797", "0.5763577", "0.57467824", "0.5726137", "0.5664444", "0.56280917...
0.6516531
2
Both main error classes that Amalgalite raises
def database_error_classes [::Amalgalite::Error, ::Amalgalite::SQLite3::Error] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error(description, result)\n raise \"Implement this in a sub-class\"\n end", "def error(*args); end", "def error\n end", "def original_error; end", "def o...
[ "0.7430369", "0.7430369", "0.7430369", "0.7430369", "0.7430369", "0.7430369", "0.7430369", "0.74077344", "0.73176277", "0.71575886", "0.70921636", "0.70921636", "0.7085073", "0.69936454", "0.69936454", "0.69936454", "0.69936454", "0.69936454", "0.69936454", "0.69936454", "0.6...
0.68004835
32
Yield a hash for each row in the dataset.
def fetch_rows(sql) execute(sql) do |stmt| self.columns = cols = stmt.result_fields.map{|c| output_identifier(c)} col_count = cols.size stmt.each do |result| row = {} col_count.times{|i| row[cols[i]] = result[i]} yield row end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n rows.hash\n end", "def each\n CSV.foreach(@file, @options) do |row|\n yield row.to_hash\n end\n end", "def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_si...
[ "0.769702", "0.70204306", "0.69263905", "0.6918874", "0.67279625", "0.6503315", "0.6503315", "0.649634", "0.64826393", "0.64541084", "0.64433444", "0.6407485", "0.621739", "0.62135524", "0.62021893", "0.6159725", "0.60882926", "0.606204", "0.5966222", "0.5965614", "0.5962944"...
0.0
-1
Quote the string using the adapter instance method.
def literal_string_append(sql, v) db.synchronize(@opts[:server]){|c| sql << c.quote(v)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quote\n %Q{\"#{self}\"}\n end", "def quote_string(s)\n @provider.quote_string(s)\n end", "def quote_string(s)\n @provider.quote_string(s)\n end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", "def quote; end", ...
[ "0.7064646", "0.6971321", "0.6971321", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "...
0.0
-1